From c56ca9f1d6949f7999960c7996fb890a18e7ea1a Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 15 Dec 2022 13:49:37 -0500 Subject: [PATCH] CSR-984 only persist to Dynamo fields not in sv2/salesforce --- src/constants/endpoints.js | 2 +- .../heritage-integration/order-helper.js | 10 ++++++- src/store/index.js | 26 ++++++++++++------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index b286f85f2..3bba311a1 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -88,7 +88,7 @@ const endpoints = { }, LoadSession: { url: "/order/api/v1/order/load-session", - method: "GET", + method: "POST", }, ValidateZip: { url: "/location/api/v1/location/zip", diff --git a/src/helpers/heritage-integration/order-helper.js b/src/helpers/heritage-integration/order-helper.js index 31ba38d35..469f38b60 100644 --- a/src/helpers/heritage-integration/order-helper.js +++ b/src/helpers/heritage-integration/order-helper.js @@ -18,7 +18,12 @@ export async function loadSessionIfPresent(isConceptInsurance) { const funnelCookie = getFunnelCookie(); // Do nothing if there is no cookie or session to use for loading. - if (funnelCookie == null || funnelCookie.SavedSessionId == null) { + if ( + funnelCookie == null || + funnelCookie.SavedSessionId == null || + funnelCookie.ReferralCorrelationId == null || + !funnelCookie.ReferralNumber + ) { return null; } @@ -34,6 +39,7 @@ export async function loadSessionIfPresent(isConceptInsurance) { await loadSession( funnelCookie.SavedSessionId, funnelCookie.ReferralNumber, + funnelCookie.ReferralDate, funnelCookie.ReferralParentAccountNumber, funnelCookie.ReferralCorrelationId, isConceptInsurance @@ -72,6 +78,7 @@ export async function saveSession() { async function loadSession( savedSessionId, referralNumber, + referralDate, accountNumber, referralCorrelationId, isConceptInsurance @@ -84,6 +91,7 @@ async function loadSession( { savedSessionId: savedSessionId?.toString(), referralNumber, + referralDate, accountNumber, referralCorrelationId, isConceptInsurance, diff --git a/src/store/index.js b/src/store/index.js index a998f5523..c019b73ab 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1041,22 +1041,28 @@ export const actions = { }, loadSession( context, - { savedSessionId, referralNumber, referralCorrelationId, accountNumber, isConceptInsurance } + { + savedSessionId, + referralNumber, + referralDate, + referralCorrelationId, + accountNumber, + isConceptInsurance, + } ) { const order = context.state.order; return globalMethods .callHttpClient({ method: endpoints.LoadSession.method, - endpoint: `${ - endpoints.LoadSession.url - }?savedSessionId=${savedSessionId?.toString()}&referralNumber=${ - referralNumber && referralNumber !== "" ? referralNumber : order.referralNumber - }&accountNumber=${accountNumber}&referralCorrelationId=${ - referralCorrelationId !== "" - ? referralCorrelationId - : order.referralCorrelationId - }`, + endpoint: endpoints.LoadSession.url, + payload: { + savedSessionId: savedSessionId?.toString(), + referralNumber: referralNumber?.toString(), + referralDate: referralDate?.toString(), + accountNumber: accountNumber?.toString(), + referralCorrelationId: referralCorrelationId, + }, }) .then((response) => { // Flatten location and name properties