From b1e160310d04ee22024dd18ebbcd0c6f220e626e Mon Sep 17 00:00:00 2001 From: Sravan Gopathi Date: Mon, 10 Apr 2023 08:44:39 -0400 Subject: [PATCH 1/3] Implemented Front End changes as per the card#1204 --- .../service-location-helper.js | 2 +- .../service-location/service-location.spec.js | 1 + src/store/index.js | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js index 157c28f2b..24be20fc8 100644 --- a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js +++ b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js @@ -35,7 +35,7 @@ export async function getServiceabilityDetails(serviceZipCode, lineItems) { storeActions.GET_SERVICEABILITY_DETAILS, { serviceZipCode: serviceZipCode, - lineItems: lineItems, + lineItems: lineItems }, false ); diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js index aad61b630..d7f5348b9 100644 --- a/src/layouts/service-location/service-location.spec.js +++ b/src/layouts/service-location/service-location.spec.js @@ -39,6 +39,7 @@ const mockGetServiceabilityDetails = (mockServiceZipCode) => { isRecalibrationServiceableInshop: true, isGlassServiceableMobile: true, isRecalibrationServiceableMobile: true, + IsServiceability:true, }; return Promise.resolve(serviceabilityDetails); diff --git a/src/store/index.js b/src/store/index.js index 6da7550a2..0549ed8c4 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -941,6 +941,20 @@ export const actions = { // const lineItems = context.getters.order.lineItems; // const lineItemsToSend = [...lineItems.supportingItems]; // const encodedLineItems = encodeURIComponent(JSON.stringify(lineItemsToSend)); + + //TODO: Restore this when CSR-1204 is 100% complete. Line# 958 to 961 should be removed Begin + // const vehicle = context.getters.vehicle; + // const carId = vehicle.carId; + // const damage = context.getters.damage; + // const glassArray = damage.glassToReplace; + // // create a new array to avoid mutating state + // const glassArrayForPayload = convertGlassPieceNamingForApi(glassArray); + // return globalMethods.callHttpClient({ + // method: endpoints.GetServiceabilityDetails.method, + // endpoint: `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&lineItems=${encodedLineItems}&carId=${carId}&glassPieces=${glassArrayForPayload}`, + // }); + //TODO: Restore this when CSR-1204 is 100% complete End + // return globalMethods.callHttpClient({ // method: endpoints.GetServiceabilityDetails.method, // endpoint: `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&lineItems=${encodedLineItems}`, From 1f2ead4579d057015b9389b8619c2300fa3e06cc Mon Sep 17 00:00:00 2001 From: Sravan Gopathi Date: Tue, 9 May 2023 09:49:34 -0400 Subject: [PATCH 2/3] 1204: Front End changes. Added CarId and Glass Pieces to endpoint --- src/store/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index 420248024..bad820b91 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -974,9 +974,15 @@ export const actions = { lineItemsWithOnlyPartNumbers, "lineItems" ); + const vehicle = context.getters.vehicle; + const carId = vehicle.carId; + const damage = context.getters.damage; + const glassArray = damage.glassToReplace; + // create a new array to avoid mutating state + const glassArrayForPayload = convertGlassPieceNamingForApi(glassArray); return globalMethods.callHttpClient({ method: endpoints.GetServiceabilityDetails.method, - endpoint: `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&${lineItemsToSend}`, + endpoint: `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&lineItems=${encodedLineItems}&carId=${carId}&glassPieces=${glassArrayForPayload}`, }); }, From 1c2c44132ebc914cb79acf798b79153e99faeba5 Mon Sep 17 00:00:00 2001 From: Sravan Gopathi Date: Tue, 9 May 2023 10:47:48 -0400 Subject: [PATCH 3/3] 1204: Payload changes --- .../service-location-helper.js | 2 +- src/layouts/service-location/service-location.spec.js | 1 - src/store/index.js | 11 ++++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js index 24be20fc8..157c28f2b 100644 --- a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js +++ b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js @@ -35,7 +35,7 @@ export async function getServiceabilityDetails(serviceZipCode, lineItems) { storeActions.GET_SERVICEABILITY_DETAILS, { serviceZipCode: serviceZipCode, - lineItems: lineItems + lineItems: lineItems, }, false ); diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js index dcb176919..52239462c 100644 --- a/src/layouts/service-location/service-location.spec.js +++ b/src/layouts/service-location/service-location.spec.js @@ -39,7 +39,6 @@ const mockGetServiceabilityDetails = (mockServiceZipCode) => { isRecalibrationServiceableInshop: true, isGlassServiceableMobile: true, isRecalibrationServiceableMobile: true, - IsServiceability:true, }; return Promise.resolve(serviceabilityDetails); diff --git a/src/store/index.js b/src/store/index.js index bad820b91..1548dd702 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -974,15 +974,20 @@ export const actions = { lineItemsWithOnlyPartNumbers, "lineItems" ); - const vehicle = context.getters.vehicle; + const vehicle = context.getters.vehicle; const carId = vehicle.carId; const damage = context.getters.damage; const glassArray = damage.glassToReplace; - // create a new array to avoid mutating state const glassArrayForPayload = convertGlassPieceNamingForApi(glassArray); return globalMethods.callHttpClient({ method: endpoints.GetServiceabilityDetails.method, - endpoint: `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&lineItems=${encodedLineItems}&carId=${carId}&glassPieces=${glassArrayForPayload}`, + endpoint: endpoints.GetServiceabilityDetails.url, + payload: { + zip: serviceZipCode, + lineItems: lineItemsToSend, + carId: carId, + glassPieces: glassArrayForPayload, + }, }); },