Merge pull request #1869 from Safelite/feature/CSR-2098

CSR-2098
This commit is contained in:
CarlNation 2024-05-24 10:58:35 -04:00 committed by GitHub
commit 946de90be7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 27 additions and 0 deletions

View file

@ -91,6 +91,7 @@ const storeActions = {
SAVE_SERVICE_LOCATION_TECH_NOTES: "saveServiceLocationTechNotes",
SAVE_CCTOKEN: "saveCCToken",
SAVE_PAYPAL_TOKEN: "savePaypalToken",
SAVE_NEXTGEN_SETTLED_AMOUNT: "saveNextGenSettledAmount",
CREATE_SUBMITTED_ORDER: "createSubmittedOrder",
RESET_SUBMITTED_ORDER: "resetSubmittedOrder",

View file

@ -2,6 +2,7 @@ const storeMutations = {
// PAYMENT MUTATIONS
UPDATE_CCTOKEN: "updateCCToken",
UPDATE_PAYPAL_TOKEN: "updatePaypalToken",
UPDATE_NEXTGEN_SETTLED_AMOUNT: "updateNextGenSettledAmount",
// VEHICLE MUTATIONS
UPDATE_YEAR: "updateYear",

View file

@ -72,7 +72,13 @@ export default {
async processPaypalResponse() {
const token = getQuerystringParameter(queryStrings.TOKEN);
const payerId = getQuerystringParameter(queryStrings.PAYERID);
baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PAYPAL_TOKEN, token, false);
baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_NEXTGEN_SETTLED_AMOUNT,
this.getAmountDue(),
false
);
await this.saveAndSubmitWorkOrder();
},
@ -122,10 +128,19 @@ export default {
transReferenceNumber: transReferenceNumber,
lastFour: lastFour,
};
baseMixin.methods.dispatchStoreAction(storeActions.SAVE_CCTOKEN, ccToken, false);
baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_NEXTGEN_SETTLED_AMOUNT,
this.getAmountDue(),
false
);
await this.saveAndSubmitWorkOrder();
}
},
getAmountDue() {
return baseMixin.methods.getAmountDue(store.getters.order.lineItems);
},
async saveAndSubmitWorkOrder() {
// Final work order submit after returning from PIA.
await this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);

View file

@ -112,6 +112,7 @@ const getDefaultState = () => {
piaType: null,
inactivePromos: null,
paypalToken: null,
nextGenSettledAmount: 0,
ccToken: {
subscriptionId: null,
expMonth: null,
@ -304,6 +305,9 @@ export const mutations = {
updatePaypalToken(state, ppToken) {
state.order.payment.paypalToken = ppToken;
},
updateNextGenSettledAmount(state, nextGenSettledAmount) {
state.order.payment.nextGenSettledAmount = nextGenSettledAmount;
},
updateInsuranceVerifiedStatus(state, isVerified) {
state.order.payment.insuranceCoverage.isVerified = isVerified;
},
@ -1729,6 +1733,7 @@ export const actions = {
isPaypal: order.payment.piaType == paymentMethods.PAYPAL ? true : false,
isAfterPay: order.payment.piaType == paymentMethods.AFTERPAY ? true : false,
paypalToken: order.payment.paypalToken,
nextGenSettledAmount: order.payment.nextGenSettledAmount,
ccToken: {
subscriptionId: order.payment.ccToken.subscriptionId,
expMonth: order.payment.ccToken.expMonth,
@ -1861,6 +1866,11 @@ export const actions = {
saveCCToken(context, ccToken) {
context.commit(storeMutations.UPDATE_CCTOKEN, ccToken);
},
saveNextGenSettledAmount(context, nextGenSettledAmount) {
context.commit(storeMutations.UPDATE_NEXTGEN_SETTLED_AMOUNT, nextGenSettledAmount);
},
savePaypalToken(context, ppToken) {
context.commit(storeMutations.UPDATE_PAYPAL_TOKEN, ppToken);
},