Revert "Merge pull request #2903 from Safelite/feature/CASH-1713"
This reverts commit2a2e3383d2, reversing changes made todbcf5351ae.
This commit is contained in:
parent
7e4e1ba1a7
commit
44939c508e
3 changed files with 39 additions and 37 deletions
|
|
@ -99,23 +99,3 @@ export async function getPricingByDayPartWithPrice(pageNameToLog) {
|
||||||
|
|
||||||
return pricingResults[0];
|
return pricingResults[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addPricesToLineItems(lineItems, pricingLineItems) {
|
|
||||||
lineItems.forEach((lineItem) => {
|
|
||||||
const lineItemIndex = pricingLineItems.findIndex(
|
|
||||||
(pricingLineItem) => pricingLineItem.partNumber === lineItem.partNumber
|
|
||||||
);
|
|
||||||
|
|
||||||
if (lineItem.childParts) {
|
|
||||||
addPricesToLineItems(lineItem.childParts, pricingLineItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
const pricedLineItem = pricingLineItems.splice(lineItemIndex, 1)[0];
|
|
||||||
lineItem.laborAmount = pricedLineItem.laborAmount;
|
|
||||||
lineItem.sellingPrice = pricedLineItem.sellingPrice;
|
|
||||||
lineItem.kitPrice = pricedLineItem.kitPrice;
|
|
||||||
lineItem.salesTax = pricedLineItem.salesTax;
|
|
||||||
});
|
|
||||||
|
|
||||||
return lineItems;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,7 @@ import {
|
||||||
getNewlyInactivatedPromos,
|
getNewlyInactivatedPromos,
|
||||||
} from "@/helpers/promotions-helper";
|
} from "@/helpers/promotions-helper";
|
||||||
import { queryStrings } from "@/constants/query-strings";
|
import { queryStrings } from "@/constants/query-strings";
|
||||||
|
import { getQuerystringParameter } from "@/helpers/querystring-helper";
|
||||||
import { deepClone } from "@/helpers/object-helper";
|
import { deepClone } from "@/helpers/object-helper";
|
||||||
|
|
||||||
import { Form } from "vee-validate";
|
import { Form } from "vee-validate";
|
||||||
|
|
@ -162,10 +163,18 @@ import { defineRule } from "vee-validate";
|
||||||
import { required } from "@/helpers/validation-rules";
|
import { required } from "@/helpers/validation-rules";
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
import { AppointmentTypeStrings } from "@/constants/schedule-constants";
|
import { AppointmentTypeStrings } from "@/constants/schedule-constants";
|
||||||
|
import { partTypeStrings } from "@/constants/part-type-strings";
|
||||||
|
import { mapTaxedLineItemsToStoreFormat } from "../../store";
|
||||||
import { coverageStatus } from "@/constants/insurance";
|
import { coverageStatus } from "@/constants/insurance";
|
||||||
|
import { containsLineItemWithPartType } from "@/helpers/service-package-helper";
|
||||||
import { containsRecalParts } from "@/helpers/recal-helper";
|
import { containsRecalParts } from "@/helpers/recal-helper";
|
||||||
import { getBoolFromString } from "@/helpers/boolean-helper";
|
import { getBoolFromString } from "@/helpers/boolean-helper";
|
||||||
import { getAmountDue, addPricesToLineItems } from "@/helpers/pricing-helper.js";
|
import {
|
||||||
|
getDisplayAmountDue,
|
||||||
|
getAmountDue,
|
||||||
|
getSubTotal,
|
||||||
|
getSalesTax,
|
||||||
|
} from "@/helpers/pricing-helper.js";
|
||||||
import { consumeQueryFromStash } from "@/router/methods/helpers/querystring-stash";
|
import { consumeQueryFromStash } from "@/router/methods/helpers/querystring-stash";
|
||||||
import { debugLog } from "@/helpers/debug-log-helper";
|
import { debugLog } from "@/helpers/debug-log-helper";
|
||||||
import { ErrorMessage } from "vee-validate";
|
import { ErrorMessage } from "vee-validate";
|
||||||
|
|
@ -222,28 +231,21 @@ export default {
|
||||||
|
|
||||||
const availableVaps = [resultMap.rainRepel, ...resultMap.wipers];
|
const availableVaps = [resultMap.rainRepel, ...resultMap.wipers];
|
||||||
|
|
||||||
const lineItemsOnOrderAndAvailableVaps = [
|
const pricedAvailableVaps = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
...availableVaps,
|
|
||||||
...glassParts,
|
|
||||||
...supportingItems,
|
|
||||||
...vaps,
|
|
||||||
];
|
|
||||||
|
|
||||||
// All line items are already priced except availableVaps
|
|
||||||
// Price everything again to ensure that serverData has all values
|
|
||||||
// Specifically this addresses an error where insurance client glass parts are not in serverData
|
|
||||||
// See CASH-1713 for details
|
|
||||||
const pricedLineItems = await baseMixin.methods.dispatchStoreActionWithLogging(
|
|
||||||
storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
||||||
{
|
{
|
||||||
availableLineItems: lineItemsOnOrderAndAvailableVaps,
|
availableLineItems: availableVaps,
|
||||||
},
|
},
|
||||||
"payment-method",
|
"payment-method",
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add prices to the availableVaps
|
const lineItemsOnOrderAndAvailableVaps = [
|
||||||
const pricedAvailableVaps = addPricesToLineItems(availableVaps, pricedLineItems);
|
...pricedAvailableVaps,
|
||||||
|
...glassParts,
|
||||||
|
...supportingItems,
|
||||||
|
...vaps,
|
||||||
|
];
|
||||||
|
|
||||||
// Promo logic
|
// Promo logic
|
||||||
// Populate the previous state of promos for toast message usage in "next()"
|
// Populate the previous state of promos for toast message usage in "next()"
|
||||||
|
|
@ -263,6 +265,7 @@ export default {
|
||||||
delete lineItemsForCart.serverData;
|
delete lineItemsForCart.serverData;
|
||||||
|
|
||||||
// End of promo logic
|
// End of promo logic
|
||||||
|
//
|
||||||
|
|
||||||
const vapsToAddToCart = getVapsThatNeedToBeAddedToSatisfyPromos(
|
const vapsToAddToCart = getVapsThatNeedToBeAddedToSatisfyPromos(
|
||||||
lineItemsForCart.promos ?? [],
|
lineItemsForCart.promos ?? [],
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ import {
|
||||||
} from "@/helpers/recal-helper";
|
} from "@/helpers/recal-helper";
|
||||||
import { externalParameterStatus } from "@/constants/external-parameters";
|
import { externalParameterStatus } from "@/constants/external-parameters";
|
||||||
import { experimentSettings } from "@/constants/experiments";
|
import { experimentSettings } from "@/constants/experiments";
|
||||||
import { addPricesToLineItems } from "@/helpers/pricing-helper";
|
|
||||||
|
|
||||||
// Export State
|
// Export State
|
||||||
const getDefaultState = () => {
|
const getDefaultState = () => {
|
||||||
|
|
@ -3702,6 +3701,26 @@ function convertGlassPieceNamingFromApi(glassArray) {
|
||||||
return glassArray;
|
return glassArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addPricesToLineItems(lineItems, pricingLineItems) {
|
||||||
|
lineItems.forEach((lineItem) => {
|
||||||
|
const lineItemIndex = pricingLineItems.findIndex(
|
||||||
|
(pricingLineItem) => pricingLineItem.partNumber === lineItem.partNumber
|
||||||
|
);
|
||||||
|
|
||||||
|
if (lineItem.childParts) {
|
||||||
|
addPricesToLineItems(lineItem.childParts, pricingLineItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
const pricedLineItem = pricingLineItems.splice(lineItemIndex, 1)[0];
|
||||||
|
lineItem.laborAmount = pricedLineItem.laborAmount;
|
||||||
|
lineItem.sellingPrice = pricedLineItem.sellingPrice;
|
||||||
|
lineItem.kitPrice = pricedLineItem.kitPrice;
|
||||||
|
lineItem.salesTax = pricedLineItem.salesTax;
|
||||||
|
});
|
||||||
|
|
||||||
|
return lineItems;
|
||||||
|
}
|
||||||
|
|
||||||
function addTaxesToPricedLineItems(pricedLineItems, taxingLineItems = []) {
|
function addTaxesToPricedLineItems(pricedLineItems, taxingLineItems = []) {
|
||||||
pricedLineItems.forEach((pricedLineItem) => {
|
pricedLineItems.forEach((pricedLineItem) => {
|
||||||
const lineItemIndex = taxingLineItems.findIndex(
|
const lineItemIndex = taxingLineItems.findIndex(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue