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