CSR-1852 router and alert logic for CC and AP declined
This commit is contained in:
parent
90d1d0cdd8
commit
602356ade2
4 changed files with 60 additions and 3 deletions
|
|
@ -24,9 +24,26 @@ export default {
|
||||||
|
|
||||||
if (piaError) {
|
if (piaError) {
|
||||||
console.log("Error during payment: " + piaError);
|
console.log("Error during payment: " + piaError);
|
||||||
this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_ERROR, this.$route, {
|
const paymentPageNavScenario =
|
||||||
[queryStrings.DISPLAY_PIA_ALERT]: true,
|
store.getters.order.payment.piaType === paymentMethods.CREDIT_CARD ||
|
||||||
});
|
store.getters.order.payment.piaType === paymentMethods.AFTERPAY;
|
||||||
|
if (paymentPageNavScenario) {
|
||||||
|
this.$router.navigateWithoutSaving(
|
||||||
|
this.navigationScenarios.PIA_CC_ERROR,
|
||||||
|
this.$route,
|
||||||
|
{
|
||||||
|
[queryStrings.DISPLAY_PIA_ALERT]: store.getters.order.payment.piaType,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.$router.navigateWithoutSaving(
|
||||||
|
this.navigationScenarios.PIA_ERROR,
|
||||||
|
this.$route,
|
||||||
|
{
|
||||||
|
[queryStrings.DISPLAY_PIA_ALERT]: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (store.getters.order.payment.piaType) {
|
switch (store.getters.order.payment.piaType) {
|
||||||
case paymentMethods.CREDIT_CARD:
|
case paymentMethods.CREDIT_CARD:
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,26 @@
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<funnelHeader cmsWidgetName="FunnelHeaderWidget" ref="funnelHeader" />
|
<funnelHeader cmsWidgetName="FunnelHeaderWidget" ref="funnelHeader" />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<alert
|
||||||
|
ref="piaCCErrorAlert"
|
||||||
|
class="my-4"
|
||||||
|
v-if="shouldDisplayPiaCCAlert"
|
||||||
|
cmsWidgetName="PIACCErrorAlertWidget"
|
||||||
|
alertClass="alert-danger"
|
||||||
|
v-bind:isDismissible="false" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<alert
|
||||||
|
ref="piaAPErrorAlert"
|
||||||
|
class="my-4"
|
||||||
|
v-if="shouldDisplayPiaAPAlert"
|
||||||
|
cmsWidgetName="PIAAPErrorAlertWidget"
|
||||||
|
alertClass="alert-danger"
|
||||||
|
v-bind:isDismissible="false" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -176,6 +196,7 @@ import funnelHeader from "@/fmg-components/funnel-header/funnel-header";
|
||||||
import navbar from "@/fmg-components/nav-bar/nav-bar";
|
import navbar from "@/fmg-components/nav-bar/nav-bar";
|
||||||
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
||||||
import cart from "@/fmg-components/cart/cart";
|
import cart from "@/fmg-components/cart/cart";
|
||||||
|
import alert from "@/ux-components/alert/alert";
|
||||||
|
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
|
@ -197,6 +218,7 @@ import { getQuerystringParameter } from "@/helpers/querystring-helper";
|
||||||
import { deepClone } from "@/helpers/object-helper";
|
import { deepClone } from "@/helpers/object-helper";
|
||||||
|
|
||||||
import iframeResize from "../../../node_modules/iframe-resizer/js/iframeResizer.js";
|
import iframeResize from "../../../node_modules/iframe-resizer/js/iframeResizer.js";
|
||||||
|
import { routerParams } from "@/router/router-constants/router-params";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "payment",
|
name: "payment",
|
||||||
|
|
@ -406,6 +428,12 @@ export default {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
shouldDisplayPiaCCAlert() {
|
||||||
|
return this.shouldDisplayPiaAlert(paymentMethods.CREDIT_CARD);
|
||||||
|
},
|
||||||
|
shouldDisplayPiaAPAlert() {
|
||||||
|
return this.shouldDisplayPiaAlert(paymentMethods.AFTERPAY);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
|
|
@ -607,12 +635,19 @@ export default {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
shouldDisplayPiaAlert(payMethod) {
|
||||||
|
return (
|
||||||
|
this.$route.query[queryStrings.DISPLAY_PIA_ALERT] === payMethod ||
|
||||||
|
this.$route.params[routerParams.DISPLAY_PIA_ALERT] === payMethod
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
funnelHeader,
|
funnelHeader,
|
||||||
navbar,
|
navbar,
|
||||||
loadingModal,
|
loadingModal,
|
||||||
cart,
|
cart,
|
||||||
|
alert,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ const navigationScenarios = {
|
||||||
// Payment
|
// Payment
|
||||||
CLICKED_PAY_NOW: "CLICKED_PAY_NOW",
|
CLICKED_PAY_NOW: "CLICKED_PAY_NOW",
|
||||||
PIA_ERROR: "PIA_ERROR",
|
PIA_ERROR: "PIA_ERROR",
|
||||||
|
PIA_CC_ERROR: "PIA_CC_ERROR",
|
||||||
PIA_SUCCESS: "PIA_SUCCESS",
|
PIA_SUCCESS: "PIA_SUCCESS",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -471,6 +471,10 @@ const routingTable = function (store) {
|
||||||
scenario: navigationScenarios.PIA_ERROR,
|
scenario: navigationScenarios.PIA_ERROR,
|
||||||
destinationFmgPageValue: fmgPageValues.PAYMENT_METHOD,
|
destinationFmgPageValue: fmgPageValues.PAYMENT_METHOD,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.PIA_CC_ERROR,
|
||||||
|
destinationFmgPageValue: fmgPageValues.PAYMENT,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.PIA_SUCCESS,
|
scenario: navigationScenarios.PIA_SUCCESS,
|
||||||
destinationFmgPageValue: fmgPageValues.CONFIRMATION,
|
destinationFmgPageValue: fmgPageValues.CONFIRMATION,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue