From fe76d39aac8c120f8550c842bdbfd20a4a31e165 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Thu, 10 Oct 2024 21:37:29 -0400 Subject: [PATCH] PR updates Will double check this is still working since policy look up kept failing. --- src/constants/endpoints.js | 4 - .../service-location/service-location.vue | 24 +---- src/store/index.js | 89 ++++++------------- 3 files changed, 29 insertions(+), 88 deletions(-) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 44c749a0..ab149820 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -72,10 +72,6 @@ const endpoints = Object.freeze({ url: `${PARTS_BASE_URL}/parts`, method: 'POST' }, - GetInsurancePriceOrderItems: { - url: `${PRICE_BASE_URL}/order-items-with-insurance-pricing`, - method: 'GET' - }, GetITACPriceOrderItems: { url: `${PRICE_BASE_URL}/order-items-with-itac-pricing`, method: 'POST' diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 88bc7d02..81febf0c 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -495,28 +495,8 @@ export default { } if (glassFees) { - // We only call the ITAC pricing endpoint if we are not repair or we are NoComp - if (!this.isRepair || this.mainStore.isNoComp) { - const { glassParts } = this.mainStore.order.lineItems; - const availableLineItems = [ - ...(glassParts ?? []), // if only glassFee and price is 0.00 tosses a 500 so including parts - ...(glassFees ?? []) - ]; - - await useMainStore().getITACPriceOrderItems(availableLineItems) - .catch((err) => { - useMainStore().setBailout(bailoutMessage.pricingResponseError( - availableLineItems.map((li) => li.partNumber), - { - code: err.code, - message: err.message, - data: err.data - } - )); - this.navigateWithScenario(navigationScenarios.PRICING_LOOKUP_ERROR); - }); - this.setGlassFeeItems(glassFees); - } + const pricedGlassFees = await useMainStore().getCombinedQuote(glassFees); + this.setGlassFeeItems(pricedGlassFees); } }, setContainsMilitaryBase(val) { diff --git a/src/store/index.js b/src/store/index.js index 07a4e292..c4c3b903 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1077,9 +1077,8 @@ export const useMainStore = defineStore({ } }, async getGlassFees() { - const { insuranceCoverage } = this.order; + const { insuranceCoverage, vehicle } = this.order; const { glassParts } = this.lineItems; - const { carId } = this.vehicle; const { isRepair } = this.damage; const { defaultProviderNumber, provider, zipCode } = this.order.serviceLocation; const damageType = isRepair ? 'Repair' : 'Install'; @@ -1087,25 +1086,24 @@ export const useMainStore = defineStore({ const providerToUse = provider?.providerNumber ?? defaultProviderNumber; const partNumberListQueryString = getPartNumbersListForQueryString(glassParts, 'PartNumbers'); - const queryString = - `ServiceType=${damageType}` - + `&FacilityType=${facilityType}` - + `&ParentAccountNumber=${this.order.parentAccountNumber}` - + `&BillToAccountNumber=${this.billToAccountNumber}` - + `&IsPremiumAppointment=${false}` - + `&IsItacOptimized=${false}` - + `&ZipCode=${zipCode}` - + `&CoverageStatus=${coverageStatuses.mapToApi(insuranceCoverage.coverageStatus)}` - + `&CoverageType=${coverageType.mapToApi(insuranceCoverage.coverageType)}` - + `&ProviderNumber=${providerToUse}` - + `&CarId=${carId}` - + `${partNumberListQueryString}`; + const params = new URLSearchParams({ + serviceType: damageType, + facilityType, + parentAccountNumber: this.order.parentAccountNumber, + billToAccountNumber: this.billToAccountNumber, + isPremiumAppointment: false, + isItacOptimized: insuranceCoverage.isItacOptimized, + zipCode, + coverageStatus: coverageStatuses.mapToApi(insuranceCoverage.coverageStatus), + coverageType: coverageType.mapToApi(insuranceCoverage.coverageType), + providerNumber: providerToUse, + carId: vehicle.carId + }); - return globalMethods - .callHttpClient({ - method: endpoints.GetGlassFees.method, - endpoint: `${endpoints.GetGlassFees.url}?${queryString}` - }); + return globalMethods.callHttpClient({ + method: endpoints.GetGlassFees.method, + endpoint: `${endpoints.GetGlassFees.url}?${params.toString()}${partNumberListQueryString}` + }); }, async getSupportingItems() { const { glassParts } = this.lineItems; @@ -1126,46 +1124,6 @@ export const useMainStore = defineStore({ }); }, - async getInsurancePriceOrderItems(availableLineItems) { - const { serviceLocation, currentDeductible } = this.order; - const lineItemsQueryString = getLineItemQueryString(availableLineItems, 'lineItems'); - const featureTogglesQueryString = getFeatureTogglesQueryString(this.experimentSettings); - - let queryString = - `ParentAccountNumber=${this.order.parentAccountNumber}` - + `&BillToAccountNumber=${this.billToAccountNumber}` - + `&CTU=${serviceLocation.zipCodeCtu}` - + `&Deductible=${currentDeductible ?? 0}` - + `&ZipCode=${serviceLocation.zipCode}` - + `&${featureTogglesQueryString}` - + `${lineItemsQueryString}`; - - const lineItemServerData = this.order.lineItems?.serverData; - if (lineItemServerData) { - queryString += `&ServerData=${encodeURIComponent(lineItemServerData)}`; - } - - const response = await globalMethods - .callHttpClient({ - method: endpoints.GetInsurancePriceOrderItems.method, - endpoint: `${endpoints.GetInsurancePriceOrderItems.url}?${queryString}` - }).catch((error) => { - console.error(error); - throw error; - }); - - const { lineItems, serverData } = response.data; - if (serverData) { - this.order.lineItems.serverData = serverData; - } - - if (lineItems) { - const retAvailableLineItems = addPricesToLineItems(availableLineItems, lineItems); - return retAvailableLineItems; - } - return availableLineItems; - }, - async getITACPriceOrderItems(availableLineItems) { const { policy, vehicle, contactInfo, serviceLocation, insuranceCoverage } = this.order; const response = await globalMethods @@ -1871,8 +1829,15 @@ export const useMainStore = defineStore({ return; } - // Process Recycle Fee - this.updateRecycleFee(feeData.find((rf) => rf.partNumber === partNumberStrings.RECYCLE_FEE)); + feeData.forEach((fee) => { + if (fee.partNumber === partTypeStrings.MOBILE_FEE) { + this.updateMobileFee(fee); + } else if (fee.partNumber === partTypeStrings.RECYCLE_FEE) { + this.updateRecycleFee(fee); + } else { + this.addPartNumberFeeItem(fee, fee.partNumber); + } + }); }, updateSupportingItems(partsData) { if (partsData == null) {