From 00dacdbbb8544c915f15ccbba6eb6b36ae7ce357 Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Mon, 23 Feb 2026 14:22:31 -0500 Subject: [PATCH 1/2] INSR-8562: Fix initialization to properly account for PIA disabled --- src/layouts/payment-method/payment-method.vue | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index fee96d3a..7b14090a 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -178,6 +178,7 @@ export default { async beforeRouteEnter(to, from, next) { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.issPage); + const pageData = useMainStore().pageData(to.query.issPage); const promiseResultMap = [ { @@ -192,7 +193,7 @@ export default { next((vm) => { vm.setCmsContent(resultMap.cmsContent); - vm.initializeComponent(); + vm.initializeComponent(pageData); vm.updateFooterButtonText(vm.customCallToActionButtonCopy); }); }, @@ -382,26 +383,21 @@ export default { && customerReqs && contactInfoReqs); }, - initializeComponent() { - const paymentMethodFromStore = this.getPaymentMethodFromStore(); - // SMS Opt In defaults to 'no', but we don't actually want to use it if the user hasn't saved data form this page yet - if (paymentMethodFromStore) { - this.smsOptIn = this.getSMSOptInFromStore(); + initializeComponent(pageData) { + if (pageData) { + this.smsOptIn = pageData.smsOptIn; } this.smsPhoneNumber = this.getSMSPhoneFromStore(); - }, - getPaymentMethodFromStore() { if (this.isPayInAdvanceDisabled) { - return paymentMethods.PAY_AT_TIME_OF_SERVICE; + this.paymentMethod = paymentMethods.PAY_AT_TIME_OF_SERVICE; } - - return useMainStore().order.payment.paymentMethod; }, updateFooterButtonText(newValue) { this.$refs.siteFooter.updateButtonText(newValue); }, async forwardButtonAction() { this.mainStore.savePaymentMethodChoice(this.paymentMethod); + this.savePageDataToStore(issPageValues.PAYMENT_METHOD, { smsOptIn: this.smsOptIn }); if (!this.hideSMSOptIn) { const requestTextUpdates = this.smsOptIn === 'Yes'; this.mainStore.updateContactInfo({ requestTextUpdates }); @@ -439,9 +435,6 @@ export default { this.$route ); }, - getSMSOptInFromStore() { - return this.mainStore.contactInfo.requestTextUpdates ? 'Yes' : 'No'; - }, getSMSPhoneFromStore() { return this.mainStore.contactInfo.alternativePhone ?? this.mainStore.contactInfo.servicePhone; }, From a98304530ccfb7aa3573ea0ccf01823ae9dd606a Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Mon, 23 Feb 2026 14:45:23 -0500 Subject: [PATCH 2/2] Fix failing tests, remove no longer needed test --- .../payment-method/payment-method.spec.js | 54 +++++++------------ src/layouts/payment-method/payment-method.vue | 1 + 2 files changed, 20 insertions(+), 35 deletions(-) diff --git a/src/layouts/payment-method/payment-method.spec.js b/src/layouts/payment-method/payment-method.spec.js index 7773a132..edee79f9 100644 --- a/src/layouts/payment-method/payment-method.spec.js +++ b/src/layouts/payment-method/payment-method.spec.js @@ -45,7 +45,8 @@ function setupMocks({ customMountOptions = {}, queryString }, mainInitialState = } return 'false'; - }) + }), + savePageDataToStore: jest.fn() } }; const cmsMixin = { @@ -84,33 +85,10 @@ describe('payment-method.vue', () => { const wrapper = setupMocks({}, store); // Act - const paymethod = wrapper.vm.getPaymentMethodFromStore(); + wrapper.vm.initializeComponent(); // Assert - expect(paymethod).toBe(payLaterMethod); - }); - test('getting payment method when method is pay in advance', async () => { - // Arrange - const payInAdvanceMethod = paymentMethods.CREDIT_CARD; - const store = { - order: { - payment: { - paymentMethod: payInAdvanceMethod - }, - insuranceCoverage: { - coverageStatus: coverageStatuses.VERIFIED, - coverageType: coverageType.Deductible - }, - currentDeductible: 1000 - } - }; - const wrapper = setupMocks({}, store); - - // Act - const paymethod = wrapper.vm.getPaymentMethodFromStore(); - - // Assert - expect(paymethod).toBe(payInAdvanceMethod); + expect(wrapper.vm.paymentMethod).toBe(payLaterMethod); }); test('getting PAY_AT_TIME_OF_SERVICE when deductible is 0', async () => { // Arrange @@ -124,16 +102,18 @@ describe('payment-method.vue', () => { coverageStatus: coverageStatuses.VERIFIED, coverageType: coverageType.Deductible }, - currentDeductible: 0 + currentDeductible: { + replace: 0 + } } }; const wrapper = setupMocks({}, store); // Act - const paymethod = wrapper.vm.getPaymentMethodFromStore(); + wrapper.vm.initializeComponent(); // Assert - expect(paymethod).toBe(payInAdvanceMethod); + expect(wrapper.vm.paymentMethod).toBe(payInAdvanceMethod); }); test('getting PAY_AT_TIME_OF_SERVICE when Unverified', async () => { // Arrange @@ -147,16 +127,18 @@ describe('payment-method.vue', () => { coverageStatus: coverageStatuses.PENDING, coverageType: coverageType.Deductible }, - currentDeductible: 1000 + currentDeductible: { + replace: 1000 + } } }; const wrapper = setupMocks({}, store); // Act - const paymethod = wrapper.vm.getPaymentMethodFromStore(); + wrapper.vm.initializeComponent(); // Assert - expect(paymethod).toBe(payInAdvanceMethod); + expect(wrapper.vm.paymentMethod).toBe(payInAdvanceMethod); }); test('getting PAY_AT_TIME_OF_SERVICE when PIA Experiment disabled', async () => { // Arrange @@ -180,16 +162,18 @@ describe('payment-method.vue', () => { coverageStatus: coverageStatuses.VERIFIED, coverageType: coverageType.Deductible }, - currentDeductible: 1000 + currentDeductible: { + replace: 1000 + } } }; const wrapper = setupMocks({}, store, mixin); // Act - const paymethod = wrapper.vm.getPaymentMethodFromStore(); + wrapper.vm.initializeComponent(); // Assert - expect(paymethod).toBe(payInAdvanceMethod); + expect(wrapper.vm.paymentMethod).toBe(payInAdvanceMethod); }); }); diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 7b14090a..90144474 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -389,6 +389,7 @@ export default { } this.smsPhoneNumber = this.getSMSPhoneFromStore(); if (this.isPayInAdvanceDisabled) { + console.log('Pay in Advance is disabled, defaulting to Pay at Time of Service'); this.paymentMethod = paymentMethods.PAY_AT_TIME_OF_SERVICE; } },