SSR-1446 Bailout Fixes

Fixed bailout not submitting after save session error
Fixed being able to navigate to any page after bailout submit
Fixed query=[object Object] in url on submit WO error
This commit is contained in:
Josh Dassinger 2024-08-07 10:28:12 -05:00
parent 4844d41842
commit 9c7c83c470
7 changed files with 18 additions and 12 deletions

View file

@ -1,6 +1,7 @@
const submitType = Object.freeze({ const submitType = Object.freeze({
SAFELITE: 0, SAFELITE: 0,
TPA: 1 TPA: 1,
BAILOUT: 2
}); });
export default submitType; export default submitType;

View file

@ -1,5 +1,6 @@
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { updateOrCreateISSCookie } from '@/helpers/cookie-helper'; import { updateOrCreateISSCookie } from '@/helpers/cookie-helper';
import submitType from '@/constants/submit-type';
/* /*
Encapsulates asynchronous Save Session logic inside a promise to allow for Save Session queuing Encapsulates asynchronous Save Session logic inside a promise to allow for Save Session queuing
@ -43,3 +44,10 @@ export async function submitWorkOrder({ submitType }) {
}); });
store.createSubmittedOrder(submitType); store.createSubmittedOrder(submitType);
} }
export async function submitBailout() {
const store = useMainStore();
store.resetSubmittedOrder();
await store.saveSession({});
store.createSubmittedOrder(submitType.BAILOUT);
}

View file

@ -91,7 +91,7 @@ import canBailoutNavigateBack from '@/helpers/bailout-helper';
import BailoutCode from '@/constants/bailoutCode'; import BailoutCode from '@/constants/bailoutCode';
import issPageValues from '@/router/router-constants/issPage-values'; import issPageValues from '@/router/router-constants/issPage-values';
import MaskaFormattedMasks from '@/constants/maska-masks'; import MaskaFormattedMasks from '@/constants/maska-masks';
import { saveSession } from '@/helpers/order-helper'; import { submitBailout } from '@/helpers/order-helper';
export default { export default {
name: 'bailout-page', name: 'bailout-page',
@ -203,7 +203,7 @@ export default {
}, },
async forwardButtonAction() { async forwardButtonAction() {
this.mainStore.setBailoutContactInfo(this.bailoutPageModel); this.mainStore.setBailoutContactInfo(this.bailoutPageModel);
await saveSession({ shouldAwaitSaveSessionQueue: true }); await submitBailout();
this.$router.navigate( this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD, this.navigationScenarios.CLICKED_FORWARD,
this.$route, this.$route,

View file

@ -297,7 +297,7 @@ export default {
this.$refs.siteFooter.updateButtonText(newValue); this.$refs.siteFooter.updateButtonText(newValue);
}, },
async forwardButtonAction() { async forwardButtonAction() {
await useMainStore().savePaymentMethodChoice(this.paymentMethod); useMainStore().savePaymentMethodChoice(this.paymentMethod);
if (this.paymentMethod === paymentMethods.PAY_AT_TIME_OF_SERVICE) { if (this.paymentMethod === paymentMethods.PAY_AT_TIME_OF_SERVICE) {
try { try {
@ -311,7 +311,7 @@ export default {
this.$router.navigate( this.$router.navigate(
this.navigationScenarios.SAVE_SESSION_FAILED, this.navigationScenarios.SAVE_SESSION_FAILED,
this.$route, this.$route,
{ query: { issPage: issPageValues.PAYMENT_METHOD } } { issPage: issPageValues.PAYMENT_METHOD }
); );
}); });
} catch (error) { } catch (error) {

View file

@ -361,7 +361,7 @@ export default {
this.navigate( this.navigate(
this.navigationScenarios.SAVE_SESSION_FAILED, this.navigationScenarios.SAVE_SESSION_FAILED,
this.$route, this.$route,
{ query: { issPage: this.issPageValues.TPA_SUBMIT } } { issPage: this.issPageValues.TPA_SUBMIT }
); );
}); });
} catch (error) { } catch (error) {

View file

@ -377,6 +377,8 @@ function getConfirmationPageFromOrder(order) {
return issPageValues.ORDER_CONFIRMATION; return issPageValues.ORDER_CONFIRMATION;
case submitType.TPA: case submitType.TPA:
return issPageValues.TPA_CONFIRMATION; return issPageValues.TPA_CONFIRMATION;
case submitType.BAILOUT:
return issPageValues.CONTACT_CONFIRMATION;
default: default:
return issPageValues.ORDER_CONFIRMATION; return issPageValues.ORDER_CONFIRMATION;
} }

View file

@ -1307,12 +1307,7 @@ export const useMainStore = defineStore({
isCreditCard: payment.payInAdvanceType === paymentMethods.CREDIT_CARD, isCreditCard: payment.payInAdvanceType === paymentMethods.CREDIT_CARD,
isAfterpay: payment.payInAdvanceType === paymentMethods.AFTERPAY, isAfterpay: payment.payInAdvanceType === paymentMethods.AFTERPAY,
nextGenSettledAmount: payment.nextGenSettledAmount, nextGenSettledAmount: payment.nextGenSettledAmount,
CCToken: payment.creditCardToken, CCToken: payment.creditCardToken
insuranceCoverage: {
isVerified: this.isVerified,
coverageStatus: this.isNoComp ? coverageStatuses.NO_COVERAGE : this.isVerified ? coverageStatuses.VERIFIED : coverageStatuses.PENDING,
claimNumber: insuranceCoverage.claimNumber
}
}, },
serviceLocation: { serviceLocation: {
address: { address: {