diff --git a/src/constants/application-config.js b/src/constants/application-config.js index 1e2324ba7..244882509 100644 --- a/src/constants/application-config.js +++ b/src/constants/application-config.js @@ -22,6 +22,7 @@ const applicationConfig = { "//" + location.host + "/fmg/?fmgPage=payment-method&src=concept-funnel", + CONFIRMATION_URL: location.protocol + "//" + location.host + "/fmg/?fmgPage=confirmation", GOOGLE_CALENDAR: "https://www.google.com/calendar/render?action=TEMPLATE", YAHOO_CALENDAR: "https://calendar.yahoo.com/?v=60", OUTLOOK_CALENDAR: diff --git a/src/layouts/payment/payment.vue b/src/layouts/payment/payment.vue index 73050bf61..201578435 100644 --- a/src/layouts/payment/payment.vue +++ b/src/layouts/payment/payment.vue @@ -17,6 +17,7 @@ v-if="shouldDisplayPiaCCAlert" cmsWidgetName="PIACCErrorAlertWidget" alertClass="alert-danger" + @textLinkClicked="paymentFailedPayLater" v-bind:isDismissible="false" /> @@ -27,6 +28,7 @@ v-if="shouldDisplayPiaAPAlert" cmsWidgetName="PIAAPErrorAlertWidget" alertClass="alert-danger" + @textLinkClicked="paymentFailedPayLater" v-bind:isDismissible="false" /> @@ -216,6 +218,7 @@ import { import { queryStrings } from "@/constants/query-strings"; import { getQuerystringParameter } from "@/helpers/querystring-helper"; import { deepClone } from "@/helpers/object-helper"; +import { submitWorkOrder } from "@/helpers/heritage-integration/order-helper.js"; import iframeResize from "../../../node_modules/iframe-resizer/js/iframeResizer.js"; import { routerParams } from "@/router/router-constants/router-params"; @@ -573,6 +576,36 @@ export default { getDisplayAmountDue() { return baseMixin.methods.getDisplayAmountDue(store.getters.order.lineItems); }, + async paymentFailedPayLater() { + this.$refs.loadingModal.isModalVisible = true; + + await this.dispatchStoreAction( + storeActions.SAVE_PAYMENT_METHOD_CHOICE, + paymentMethods.LATER, + false + ); + + await this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); + try { + await submitWorkOrder({ + pageNameToLog: "payment", + submitAfterSave: true, + }); + + await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER); + window.location = applicationConfig.CONFIRMATION_URL; + } catch (error) { + console.log("error: response from submit work order(payment pg):" + error.message); + this.$router.navigateWithoutSaving( + this.navigationScenarios.PIA_ERROR, + this.$route, + {}, + { [routerParams.DISPLAY_PIA_ALERT]: true } + ); + this.$refs.loadingModal.isModalVisible = false; + return; + } + }, backButtonAction() { // The only way I could figure out how to get navigation to work on a page with the iframe. // This is also how a cancel from Paypal would work. Just a redirect to the payment-method page. diff --git a/src/ux-components/alert/alert.vue b/src/ux-components/alert/alert.vue index 7274ae487..637ba3e1d 100644 --- a/src/ux-components/alert/alert.vue +++ b/src/ux-components/alert/alert.vue @@ -23,7 +23,7 @@