From 5f5bb799b0f86c0649b93523e08fe469538ef150 Mon Sep 17 00:00:00 2001 From: Matt Caimi Date: Mon, 26 Feb 2024 10:27:43 -0500 Subject: [PATCH 01/14] SSR-1063 prefilled customer data from contact info --- src/layouts/payment-page/payment-page.spec.js | 5 ++-- src/layouts/payment-page/payment-page.vue | 24 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/layouts/payment-page/payment-page.spec.js b/src/layouts/payment-page/payment-page.spec.js index 1b46819f..07822757 100644 --- a/src/layouts/payment-page/payment-page.spec.js +++ b/src/layouts/payment-page/payment-page.spec.js @@ -178,12 +178,11 @@ describe('payment-page.vue', () => { }, techNotes: '' }, - customer: { + contactInfo: { firstName: 'first', lastName: 'last', emailAddress: 'builddigitaltest@safelite.com', - phoneNumber: '555-555-5555', - isSmsOptIn: false + phoneNumber: '555-555-5555' }, damage: { isRepair: false, diff --git a/src/layouts/payment-page/payment-page.vue b/src/layouts/payment-page/payment-page.vue index 36f072c6..45cc5270 100644 --- a/src/layouts/payment-page/payment-page.vue +++ b/src/layouts/payment-page/payment-page.vue @@ -239,15 +239,15 @@ export default { authSignature: '', authSignatureStart: '', referralSequenceNumber: useMainStore().order.referralSequenceNumber, - emailAddress: useMainStore().order.customer.emailAddress, + emailAddress: useMainStore().order.contactInfo.emailAddress, address1: this.getAddress1(), address2: this.getAddress2(), city: this.getCity(), state: this.getState(), zipCode: this.getZipCode(), - firstName: useMainStore().order.customer.firstName, - lastName: useMainStore().order.customer.lastName, - phoneNumber: useMainStore().order.customer.phoneNumber, + firstName: useMainStore().order.contactInfo.firstName, + lastName: useMainStore().order.contactInfo.lastName, + phoneNumber: useMainStore().order.contactInfo.phoneNumber, ctu: useMainStore().order.serviceLocation.zipCodeCtu, referralCorrelationId: useMainStore().order.referralCorrelationId, workOrderNumber: this.getWorkOrderNumber(), @@ -336,13 +336,13 @@ export default { && schedule.jobMinMinutes ); - // Customer - const { customer } = useMainStore().order; - const customerReqs = !!( - customer.firstName - && customer.lastName - && customer.phoneNumber - && customer.emailAddress + // Contact Info + const { contactInfo } = useMainStore().order; + const contactInfoReqs = !!( + contactInfo.firstName + && contactInfo.lastName + && contactInfo.phoneNumber + && contactInfo.emailAddress ); const paymentMethodReqs = @@ -354,7 +354,7 @@ export default { && serviceLocationReqs && isInsuranceSet && scheduleReqs - && customerReqs + && contactInfoReqs && paymentMethodReqs ); }, From 18093c18852fa8e888c70a4f23f4d0e772a945ee Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Mon, 26 Feb 2024 11:33:14 -0500 Subject: [PATCH 02/14] carrier phone number on frontend --- src/constants/endpoints.js | 4 ++++ src/layouts/tpa-confirmation/tpa-confirmation.vue | 5 +++-- src/store/index.js | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 60ef3ba8..de544f57 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -99,6 +99,10 @@ const endpoints = Object.freeze({ url: '/vehicle/api/v1/vehicle/lookup', method: 'GET' }, + GetAccountInfo: { + url: '/account/api/v1/account/', + method: 'GET' + }, LogExperimentExposureIfAssigned: { url: '/experiments/api/v1/experiments/log-exposure', method: 'POST' diff --git a/src/layouts/tpa-confirmation/tpa-confirmation.vue b/src/layouts/tpa-confirmation/tpa-confirmation.vue index 3741f4b8..f4c94be6 100644 --- a/src/layouts/tpa-confirmation/tpa-confirmation.vue +++ b/src/layouts/tpa-confirmation/tpa-confirmation.vue @@ -161,9 +161,10 @@ export default { isVerified() { return useMainStore().order.payment.insuranceCoverage.isVerified; }, - // TODO: Replace with actual carrier number when account service is ready carrierPhoneNumber() { - return '800-000-0000'; + const accountInfo = useMainStore().getClientAccountInfo(); + const { phoneNumber } = accountInfo; + return phoneNumber; }, carrierName() { return this.mainStore.issConfig.clientName; diff --git a/src/store/index.js b/src/store/index.js index 2b35d46d..fa1e57e9 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -925,6 +925,13 @@ export const useMainStore = defineStore({ }); }, + getClientAccountInfo() { + return globalMethods.callHttpClient({ + method: endpoints.GetAccountInfo.method, + endpoint: endpoints.GetAccountInfo.url + this.issConfig.parentAccountNumber + }); + }, + async getSupportingItems() { const glassPartsArray = this.order.lineItems.glassParts ?? []; const { carId } = this.order.vehicle; From ca10097f4011351b7ac732bd5334e03a735c0e33 Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Mon, 26 Feb 2024 12:01:38 -0500 Subject: [PATCH 03/14] final changes --- src/layouts/tpa-confirmation/tpa-confirmation.vue | 9 ++++----- src/store/index.js | 9 ++++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/layouts/tpa-confirmation/tpa-confirmation.vue b/src/layouts/tpa-confirmation/tpa-confirmation.vue index f4c94be6..83776523 100644 --- a/src/layouts/tpa-confirmation/tpa-confirmation.vue +++ b/src/layouts/tpa-confirmation/tpa-confirmation.vue @@ -161,22 +161,21 @@ export default { isVerified() { return useMainStore().order.payment.insuranceCoverage.isVerified; }, - carrierPhoneNumber() { - const accountInfo = useMainStore().getClientAccountInfo(); - const { phoneNumber } = accountInfo; - return phoneNumber; - }, carrierName() { return this.mainStore.issConfig.clientName; }, carrierUrl() { return this.mainStore.issConfig.successReturnURL; + }, + carrierPhoneNumber() { + return this.toDisplayPhoneNumber(useMainStore().order.carrierPhoneNumber); } }, mounted() { if (this.carrierUrl) { this.$refs.siteFooter.updateButtonText(`Go back to ${this.carrierName}`); } + useMainStore().getCarrierAccountInfo(); }, methods: { diff --git a/src/store/index.js b/src/store/index.js index 06da1c35..f3d4336d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -175,7 +175,8 @@ const getDefaultState = () => ({ eon: null, workOrderNumber: null, originalDeductible: null, - currentDeductible: null + currentDeductible: null, + carrierPhoneNumber: null }, applicationUser: { experiments: [], @@ -925,11 +926,13 @@ export const useMainStore = defineStore({ }); }, - getClientAccountInfo() { - return globalMethods.callHttpClient({ + async getCarrierAccountInfo() { + const response = await globalMethods.callHttpClient({ method: endpoints.GetAccountInfo.method, endpoint: endpoints.GetAccountInfo.url + this.issConfig.parentAccountNumber }); + this.order.carrierPhoneNumber = response.data.phoneNumber; + return response; }, async getSupportingItems() { From 85ee04ab9040e868f92fb49c3a84ca3ced9ada9f Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Mon, 26 Feb 2024 14:10:40 -0500 Subject: [PATCH 04/14] PR feedback changes --- src/layouts/tpa-confirmation/tpa-confirmation.vue | 11 ++++++++--- src/store/index.js | 15 +++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/layouts/tpa-confirmation/tpa-confirmation.vue b/src/layouts/tpa-confirmation/tpa-confirmation.vue index 83776523..135d47ab 100644 --- a/src/layouts/tpa-confirmation/tpa-confirmation.vue +++ b/src/layouts/tpa-confirmation/tpa-confirmation.vue @@ -99,13 +99,19 @@ export default { async beforeRouteEnter(to, from, next) { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.issPage); + const accountInfoPromise = useMainStore().getCarrierAccountInfo(); // Settle promises and get results const promiseResultMap = [ { resultKey: 'cmsContent', promise: cmsContentPromise - }]; - // use resultMap to populate layout content. + }, + { + resultKey: 'accountInfo', + promise: accountInfoPromise + } + ]; + // use resultMap to populate layout content. const resultMap = await settleAllPromises(promiseResultMap); next((vm) => { vm.setCmsContent(resultMap.cmsContent); @@ -175,7 +181,6 @@ export default { if (this.carrierUrl) { this.$refs.siteFooter.updateButtonText(`Go back to ${this.carrierName}`); } - useMainStore().getCarrierAccountInfo(); }, methods: { diff --git a/src/store/index.js b/src/store/index.js index f3d4336d..9dd4e7ce 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -926,13 +926,16 @@ export const useMainStore = defineStore({ }); }, - async getCarrierAccountInfo() { - const response = await globalMethods.callHttpClient({ - method: endpoints.GetAccountInfo.method, - endpoint: endpoints.GetAccountInfo.url + this.issConfig.parentAccountNumber + getCarrierAccountInfo() { + return new Promise((resolve, reject) => { + globalMethods.callHttpClient({ + method: endpoints.GetAccountInfo.method, + endpoint: endpoints.GetAccountInfo.url + this.issConfig.parentAccountNumber + }).then((response) => { + this.order.carrierPhoneNumber = response.data.phoneNumber; + return resolve(response.data); + }).catch((error) => reject(error)); }); - this.order.carrierPhoneNumber = response.data.phoneNumber; - return response; }, async getSupportingItems() { From 42bf25f4df58a76d12fd7bc31a541307a02f8367 Mon Sep 17 00:00:00 2001 From: Michaela Brydon Date: Mon, 26 Feb 2024 16:21:45 -0500 Subject: [PATCH 05/14] Adjustments --- src/layouts/payment-method/payment-method.vue | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 5d50380d..e263453f 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -19,8 +19,10 @@

-
Cart Placeholder
-
+ +
Pia Alert Placeholder
Date: Mon, 26 Feb 2024 16:26:02 -0500 Subject: [PATCH 06/14] Partial --- .../cart-dropdown/cart-dropdown.spec.js | 0 .../cart-dropdown/cart-dropdown.vue | 144 ++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 src/iss-components/cart-dropdown/cart-dropdown.spec.js create mode 100644 src/iss-components/cart-dropdown/cart-dropdown.vue diff --git a/src/iss-components/cart-dropdown/cart-dropdown.spec.js b/src/iss-components/cart-dropdown/cart-dropdown.spec.js new file mode 100644 index 00000000..e69de29b diff --git a/src/iss-components/cart-dropdown/cart-dropdown.vue b/src/iss-components/cart-dropdown/cart-dropdown.vue new file mode 100644 index 00000000..d2e2d641 --- /dev/null +++ b/src/iss-components/cart-dropdown/cart-dropdown.vue @@ -0,0 +1,144 @@ + + + + + From 16b8691d42c7a19cdc11e19f662bc7864e5636bd Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Tue, 27 Feb 2024 10:33:30 -0500 Subject: [PATCH 07/14] auto-save formatting only to prevent un needed compare in the actual PR later. --- src/layouts/payment-page/payment-page.vue | 386 ++++++++++++++++------ 1 file changed, 293 insertions(+), 93 deletions(-) diff --git a/src/layouts/payment-page/payment-page.vue b/src/layouts/payment-page/payment-page.vue index 36f072c6..c37fde79 100644 --- a/src/layouts/payment-page/payment-page.vue +++ b/src/layouts/payment-page/payment-page.vue @@ -38,71 +38,192 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
From c7d7cbdf15cceea5f3b66657a0afcca5f34ad3ed Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Wed, 28 Feb 2024 10:26:30 -0500 Subject: [PATCH 10/14] refactor unit test --- .../order-confirmation/order-confirmation.spec.js | 12 +++++++++--- .../order-confirmation/order-confirmation.vue | 4 +--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/layouts/order-confirmation/order-confirmation.spec.js b/src/layouts/order-confirmation/order-confirmation.spec.js index 79e4ea41..fe981266 100644 --- a/src/layouts/order-confirmation/order-confirmation.spec.js +++ b/src/layouts/order-confirmation/order-confirmation.spec.js @@ -29,6 +29,10 @@ const footerStub = { } }; +const headerStub = { + render: () => {} +}; + function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRun = () => {}) { const mountOptions = getMountOptions({ router: { @@ -38,8 +42,10 @@ function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRu }); mountOptions.global.stubs = { - siteFooter: footerStub + siteFooter: footerStub, + siteHeader: headerStub }; + const testingPinia = createTestingPinia({ initialState: { main: mainInitialState @@ -72,7 +78,7 @@ describe('OrderConfirmation.vue', () => { const { wrapper } = getMountedComponent({}); // Act - const siteHeader = wrapper.findComponent({ ref: 'siteHeader' }); + const siteHeader = wrapper.findComponent(headerStub); // Assert expect(siteHeader.exists()).toBe(true); @@ -121,5 +127,5 @@ describe('OrderConfirmation.vue', () => { // Assert expect(wrapper.vm.$router.navigateToExternalUrl).toHaveBeenCalledWith(carrierReturnUrl); }); - }) + }); }); diff --git a/src/layouts/order-confirmation/order-confirmation.vue b/src/layouts/order-confirmation/order-confirmation.vue index cd06c4f1..57c8de44 100644 --- a/src/layouts/order-confirmation/order-confirmation.vue +++ b/src/layouts/order-confirmation/order-confirmation.vue @@ -6,9 +6,7 @@ @invalidSubmit="onInvalidSubmit">
- +

Placeholder for order confirmation page

Date: Wed, 28 Feb 2024 11:19:15 -0500 Subject: [PATCH 11/14] Finalizing --- .../cart-dropdown/cart-dropdown.spec.js | 159 ++++++++++++++++++ .../cart-dropdown/cart-dropdown.vue | 66 ++++---- src/layouts/payment-method/payment-method.vue | 2 +- 3 files changed, 189 insertions(+), 38 deletions(-) diff --git a/src/iss-components/cart-dropdown/cart-dropdown.spec.js b/src/iss-components/cart-dropdown/cart-dropdown.spec.js index e69de29b..e55bdc36 100644 --- a/src/iss-components/cart-dropdown/cart-dropdown.spec.js +++ b/src/iss-components/cart-dropdown/cart-dropdown.spec.js @@ -0,0 +1,159 @@ +import { shallowMount } from '@vue/test-utils'; +import { createTestingPinia } from '@pinia/testing'; +import cartDropdown from '@/iss-components/cart-dropdown/cart-dropdown.vue'; + +// Supporting Files +import { getMountOptions } from '@/helpers/unit-test-helper.js'; +import { useMainStore } from '@/store'; + +function getMountedComponent(mainInitialState = {}, initialData = {}, propsData = {}) { + const mountOptions = getMountOptions({ + router: { + navigate: jest.fn() + } + }); + + const testingPinia = createTestingPinia({ + initialState: { + main: mainInitialState + } + }); + useMainStore(testingPinia); + + mountOptions.global.plugins = [testingPinia]; + mountOptions.data = () => (initialData); + mountOptions.propsData = propsData; + + const wrapper = shallowMount(cartDropdown, mountOptions); + wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => {}); + wrapper.vm.setCmsContent = jest.fn(); + return { wrapper }; +} + +describe('cart-dropdown component', () => { + test('initial data rendered as expected', () => { + // Arrange + const { wrapper } = getMountedComponent(); + + // Assert + expect(wrapper.vm.$data).toMatchSnapshot(); + }); + describe('displays', () => { + test('cart dropdown head', () => { + // Arrange + const reference = '#cart-dropdown-head'; + const { wrapper } = getMountedComponent(cartDropdown); + + // Act + const head = wrapper.find(reference); + + // Assert + expect(head.exists()).toBeTruthy(); + }); + test('cart table', () => { + // Arrange + const reference = '#cart-table'; + const isExpanded = true; + const initialData = { isExpanded }; + const { wrapper } = getMountedComponent(cartDropdown, {}, initialData); + + // Act + const cartTable = wrapper.find(reference); + + // Assert + expect(cartTable.exists()).toBeTruthy(); + }); + }); + describe('computed', () => { + test.each([ + [true, true], + [false, false], + [false, null] + ])('isVerified returns %p when isVerified store value is %p', (expected, isVerified) => { + // Arrange + const storeData = { + order: { + payment: { + insuranceCoverage: { isVerified } + } + } + }; + const { wrapper } = getMountedComponent(storeData); + + // Act + const result = wrapper.vm.isVerified; + + // Assert + expect(result).toBe(expected); + }); + describe('amountDueDisplayed', () => { + test('returns verifying coverage text when isVerified false', () => { + // Arrange + const VERIFYING_COVERAGE = 'Verifying coverage'; + const storeData = { + order: { + payment: { + insuranceCoverage: { + isVerified: false + } + } + } + }; + const { wrapper } = getMountedComponent(storeData); + + // Act + const result = wrapper.vm.amountDueDisplayed; + + // Assert + expect(result).toBe(VERIFYING_COVERAGE); + }); + test('returns formatted amount due when isVerified false', () => { + // TODO finish when methods done + }); + }); + describe('amountDue', () => { + test('returns 0 when showAsPaid is true', () => { + // Arrange + const propsData = { + showAsPaid: true + }; + const { wrapper } = getMountedComponent({}, {}, propsData); + + // Act + const result = wrapper.vm.amountDue; + + // Assert + expect(result).toBe(0); + }); + test('returns sum of subTotal and salesTax when showAsPaid is false', () => { + // TODO when subTotal and salesTax are finished + }); + }); + describe('subTotal', () => { + // TODO when method implemented + }); + describe('salesTax', () => { + // TODO when method implemented + }); + }); + describe('method', () => { + test.each([ + ['$0.00', 0], + ['$12.00', 12], + ['$12.30', 12.3], + ['$12.34', 12.34], + ['$12.35', 12.345], + ['$12.34', 12.344], + ['-$1.00', -1] + ])('get FormattedAmount returns `%` when amount %', (expected, amount) => { + // Arrange + const { wrapper } = getMountedComponent(); + + // Act + const result = wrapper.vm.getFormattedAmount(amount); + + // Assert + expect(result).toBe(expected); + }); + }); +}); diff --git a/src/iss-components/cart-dropdown/cart-dropdown.vue b/src/iss-components/cart-dropdown/cart-dropdown.vue index d2e2d641..a24f7b69 100644 --- a/src/iss-components/cart-dropdown/cart-dropdown.vue +++ b/src/iss-components/cart-dropdown/cart-dropdown.vue @@ -1,46 +1,39 @@ + diff --git a/src/layouts/tpa-confirmation/tpa-confirmation.vue b/src/layouts/tpa-confirmation/tpa-confirmation.vue index 135d47ab..2d777f8c 100644 --- a/src/layouts/tpa-confirmation/tpa-confirmation.vue +++ b/src/layouts/tpa-confirmation/tpa-confirmation.vue @@ -57,6 +57,7 @@ v-if="carrierUrl" ref="siteFooter" cmsWidgetName="SiteFooterWidget" + :isStackedVertically="true" :isForwardActionDisabled="!meta.valid" @ForwardClicked="forwardButtonAction" @backClicked="navigateBack" />