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