diff --git a/src/layouts/confirmation/add-to-calendar/add-to-calendar.spec.js b/src/layouts/confirmation/add-to-calendar/add-to-calendar.spec.js index c55b170cd..52063c1b9 100644 --- a/src/layouts/confirmation/add-to-calendar/add-to-calendar.spec.js +++ b/src/layouts/confirmation/add-to-calendar/add-to-calendar.spec.js @@ -12,7 +12,7 @@ beforeEach(() => { jest.restoreAllMocks(); jest.clearAllMocks(); store.getters = { - order: { + submittedOrder: { schedule: { date: "2019-01-01", startTime: "09:00", diff --git a/src/layouts/confirmation/add-to-calendar/add-to-calendar.vue b/src/layouts/confirmation/add-to-calendar/add-to-calendar.vue index 24427b2d5..4cbe0d748 100644 --- a/src/layouts/confirmation/add-to-calendar/add-to-calendar.vue +++ b/src/layouts/confirmation/add-to-calendar/add-to-calendar.vue @@ -110,11 +110,11 @@ export default { return this.getCmsContent(this.sameDayDropOffWidgetName, "BodyText"); }, UniqueId() { - return store.getters.order.referralNumber?.toString(); + return store.getters.submittedOrder.referralNumber?.toString(); }, ServiceType() { - const isRepair = store.getters.order.damage.isRepair; - const funnelHasRecalibrationPart = store.getters.funnelHasRecalibrationPart; + const isRepair = store.getters.submittedOrder.damage.isRepair; + const funnelHasRecalibrationPart = store.getters.isRecalibrationOnSubmittedOrder; if (!isRepair) { if (funnelHasRecalibrationPart) { return serviceType.REPLACEMENT_AND_RECALIBRATION; @@ -125,7 +125,7 @@ export default { return serviceType.REPAIR; }, RouteCode() { - return store.getters.order.schedule.routeCode; + return store.getters.submittedOrder.schedule.routeCode; }, Appointment() { var subject = ""; diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 7a43b7440..98409e3e7 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -204,6 +204,7 @@ export default { taxedVaps, lineItems ); + lineItems.vaps = lineItems.vaps ?? []; lineItems.vaps.push(...vapsToAddToCart); // Call the "next" function to complete the transition to this page. diff --git a/src/store/index.js b/src/store/index.js index c55377ee3..e8edb1ed2 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -595,6 +595,15 @@ export const getters = { isRecalibrationOnOrder: (state) => { return getHasRecalibrationPart(state); }, + isRecalibrationOnSubmittedOrder: (state) => { + if (window.sessionStorage.getItem("submittedOrder") !== null) { + return getHasRecalibrationPart({ + order: JSON.parse(window.sessionStorage.getItem("submittedOrder")), + }); + } + + return false; + }, areRearWipersOnOrder: (state) => { return !!state.order.lineItems.vaps?.some( (vap) => vap.partType.toUpperCase() === partTypeStrings.REAR_WIPER.toUpperCase() @@ -1039,14 +1048,7 @@ export const actions = { context.commit(storeMutations.UPDATE_CRM_CUSTOMER_ID, crmCustomerId); context.commit(storeMutations.WORK_ORDER_NUMBER, workOrderNumber); context.commit(storeMutations.LOCK_TOKEN, lockToken); - - // if we already have the token, do not update it. pia does 2 work order submits and the value is not persisted after the first submit - if ( - state.order.customerPortalLoginToken != null && - state.order.customerPortalLoginToken != "00000000-0000-0000-0000-000000000000" - ) { - context.commit(storeMutations.Customer_Portal_Login_Token, customerPortalLoginToken); - } + context.commit(storeMutations.Customer_Portal_Login_Token, customerPortalLoginToken); }, logPageView(