Merge pull request #772 from Safelite/feature/digital/SSR-1375
SSR-1375 Cleanup validateZip api calls
This commit is contained in:
commit
d4c1e5b2d7
2 changed files with 5 additions and 27 deletions
|
|
@ -24,21 +24,12 @@ jest.mock('@/helpers/cms-content-helper', () => ({
|
|||
|
||||
/** @ignore */
|
||||
function setupMocks({
|
||||
isZipValid = true,
|
||||
isZipServiceable = true,
|
||||
lookupVinByPlateResponse,
|
||||
partsOrQuestions = [],
|
||||
carId = 'C0000',
|
||||
vinLookupResponseError = null,
|
||||
route = null
|
||||
}) {
|
||||
useMainStore().validateZip = jest.fn().mockImplementation(() => Promise.resolve({
|
||||
data: {
|
||||
isValid: isZipValid,
|
||||
isServiceable: isZipServiceable
|
||||
}
|
||||
}));
|
||||
|
||||
useMainStore().lookupVinByPlate = jest.fn().mockImplementation(() => Promise.resolve({
|
||||
data: lookupVinByPlateResponse || {
|
||||
vin: 'TEST_VIN',
|
||||
|
|
|
|||
|
|
@ -1040,22 +1040,15 @@ export const useMainStore = defineStore({
|
|||
},
|
||||
|
||||
async getInsurancePriceOrderItems(availableLineItems) {
|
||||
const zipCodeToUse = this.order.serviceLocation.zipCode;
|
||||
if (!this.order.serviceLocation.zipCodeCtu) {
|
||||
const zipInfo = await this.validateZip({ zip: zipCodeToUse });
|
||||
this.order.serviceLocation.zipCodeCtu = zipInfo.zipCodeCtu;
|
||||
}
|
||||
const ctuToUse = this.order.serviceLocation.zipCodeCtu;
|
||||
const deductibleToUse = this.order.currentDeductible ?? 0;
|
||||
|
||||
const { serviceLocation, currentDeductible } = this.order;
|
||||
const lineItemsQueryString = getLineItemQueryString(availableLineItems, 'lineItems');
|
||||
|
||||
let queryString =
|
||||
`ParentAccountNumber=${this.order.parentAccountNumber}`
|
||||
+ `&BillToAccountNumber=${this.billToAccountNumber}`
|
||||
+ `&CTU=${ctuToUse}`
|
||||
+ `&Deductible=${deductibleToUse}`
|
||||
+ `&ZipCode=${zipCodeToUse}`
|
||||
+ `&CTU=${serviceLocation.zipCodeCtu}`
|
||||
+ `&Deductible=${currentDeductible ?? 0}`
|
||||
+ `&ZipCode=${serviceLocation.zipCode}`
|
||||
+ `${lineItemsQueryString}`;
|
||||
|
||||
const lineItemServerData = this.order.lineItems?.serverData;
|
||||
|
|
@ -1085,12 +1078,6 @@ export const useMainStore = defineStore({
|
|||
},
|
||||
|
||||
async getITACPriceOrderItems(availableLineItems) {
|
||||
const zipCodeToUse = this.order.serviceLocation.zipCode;
|
||||
if (!this.order.serviceLocation.zipCodeCtu) {
|
||||
const zipInfo = await this.validateZip({ zip: zipCodeToUse });
|
||||
this.order.serviceLocation.zipCodeCtu = zipInfo.zipCodeCtu;
|
||||
}
|
||||
|
||||
const { policy, vehicle, contactInfo, serviceLocation, insuranceCoverage } = this.order;
|
||||
|
||||
const response = await globalMethods
|
||||
|
|
@ -1104,7 +1091,7 @@ export const useMainStore = defineStore({
|
|||
ReferralDate: `${this.order.referralDate}Z`,
|
||||
lineItems: availableLineItems,
|
||||
ServerData: this.order.lineItems.serverData,
|
||||
ServiceZipCode: zipCodeToUse,
|
||||
ServiceZipCode: serviceLocation.zipCode,
|
||||
Customer: {
|
||||
PhoneNumber: contactInfo.servicePhone,
|
||||
State: policy.damageState,
|
||||
|
|
|
|||
Loading…
Reference in a new issue