From e54ead578e532059944a1632ff85bc58cb4f4c22 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 5 Sep 2024 17:02:15 -0400 Subject: [PATCH 01/21] Add call to recal endpoint --- src/constants/endpoints.js | 4 +++ src/constants/store-actions.js | 1 + src/mixins/vehicle-questions-mixin.js | 12 +++++++- src/store/index.js | 40 +++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 43abf149c..2b5c654e5 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -84,6 +84,10 @@ const endpoints = { url: "/parts/api/v1/parts/supporting-items", method: "POST", }, + GetRecalPart: { + url: "/parts/api/v1/parts/recal-parts", + method: "GET", + }, GetAlertReasons: { url: "/location/api/v1/location/alert-reasons", method: "GET", diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 069079d35..f5c7ea047 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -53,6 +53,7 @@ const storeActions = { VALIDATE_ORDER_PROMO_AND_SAVE_SERVER_DATA: "validateOrderPromoAndSaveServerData", REVALIDATE_ORDER_PROMOS_AND_SAVE_SERVER_DATA: "revalidateOrderPromosAndSaveServerData", GET_INSURANCE_COMPANY_LIST: "getInsuranceCompanyList", + GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS: "getRecalPartsAndSaveToLineItems", // DEPENDENCY MUTATIONS RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies", diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index 2749d1933..517fc7c90 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -450,7 +450,17 @@ export default { const collectedGlassParts = this.reducedGlassPartsArray(partsOrQuestions); // save to store lineItems.glassParts - self.dispatchStoreAction(storeActions.SAVE_GLASS_PARTS, collectedGlassParts, false); + await self.dispatchStoreAction( + storeActions.SAVE_GLASS_PARTS, + collectedGlassParts, + false + ); + + await self.dispatchStoreActionWithLogging( + storeActions.GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS, + null, + currentPage + ); const payment = store.getters.payment; diff --git a/src/store/index.js b/src/store/index.js index aa5747a0f..a74a52623 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2855,6 +2855,46 @@ export const actions = { externalParameterMMS.externalParameterStyle ); }, + + async getRecalPartsAndSaveToLineItems(context, { pageNameToLog }) { + // identify each part that needs recal + const glassParts = context.state.order?.lineItems?.glassParts ?? []; + + for (let i = 0; i < glassParts.length; i++) { + // does this part need recal? + const needsRecal = + !!glassParts[i].requiresRecalibration && !!glassParts[i].recalibrationType; + + if (needsRecal) { + const recalType = glassParts[i].recalibrationType; + const parentAccountNumber = + context.state.order.payment.parentAccountNumber ?? + applicationConfig.CASH_PARENT_ACCOUNT_NUMBER; + + // Get part from API + const urlExtension = `${context.state.order.vehicle.carId}/${glassParts[i].partNumber}/${recalType}/${parentAccountNumber}/${context.state.order.serviceLocation.zipCode}/${applicationConfig.ANALYTICS_APPLICATION_NAME}/${context.state.order.referralSequenceNumber}`; + + const recalPartResponse = await globalMethods.callHttpClient({ + method: endpoints.GetRecalPart.method, + endpoint: `${endpoints.GetRecalPart.url}/${urlExtension}`, + payload: {}, + pageNameToLog: pageNameToLog, + }); + + // If any parts retrieved, add as children to the glass part. + if ( + recalPartResponse.status === 200 && + recalPartResponse.data.recalibrationParts?.length > 0 + ) { + if (!glassParts[i].childParts) { + glassParts[i].childParts = []; + } + + glassParts[i].childParts.push(...recalPartResponse.data.recalibrationParts); + } + } + } + }, }; export default createStore({ From 6f3e35388b7c7b2dfc434d59a80895d71201f5d5 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 12 Sep 2024 09:52:39 -0400 Subject: [PATCH 02/21] Create helper files --- src/constants/part-type-strings.js | 1 + src/helpers/recal-helper.js | 39 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/helpers/recal-helper.js diff --git a/src/constants/part-type-strings.js b/src/constants/part-type-strings.js index 3ad66c40a..4681e2776 100644 --- a/src/constants/part-type-strings.js +++ b/src/constants/part-type-strings.js @@ -2,6 +2,7 @@ const partTypeStrings = { FRONT_WIPER: "FRONT WIPER", REAR_WIPER: "REAR WIPER", RAIN_DEFENSE: "RAIN DEFENSE", + ADAS_RECALIBRATION: "ADAS RECALIBRATION", RECALIBRATION: "RECALIBRATION", REPLACE_FEE: "REPLACE FEE", RECYCLE_FEE: "RECYCLE FEE", diff --git a/src/helpers/recal-helper.js b/src/helpers/recal-helper.js new file mode 100644 index 000000000..d6b1d044f --- /dev/null +++ b/src/helpers/recal-helper.js @@ -0,0 +1,39 @@ +import { deepClone } from "@/helpers/object-helper"; +import { partTypeStrings } from "@/constants/part-type-strings"; + +const recalPartTypes = [partTypeStrings.RECALIBRATION, partTypeStrings.ADAS_RECALIBRATION]; + +export function isRecalPartOrHasChildRecalPart(lineItem) { + if (lineItem.childParts && lineItem.childParts.length > 0) { + return isRecalPart(lineItem) || containsRecalParts(lineItem.childParts); + } else { + return isRecalPart(lineItem); + } +} + +export function isRecalPart(lineItem) { + return recalPartTypes.some((type) => lineItem.partType === type); +} + +export function containsRecalParts(lineItems) { + if (!lineItems) { + return false; + } + return lineItems.some((li) => isRecalPartOrHasChildRecalPart(li)); +} + +export function getItemsWithoutRecalParts(lineItems) { + const copy = deepClone(lineItems); + + const firstLevelFiltered = copy.filter((li) => !isRecalPart(li)); + + const childrenFiltered = firstLevelFiltered.map((li) => { + if (li.childParts && li.childParts.length > 0) { + li.childParts = getItemsWithoutRecalParts(li.childParts); + } + + return li; + }); + + return childrenFiltered; +} From 51fb83932d38a84b0a29faa63f4f23c1d696e34f Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 12 Sep 2024 12:28:32 -0400 Subject: [PATCH 03/21] Update `containsRecalPart` to accept both lineitems formats --- src/helpers/recal-helper.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/helpers/recal-helper.js b/src/helpers/recal-helper.js index d6b1d044f..fa33e7849 100644 --- a/src/helpers/recal-helper.js +++ b/src/helpers/recal-helper.js @@ -19,7 +19,20 @@ export function containsRecalParts(lineItems) { if (!lineItems) { return false; } - return lineItems.some((li) => isRecalPartOrHasChildRecalPart(li)); + + if (Array.isArray(lineItems)) { + return lineItems.some((li) => isRecalPartOrHasChildRecalPart(li)); + } else { + // complex object form -- flatten and re-call. + const flattened = [ + ...(lineItems.glassParts ?? []), + ...(lineItems.supportingItems ?? []), + ...(lineItems.vaps ?? []), + ...(lineItems.promos ?? []), + ]; + + return flattened.some((li) => isRecalPartOrHasChildRecalPart(li)); + } } export function getItemsWithoutRecalParts(lineItems) { From e29248a7ed0b65c207a25c4ede65fd96b542b0e3 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 12 Sep 2024 12:29:22 -0400 Subject: [PATCH 04/21] Update quote to use new parts --- src/layouts/quote/quote.vue | 19 +++++++++---------- .../service-package-question.vue | 13 +++++-------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 3d539e630..c0e6165ea 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -30,6 +30,7 @@ insuranceCmsWidgetName="InsuranceServicePackageQuestionWidget" groupName="ServicePackageQuestion" :availableLineItems="availableLineItems" + :shouldHideRecalibration="shouldHideRecalibration" :isInsuranceSelected="isInsuranceSelected" @vapsItemsSelected="vapsItemsSelectedAction" @servicePackageDiscountSelected="servicePackageDiscountSelectedAction" @@ -131,6 +132,7 @@ import { containsLineItemWithPartType } from "@/helpers/service-package-helper"; import { nextTick } from "vue"; import { packageNames } from "@/constants/package-names"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; +import { containsRecalParts } from "@/helpers/recal-helper"; defineRule("option-required", required(errorMessages.OPTION_REQUIRED)); export default { @@ -209,10 +211,7 @@ export default { ]; // If the recal experiment is found then log the experiment exposure. - const isRecalibrationOnOrder = containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - availableLineItems - ); + const isRecalibrationOnOrder = containsRecalParts(availableLineItems); const canSafeliteRecalibrate = nullSafeGlassParts.some((glassPart) => { return glassPart.partType === "WINDSHIELD" && glassPart.canSafeliteRecalibrate; }); @@ -354,10 +353,7 @@ export default { return Object.assign({}, this.lineItems); }, isRecalibrationOnOrder() { - return containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - this?.availableLineItems - ); + return containsRecalParts(this.lineItems); }, shouldHideRecalibration() { const recalSettingValue = experimentMixin.methods.getSettingValue( @@ -366,10 +362,13 @@ export default { return recalSettingValue; }, showAfterpayBanner() { - return !this.isInsuranceSelected && (!this.isRecalibrationOnOrder || !this.shouldHideRecalibration) + return ( + !this.isInsuranceSelected && + (!this.isRecalibrationOnOrder || !this.shouldHideRecalibration) + ); }, showRecalDisclaimer() { - return this.isRecalibrationOnOrder && this.shouldHideRecalibration + return this.isRecalibrationOnOrder && this.shouldHideRecalibration; }, }, methods: { diff --git a/src/layouts/quote/service-package-question/service-package-question.vue b/src/layouts/quote/service-package-question/service-package-question.vue index 93d8ff79b..f17fe908a 100644 --- a/src/layouts/quote/service-package-question/service-package-question.vue +++ b/src/layouts/quote/service-package-question/service-package-question.vue @@ -36,6 +36,7 @@ import { getPromosWithAddableVaps, getLineItemsThatMatchPromos, } from "@/helpers/promotions-helper"; +import { containsRecalParts, getItemsWithoutRecalParts } from "@/helpers/recal-helper"; export default { name: "servicePackageQuestion", @@ -49,6 +50,7 @@ export default { availableLineItems: null, activePromos: null, servicePackage: null, + shouldHideRecalibration: Boolean, }, data() { return { @@ -142,10 +144,7 @@ export default { return modifiedAnswers; }, isRecalibrationOnOrder() { - return containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - this.nullSafeAvailableLineItems - ); + return containsRecalParts(this.nullSafeAvailableLineItems); }, isServicePackageDiscountOnOrder() { return containsLineItemWithPartType( @@ -242,10 +241,8 @@ export default { }, getPackagePrice(packageName, { discountedPrice = false, servicePackageDiscount = false }) { var lineItemsToPrice = [...this.nullSafeAvailableLineItems]; - if (this.isRecalibrationOnOrder) { - lineItemsToPrice = lineItemsToPrice.filter((item) => { - return item.partType != partTypeStrings.RECALIBRATION; - }); + if (this.shouldHideRecalibration && this.isRecalibrationOnOrder) { + lineItemsToPrice = getItemsWithoutRecalParts(lineItemsToPrice); } //remove service package discount part From e30f2631e5952411f9c842728c48872acbf7674f Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 17 Sep 2024 13:23:19 -0400 Subject: [PATCH 05/21] Merge issue --- src/layouts/quote/quote.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 599ba0f6a..c6176ff9d 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -30,7 +30,6 @@ insuranceCmsWidgetName="InsuranceServicePackageQuestionWidget" groupName="ServicePackageQuestion" :availableLineItems="availableLineItems" - :shouldHideRecalibration="shouldHideRecalibration" :isInsuranceSelected="isInsuranceSelected" :isRecalibrationOnOrder="isRecalibrationOnOrder" :shouldHideRecalibration="shouldHideRecalibration" From 1dde9eb6f7e50fe2f92579c29227c9a1f0bc4b35 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 17 Sep 2024 13:45:32 -0400 Subject: [PATCH 06/21] Update store getters for recal --- src/store/index.js | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index c95366add..b0037bc61 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -39,6 +39,7 @@ import { coverageType, coverageTypeValue, } from "@/constants/insurance"; +import { containsRecalParts } from "@/helpers/recal-helper"; // Export State const getDefaultState = () => { @@ -2421,8 +2422,9 @@ export const actions = { })); const order = context.getters.order; - - var providerNumber = order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; + + var providerNumber = + order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; if (providerNumber.startsWith("00")) { providerNumber = providerNumber.substring(1); } @@ -2912,34 +2914,7 @@ export default createStore({ // Private Functions function getHasRecalibrationPart(state) { - var hasRequiresRecalibration = - getNonFalseValuesOfPropertyInArrayOfObjects( - state.order.lineItems.glassParts, - "requiresRecalibration" - )?.length > 0; - var hasRecalibrationType = - getNonFalseValuesOfPropertyInArrayOfObjects( - state.order.lineItems.glassParts, - "recalibrationType" - )?.length > 0; - - if (hasRequiresRecalibration) { - if (hasRecalibrationType) { - // Has both 'requiresRecalibration' and 'recalibrationType' and 'recalibrationType' - return ( - getNonFalseValuesOfPropertyInArrayOfObjects( - state.order.lineItems.glassParts, - "recalibrationType" - )[0].toLowerCase() != "unknown" - ); - } else { - // Has 'requiresRecalibration' but no 'recalibrationType' at all - return true; - } - } else { - // Does not have 'requiresRecalibration' - return false; - } + return containsRecalParts(state.order.lineItems); } function sortArrayOfObjectsByPropertyValue(arrayOfObjects, propertyName) { From 51655e7247d73f704aae148f5eb4223099453296 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 17 Sep 2024 14:23:55 -0400 Subject: [PATCH 07/21] Update payment-method & cart for new recal --- src/fmg-components/cart/cart.vue | 4 ++-- src/layouts/payment-method/payment-method.vue | 10 ++++++---- src/mixins/base-mixin.js | 6 ++---- src/store/index.js | 5 +++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 90c1adf98..0dffbd6de 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -305,8 +305,8 @@ export default { if (!this.lineItems || this.lineItems.length < 1) return; const lineItemsCopy = deepClone(this.lineItems); - lineItemsCopy.supportingItems = lineItemsCopy.supportingItems - ? baseMixin.methods.filterOutRecalibration(lineItemsCopy?.supportingItems) + lineItemsCopy.glassParts = lineItemsCopy.glassParts + ? baseMixin.methods.filterOutRecalibration(lineItemsCopy?.glassParts) : []; return lineItemsCopy; }, diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index ff7e6a8d8..2c458e124 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -153,6 +153,7 @@ import { partTypeStrings } from "@/constants/part-type-strings"; import { mapTaxedLineItemsToStoreFormat } from "../../store"; import { coverageStatus } from "@/constants/insurance"; import { containsLineItemWithPartType } from "@/helpers/service-package-helper"; +import { containsRecalParts } from "@/helpers/recal-helper"; defineRule("payment-method-required", required(errorMessages.OPTION_REQUIRED)); defineRule("recal-ack-required", required(errorMessages.RECAL_ACK_REQUIRED)); @@ -588,10 +589,11 @@ export default { }, computed: { isRecalibrationOnOrder() { - return containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - this.$store.getters.order.lineItems?.supportingItems - ); + const order = baseMixin.methods.hasSubmittedOrder() + ? baseMixin.methods.getSubmittedOrder() + : this.$store.getters.order; + + return containsRecalParts(order.lineItems); }, shouldHideRecalibration() { return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE); diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index c1e60d16a..669e3306f 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -8,6 +8,7 @@ import { queryStrings } from "@/constants/query-strings"; import { dynamicStrings } from "@/constants/dynamic-strings"; import { partTypeStrings } from "../constants/part-type-strings"; import { showFmgLoadingModal } from "@/helpers/loading-modal-helper"; +import { getItemsWithoutRecalParts } from "@/helpers/recal-helper"; export default { data() { @@ -103,10 +104,7 @@ export default { return filteredLineItems; }, filterOutRecalibration(lineItems) { - const filteredLineItems = lineItems.filter((item) => { - return !item.partType.includes(partTypeStrings.RECALIBRATION); - }); - return filteredLineItems; + return getItemsWithoutRecalParts(lineItems); }, getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) { let totalPrice = 0; diff --git a/src/store/index.js b/src/store/index.js index 8a87018d6..f6751bcef 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2422,8 +2422,9 @@ export const actions = { })); const order = context.getters.order; - - var providerNumber = order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; + + var providerNumber = + order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; if (providerNumber.startsWith("00") && providerNumber.length > 5) { providerNumber = providerNumber.substring(1); } From 3dbdab62755e7326ff01759a9d2e79d41e93434a Mon Sep 17 00:00:00 2001 From: Sneha Date: Wed, 25 Sep 2024 16:16:07 +0530 Subject: [PATCH 08/21] Changing EON --- src/constants/header-keys.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/header-keys.js b/src/constants/header-keys.js index 7caaef65c..2f7598244 100644 --- a/src/constants/header-keys.js +++ b/src/constants/header-keys.js @@ -4,5 +4,5 @@ export const headerKeys = { REFERRAL_SEQUENCE_NUMBER: "X-Referral-Sequence-Number", SESSION_SEQUENCE_NUMBER: "X-Session-Sequence-Number", TRANSACTION_ID: "X-Transaction-Id", - EON: "X-EON", + EON: "X-Enterprise-Order-Number", }; From e7e20f5f9f67e3c71c4949e43e6e6819dbd6b419 Mon Sep 17 00:00:00 2001 From: Sneha Date: Thu, 26 Sep 2024 17:34:51 +0530 Subject: [PATCH 09/21] CSR-2199 --- src/constants/analytics.js | 1 + src/layouts/quote/quote.vue | 57 ++++++++++++++++++++++++++++++++++- src/mixins/analytics-mixin.js | 7 +++++ 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/src/constants/analytics.js b/src/constants/analytics.js index fe43be06d..f6534cda4 100644 --- a/src/constants/analytics.js +++ b/src/constants/analytics.js @@ -23,6 +23,7 @@ const GaActions = { SUBMITTED: "Submitted", DISPLAYED: "Displayed", CASH_QUOTE_DISPLAYED: "Cash quote displayed", + SERVICE_PACKAGE_PRICE: "Service package price", MOBILE_AVAILABLE: "mobile_available", SHOPS_FIRST_DISPLAYED: "shops_first_displayed", MORE_LOCATIONS_CLICKED: "more_locations_clicked", diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 62c941f90..8aedcc754 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -128,7 +128,10 @@ import { queryStrings } from "@/constants/query-strings"; import { getQuerystringParameter } from "@/helpers/querystring-helper"; import promoModalQuestion from "@/fmg-components/promo-modal-question/promo-modal-question"; import { partTypeStrings } from "@/constants/part-type-strings"; -import { containsLineItemWithPartType } from "@/helpers/service-package-helper"; +import { + containsLineItemWithPartType, + findLineItemsWithPartType, +} from "@/helpers/service-package-helper"; import { nextTick } from "vue"; import { packageNames } from "@/constants/package-names"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; @@ -401,6 +404,18 @@ export default { this?.availableLineItems ); }, + isServicePackageDiscountOnOrder() { + return containsLineItemWithPartType( + partTypeStrings.SERVICE_PACKAGE_DISCOUNT, + this.availableLineItems + ); + }, + servicePackageDiscountParts() { + return findLineItemsWithPartType( + partTypeStrings.SERVICE_PACKAGE_DISCOUNT, + this.availableLineItems + ); + }, shouldHideRecalibration() { return ( this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE)?.toLowerCase() === @@ -563,6 +578,46 @@ export default { ); } }); + this.$nextTick(() => { + const availablePackageNames = this.$refs.servicePackage.servicePackageAnswers; + var eventLabel = ""; + availablePackageNames?.forEach((tier) => { + if (tier) { + let lineItemsToPrice = this.availableLineItems; + if (this.isRecalibrationOnOrder && this.shouldHideRecalibration) { + lineItemsToPrice = lineItemsToPrice?.filter((item) => { + return item.partType != partTypeStrings.RECALIBRATION; + }); + } + if (this.isServicePackageDiscountOnOrder) { + lineItemsToPrice = lineItemsToPrice?.filter((item) => { + return ( + item.partType != this.servicePackageDiscountParts[0].partType + ); + }); + } + let price = 0; + if (tier.value == "TierTwo" && this.isServicePackageDiscountOnOrder) { + lineItemsToPrice.push(...this.servicePackageDiscountParts); + } + price += baseMixin.methods.getTierOnePackagePrice( + baseMixin.methods.filterOutFees(lineItemsToPrice) + ); + price += this.$refs.servicePackage.getVapsPrice(tier.value); + const formattedPrice = parseFloat(price).toFixed(2); + eventLabel += tier.value + "_" + formattedPrice; + } + eventLabel += ","; + }); + eventLabel = eventLabel.slice(0, -1); + + this.pushEventToGA( + "quote", + this.GaActions.SERVICE_PACKAGE_PRICE, + eventLabel, + true + ); + }); }, }, mounted() { diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index e0517080e..b66ad59dc 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -211,6 +211,13 @@ export default { payload.glassToReplace = glassString; } + //EON + if (order.eon) { + payload.eon = order.eon; + } else { + payload.eon = ""; + } + // Work Order Id if (order.workOrderId) { const parsedId = parseInt(order.workOrderId); From daf9ecba0de30af4124effdd53b58655dc496bf3 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 26 Sep 2024 11:59:28 -0400 Subject: [PATCH 10/21] CSR-1600 CSR-1600 new endpoint from mule for applicable fees --- src/store/index.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index 89d0db2a3..1b48e3252 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1537,9 +1537,30 @@ export const actions = { ? context.getters.payment.billToAccountNumber : applicationConfig.CASH_DEFAULT_BILL_TO_ACCOUNT_NUMBER; + const order = context.getters.order; + const coverageStatus = order.payment?.insuranceCoverage?.coverageStatus; + const coverageSubStatus = order.payment?.insuranceCoverage?.coverageSubStatus; + const isItac = order.policy?.isItac ?? false; + const zipCode = order.serviceLocation?.provider?.address?.zipCode ?? order.serviceLocation?.zipCode; + + var providerNumber = + order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; + if (providerNumber.startsWith("00") && providerNumber.length > 5) { + providerNumber = providerNumber.substring(1); + } + + var endPoint = `${endpoints.GetMobileFeePart.url}/?damageType=${damageType}&parentAccountNumber=${parentAccountNumber}&billToAccountNumber=${billToAccountNumber}&providerNumber=${providerNumber}&isItac=${isItac}&zipCode=${zipCode}`; + if (coverageStatus) { + endPoint = `${endPoint}&coverageStatus=${coverageStatus}`; + } + + if (coverageSubStatus) { + endPoint = `${endPoint}&coverageSubStatus=${coverageSubStatus}`; + } + return globalMethods.callHttpClient({ method: endpoints.GetMobileFeePart.method, - endpoint: `${endpoints.GetMobileFeePart.url}/${damageType}/${parentAccountNumber}/${billToAccountNumber}`, + endpoint: endPoint, logApiCall: true, pageNameToLog: pageNameToLog, }); From feab3c5c54c32db022e42b811f785a252dee6114 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 26 Sep 2024 12:03:35 -0400 Subject: [PATCH 11/21] CSR-1600 prettier CSR-1600 prettier --- src/layouts/quote/quote.vue | 7 +------ src/store/index.js | 13 +++++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 8aedcc754..78ce15fa4 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -611,12 +611,7 @@ export default { }); eventLabel = eventLabel.slice(0, -1); - this.pushEventToGA( - "quote", - this.GaActions.SERVICE_PACKAGE_PRICE, - eventLabel, - true - ); + this.pushEventToGA("quote", this.GaActions.SERVICE_PACKAGE_PRICE, eventLabel, true); }); }, }, diff --git a/src/store/index.js b/src/store/index.js index 1b48e3252..e03e2ac16 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1541,13 +1541,14 @@ export const actions = { const coverageStatus = order.payment?.insuranceCoverage?.coverageStatus; const coverageSubStatus = order.payment?.insuranceCoverage?.coverageSubStatus; const isItac = order.policy?.isItac ?? false; - const zipCode = order.serviceLocation?.provider?.address?.zipCode ?? order.serviceLocation?.zipCode; + const zipCode = + order.serviceLocation?.provider?.address?.zipCode ?? order.serviceLocation?.zipCode; - var providerNumber = - order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; - if (providerNumber.startsWith("00") && providerNumber.length > 5) { - providerNumber = providerNumber.substring(1); - } + var providerNumber = + order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu; + if (providerNumber.startsWith("00") && providerNumber.length > 5) { + providerNumber = providerNumber.substring(1); + } var endPoint = `${endpoints.GetMobileFeePart.url}/?damageType=${damageType}&parentAccountNumber=${parentAccountNumber}&billToAccountNumber=${billToAccountNumber}&providerNumber=${providerNumber}&isItac=${isItac}&zipCode=${zipCode}`; if (coverageStatus) { From b5d8d86b27258ec59395b93a0f640ba11f00195c Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Thu, 26 Sep 2024 13:44:29 -0400 Subject: [PATCH 12/21] CSR-2227 fix missing subheader copy. --- src/fmg-components/funnel-sub-header/funnel-sub-header.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fmg-components/funnel-sub-header/funnel-sub-header.vue b/src/fmg-components/funnel-sub-header/funnel-sub-header.vue index fa8aea13f..54c8aa34d 100644 --- a/src/fmg-components/funnel-sub-header/funnel-sub-header.vue +++ b/src/fmg-components/funnel-sub-header/funnel-sub-header.vue @@ -53,7 +53,7 @@ export default { return this.leftAlignHeader ? "justify-content-start" : "justify-content-center"; }, subText() { - return this.getCmsContent(this.cmsWidgetName, "HeaderSubText"); + return this.getCmsContent(this.cmsWidgetName, "SubheaderText"); }, backButtonAccessibleText() { return this.getCmsContent(this.cmsWidgetName, "BackButtonAccessibleText"); From 2419986c7ea4836e72bb14229557141854650f91 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 26 Sep 2024 15:34:10 -0400 Subject: [PATCH 13/21] CSR-1600 CSR-1600 mobile fee endpoint changes --- src/constants/insurance.js | 28 ++++++++++++++++++++++++++++ src/store/index.js | 17 ++++++++++------- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/constants/insurance.js b/src/constants/insurance.js index 1df261d63..5ab8c2572 100644 --- a/src/constants/insurance.js +++ b/src/constants/insurance.js @@ -29,6 +29,19 @@ export function coverageStatusValue(intCoverageStatus) { } } +export function coverageStatusEnum(strCoverageStatus) { + switch (strCoverageStatus) { + case coverageStatus.PENDING: + return 0; + case coverageStatus.NOCOMP: + return 1; + case coverageStatus.VERIFIED: + return 2; + default: + return null; + } +} + export const coverageType = { NONE: "None", DEDUCTIBLE: "Deductible", @@ -50,3 +63,18 @@ export function coverageTypeValue(intCoverageType) { return null; } } + +export function coverageTypeEnum(strCoverageType) { + switch (strCoverageType) { + case coverageType.NONE: + return 0; + case coverageType.DEDUCTIBLE: + return 1; + case coverageType.ITAC: + return 2; + case coverageType.NOCOMP: + return 3; + default: + return null; + } +} \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js index e03e2ac16..562659bf0 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -36,8 +36,10 @@ import sharedMutations from "./vuex-shared-mutations/vuexSharedMutations"; import { coverageStatus, coverageStatusValue, + coverageStatusEnum, coverageType, coverageTypeValue, + coverageTypeEnum, } from "@/constants/insurance"; // Export State @@ -1531,16 +1533,17 @@ export const actions = { }, getMobileFeePart(context, { pageNameToLog }) { - const damageType = context.getters.damage.isRepair ? "Repair" : "Replace"; + const serviceType = context.getters.damage.isRepair ? "Repair" : "Install"; + const facilityType = "Mobile"; const parentAccountNumber = context.getters.payment.parentAccountNumber; const billToAccountNumber = context.getters.payment.billToAccountNumber ? context.getters.payment.billToAccountNumber : applicationConfig.CASH_DEFAULT_BILL_TO_ACCOUNT_NUMBER; const order = context.getters.order; - const coverageStatus = order.payment?.insuranceCoverage?.coverageStatus; - const coverageSubStatus = order.payment?.insuranceCoverage?.coverageSubStatus; - const isItac = order.policy?.isItac ?? false; + const coverageStatus = coverageStatusEnum(order.payment?.insuranceCoverage?.coverageStatus); + const coverageType = coverageTypeEnum(order.payment?.insuranceCoverage?.coverageType); + const isItacOptimized = order.policy?.isItac ?? false; const zipCode = order.serviceLocation?.provider?.address?.zipCode ?? order.serviceLocation?.zipCode; @@ -1550,13 +1553,13 @@ export const actions = { providerNumber = providerNumber.substring(1); } - var endPoint = `${endpoints.GetMobileFeePart.url}/?damageType=${damageType}&parentAccountNumber=${parentAccountNumber}&billToAccountNumber=${billToAccountNumber}&providerNumber=${providerNumber}&isItac=${isItac}&zipCode=${zipCode}`; + var endPoint = `${endpoints.GetMobileFeePart.url}/?serviceType=${serviceType}&facilityType=${facilityType}&parentAccountNumber=${parentAccountNumber}&billToAccountNumber=${billToAccountNumber}&providerNumber=${providerNumber}&isItac=${isItacOptimized}&zipCode=${zipCode}`; if (coverageStatus) { endPoint = `${endPoint}&coverageStatus=${coverageStatus}`; } - if (coverageSubStatus) { - endPoint = `${endPoint}&coverageSubStatus=${coverageSubStatus}`; + if (coverageType) { + endPoint = `${endPoint}&coverageType=${coverageType}`; } return globalMethods.callHttpClient({ From b4f402e04b50b0ec74bb798da95b78cb585364b4 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 26 Sep 2024 15:34:55 -0400 Subject: [PATCH 14/21] CSR-1600 prettier --- src/constants/insurance.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/insurance.js b/src/constants/insurance.js index 5ab8c2572..f7550513b 100644 --- a/src/constants/insurance.js +++ b/src/constants/insurance.js @@ -77,4 +77,4 @@ export function coverageTypeEnum(strCoverageType) { default: return null; } -} \ No newline at end of file +} From fad42eba6ebdcfdb62b9b3b9c691b099d4f98863 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 26 Sep 2024 15:52:17 -0400 Subject: [PATCH 15/21] Update unit test --- src/store/store.spec.js | 104 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index fb1c73f98..6c36c6c26 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -3950,6 +3950,110 @@ describe("Getters", () => { mutations.updateVaps(storeState, mockStateValues.funnelVaps); mutations.updateGlassToReplace(storeState, mockStateValues.glassToReplace); + //Assert + expect(getters.experimentOrder(storeState)).toEqual({ + funnelVehicleYear: mockStateValues.vehicleYear, + funnelVehicleMake: mockStateValues.vehicleMake, + funnelVehicleModel: mockStateValues.vehicleModel, + funnelVehicleStyle: mockStateValues.vehicleStyle, + funnelIsRepair: mockStateValues.isRepair, + funnelNumberOfChips: mockStateValues.numberOfChips, + funnelCarId: mockStateValues.carId, + funnelServiceCity: mockStateValues.serviceCity, + funnelServiceState: mockStateValues.serviceState, + funnelServiceZipCode: mockStateValues.serviceZipCode, + funnelParentAccountNumber: mockStateValues.parentAccountNumber, + funnelIsCoverageVerified: mockStateValues.isCoverageVerified, + funnelOrderPartNumbers: ["WINDSHIELDPARTNUMBER"], + funnelOrderPartTypes: ["ADAS, maybe"], + funnelHasRecalibrationPart: false, + funnelSelectedMultiGlass: false, + funnelSelectedWindshieldGlass: true, + funnelSelectedBackGlass: false, + funnelSelectedDriverSideGlass: false, + funnelSelectedPassengerSideGlass: false, + funnelProviderNumber: mockStateValues.funnelProviderNumber, + funnelReferralType: mockStateValues.funnelReferralType, + funnelServiceZipCodeCtu: mockStateValues.funnelServiceZipCodeCtu, + }); + }); + + test("Single windshield with recalibration child part > return correct experimentOrder values", () => { + // Arrange + const storeState = state; + const mockStateValues = { + vehicleYear: 1000, + vehicleMake: "CarMake", + vehicleModel: "CarModel", + vehicleStyle: "SuperCoolStyle", + isRepair: false, + numberOfChips: 0, + carId: "Gibberish", + serviceCity: "Columbus", + serviceState: "OH-IO", + serviceZipCode: 43215, + parentAccountNumber: "999999", + isCoverageVerified: false, + glassParts: [ + { + partNumber: "WINDSHIELDPARTNUMBER", + description: "This is a windshield", + recalibrationType: "ADAS, maybe", + requiresRecalibration: true, + requiresCapabilityQuestions: false, + childParts: [ + { + "partNumber": "THIRD RECAL", + "description": "Additional Static Recal", + "recalibrationType": "DUAL & RECAL THIRD & HC FUNCTION TEST & RL SENSOR", + "ribCode": "RL", + "safelitePartNumber": "THIRD RECAL", + "status": "ACTIVE", + "partType": "ADAS RECALIBRATION", + "childParts": [], + "recalibrationFees": [], + "salesTax": null + } + ], + }, + ], + otherParts: [], + glassToReplace: [ + { + glassLocation: "Windshield", + glassName: "Single", + }, + ], + funnelProviderNumber: "1", + funnelReferralType: "CASH QUOTE", + funnelServiceZipCodeCtu: "11111", + }; + + //Act + mutations.updateYear(storeState, mockStateValues.vehicleYear); + mutations.updateMake(storeState, mockStateValues.vehicleMake); + mutations.updateModel(storeState, mockStateValues.vehicleModel); + mutations.updateStyle(storeState, mockStateValues.vehicleStyle); + mutations.updateIsRepair(storeState, mockStateValues.isRepair); + mutations.updateNumberOfChips(storeState, mockStateValues.numberOfChips); + mutations.updateCarId(storeState, mockStateValues.carId); + mutations.updateServiceLocation(storeState, { + city: mockStateValues.serviceCity, + state: mockStateValues.serviceState, + zipCode: mockStateValues.serviceZipCode, + zipCodeCtu: mockStateValues.funnelServiceZipCodeCtu, + provider: { + providerNumber: mockStateValues.funnelProviderNumber, + }, + }); + mutations.updateParentAcctNumber(storeState, mockStateValues.parentAccountNumber); + mutations.updateInsuranceVerifiedStatus(storeState, mockStateValues.isCoverageVerified); + mutations.updateIsInsurance(storeState, false); + mutations.updateGlassParts(storeState, mockStateValues.glassParts); + mutations.updateSupportingItems(storeState, mockStateValues.funnelSupportingItems); + mutations.updateVaps(storeState, mockStateValues.funnelVaps); + mutations.updateGlassToReplace(storeState, mockStateValues.glassToReplace); + //Assert expect(getters.experimentOrder(storeState)).toEqual({ funnelVehicleYear: mockStateValues.vehicleYear, From 06a2d381fa6728ed5e9847fdbb81f52ca488cbbe Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 26 Sep 2024 17:34:13 -0400 Subject: [PATCH 16/21] Tweaks to dev changes --- src/layouts/confirmation/confirmation.vue | 6 ++---- src/layouts/quote/quote.vue | 12 +++--------- src/store/store.spec.js | 23 ++++++++++++----------- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index 72ee038db..c7f944078 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -108,6 +108,7 @@ import { getDisplayTextForDurationLength } from "@/helpers/duration-length-helpe import { experimentSettings } from "@/constants/experiments"; import { partTypeStrings } from "@/constants/part-type-strings"; import { containsLineItemWithPartType } from "@/helpers/service-package-helper"; +import { containsRecalParts } from "@/helpers/recal-helper.js"; export default { name: "confirmation", @@ -170,10 +171,7 @@ export default { }, computed: { isRecalibrationOnOrder() { - return containsLineItemWithPartType( - partTypeStrings.RECALIBRATION, - this?.lineItems?.supportingItems - ); + return containsRecalParts(this?.lineItems); }, shouldHideRecalibration() { return ( diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index c8e2dda02..b778116e9 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -583,9 +583,8 @@ export default { if (tier) { let lineItemsToPrice = this.availableLineItems; if (this.isRecalibrationOnOrder && this.shouldHideRecalibration) { - lineItemsToPrice = lineItemsToPrice?.filter((item) => { - return item.partType != partTypeStrings.RECALIBRATION; - }); + lineItemsToPrice = + baseMixin.methods.filterOutRecalibration(lineItemsToPrice); } if (this.isServicePackageDiscountOnOrder) { lineItemsToPrice = lineItemsToPrice?.filter((item) => { @@ -609,12 +608,7 @@ export default { }); eventLabel = eventLabel.slice(0, -1); - this.pushEventToGA( - "quote", - this.GaActions.SERVICE_PACKAGE_PRICE, - eventLabel, - true - ); + this.pushEventToGA("quote", this.GaActions.SERVICE_PACKAGE_PRICE, eventLabel, true); }); }, }, diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 6c36c6c26..9c546d3be 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -4003,17 +4003,18 @@ describe("Getters", () => { requiresCapabilityQuestions: false, childParts: [ { - "partNumber": "THIRD RECAL", - "description": "Additional Static Recal", - "recalibrationType": "DUAL & RECAL THIRD & HC FUNCTION TEST & RL SENSOR", - "ribCode": "RL", - "safelitePartNumber": "THIRD RECAL", - "status": "ACTIVE", - "partType": "ADAS RECALIBRATION", - "childParts": [], - "recalibrationFees": [], - "salesTax": null - } + partNumber: "THIRD RECAL", + description: "Additional Static Recal", + recalibrationType: + "DUAL & RECAL THIRD & HC FUNCTION TEST & RL SENSOR", + ribCode: "RL", + safelitePartNumber: "THIRD RECAL", + status: "ACTIVE", + partType: "ADAS RECALIBRATION", + childParts: [], + recalibrationFees: [], + salesTax: null, + }, ], }, ], From d8c14e77ea6491c05b380083c60e069df5f0f951 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 27 Sep 2024 13:32:37 -0400 Subject: [PATCH 17/21] CSR-1600 CSR-1600 correct name for itac flag on part service --- src/store/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index 562659bf0..00bdd486f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1553,7 +1553,7 @@ export const actions = { providerNumber = providerNumber.substring(1); } - var endPoint = `${endpoints.GetMobileFeePart.url}/?serviceType=${serviceType}&facilityType=${facilityType}&parentAccountNumber=${parentAccountNumber}&billToAccountNumber=${billToAccountNumber}&providerNumber=${providerNumber}&isItac=${isItacOptimized}&zipCode=${zipCode}`; + var endPoint = `${endpoints.GetMobileFeePart.url}/?serviceType=${serviceType}&facilityType=${facilityType}&parentAccountNumber=${parentAccountNumber}&billToAccountNumber=${billToAccountNumber}&providerNumber=${providerNumber}&isItacOptimized=${isItacOptimized}&zipCode=${zipCode}`; if (coverageStatus) { endPoint = `${endPoint}&coverageStatus=${coverageStatus}`; } From 62d550750f19bd98f80af99accf7ff8831956bf1 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 27 Sep 2024 15:11:20 -0400 Subject: [PATCH 18/21] CSR-2237 CSR-2237 when coverage is verified, only show deductible for amount due in the cart --- src/mixins/base-mixin.js | 2 +- src/mixins/base-mixin.spec.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index c1e60d16a..15095746b 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -173,7 +173,7 @@ export default { !order.policy.isNoComp && !order.policy.isItac ) { - amountDue += order.policy.currentDeductible; + amountDue = order.policy.currentDeductible; } return ((amountDue * 100) / 100).toFixed(2); diff --git a/src/mixins/base-mixin.spec.js b/src/mixins/base-mixin.spec.js index 9a062a831..a3493910e 100644 --- a/src/mixins/base-mixin.spec.js +++ b/src/mixins/base-mixin.spec.js @@ -175,7 +175,7 @@ describe("baseMixin.js", () => { promos: [], }; - const payment = { insuranceCoverage: { isVerified: true } }; + const payment = { insuranceCoverage: { isVerified: false } }; const policy = { isNoComp: false, isItac: false, currentDeductible: 250 }; store.getters = { @@ -190,7 +190,7 @@ describe("baseMixin.js", () => { var amtDue = mixIn.methods.getAmountDue(lineItems); - expect(amtDue).toEqual("303.00"); + expect(amtDue).toEqual("53.00"); }); test("getAmountDue should function with a submitted order", () => { @@ -223,7 +223,7 @@ describe("baseMixin.js", () => { promos: [], }; - const payment = { insuranceCoverage: { isVerified: true } }; + const payment = { insuranceCoverage: { isVerified: false } }; const policy = { isNoComp: false, isItac: false, currentDeductible: 250 }; mixIn.methods.hasSubmittedOrder = jest.fn().mockReturnValue(true); @@ -240,7 +240,7 @@ describe("baseMixin.js", () => { var amtDue = mixIn.methods.getAmountDue(lineItems); - expect(amtDue).toEqual("303.00"); + expect(amtDue).toEqual("53.00"); }); test("getAmountDue for cash should sum lineitems", () => { From 8ebd0cd3060f61eaa93ad5da5ac778613470b4e6 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Sun, 29 Sep 2024 09:31:26 -0400 Subject: [PATCH 19/21] CSR-2237 CSR-2237 Added new getter that checks the 7777 and 9999 deductibles when determining if coverage is verified. Added the amount of vaps due to the amount due when using deductible/verified pricing. --- src/layouts/payment-method/payment-method.vue | 11 +++++---- src/mixins/base-mixin.js | 9 +++++-- src/store/index.js | 24 ++++++++++++++++--- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 3c8d23502..60eabcb02 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -626,13 +626,16 @@ export default { }, showInsuranceCoverageAs() { if (!this.isInsurance) return null; + if (this.isNoComp || this.isItac) { return coverageStatus.NOCOMP; - } else { - return this.hasSubmittedOrder() - ? this.getSubmittedOrder()?.payment.insuranceCoverage.coverageStatus - : this.$store.getters.payment.insuranceCoverage.coverageStatus; } + + if (this.$store.getters.coverageIsVerified) { + return coverageStatus.VERIFIED; + } + + return coverageStatus.PENDING; }, currentDeductible() { return this.hasSubmittedOrder() diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index 15095746b..b740cc5ac 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -167,13 +167,18 @@ export default { } const order = this.hasSubmittedOrder() ? this.getSubmittedOrder() : store.getters.order; - if ( - order.payment.insuranceCoverage.isVerified && + store.getters.coverageIsVerified && !order.policy.isNoComp && !order.policy.isItac ) { amountDue = order.policy.currentDeductible; + if (lineItems.vaps) { + amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( + lineItems.vaps, + includeTax + ); + } } return ((amountDue * 100) / 100).toFixed(2); diff --git a/src/store/index.js b/src/store/index.js index 00bdd486f..4ec245ff3 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -774,6 +774,24 @@ export const getters = { ); return !!nonWindshieldItems?.length; }, + coverageIsVerified: (state) => { + let order; + if (window.sessionStorage.getItem("submittedOrder") !== null) { + order = JSON.parse(window.sessionStorage.getItem("submittedOrder")); + } else { + order = state.order; + } + + if ( + order.payment?.insuranceCoverage?.isVerified && + order.policy?.currentDeductible != 9999 && + order.policy?.currentDeductible != 7777 + ) { + return true; + } + + return false; + }, isMobileAppointment: (state) => { return state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE; }, @@ -899,13 +917,13 @@ export const getters = { isVerifiedAndDeductibleZeroConfirmed: (state) => { // used as a CMS variable on /payment-method, needed for FunnelSubHeaderWidget on cart pages if ( - (state.order.policy.currentDeductible === 0 || - state.order.policy.currentDeductible > 0) && - state.order.payment.insuranceCoverage.coverageStatus === coverageStatus.VERIFIED && + state.order.policy.currentDeductible === 0 && + getters.coverageIsVerified(state) && !state.order.policy.isNoComp ) { return true; } + return false; }, requiresVerifiedRedirecting: (state) => { From 92e0e6e60d63bdce3aa49f399e92993454fa31d8 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 30 Sep 2024 06:22:52 -0400 Subject: [PATCH 20/21] CSR-2237 CSR-2237 move vaps and promos below deductible pricing to make sure it is added into the amount due and also avoid code duplication --- src/mixins/base-mixin.js | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index fdf1261e0..e30663fea 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -145,24 +145,13 @@ export default { includeTax ); } + if (lineItems.supportingItems) { amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( lineItems.supportingItems, includeTax ); } - if (lineItems.vaps) { - amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( - lineItems.vaps, - includeTax - ); - } - if (lineItems.promos) { - amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( - lineItems.promos, - includeTax - ); - } const order = this.hasSubmittedOrder() ? this.getSubmittedOrder() : store.getters.order; if ( @@ -171,12 +160,20 @@ export default { !order.policy.isItac ) { amountDue = order.policy.currentDeductible; - if (lineItems.vaps) { - amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( - lineItems.vaps, - includeTax - ); - } + } + + if (lineItems.vaps) { + amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( + lineItems.vaps, + includeTax + ); + } + + if (lineItems.promos) { + amountDue += this.getTotalPriceOfAllLineItemsAndChildParts( + lineItems.promos, + includeTax + ); } return ((amountDue * 100) / 100).toFixed(2); From c41fe3fcfcd730fba2cde0e2f4fba632b63507cc Mon Sep 17 00:00:00 2001 From: CarlNation Date: Tue, 1 Oct 2024 08:21:47 -0400 Subject: [PATCH 21/21] 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