diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 660681da1..f98d4dab0 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -207,7 +207,10 @@ export default { ...servicePackageDiscountPart, ]; - // When calling pricing from the quote page, always use the cash parent account + // When calling pricing from the quote page, always use the cash parent account but save the existing one in case it's unverified insurance navigating backwards + var holdParentAccountNumber = store.getters.order.payment?.parentAccountNumber; + var holdBillToAccountNumber = store.getters.order.payment?.billToAccountNumber; + baseMixin.methods.dispatchStoreAction( storeActions.SAVE_PARENT_ACCOUNT_NUMBER, applicationConfig.CASH_PARENT_ACCOUNT_NUMBER, @@ -260,6 +263,8 @@ export default { vm.lineItems = lineItems; vm.availableLineItems = pricingResults; vm.isInsuranceSelected = vm.getDefaultIsInsuranceSelectedValue(vm.availableLineItems); + vm.holdParentAccountNumber = holdParentAccountNumber; + vm.holdBillToAccountNumber = holdBillToAccountNumber; if (revalidatePromoResponse) { const revalidateAlerts = buildToastMessagesFromRevalidateOrValidatePromoResponse( @@ -280,17 +285,10 @@ export default { ); } + // This is a safeguard to prevent verified insurance from seeing quote page again. const payment = store.getters.payment; - const policy = store.getters.policy; - if (payment?.isInsurance) { - const vehicleChangedDuringPolicyLookupInHeritage = - payment.insuranceCoverage?.coverageStatus && policy?.policyNumber !== ""; - - // This is a safeguard to prevent insurance from seeing quote page again. - // Usually this is caught in vehicle-questions-mixin with a referral length 6 check - if (vehicleChangedDuringPolicyLookupInHeritage) { - navigateToHeritageFunnel({ shouldSaveSession: true, pageNameToLog: "quote" }); - } + if (payment?.isInsurance && payment?.insuranceCoverage?.isVerified) { + navigateToHeritageFunnel({ shouldSaveSession: true, pageNameToLog: "quote" }); } if (store.getters.externalParameterState?.isExternalParameter) { @@ -319,6 +317,8 @@ export default { lineItems: [], addableVaps: [], servicePackage: null, + holdParentAccountNumber: null, + holdBillToAccountNumber: null, }; }, computed: { @@ -352,13 +352,44 @@ export default { this.$refs[modalName].openModal(); }, arePagePrerequisitesValid() { + const payment = store.getters.order.payment; + const log = getQuerystringParameter(queryStrings.LOG); + if (eval(log)) { + console.log("quote.vue pagePrereqs:"); + console.log( + new Date() + + " store.getters.order.serviceLocation.zipCode: " + + store.getters.order.serviceLocation?.zipCode + ); + console.log( + new Date() + + " store.getters.order.serviceLocation.zipCodeCtu: " + + store.getters.order.serviceLocation?.zipCodeCtu + ); + console.log( + new Date() + + " store.getters.order.damage.isRepair: " + + store.getters.order.damage?.isRepair + ); + console.log( + new Date() + + " store.getters.order.lineItems?.glassParts: " + + JSON.stringify(store.getters.order.lineItems?.glassParts) + ); + console.log( + new Date() + + " store.getters.order.payment.insuranceCoverage?.isVerified: " + + payment?.insuranceCoverage?.isVerified + ); + } return ( store.getters.order.serviceLocation.zipCode && store.getters.order.serviceLocation.zipCodeCtu && (store.getters.order.damage.isRepair || (store.getters.order.lineItems?.glassParts != null && store.getters.order.lineItems.glassParts.length > 0)) && - store.getters.order.referralNumber?.length !== 6 + (payment.insuranceCoverage?.isVerified == null || + payment.insuranceCoverage?.isVerified === false) ); }, getDefaultIsInsuranceSelectedValue(availableLineItems) { @@ -412,6 +443,17 @@ export default { applicationConfig.CASH_DEFAULT_BILL_TO_ACCOUNT_NUMBER, false ); + } else { + baseMixin.methods.dispatchStoreAction( + storeActions.SAVE_PARENT_ACCOUNT_NUMBER, + this.holdParentAccountNumber, + false + ); + baseMixin.methods.dispatchStoreAction( + storeActions.SAVE_BILL_TO_ACCOUNT_NUMBER, + this.holdBillToAccountNumber, + false + ); } if ( diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index badd8a204..022fa1183 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -503,7 +503,8 @@ export default { this.recalibrationInformationModal.openModal(); }, backButtonAction() { - if (store.getters.order.payment.isInsurance) { + const payment = store.getters.order.payment; + if (payment?.isInsurance && payment?.insuranceCoverage?.isVerified) { navigateToHeritageFunnel({ shouldSaveSession: false }); } else { this.$router.navigateWithoutSaving(