SSR-659.3. Fix error when Mobile is selected, remove call to non-insurance pricing endpoint (#620)
This commit is contained in:
parent
0fa31168f9
commit
8a7667a129
5 changed files with 7 additions and 59 deletions
|
|
@ -76,10 +76,6 @@ const endpoints = Object.freeze({
|
|||
url: `${PRICE_BASE_URL}/order-items-with-insurance-pricing`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetPriceOrderItems: {
|
||||
url: `${PRICE_BASE_URL}/order-items`,
|
||||
method: 'GET'
|
||||
},
|
||||
GetProviders: {
|
||||
url: `${LOCATION_BASE_URL}/providers`,
|
||||
method: 'GET'
|
||||
|
|
|
|||
|
|
@ -16,14 +16,18 @@ export async function getPricedMobileFeePart(serviceZipCode) {
|
|||
if (!serviceZipCode) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
const zipCodeData = await getZipCodeData(serviceZipCode);
|
||||
|
||||
// Get the Mobile Fee Part
|
||||
const mobileFeePart = await useMainStore().getMobileFeePart();
|
||||
|
||||
|
||||
if (mobileFeePart.data == null || mobileFeePart.data === '') {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
// Get the Mobile Fee Part Price
|
||||
const pricingResults = await useMainStore()
|
||||
.priceOrderItemsAndSaveServerData([mobileFeePart.data], serviceZipCode, zipCodeData.zipCodeCtu);
|
||||
.getPriceOrderItems([mobileFeePart.data]);
|
||||
|
||||
return Promise.resolve(pricingResults[0]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,18 +18,6 @@ const mockMixin = {
|
|||
getCmsContent: jest.fn().mockImplementation(() => ''),
|
||||
setCmsContent: jest.fn(),
|
||||
dispatchStoreAction: jest.fn().mockImplementation((storeAction) => {
|
||||
if (storeAction === 'priceOrderItemsAndSaveServerData') {
|
||||
return Promise.resolve([
|
||||
{
|
||||
partNumber: 'EARLY BIRD',
|
||||
description: null,
|
||||
partType: 'EARLY BIRD',
|
||||
laborAmount: 0,
|
||||
sellingPrice: 14.99,
|
||||
kitPrice: 0
|
||||
}
|
||||
]);
|
||||
}
|
||||
if (storeAction === 'saveSupportingItemsSuppressingStateResetting') {
|
||||
return Promise.resolve([
|
||||
{
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ export default {
|
|||
|
||||
const premiumFeeWithPricePromise = premiumFeePromise.then((result) => {
|
||||
if (result.data) {
|
||||
return useMainStore().priceOrderItemsAndSaveServerData(result.data);
|
||||
return useMainStore().getPriceOrderItems(result.data);
|
||||
}
|
||||
return result.data;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1880,46 +1880,6 @@ export const useMainStore = defineStore({
|
|||
this.updateCapabilityQuestionAnswers(capabilityQuestionAnswersArray);
|
||||
},
|
||||
|
||||
// Price order actions
|
||||
async priceOrderItemsAndSaveServerData(availableLineItems, serviceZipCode, serviceZipCodeCtu) {
|
||||
const zipCodeToUse = serviceZipCode || this.order.serviceLocation.zipCode;
|
||||
const ctuToUse = serviceZipCodeCtu || this.order.serviceLocation.zipCodeCtu;
|
||||
const flattenedLineItemsWithChildParts = getFlattenedArrayOfLineItemsWithChildParts(availableLineItems);
|
||||
const lineItemsWithOnlyPartNumbers = flattenedLineItemsWithChildParts.map((lineItem) => ({
|
||||
partNumber: lineItem.partNumber
|
||||
}));
|
||||
const availableLineItemsFormattedForRequest =
|
||||
buildQueryStringParameterFromArrayOfComplexObjects(
|
||||
lineItemsWithOnlyPartNumbers,
|
||||
'lineItems'
|
||||
);
|
||||
|
||||
const { vehicle } = this.order;
|
||||
|
||||
let queryString =
|
||||
`ParentAccountNumber=${this.order.accountNumber}`
|
||||
+ `&CTU=${ctuToUse}`
|
||||
+ `&CarId=${vehicle.carId}`
|
||||
+ `&Make=${vehicle.make}`
|
||||
+ `&Model=${vehicle.model}`
|
||||
+ `&Year=${vehicle.year}`
|
||||
+ `&EON=${this.order.eon}`
|
||||
+ `&ZipCode=${zipCodeToUse}`
|
||||
+ `&${availableLineItemsFormattedForRequest}`;
|
||||
|
||||
const lineItemServerData = this.order.lineItems.serverData;
|
||||
if (lineItemServerData) {
|
||||
queryString += `&ServerData=${encodeURIComponent(lineItemServerData)}`;
|
||||
}
|
||||
|
||||
const response = await globalMethods.callHttpClient({
|
||||
method: endpoints.GetPriceOrderItems.method,
|
||||
endpoint: `${endpoints.GetPriceOrderItems.url}?${queryString}`
|
||||
});
|
||||
|
||||
// context.commit(storeMutations.UPDATE_LINE_ITEMS_SERVER_DATA, response.data.serverData);
|
||||
return addPricesToLineItems(availableLineItems, response.data.lineItems);
|
||||
},
|
||||
// Tax order actions
|
||||
async taxOrderItemsAndSaveServerData(pricedLineItems) {
|
||||
const { order } = this;
|
||||
|
|
|
|||
Loading…
Reference in a new issue