From edb4a5868d2aa6085196a51785ea7de372a6b992 Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Fri, 9 Aug 2024 09:08:18 -0500 Subject: [PATCH] SSR-1383 Use provider number instead of zipcodectu --- src/store/index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 58e1b450..56fdbf63 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -131,6 +131,7 @@ export const getDefaultState = () => ({ state: null, zipCode: null, zipCodeCtu: null, + defaultProviderNumber: null, appointmentType: null, isVehicleProtected: null, IsSafeliteProvider: null, @@ -294,6 +295,7 @@ export const useMainStore = defineStore({ isUnverified: (s) => s.order.insuranceCoverage.coverageStatus !== coverageStatuses.VERIFIED, isVerified: (state) => state.order.insuranceCoverage.coverageStatus === coverageStatuses.VERIFIED, isPendingClaimRegistration: (state) => state.order.insuranceCoverage.coverageStatus === coverageStatuses.PENDING, + providerNumber: (state) => state.order.serviceLocation.provider.providerNumber || state.order.serviceLocation.defaultProviderNumber, eventBusItem: (state) => (eventCategory, eventSubCategory) => { const matchedEvent = state.applicationUser.eventBus.find(({ category, subCategory }) => category === eventCategory && subCategory === eventSubCategory); return matchedEvent?.eventValue; @@ -382,7 +384,7 @@ export const useMainStore = defineStore({ funnelServiceZipCode: s.order.serviceLocation.zipCode, funnelServiceZipCodeCtu: ctuToUse, funnelParentAccountNumber: s.order.parentAccountNumber, - funnelProviderNumber: s.order.serviceLocation.provider.providerNumber, + funnelProviderNumber: s.providerNumber, funnelIsCoverageVerified: s.isVerified, funnelHasRecalibrationPart: getHasRecalibrationPart(s), funnelSelectedMultiGlass: s.order.damage.glassToReplace?.length > 1, @@ -1094,7 +1096,7 @@ export const useMainStore = defineStore({ ZipCode: policy.policyZipCode }, Provider: { - ProviderNumber: serviceLocation.zipCodeCtu, + ProviderNumber: this.providerNumber, ProviderCtuNumber: serviceLocation.zipCodeCtu }, Vehicle: { @@ -1323,7 +1325,7 @@ export const useMainStore = defineStore({ isVehicleProtected: serviceLocation.isVehicleProtected, provider: { IsSafeliteProvider: serviceLocation?.IsSafeliteProvider, - providerNumber: serviceLocation.provider?.providerNumber, + providerNumber: this.providerNumber, address: { streetAddress: serviceLocation.provider?.address?.streetAddress, city: serviceLocation.provider?.address?.city, @@ -2041,7 +2043,6 @@ export const useMainStore = defineStore({ async getTaxOrderItems(pricedLineItems) { const { order } = this; const { serviceLocation } = order; - const { providerNumber } = serviceLocation.provider; const { appointmentType } = serviceLocation; const serviceLocationCity = serviceLocation.city; const serviceLocationState = serviceLocation.state; @@ -2055,7 +2056,7 @@ export const useMainStore = defineStore({ queryString = `ParentAccountNumber=${this.order.parentAccountNumber}` + `&BillToAccountNumber=${this.billToAccountNumber}` - + `&ProviderNumber=${providerNumber}` + + `&ProviderNumber=${this.providerNumber}` + `&AppointmentType=${appointmentType}` + `&ServiceLocation.City=${serviceLocationCity}` + `&ServiceLocation.State=${serviceLocationState}` @@ -2065,7 +2066,7 @@ export const useMainStore = defineStore({ queryString = `ParentAccountNumber=${this.order.parentAccountNumber}` + `&BillToAccountNumber=${this.billToAccountNumber}` - + `&ProviderNumber=${providerNumber}` + + `&ProviderNumber=${this.providerNumber}` + `&AppointmentType=${appointmentType}` + `${lineItemsQueryString}`; } @@ -2310,6 +2311,7 @@ export const useMainStore = defineStore({ const zipInfo = response.data; if (zipInfo?.isValid === true) { this.order.serviceLocation.zipCodeCtu = zipInfo.zipCodeCtu; + this.order.serviceLocation.defaultProviderNumber = zipInfo.providerNumber; return Promise.resolve(zipInfo); } @@ -2324,7 +2326,7 @@ export const useMainStore = defineStore({ try { const params = new URLSearchParams({ parentAccountNumber: issConfig.parentAccountNumber.toString(), - providerNumber: order.serviceLocation.zipCodeCtu.toString(), + providerNumber: this.providerNumber, typeOfClaim: 'GLASS ONLY', lineOfBusiness: 'PERSONAL', isItac: this.isITAC