From 1ba6a13875565b2788bb1c8961cf7f7f6ea00cb3 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 13 Dec 2022 16:40:10 -0500 Subject: [PATCH 1/2] CSR-747 Add isInsurance override on quote --- src/helpers/heritage-integration/order-helper.js | 9 ++++++--- src/layouts/part-questions/part-questions.vue | 5 +---- src/layouts/quote/quote.vue | 6 +++++- src/router/index.js | 10 +++++++++- src/store/index.js | 4 ++-- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/helpers/heritage-integration/order-helper.js b/src/helpers/heritage-integration/order-helper.js index f18cd44de..88c352bed 100644 --- a/src/helpers/heritage-integration/order-helper.js +++ b/src/helpers/heritage-integration/order-helper.js @@ -14,7 +14,7 @@ import { storeMutations } from "@/constants/store-mutations"; it will reset the state and go back to the start of the funnel. */ -export async function loadSessionIfPresent() { +export async function loadSessionIfPresent(isConceptInsurance) { const funnelCookie = getFunnelCookie(); // Do nothing if there is no cookie or session to use for loading. @@ -35,7 +35,8 @@ export async function loadSessionIfPresent() { funnelCookie.SavedSessionId, funnelCookie.ReferralNumber, funnelCookie.ReferralParentAccountNumber, - funnelCookie.ReferralCorrelationId + funnelCookie.ReferralCorrelationId, + isConceptInsurance ) ).data; } @@ -68,9 +69,10 @@ export async function saveSession() { Calls API to load session given the referral number, referralDate, and referralCorrelationId and returns the response. */ -async function loadSession(savedSessionId, referralNumber, accountNumber, referralCorrelationId) { +async function loadSession(savedSessionId, referralNumber, accountNumber, referralCorrelationId, isConceptInsurance) { // await the saveSessionPromise in the store to make sure we're loading up to date information await store.getters.applicationUser.saveSessionPromise; + const response = await baseMixin.methods.dispatchStoreAction( storeActions.LOAD_SESSION, { @@ -78,6 +80,7 @@ async function loadSession(savedSessionId, referralNumber, accountNumber, referr referralNumber, accountNumber, referralCorrelationId, + isConceptInsurance }, false ); diff --git a/src/layouts/part-questions/part-questions.vue b/src/layouts/part-questions/part-questions.vue index 770c8443f..76ea36869 100644 --- a/src/layouts/part-questions/part-questions.vue +++ b/src/layouts/part-questions/part-questions.vue @@ -149,10 +149,7 @@ export default { const glassPartsForStore = partsLookup.data.glassPieceParts; - // this.navigateForward(glassPartsForStore); - - // TODO KO delete for quote mvp - this.navigateForward(glassPartsForStore, null, this.shouldGoToHeritageQuote); + this.navigateForward(glassPartsForStore); }, }, components: { diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 3f2a75ebb..19f1e4e12 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -138,8 +138,12 @@ export default { ); }, getDefaultIsInsuranceSelectedValue() { + // Override if coming back from QuoteDetails. Remove override after Quote release + const isInsuranceOverrideValue = this.$route.query?.isInsurance; const defaultIsInsuranceSelectedValue = this.$store.getters.order.payment.isInsurance; - if (defaultIsInsuranceSelectedValue != null) { + if (isInsuranceOverrideValue != null) { + return isInsuranceOverrideValue == "true"; + } else if (defaultIsInsuranceSelectedValue != null) { return defaultIsInsuranceSelectedValue; } else { return this.availableLineItems diff --git a/src/router/index.js b/src/router/index.js index 67961ece2..324cba3c7 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -67,7 +67,15 @@ const routes = [ // the saveSessionPromise will no longer point to a valid promise baseMixin.methods.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); - const loadSessionResponse = await loadSessionIfPresent(); + // Remove the parameter after quote release + const loadSessionResponse = await loadSessionIfPresent( + to.query.isInsurance != null + ? to.query.isInsurance == "true" + ? true + : false + : null + ); + const pageToRedirectTo = await getPageToRouteExistingOrderTo( to, loadSessionResponse diff --git a/src/store/index.js b/src/store/index.js index 8684f513a..b34a0d5c0 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1026,9 +1026,9 @@ export const actions = { }, }); }, - loadSession(context, { savedSessionId, referralNumber, referralCorrelationId, accountNumber }) { + loadSession(context, { savedSessionId, referralNumber, referralCorrelationId, accountNumber, isConceptInsurance }) { const order = context.state.order; - + return globalMethods .callHttpClient({ method: endpoints.LoadSession.method, From 8a5b81cb6ab8216278ed54e2a4d981cc753ade01 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 13 Dec 2022 16:41:06 -0500 Subject: [PATCH 2/2] CSR-747 Format --- src/helpers/heritage-integration/order-helper.js | 12 +++++++++--- src/store/index.js | 7 +++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/helpers/heritage-integration/order-helper.js b/src/helpers/heritage-integration/order-helper.js index 88c352bed..6f19b3eb5 100644 --- a/src/helpers/heritage-integration/order-helper.js +++ b/src/helpers/heritage-integration/order-helper.js @@ -69,10 +69,16 @@ export async function saveSession() { Calls API to load session given the referral number, referralDate, and referralCorrelationId and returns the response. */ -async function loadSession(savedSessionId, referralNumber, accountNumber, referralCorrelationId, isConceptInsurance) { +async function loadSession( + savedSessionId, + referralNumber, + accountNumber, + referralCorrelationId, + isConceptInsurance +) { // await the saveSessionPromise in the store to make sure we're loading up to date information await store.getters.applicationUser.saveSessionPromise; - + const response = await baseMixin.methods.dispatchStoreAction( storeActions.LOAD_SESSION, { @@ -80,7 +86,7 @@ async function loadSession(savedSessionId, referralNumber, accountNumber, referr referralNumber, accountNumber, referralCorrelationId, - isConceptInsurance + isConceptInsurance, }, false ); diff --git a/src/store/index.js b/src/store/index.js index b34a0d5c0..c80cf5b2a 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1026,9 +1026,12 @@ export const actions = { }, }); }, - loadSession(context, { savedSessionId, referralNumber, referralCorrelationId, accountNumber, isConceptInsurance }) { + loadSession( + context, + { savedSessionId, referralNumber, referralCorrelationId, accountNumber, isConceptInsurance } + ) { const order = context.state.order; - + return globalMethods .callHttpClient({ method: endpoints.LoadSession.method,