CASH-535 - updated 'cashSubTotal' to be 'cashPriceSubTotal' and to match the logic of 'priceSubTotal'

This commit is contained in:
Minojhini Valaiyapathi 2025-05-07 12:57:30 -04:00
parent 92bb35c21b
commit 5aacb6ec2a
6 changed files with 35 additions and 24 deletions

View file

@ -42,16 +42,4 @@ const ValueToLogTypes = {
LAST_5: "last_5",
};
const Variables = {
CASH_SUBTOTAL: "cashSubTotal",
};
export {
analyticsPageEvents,
GaCategories,
GaActions,
GaLabels,
GaEvents,
ValueToLogTypes,
Variables,
};
export { analyticsPageEvents, GaCategories, GaActions, GaLabels, GaEvents, ValueToLogTypes };

View file

@ -69,7 +69,7 @@ const storeMutations = {
UPDATE_SETTLED_TENDER_AMOUNT: "updateSettledTenderAmount",
UPDATE_IS_RECAL_ACK_OPT_IN: "updateIsRecalAckOptIn",
UPDATE_IS_MSR_FEE_APPLICABLE: "updateIsMSRFeeApplicable",
UPDATE_CASH_SUBTOTAL: "updateCashSubTotal",
UPDATE_CASH_PRICE_SUBTOTAL: "updateCashPriceSubTotal",
// EVENT BUS MUTATIONS
ADD_EVENT_TO_BUS: "addEventToBus",

View file

@ -83,6 +83,22 @@ export async function saveSession({
if (!store.getters.applicationUser.savedSessionId || shouldAwaitSaveSessionQueue) {
await saveSessionPromise;
}
const lineItems = store.getters.order?.lineItems ?? {};
const combinedLineItems = [
...(lineItems.glassParts || []),
...(lineItems.supportingItems || []),
...(lineItems.vaps || []),
...(lineItems.promos || []),
];
const cashPriceSubtotal = combinedLineItems.length
? baseMixin.methods
.getTotalPriceOfAllLineItemsAndChildParts(combinedLineItems, false)
.toFixed(2)
: "";
store.commit(storeMutations.UPDATE_CASH_PRICE_SUBTOTAL, cashPriceSubtotal);
}
export async function submitWorkOrder({

View file

@ -163,13 +163,7 @@ export default {
isInsuranceSelected: this.isInsuranceSelected,
},
}));
if (availablePackages.length > 1 || availablePackages.length == 1) {
let price = this.getPackagePrice(availablePackages[0].packageName, {
discountedPrice: false,
servicePackageDiscount: false,
});
store.commit(storeMutations.UPDATE_CASH_SUBTOTAL, price?.toFixed(2));
}
this.$emit("currentNumberOfPackages", modifiedAnswers.length);
return modifiedAnswers;
},

View file

@ -311,6 +311,18 @@ export default {
} else {
payload.priceSubTotal = "";
}
// Cash Quote or Cash Price Sub Total
if (isPricingAvailable) {
const subtotal = baseMixin.methods
.getTotalPriceOfAllLineItemsAndChildParts(combinedLineItems, false)
.toFixed(2);
payload.cashPriceSubTotal = parseFloat(subtotal);
} else {
payload.cashPriceSubTotal = "";
}
//unverified (in scenarios we dont display the price)
if (
order.payment.isInsurance &&

View file

@ -340,8 +340,9 @@ export const mutations = {
updateIsMSRFeeApplicable(state, isMSRFeeApplicable) {
state.order.isMSRFeeApplicable = isMSRFeeApplicable;
},
updateCashSubTotal(state, cashSubTotal) {
state.order.cashSubTotal = cashSubTotal;
updateCashPriceSubTotal(state, cashPriceSubTotal) {
state.order.cashPriceSubTotal =
cashPriceSubTotal === "" ? null : cashPriceSubTotal.toString();
},
updateCCToken(state, ccToken) {
state.order.payment.ccToken.subscriptionId = ccToken.subscriptionId;
@ -2342,7 +2343,7 @@ export const actions = {
lockToken: order.lockToken,
isRecalAckOptIn: order.isRecalAckOptIn,
isMSRFeeApplicable: order.isMSRFeeApplicable,
cashSubTotal: order.cashSubTotal,
cashPriceSubTotal: order.cashPriceSubTotal,
},
},
logApiCall: true,