From 8ab399e91857284515993abe65bf8dbf0f22d962 Mon Sep 17 00:00:00 2001 From: Kroell Date: Tue, 18 Apr 2023 18:06:40 -0400 Subject: [PATCH] serviceability details method --- src/helpers/service-location-helper.js | 30 -------------------------- src/store/index.js | 13 ++++++++++- 2 files changed, 12 insertions(+), 31 deletions(-) diff --git a/src/helpers/service-location-helper.js b/src/helpers/service-location-helper.js index 62b0f6db..9008a8c5 100644 --- a/src/helpers/service-location-helper.js +++ b/src/helpers/service-location-helper.js @@ -1,36 +1,7 @@ import { useMainStore } from '@/store'; import baseMixin from "@/mixins/base-mixin.js"; -export async function getPricedMobileFeePart(serviceZipCode) { - if (!serviceZipCode) { - return Promise.resolve(null); - } - - const zipCodeData = await baseMixin.methods.getZipCodeData(serviceZipCode); - - // Get the Mobile Fee Part - const mobileFeePart = await baseMixin.methods.dispatchStoreAction( - useMainStore.GET_MOBILE_FEE_PART, - null, - false - ); - - // Get the Mobile Fee Part Price - const pricingResults = await baseMixin.methods.dispatchStoreAction( - useMainStore.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA, - { - availableLineItems: [mobileFeePart.data], - serviceZipCode: serviceZipCode, - serviceZipCodeCtu: zipCodeData.zipCodeCtu, - }, - false - ); - - return Promise.resolve(pricingResults[0]); -} - export async function getServiceabilityDetails(serviceZipCode, lineItems) { - // Get the Mobile Fee Part const serviceabilityDetails = await baseMixin.methods.dispatchStoreAction( useMainStore.GET_SERVICEABILITY_DETAILS, { @@ -39,6 +10,5 @@ export async function getServiceabilityDetails(serviceZipCode, lineItems) { }, false ); - return Promise.resolve(serviceabilityDetails); } \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js index 4b6ac5b6..2924666d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -433,7 +433,18 @@ export const useMainStore = defineStore({ capabilityAnswerResults: capabilityQuestionAnswersForPart, }, }); - }, + }, + + getServiceabilityDetails({ serviceZipCode }) { + const lineItems = this.order.lineItems; + const lineItemsToSend = [...lineItems.supportingItems]; + const encodedLineItems = encodeURIComponent(JSON.stringify(lineItemsToSend)); + return globalMethods.callHttpClient({ + method: endpoints.GetServiceabilityDetails.method, + endpoint: `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&lineItems=${encodedLineItems}`, + }); + }, + lookupVehicleByVin(vin) { return globalMethods.callHttpClient({ method: endpoints.LookupVehicleByVin.method,