SSR-1385 Allow Repair NoComp to call ITAC pricing API

This commit is contained in:
Josh Dassinger 2024-06-19 14:19:53 -05:00
parent ae0da7749e
commit e560191866

View file

@ -364,31 +364,22 @@ export default {
...(clonedGlassParts ?? [])
];
let pricingRequest;
if (!this.isRepair) {
// If we are NOT a repair we call the ITAC pricing service
pricingRequest = useMainStore().getITACPriceOrderItems(availableLineItems);
} else if (this.mainStore.isNoComp) {
// If we are a repair and are NoComp we call the insurance pricing service.
pricingRequest = useMainStore().getInsurancePriceOrderItems(availableLineItems);
} else {
// We don't price parts if we are repair and is Deductible
return;
// We only call the ITAC pricing endpoint if we are not repair or we are NoComp
if (!this.isRepair || this.mainStore.isNoComp) {
const pricingResults = 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.setBaseServiceLineItems(pricingResults);
}
const pricingResults = await pricingRequest.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.setBaseServiceLineItems(pricingResults);
},
async navigateForward() {
if (this.isUnverifiedVisible || this.isDeductibleVisible) {