Merge pull request #1442 from Safelite/feature/CSR-1390-style
Feature/csr 1390 style
This commit is contained in:
commit
a6c3d0e55a
4 changed files with 28 additions and 17 deletions
|
|
@ -93,6 +93,7 @@ const storeActions = {
|
||||||
SAVE_PIA_ERROR_CODE: "savePiaErrorCode",
|
SAVE_PIA_ERROR_CODE: "savePiaErrorCode",
|
||||||
SAVE_PIA_WORK_ORDER: "savePiaWorkOrder",
|
SAVE_PIA_WORK_ORDER: "savePiaWorkOrder",
|
||||||
SAVE_CCTOKEN: "saveCCToken",
|
SAVE_CCTOKEN: "saveCCToken",
|
||||||
|
SAVE_PAYPAL_TOKEN: "savePaypalToken",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { storeActions };
|
export { storeActions };
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ const storeMutations = {
|
||||||
UPDATE_PIA_ERROR_CODE: "updatePiaErrorCode",
|
UPDATE_PIA_ERROR_CODE: "updatePiaErrorCode",
|
||||||
UPDATE_PIA_WORK_ORDER: "updatePiaWorkOrder",
|
UPDATE_PIA_WORK_ORDER: "updatePiaWorkOrder",
|
||||||
UPDATE_CCTOKEN: "updateCCToken",
|
UPDATE_CCTOKEN: "updateCCToken",
|
||||||
|
UPDATE_PAYPAL_TOKEN: "updatePaypalToken",
|
||||||
|
|
||||||
// VEHICLE MUTATIONS
|
// VEHICLE MUTATIONS
|
||||||
UPDATE_YEAR: "updateYear",
|
UPDATE_YEAR: "updateYear",
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,7 @@ export default {
|
||||||
name: "payment-pia-return",
|
name: "payment-pia-return",
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.$refs.loadingModal.showModal();
|
this.$refs.loadingModal.showModal();
|
||||||
// from paypal
|
|
||||||
const piaError = getQuerystringParameter(queryStrings.ERROR);
|
const piaError = getQuerystringParameter(queryStrings.ERROR);
|
||||||
const token = getQuerystringParameter(queryStrings.TOKEN);
|
|
||||||
const payerId = getQuerystringParameter(queryStrings.PAYERID);
|
|
||||||
|
|
||||||
// from credit card
|
|
||||||
const subscriptionID = getQuerystringParameter(queryStrings.SUBSCRIPTIONID);
|
|
||||||
|
|
||||||
if (piaError) {
|
if (piaError) {
|
||||||
console.log("Error during payment: " + piaError);
|
console.log("Error during payment: " + piaError);
|
||||||
|
|
@ -35,15 +29,16 @@ export default {
|
||||||
);
|
);
|
||||||
this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_ERROR, this.$route);
|
this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_ERROR, this.$route);
|
||||||
} else {
|
} else {
|
||||||
if (token && payerId) {
|
switch (store.getters.order.payment.piaType) {
|
||||||
await this.processPaypalResponse();
|
case "cc":
|
||||||
} else {
|
case "ap":
|
||||||
if (subscriptionID) {
|
await this.processCreditCardResponse();
|
||||||
await this.processCreditCardResponse(subscriptionID);
|
break;
|
||||||
} else {
|
case "pp":
|
||||||
console.log(
|
await this.processPaypalResponse();
|
||||||
"Error during payment: " + token + " : " + payerId + " : " + subscriptionID
|
break;
|
||||||
);
|
default:
|
||||||
|
console.log("Unknown Pia type: " + store.getters.order.payment.piaType);
|
||||||
baseMixin.methods.dispatchStoreAction(
|
baseMixin.methods.dispatchStoreAction(
|
||||||
storeActions.SAVE_PIA_ERROR_CODE,
|
storeActions.SAVE_PIA_ERROR_CODE,
|
||||||
piaError,
|
piaError,
|
||||||
|
|
@ -53,7 +48,6 @@ export default {
|
||||||
this.navigationScenarios.PIA_ERROR,
|
this.navigationScenarios.PIA_ERROR,
|
||||||
this.$route
|
this.$route
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -62,12 +56,16 @@ export default {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
async processPaypalResponse() {
|
async processPaypalResponse() {
|
||||||
|
const token = getQuerystringParameter(queryStrings.TOKEN);
|
||||||
|
const payerId = getQuerystringParameter(queryStrings.PAYERID);
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false);
|
baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false);
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.SAVE_WORK_ORDER_FLAG, true, false);
|
baseMixin.methods.dispatchStoreAction(storeActions.SAVE_WORK_ORDER_FLAG, true, false);
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PAYPAL_TOKEN, token, false);
|
||||||
|
|
||||||
await this.saveAndSubmitWorkOrder();
|
await this.saveAndSubmitWorkOrder();
|
||||||
},
|
},
|
||||||
async processCreditCardResponse(subscriptionID) {
|
async processCreditCardResponse() {
|
||||||
|
const subscriptionID = getQuerystringParameter(queryStrings.SUBSCRIPTIONID);
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false);
|
baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false);
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.SAVE_WORK_ORDER_FLAG, true, false);
|
baseMixin.methods.dispatchStoreAction(storeActions.SAVE_WORK_ORDER_FLAG, true, false);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ const getDefaultState = () => {
|
||||||
piaType: null,
|
piaType: null,
|
||||||
piaErrorCode: null,
|
piaErrorCode: null,
|
||||||
inactivePromos: null,
|
inactivePromos: null,
|
||||||
|
paypalToken: null,
|
||||||
ccToken: {
|
ccToken: {
|
||||||
subscriptionId: null,
|
subscriptionId: null,
|
||||||
expMonth: null,
|
expMonth: null,
|
||||||
|
|
@ -270,6 +271,9 @@ export const mutations = {
|
||||||
state.order.payment.ccToken.transactionId = ccToken.transactionId;
|
state.order.payment.ccToken.transactionId = ccToken.transactionId;
|
||||||
state.order.payment.ccToken.transReferenceNumber = ccToken.transReferenceNumber;
|
state.order.payment.ccToken.transReferenceNumber = ccToken.transReferenceNumber;
|
||||||
},
|
},
|
||||||
|
updatePaypalToken(state, ppToken) {
|
||||||
|
state.order.payment.paypalToken = ppToken;
|
||||||
|
},
|
||||||
updateInsuranceVerifiedStatus(state, isVerified) {
|
updateInsuranceVerifiedStatus(state, isVerified) {
|
||||||
state.order.payment.insuranceCoverage.isVerified = isVerified;
|
state.order.payment.insuranceCoverage.isVerified = isVerified;
|
||||||
},
|
},
|
||||||
|
|
@ -1644,6 +1648,10 @@ export const actions = {
|
||||||
isInsurance: order.payment.isInsurance,
|
isInsurance: order.payment.isInsurance,
|
||||||
parentAccountNumber: order.payment.parentAccountNumber,
|
parentAccountNumber: order.payment.parentAccountNumber,
|
||||||
inactivePromos: order.payment.inactivePromos,
|
inactivePromos: order.payment.inactivePromos,
|
||||||
|
isCreditCard: order.payment.piaType == "cc" ? true : false,
|
||||||
|
isPaypal: order.payment.piaType == "pp" ? true : false,
|
||||||
|
isAfterPay: order.payment.piaType == "ap" ? true : false,
|
||||||
|
paypalToken: order.payment.paypalToken,
|
||||||
ccToken: {
|
ccToken: {
|
||||||
subscriptionId: order.payment.ccToken.subscriptionId,
|
subscriptionId: order.payment.ccToken.subscriptionId,
|
||||||
expMonth: order.payment.ccToken.expMonth,
|
expMonth: order.payment.ccToken.expMonth,
|
||||||
|
|
@ -1777,6 +1785,9 @@ export const actions = {
|
||||||
saveCCToken(context, ccToken) {
|
saveCCToken(context, ccToken) {
|
||||||
context.commit(storeMutations.UPDATE_CCTOKEN, ccToken);
|
context.commit(storeMutations.UPDATE_CCTOKEN, ccToken);
|
||||||
},
|
},
|
||||||
|
savePaypalToken(context, ppToken) {
|
||||||
|
context.commit(storeMutations.UPDATE_PAYPAL_TOKEN, ppToken);
|
||||||
|
},
|
||||||
|
|
||||||
// Business domain actions
|
// Business domain actions
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue