From 80caabf5efdabba4ab37d51169c46666e99f9199 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Tue, 11 Feb 2025 09:10:00 -0500 Subject: [PATCH 1/4] CASH-201 | Add "Pay on my own" link Add the link to insurance-company Make cash auto selected on quote when this link is used --- .../insurance-company/insurance-company.vue | 16 +++++++++++++++- src/layouts/quote/quote.vue | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index 79e238d47..ddfffe177 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -16,6 +16,13 @@ v-model="parentAccountNumber" :originalList="originalList" /> + diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 4428f6e40..99b75c9a7 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -328,6 +328,10 @@ export default { } const getIsInsuranceSelectedValue = (availableLineItems, insuranceThreshold) => { + // routeParam checked here is set on insurance-selection "Pay on my own" link click + if (from.params.forceCashSelection) { + return false; + } const serviceLocationState = store.getters.order.serviceLocation.state; // usually true when returning from heritage but can be false when returning from heritage on a save quote From 37cd5f01bfb92d5eaa07a4a50ac977a048e4a15b Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Tue, 11 Feb 2025 09:20:48 -0500 Subject: [PATCH 2/4] CASH-201 | Update unit test Fixed broken tests, haven't added new ones yet --- src/layouts/quote/quote.spec.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/layouts/quote/quote.spec.js b/src/layouts/quote/quote.spec.js index deca0d6d1..42e3aecd0 100644 --- a/src/layouts/quote/quote.spec.js +++ b/src/layouts/quote/quote.spec.js @@ -293,7 +293,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - undefined, + {params:{}}, (c) => c(wrapper.vm) ); @@ -345,7 +345,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - undefined, + {params:{}}, (c) => c(wrapper.vm) ); //Assert @@ -388,7 +388,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - undefined, + {params:{}}, (c) => c(wrapper.vm) ); @@ -432,7 +432,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote", isInsurance: false } }, - undefined, + {params:{}}, (c) => c(wrapper.vm) ); @@ -478,7 +478,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - undefined, + {params:{}}, (c) => c(wrapper.vm) ); @@ -523,7 +523,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - undefined, + {params:{}}, (c) => c(wrapper.vm) ); @@ -570,7 +570,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - undefined, + {params:{}}, (c) => c(wrapper.vm) ); @@ -618,7 +618,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - undefined, + {params:{}}, (c) => c(wrapper.vm) ); @@ -662,7 +662,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - undefined, + {params:{}}, (c) => c(wrapper.vm) ); //Assert @@ -783,7 +783,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - undefined, + {params:{}}, nextFunction ); await nextTick(); From 738e6a108d025e812cda4f68986e9cfdd26f3aa5 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Tue, 11 Feb 2025 10:20:34 -0500 Subject: [PATCH 3/4] CASH-201 | Switch to query parameter --- .../insurance-company/insurance-company.vue | 9 ++++++--- src/layouts/quote/quote.spec.js | 20 +++++++++---------- src/layouts/quote/quote.vue | 4 ++-- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/layouts/insurance-company/insurance-company.vue b/src/layouts/insurance-company/insurance-company.vue index ddfffe177..452484e48 100644 --- a/src/layouts/insurance-company/insurance-company.vue +++ b/src/layouts/insurance-company/insurance-company.vue @@ -101,7 +101,7 @@ export default { return !!this.parentAccountNumber; }, payWithCashButtonCopy() { - return "Pay on my own"; + return this.getCmsContent("PayWithCashWidget", "Text"); } }, methods: { @@ -122,8 +122,11 @@ export default { }, backButtonAction(forceCashSelectionOnQuote) { // Go back to Quote page - if (forceCashSelectionOnQuote) - this.$route.params['forceCashSelection'] = true; + if (forceCashSelectionOnQuote) { + this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route, {"isCashSelected": true}); + return; + } + this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); }, async forwardButtonAction() { diff --git a/src/layouts/quote/quote.spec.js b/src/layouts/quote/quote.spec.js index 42e3aecd0..deca0d6d1 100644 --- a/src/layouts/quote/quote.spec.js +++ b/src/layouts/quote/quote.spec.js @@ -293,7 +293,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - {params:{}}, + undefined, (c) => c(wrapper.vm) ); @@ -345,7 +345,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - {params:{}}, + undefined, (c) => c(wrapper.vm) ); //Assert @@ -388,7 +388,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - {params:{}}, + undefined, (c) => c(wrapper.vm) ); @@ -432,7 +432,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote", isInsurance: false } }, - {params:{}}, + undefined, (c) => c(wrapper.vm) ); @@ -478,7 +478,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - {params:{}}, + undefined, (c) => c(wrapper.vm) ); @@ -523,7 +523,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - {params:{}}, + undefined, (c) => c(wrapper.vm) ); @@ -570,7 +570,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - {params:{}}, + undefined, (c) => c(wrapper.vm) ); @@ -618,7 +618,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - {params:{}}, + undefined, (c) => c(wrapper.vm) ); @@ -662,7 +662,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - {params:{}}, + undefined, (c) => c(wrapper.vm) ); //Assert @@ -783,7 +783,7 @@ describe("quote.vue", () => { await quote.beforeRouteEnter.call( wrapper.vm, { query: { fmgPage: "quote" } }, - {params:{}}, + undefined, nextFunction ); await nextTick(); diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 99b75c9a7..20dc16304 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -328,8 +328,8 @@ export default { } const getIsInsuranceSelectedValue = (availableLineItems, insuranceThreshold) => { - // routeParam checked here is set on insurance-selection "Pay on my own" link click - if (from.params.forceCashSelection) { + // query param checked here is set on insurance-selection "Pay on my own" link click + if (to.query?.isCashSelected || to.query?.iscashselected) { return false; } const serviceLocationState = store.getters.order.serviceLocation.state; From 8b2b22b86846854765f6a5943e3041cf03516243 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Tue, 11 Feb 2025 10:33:52 -0500 Subject: [PATCH 4/4] CASH-201 | Add unit test --- src/layouts/quote/quote.spec.js | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/layouts/quote/quote.spec.js b/src/layouts/quote/quote.spec.js index deca0d6d1..522bc4f2e 100644 --- a/src/layouts/quote/quote.spec.js +++ b/src/layouts/quote/quote.spec.js @@ -577,6 +577,56 @@ describe("quote.vue", () => { //Assert expect(wrapper.vm.isInsuranceSelected).toBe(false); }); + test("should default to cash if isCashSelected is true, despite all other checks pointing to insurance selection", async () => { + // Also needs no query parameter or previous selection in store to be present + //Arrange + + store.getters = { + lineItems: { + glassParts: ["item", "item2"], + }, + applicationUser: { + experiments: [], + }, + order: { + lineItems: { + glassParts: ["item", "item2"], + }, + payment: { + isInsurance: true, + }, + customer: { + emailAddress: "test@test.com", + }, + serviceLocation: { + state: null, + }, + }, + vehicle: { + cardId: "123", + }, + experimentSettings: { + settingName: "SERVICE_PACKAGE_DISCOUNT", + }, + }; + mockTierOnePrice = 505; + const { wrapper } = setupMocks({}); + + + //Act + await quote.beforeRouteEnter.call( + wrapper.vm, + { query: { fmgPage: "quote", + isInsuranceSelected: true, + isCashSelected: true, + } }, + undefined, + (c) => c(wrapper.vm) + ); + + //Assert + expect(wrapper.vm.isInsuranceSelected).toBe(false); + }); test("should default to insurance if total economy package price is over $500", async () => { // Also needs no query parameter or previous selection in store to be present //Arrange