diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 8d41f1d2..589f6986 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -303,14 +303,21 @@ export default { await submitWorkOrder({ pageNameToLog: 'payment-method', submitAfterSave: true + }).then(() => { + useMainStore().resetSubmittedOrder(); + + this.$router.navigate( + this.navigationScenarios.CLICKED_FORWARD, + this.$route + ); + }).catch((submitError) => { + useMainStore().setBailout(bailoutMessage.saveSessionError(submitError.data)); + this.$router.navigate( + this.navigationScenarios.SAVE_SESSION_FAILED, + this.$route, + { query: { issPage: issPageValues.PAYMENT_METHOD } } + ); }); - - useMainStore().resetSubmittedOrder(); - - this.$router.navigate( - this.navigationScenarios.CLICKED_FORWARD, - this.$route - ); } catch (error) { console.error(`error: response from submit work order:${error.message}`); } diff --git a/src/layouts/tpa-submit/tpa-submit.vue b/src/layouts/tpa-submit/tpa-submit.vue index c1b90917..381e63ca 100644 --- a/src/layouts/tpa-submit/tpa-submit.vue +++ b/src/layouts/tpa-submit/tpa-submit.vue @@ -136,6 +136,7 @@ import { } from '@/helpers/damage-review-content-generator.js'; import damageLocationsSelected from '@/constants/damage-locations-selected.js'; import { submitWorkOrder } from '@/helpers/order-helper.js'; +import bailoutMessage from '@/constants/bailoutMessage'; const VERIFYING_COVERAGE = 'Verifying coverage'; @@ -355,8 +356,16 @@ export default { await submitWorkOrder({ pageNameToLog: 'tpa-submit', submitAfterSave: true + }).then(() => { + this.navigate(this.navigationScenarios.CLICKED_FORWARD); + }).catch((submitError) => { + useMainStore().setBailout(bailoutMessage.saveSessionError(submitError.data)); + this.navigate( + this.navigationScenarios.SAVE_SESSION_FAILED, + this.$route, + { query: { issPage: this.issPageValues.TPA_SUBMIT } } + ); }); - this.navigate(this.navigationScenarios.CLICKED_FORWARD); } catch (error) { console.error(`error: response from submit work order:${error.message}`); } diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 640c7d20..85b7aa8f 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -641,6 +641,10 @@ const routingTable = () => [ { scenario: navigationScenarios.CLICKED_PAY_NOW, destinationIssPageValue: issPageValues.PAYMENT_PAGE + }, + { + scenario: navigationScenarios.SAVE_SESSION_FAILED, + destinationIssPageValue: issPageValues.BAILOUT_PAGE } ] }, @@ -713,6 +717,10 @@ const routingTable = () => [ { scenario: navigationScenarios.CLICKED_FORWARD, destinationIssPageValue: issPageValues.TPA_CONFIRMATION + }, + { + scenario: navigationScenarios.SAVE_SESSION_FAILED, + destinationIssPageValue: issPageValues.BAILOUT_PAGE } ] },