Add in environment swapping
This commit is contained in:
parent
8e902b27cb
commit
4f3c798108
1 changed files with 39 additions and 1 deletions
|
|
@ -1343,8 +1343,46 @@ export const useMainStore = defineStore({
|
||||||
endpoint: `${endpoints.GetMobileFeePart.url}?${params.toString()}`
|
endpoint: `${endpoints.GetMobileFeePart.url}?${params.toString()}`
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getServiceabilityDetails(serviceZipCode) {
|
getServiceabilityDetails(serviceZipCode) {
|
||||||
|
console.log('BEEP BOOP');
|
||||||
|
console.log('--ENVIRONMENT DETECTOR ROBOT ENGAGED--');
|
||||||
|
const currentEnvironment = applicationConfig.CURRENT_ENVIRONMENT;
|
||||||
|
console.log('I HAVE DETERMINED THAT THE CURRENT ENVIRONMENT IS:', currentEnvironment);
|
||||||
|
console.log('---');
|
||||||
|
console.log('---');
|
||||||
|
if (currentEnvironment === 'Localhost' || currentEnvironment === 'Dev') {
|
||||||
|
console.log('NEW SERVICEABILITY DETAILS METHOD ACTIVATED');
|
||||||
|
return this.getServiceabilityDetailsNewMethod(serviceZipCode);
|
||||||
|
} else {
|
||||||
|
console.log('OLD SERVICEABILITY DETAILS METHOD ACTIVATED');
|
||||||
|
return this.getServiceabilityDetailsOldMethod(serviceZipCode);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getServiceabilityDetailsOldMethod(serviceZipCode) {
|
||||||
|
const { vehicle, damage, parentAccountNumber, referralSequenceNumber, lineItems } = this.order;
|
||||||
|
const { carId } = vehicle;
|
||||||
|
const glassArray = convertGlassPieceNamingForApi(damage.glassToReplace);
|
||||||
|
const lineItemParts = [...(lineItems.glassParts || []), ...(lineItems.supportingItems || [])].map((part) => ({
|
||||||
|
partNumber: part.partNumber,
|
||||||
|
recalibrationType: part.recalibrationType
|
||||||
|
}));
|
||||||
|
|
||||||
|
const params = buildURLSearchParams({
|
||||||
|
applicationName: applicationConfig.APPLICATION_NAME,
|
||||||
|
parentAccountNumber,
|
||||||
|
referralSequenceNumber,
|
||||||
|
zip: serviceZipCode,
|
||||||
|
carId,
|
||||||
|
glassPieces: glassArray,
|
||||||
|
lineItems: lineItemParts
|
||||||
|
});
|
||||||
|
|
||||||
|
return globalMethods.callHttpClient({
|
||||||
|
method: endpoints.GetServiceabilityDetails.method,
|
||||||
|
endpoint: `${endpoints.GetServiceabilityDetails.url}?${params.toString()}`
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getServiceabilityDetailsNewMethod(serviceZipCode) {
|
||||||
const { damage, lineItems, parentAccountNumber, vehicle } = this.order;
|
const { damage, lineItems, parentAccountNumber, vehicle } = this.order;
|
||||||
const { carId } = vehicle;
|
const { carId } = vehicle;
|
||||||
const flattenedGlassParts = getLineItemsFlattened(lineItems.glassParts);
|
const flattenedGlassParts = getLineItemsFlattened(lineItems.glassParts);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue