From 0a9466af9f9ae00b6c8f7739925545ad1cdc9578 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 28 Nov 2023 12:10:43 -0500 Subject: [PATCH] Pass error status by querystring --- src/constants/query-strings.js | 1 + src/layouts/payment-method/payment-method.vue | 8 ++++++-- src/layouts/payment-pia-return/payment-pia-return.vue | 9 +++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/constants/query-strings.js b/src/constants/query-strings.js index 40f3a2242..5c056c934 100644 --- a/src/constants/query-strings.js +++ b/src/constants/query-strings.js @@ -19,6 +19,7 @@ const queryStrings = { AUTH_CODE: "auth_code", TRANSACTION_ID: "transaction_id", TRANS_REFERENCE_NUMBER: "auth_trans_ref_no", + DISPLAY_PIA_ALERT: "displayPiaAlert", }; export { queryStrings }; diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 6fa1b02a6..e13f62590 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -103,6 +103,7 @@ import { getNewlyInactivatedPromos, } from "@/helpers/promotions-helper"; import { queryStrings } from "@/constants/query-strings"; +import { routerParams } from "@/router/router-constants/router-params"; import { getQuerystringParameter } from "@/helpers/querystring-helper"; import { deepClone } from "@/helpers/object-helper"; @@ -421,7 +422,7 @@ export default { } catch (error) { console.log("error: response from pia submit work order:" + error.message); this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); - this.$route.params[this.routerParams.DISPLAY_PIA_ALERT] = true; + this.$route.params[routerParams.DISPLAY_PIA_ALERT] = true; return; } } @@ -469,7 +470,10 @@ export default { return this.paymentMethodInternalModel; }, shouldDisplayPiaAlert() { - return this.$route.params[this.routerParams.DISPLAY_PIA_ALERT]; + return ( + this.$route.query[queryStrings.DISPLAY_PIA_ALERT] || + this.$route.params[routerParams.DISPLAY_PIA_ALERT] + ); }, // Necessary to make the watcher of lineItems work // JavaScript does not keep a record of the old value, only a reference to it's location in the memory. diff --git a/src/layouts/payment-pia-return/payment-pia-return.vue b/src/layouts/payment-pia-return/payment-pia-return.vue index 8088cbb06..d12e45705 100644 --- a/src/layouts/payment-pia-return/payment-pia-return.vue +++ b/src/layouts/payment-pia-return/payment-pia-return.vue @@ -24,12 +24,9 @@ export default { if (piaError) { console.log("Error during payment: " + piaError); - this.$router.navigateWithoutSaving( - this.navigationScenarios.PIA_ERROR, - this.$route, - {}, - { [routerParams.DISPLAY_PIA_ALERT]: true } - ); + this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_ERROR, this.$route, { + [queryStrings.DISPLAY_PIA_ALERT]: true, + }); } else { switch (store.getters.order.payment.piaType) { case paymentMethods.CREDIT_CARD: