From 6e658992cd027ecf2a661ffce36a6886ebe90625 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 19 Oct 2023 10:21:09 -0400 Subject: [PATCH] Save & reorganize --- src/layouts/payment-method/payment-method.vue | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 731017d18..09463ba85 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -292,24 +292,29 @@ 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("cc"); + this.piaSetup(this.paymentMethod); break; case paymentMethods.PAYPAL: - this.piaSetup("pp"); + this.piaSetup(this.paymentMethod); break; case paymentMethods.AFTERPAY: - this.piaSetup("ap"); + this.piaSetup(this.paymentMethod); 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, @@ -317,25 +322,11 @@ export default { ); } }, - async ccdPayment() { - this.piaSetup("cc"); - }, - async paypal() { - this.piaSetup("pp"); - }, - async afterpay() { - this.piaSetup("ap"); - }, async piaSetup(payNowType) { this.$refs.loadingModal.showModal(); // 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, - this.paymentMethod, - false - ); // make sure pia error codes are reset this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false);