From c41fe3fcfcd730fba2cde0e2f4fba632b63507cc Mon Sep 17 00:00:00 2001 From: CarlNation Date: Tue, 1 Oct 2024 08:21:47 -0400 Subject: [PATCH] CSR-2237 CSR-2237 found another cart price issue. Salestax was showing $13 on an order that was pending coverage. Changed salestax to return 0 for not verified insurance --- src/fmg-components/cart/cart.vue | 5 +++++ .../heritage-integration/navigation-helper.js | 2 ++ src/layouts/confirmation/confirmation.vue | 1 + src/layouts/quote/quote.vue | 3 ++- src/layouts/vehicle/vehicle.vue | 9 +++++++++ src/mixins/base-mixin.js | 16 ++++++++-------- 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 0dffbd6de..e6b66d4e6 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -1007,6 +1007,11 @@ export default { }, salesTax() { if (!this.lineItems || this.lineItems.length < 1) return; + + if (this.isInsurance && !this.showCoverageAsVerified) { + return 0; + } + return this.isInsurance || !this.shouldHideRecalibration ? baseMixin.methods.getSalesTax(this.lineItems) // calculate with recal (if on order) : baseMixin.methods.getSalesTax(this.lineItemsWithoutRecal); // calculated without recal diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 208a301e4..00687155b 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -109,8 +109,10 @@ export async function getImplicitNavigation(toRoute) { export async function navigateToHeritageFunnel({ shouldSaveSession, pageNameToLog }) { const log = getQuerystringParameter(queryStrings.LOG); if (eval(log)) { + console.log("------------- Navigate to heritage start -----------------"); console.log(new Date() + " applicationConfig: " + JSON.stringify(applicationConfig)); console.log(new Date() + " navigateToHeritageFunnel: " + applicationConfig.HERITAGE_FUNNEL); + console.log("------------- Navigate to heritage end -----------------"); } // Create the order (or save existing order) when navigating to Heritage Funnel. diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index c7f944078..dc3cc8085 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -60,6 +60,7 @@ v-model="lineItems" :showAsPaid="isPia" servicePackageOptionsCmsName="ServicePackageTitle" + :isInsurance="isInsurance" :insuranceDeductible="currentDeductible" :insuranceCompanyName="insuranceCompanyName" :showInsuranceCoverageAs="showInsuranceCoverageAs" diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index b778116e9..cfd51dc8b 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -438,7 +438,7 @@ export default { const payment = store.getters.order.payment; const log = getQuerystringParameter(queryStrings.LOG); if (eval(log)) { - console.log("quote.vue pagePrereqs:"); + console.log("------------- quote.vue pagePrereqs start -----------------"); console.log( new Date() + " store.getters.order.serviceLocation.zipCode: " + @@ -464,6 +464,7 @@ export default { " store.getters.order.payment.insuranceCoverage?.isVerified: " + payment?.insuranceCoverage?.isVerified ); + console.log("----------------- quote.vue pagePrereqs end -----------------"); } return ( store.getters.order.serviceLocation.zipCode && diff --git a/src/layouts/vehicle/vehicle.vue b/src/layouts/vehicle/vehicle.vue index 7f629db0a..30191e4fa 100644 --- a/src/layouts/vehicle/vehicle.vue +++ b/src/layouts/vehicle/vehicle.vue @@ -98,6 +98,9 @@ import store from "@/store"; import { storeActions } from "@/constants/store-actions.js"; import baseMixin from "@/mixins/base-mixin.js"; import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper"; +import { applicationConfig } from "../../constants/application-config"; +import { queryStrings } from "@/constants/query-strings"; +import { getQuerystringParameter } from "@/helpers/querystring-helper"; //define validation rules defineRule("year-required", required(errorMessages.YEAR_REQUIRED)); @@ -127,6 +130,12 @@ export default { }, async beforeRouteEnter(to, from, next) { + const log = getQuerystringParameter(queryStrings.LOG); + if (eval(log)) { + console.log("----------------- applicationConfig start -----------------"); + console.log(new Date() + JSON.stringify(applicationConfig)); + console.log("----------------- applicationConfig end -----------------"); + } // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); const experimentForLogging = store.getters.applicationUser.experiments.find( diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index e30663fea..12b9a99a2 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -83,7 +83,7 @@ export default { }; }, getTierOnePackagePrice(lineItems) { - let lineItemsToPrice = lineItems.filter((lineItem) => { + let lineItemsToPrice = lineItems?.filter((lineItem) => { return ( lineItem.partType != partTypeStrings.FRONT_WIPER && lineItem.partType != partTypeStrings.REAR_WIPER && @@ -95,7 +95,7 @@ export default { return totalPrice; }, filterOutFees(lineItems) { - const filteredLineItems = lineItems.filter((item) => { + const filteredLineItems = lineItems?.filter((item) => { return ( (!item.partType.includes("FEE") && !item.partType.includes("EARLY BIRD")) || (item.partType === "REPAIR FEE" && item.partNumber != "SUPPLIES-REPAIR") @@ -108,7 +108,7 @@ export default { }, getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) { let totalPrice = 0; - lineItems.forEach((lineItem) => { + lineItems?.forEach((lineItem) => { totalPrice += this.getTotalLineItemPrice(lineItem, includeTax); if (lineItem.childParts) { totalPrice += this.getTotalPriceOfAllLineItemsAndChildParts( @@ -139,14 +139,14 @@ export default { }, getAmountDue(lineItems, includeTax = true) { var amountDue = 0; - if (lineItems.glassParts) { + if (lineItems?.glassParts) { amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( lineItems.glassParts, includeTax ); } - - if (lineItems.supportingItems) { + + if (lineItems?.supportingItems) { amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( lineItems.supportingItems, includeTax @@ -162,14 +162,14 @@ export default { amountDue = order.policy.currentDeductible; } - if (lineItems.vaps) { + if (lineItems?.vaps) { amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( lineItems.vaps, includeTax ); } - if (lineItems.promos) { + if (lineItems?.promos) { amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( lineItems.promos, includeTax