diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 64e6df3aa..9801ef22e 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -93,7 +93,6 @@ const storeActions = { SAVE_PIA_ERROR_CODE: "savePiaErrorCode", SAVE_PIA_WORK_ORDER: "savePiaWorkOrder", SAVE_CCTOKEN: "saveCCToken", - SAVE_PAYPAL_TOKEN: "savePaypalToken", }; export { storeActions }; diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 9e2e30a14..2b2efae64 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -4,7 +4,6 @@ const storeMutations = { UPDATE_PIA_ERROR_CODE: "updatePiaErrorCode", UPDATE_PIA_WORK_ORDER: "updatePiaWorkOrder", UPDATE_CCTOKEN: "updateCCToken", - UPDATE_PAYPAL_TOKEN: "updatePaypalToken", // VEHICLE MUTATIONS UPDATE_YEAR: "updateYear", diff --git a/src/fmg-components/layouts/questions-page-layout/questions-page-layout.vue b/src/fmg-components/layouts/questions-page-layout/questions-page-layout.vue index 0bacf3f01..8fc382bf0 100644 --- a/src/fmg-components/layouts/questions-page-layout/questions-page-layout.vue +++ b/src/fmg-components/layouts/questions-page-layout/questions-page-layout.vue @@ -8,7 +8,7 @@
-
+
diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 67bdd5f2e..ca8b39d32 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -186,6 +186,7 @@ export default { lineItems: [], availableLineItems: [], paymentMethodInternalModel: this.getPaymentMethodFromStore(), + displayPiaAlert: this.getPiaAlert(), }; }, methods: { @@ -244,6 +245,9 @@ export default { packageReqs && serviceLocationReqs && isInsuranceSet && scheduleReqs && customerReqs ); }, + getPiaAlert() { + return store.getters.order.payment.piaErrorCode ? true : false; + }, getPaymentMethodFromStore() { const isPia = store.getters.order.payment.isPia; @@ -262,29 +266,24 @@ export default { this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); }, async forwardButtonAction() { - await this.dispatchStoreAction( - storeActions.SAVE_PAYMENT_METHOD_CHOICE, - this.paymentMethod, - false - ); - - await this.dispatchStoreAction(storeActions.SAVE_VAPS, this.lineItems.vaps, false); - - await this.dispatchStoreAction(storeActions.SAVE_PROMOS, this.lineItems.promos, false); - switch (this.paymentMethod) { case paymentMethods.CREDIT_CARD: - this.piaSetup(this.paymentMethod); + this.piaSetup("cc"); break; case paymentMethods.PAYPAL: - this.piaSetup(this.paymentMethod); + this.piaSetup("pp"); break; case paymentMethods.AFTERPAY: - this.piaSetup(this.paymentMethod); + this.piaSetup("ap"); break; default: this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false); this.dispatchStoreAction(this.storeActions.SAVE_WORK_ORDER_FLAG, true, false); + this.dispatchStoreAction( + storeActions.SAVE_PAYMENT_METHOD_CHOICE, + this.paymentMethod, + false + ); await submitWorkOrder({ pageNameToLog: "payment-method" }); this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_FORWARD, @@ -297,6 +296,11 @@ export default { // since we're leaving the site for pia, clear any save session promises that we will not be able to resolve when we return await this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); + await this.dispatchStoreAction( + storeActions.SAVE_PAYMENT_METHOD_CHOICE, + payNowType, + false + ); // make sure pia error codes are reset this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false); @@ -349,9 +353,6 @@ export default { return this.paymentMethodInternalModel; }, - displayPiaAlert() { - return store.getters.order.payment.piaErrorCode ? true : false; - }, }, watch: { customCtaCopy(newValue) { diff --git a/src/layouts/payment-pia-return/payment-pia-return.vue b/src/layouts/payment-pia-return/payment-pia-return.vue index aa9340995..ec2ecd1c0 100644 --- a/src/layouts/payment-pia-return/payment-pia-return.vue +++ b/src/layouts/payment-pia-return/payment-pia-return.vue @@ -13,13 +13,18 @@ import store from "@/store"; import baseMixin from "@/mixins/base-mixin.js"; import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue"; import { Form } from "vee-validate"; -import { paymentMethods } from "@/constants/payment-method-constants"; 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); @@ -30,26 +35,25 @@ export default { ); this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_ERROR, this.$route); } else { - switch (store.getters.order.payment.piaType) { - case paymentMethods.CREDIT_CARD: - case paymentMethods.AFTERPAY: - await this.processCreditCardResponse(); - break; - case paymentMethods.PAYPAL: - await this.processPaypalResponse(); - break; - default: - var msg = "Unknown Pia type: " + store.getters.order.payment.piaType; - console.log(msg); + if (token && payerId) { + await this.processPaypalResponse(); + } else { + if (subscriptionID) { + await this.processCreditCardResponse(subscriptionID); + } else { + console.log( + "Error during payment: " + token + " : " + payerId + " : " + subscriptionID + ); baseMixin.methods.dispatchStoreAction( storeActions.SAVE_PIA_ERROR_CODE, - msg, + piaError, false ); this.$router.navigateWithoutSaving( this.navigationScenarios.PIA_ERROR, this.$route ); + } } } }, @@ -58,16 +62,12 @@ 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() { - const subscriptionID = getQuerystringParameter(queryStrings.SUBSCRIPTIONID); + async processCreditCardResponse(subscriptionID) { baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false); baseMixin.methods.dispatchStoreAction(storeActions.SAVE_WORK_ORDER_FLAG, true, false); diff --git a/src/layouts/payment/payment.vue b/src/layouts/payment/payment.vue index c4dcb9469..d6a6394fe 100644 --- a/src/layouts/payment/payment.vue +++ b/src/layouts/payment/payment.vue @@ -168,7 +168,6 @@ import { externalUrls } from "@/router/router-constants/externalUrl-values"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { settleAllPromises } from "@/helpers/layout-helper"; import { applicationConfig } from "@/constants/application-config"; -import { paymentMethods } from "@/constants/payment-method-constants"; import baseMixin from "@/mixins/base-mixin.js"; // Validation @@ -287,16 +286,7 @@ export default { : store.getters.order.serviceLocation.provider.address.zipCode; }, getPaymentType() { - switch (store.getters.order.payment.piaType) { - case paymentMethods.AFTERPAY: - return "ap"; - case paymentMethods.CREDIT_CARD: - return "cc"; - case paymentMethods.PAYPAL: - return "pp"; - default: - return store.getters.payment.piaType; - } + return store.getters.order.payment.piaType; }, getHeaderLine1() { if (!this.isPaypal()) { @@ -326,11 +316,11 @@ export default { return itemsForPia; }, getAmountDue() { - return 2; + return 350.0; //return baseMixin.methods.getAmountDue(store.getters.order.lineItems); }, getDisplayAmountDue() { - return "$2.00"; + return "$350.00"; //return baseMixin.methods.getDisplayAmountDue(store.getters.order.lineItems); }, isPaypal() { diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 42916b47f..5b05cf961 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -265,7 +265,7 @@ export default { } this.dispatchStoreAction(this.storeActions.SAVE_VAPS, this.selectedVaps, false); - this.dispatchStoreAction(this.storeActions.SAVE_PROMOS, this.allActivePromos, false); + this.dispatchStoreAction(this.storeActions.SAVE_PROMOS, this.newValidatedPromos, false); const payment = this.$store.getters.payment; if (payment.isInsurance) { diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index ff1961465..704ad007d 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -9,7 +9,7 @@
- +