From 517e79d62dce477cfb23aa84a9144038bdfe54c1 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Wed, 19 Jul 2023 10:51:44 -0400 Subject: [PATCH 1/3] CSR-1552 allow unverified insurance to return to quote page. set a variable indicating switching from insurance to cash to pass to heritage so referral properties can be reset. --- src/constants/store-actions.js | 1 + src/constants/store-mutations.js | 1 + .../heritage-integration/navigation-helper.js | 1 + src/layouts/quote/quote.vue | 23 ++++++++++++++++++- src/mixins/vehicle-questions-mixin.js | 4 +--- src/store/index.js | 8 +++++++ 6 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 392e7b59e..9020ae2db 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -84,6 +84,7 @@ const storeActions = { SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING: "saveSupportingItemsSuppressingStateResetting", SAVE_VAPS: "saveVaps", + SAVE_SWITCH_INSURANCE_TO_CASH: "saveSwitchInsuranceToCash", }; export { storeActions }; diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index d4e07cf0a..66a0f5047 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -22,6 +22,7 @@ const storeMutations = { UPDATE_VAPS: "updateVaps", UPDATE_SUPPORTING_ITEMS: "updateSupportingItems", UPDATE_LINE_ITEMS_SERVER_DATA: "updateLineItemsServerData", + UPDATE_SWITCH_INSURANCE_TO_CASH: "updateSwitchInsuranceToCash", UPDATE_REGISTRATION_LICENSE_PLATE: "updateRegistrationLicensePlate", UPDATE_REGISTRATION_ADDRESS: "updateRegistrationAddress", diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 913fbcb1b..c8f320b1f 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -63,6 +63,7 @@ export async function navigateToHeritageFunnel({ shouldSaveSession = true, loadi src: "concept-funnel", conceptsqid: store.getters.applicationUser.savedSessionId, isInsurance: store.getters.payment.isInsurance, + switchInsuranceToCash: store.getters.order.switchInsuranceToCash, }); } diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 1e78647dc..c05495339 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -150,7 +150,7 @@ export default { (store.getters.order.damage.isRepair || (store.getters.order.lineItems?.glassParts != null && store.getters.order.lineItems.glassParts.length > 0)) && - store.getters.order.referralNumber?.length !== 6 + !store.getters.payment.insuranceCoverage.isVerified ); }, getDefaultIsInsuranceSelectedValue(availableLineItems) { @@ -177,6 +177,27 @@ export default { vehicleQuestionsMixin.methods.navigateBack(this); }, forwardButtonAction() { + // if referral is 6 digits unverified it indicates they were previously insurance and been to heritage + // need to set an indicator for heritage if they switched from insurance to cash. many things to reset on the referral in heritage if so + const prevPayment = this.$store.getters.payment; + if ( + this.$store.getters.order.referralNumber?.length === 6 && + !prevPayment.insuranceCoverage.isVerified && + prevPayment.isInsurance + ) { + this.dispatchStoreAction( + this.storeActions.SAVE_SWITCH_INSURANCE_TO_CASH, + true, + false + ); + } else { + this.dispatchStoreAction( + this.storeActions.SAVE_SWITCH_INSURANCE_TO_CASH, + false, + false + ); + } + this.dispatchStoreAction( this.storeActions.SAVE_PAYMENT_TYPE, this.isInsuranceSelected, diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index 4b05067ea..4a0c49c81 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -446,9 +446,7 @@ export default { const payment = store.getters.payment; - if (store.getters.order.referralNumber?.length === 6) { - navigateToHeritageFunnel({ loadingModal: self.$refs.loadingModal }); - } else if (payment.isInsurance && payment.insuranceCoverage.isVerified) { + if (payment.isInsurance && payment.insuranceCoverage.isVerified) { navigateToHeritageFunnel({ loadingModal: self.$refs.loadingModal }); } else { self.$router.navigateWithSaving( diff --git a/src/store/index.js b/src/store/index.js index c3c9fc8a0..23e7e14df 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -95,6 +95,7 @@ const getDefaultState = () => { referralDate: null, referralCorrelationId: null, eon: null, + switchInsuranceToCash: false, }, applicationUser: { eventBus: [], @@ -280,6 +281,9 @@ export const mutations = { state.order.schedule.jobMaxMinutes = scheduleInfo.jobMaxMinutes; } }, + updateSwitchInsuranceToCash(state, switchValue) { + state.order.switchInsuranceToCash = switchValue; + }, // applicationUser MUTATIONS updateSaveSessionPromise(state, saveSessionPromise) { @@ -1867,6 +1871,10 @@ export const actions = { context.commit(storeMutations.UPDATE_VAPS, vaps); }, + saveSwitchInsuranceToCash(context, switchValue) { + context.commit(storeMutations.UPDATE_SWITCH_INSURANCE_TO_CASH, switchValue); + }, + // Price order actions async priceOrderItemsAndSaveServerData( context, From 1870abcb5efacb91dc1646592e20b2395fe6e66d Mon Sep 17 00:00:00 2001 From: CarlNation Date: Wed, 19 Jul 2023 11:18:11 -0400 Subject: [PATCH 2/3] CSR-1552 add payment to test --- src/layouts/quote/quote.spec.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/layouts/quote/quote.spec.js b/src/layouts/quote/quote.spec.js index 099a3778e..807f8171b 100644 --- a/src/layouts/quote/quote.spec.js +++ b/src/layouts/quote/quote.spec.js @@ -162,6 +162,11 @@ describe("quote.vue", () => { }, referralNumber: "1234567", }, + payment: { + insuranceCoverage: { + isVerified: false + } + }, }; let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); @@ -185,6 +190,11 @@ describe("quote.vue", () => { glassParts: ["item", "item2"], }, }, + payment: { + insuranceCoverage: { + isVerified: false + } + }, }; let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); From b8f0c8ea7aa48d6003e4c8c9e4d273a016f79f5b Mon Sep 17 00:00:00 2001 From: CarlNation Date: Wed, 19 Jul 2023 11:21:34 -0400 Subject: [PATCH 3/3] CSR-1552 prettier --- src/layouts/quote/quote.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/layouts/quote/quote.spec.js b/src/layouts/quote/quote.spec.js index 807f8171b..6895b5d0b 100644 --- a/src/layouts/quote/quote.spec.js +++ b/src/layouts/quote/quote.spec.js @@ -164,8 +164,8 @@ describe("quote.vue", () => { }, payment: { insuranceCoverage: { - isVerified: false - } + isVerified: false, + }, }, }; @@ -192,8 +192,8 @@ describe("quote.vue", () => { }, payment: { insuranceCoverage: { - isVerified: false - } + isVerified: false, + }, }, };