PR updates
Will double check this is still working since policy look up kept failing.
This commit is contained in:
parent
68ae6e0498
commit
fe76d39aac
3 changed files with 29 additions and 88 deletions
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue