From 93b985f9a63cb46a0b33409defc56fa6cb8cb4b0 Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Fri, 17 Nov 2023 14:18:35 -0600 Subject: [PATCH 1/7] SSR-861 Save Session to Mainframe --- src/layouts/welcome-page/welcome-page.vue | 1 + src/store/index.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index 382664ef..20fc663c 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -319,6 +319,7 @@ export default { }, navigateForward() { + this.mainStore.order.submitToMF = true; if (this.mainStore.applicationUser.duplicateOrders?.length > 0 ?? false) { this.$router.navigate( this.navigationScenarios.CLICKED_FORWARD_WITH_DUPLICATES, diff --git a/src/store/index.js b/src/store/index.js index fbbe645a..d905cf14 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -155,7 +155,8 @@ const getDefaultState = () => ({ eon: null, workOrderNumber: null, originalDeductible: null, - currentDeductible: null + currentDeductible: null, + submitToMF: false }, applicationUser: { experiments: [], @@ -1165,7 +1166,8 @@ export const useMainStore = defineStore({ referralNumber: this.order.referralNumber?.toString(), referralCorrelationId: this.order.referralCorrelationId, referralSequenceNumber: this.order.referralSequenceNumber, - eon: this.order.eon + eon: this.order.eon, + submitToMF: this.order.submitToMF }, additionalSuccessEventDataHandler: (response) => `Email provided: ${customer.emailAddress ? 'true' : 'false'}` From a27ef126099a3ad2cd1272dcba56c1f1c5e7ba86 Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Mon, 20 Nov 2023 10:21:17 -0600 Subject: [PATCH 2/7] SSR-861 Submit to mainframe when we have referral number Renamed SubmitToMF to SubmitToMainframe --- src/store/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index d905cf14..1aab7bf1 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -155,8 +155,7 @@ const getDefaultState = () => ({ eon: null, workOrderNumber: null, originalDeductible: null, - currentDeductible: null, - submitToMF: false + currentDeductible: null }, applicationUser: { experiments: [], @@ -1167,7 +1166,7 @@ export const useMainStore = defineStore({ referralCorrelationId: this.order.referralCorrelationId, referralSequenceNumber: this.order.referralSequenceNumber, eon: this.order.eon, - submitToMF: this.order.submitToMF + submitToMainframe: !!this.order.referralNumber }, additionalSuccessEventDataHandler: (response) => `Email provided: ${customer.emailAddress ? 'true' : 'false'}` From a472919eeff13bf23e8f07080674dc5c4870aa92 Mon Sep 17 00:00:00 2001 From: Jeremy Zimmerman Date: Mon, 20 Nov 2023 13:24:50 -0500 Subject: [PATCH 3/7] Updated logic for calling final-deductible. --- src/store/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index fbbe645a..c0bbd4d0 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -546,10 +546,18 @@ export const useMainStore = defineStore({ status: this.order.policy.status, currentDeductible: this.order.currentDeductible, noCoverage: this.order.policy.noCoverage, - isRepair: this.order.damage.isRepair + isRepair: this.order.damage.isRepair, + insuredFirstName: this.order.customer.firstName, + insuredLastName: this.order.customer.lastName, + insuredZipCode: this.order.customer.address.zipCode, + policyVehicleId: this.order.vehicle.policyVehicleId, + vehicleVin: this.order.vehicle.vin, + policyData: this.order.policy.policyData, + isItac: this.order.policy.isITAC } }).then((r) => { - this.updateDeductible(r.data); + this.order.policy.policyData = r.data.policyData; + this.updateDeductible(r.data.deductible); return resolve(r); }).catch((error) => reject(error)); }); From 5bdcbe91b28cbc836856fa1e828c9cbd0171dce5 Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Mon, 20 Nov 2023 14:05:07 -0500 Subject: [PATCH 4/7] Updating unit tests. --- src/store/index.js | 3 ++- src/store/store.spec.js | 56 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index c0bbd4d0..4e03ce52 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -547,10 +547,11 @@ export const useMainStore = defineStore({ currentDeductible: this.order.currentDeductible, noCoverage: this.order.policy.noCoverage, isRepair: this.order.damage.isRepair, + policyNumber: this.order.policy.policyNumber, insuredFirstName: this.order.customer.firstName, insuredLastName: this.order.customer.lastName, insuredZipCode: this.order.customer.address.zipCode, - policyVehicleId: this.order.vehicle.policyVehicleId, + policyVehicleId: this.order.vehicle.policyVehicleId?.toString() ?? '', vehicleVin: this.order.vehicle.vin, policyData: this.order.policy.policyData, isItac: this.order.policy.isITAC diff --git a/src/store/store.spec.js b/src/store/store.spec.js index eb59c670..a46f77c6 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -1740,6 +1740,15 @@ describe('Store', () => { const currentDeductible = getRandomInt(0, 5000); const noCoverage = getRandomBoolean(); const isRepair = getRandomBoolean(); + const policyNumber = getRandomString(10, 20); + const insuredFirstName = getRandomString(10, 20); + const insuredLastName = getRandomString(10, 20); + const insuredZipCode = getRandomInt(5, 5); + const policyVehicleId = getRandomInt(1, 2); + const vehicleVin = getRandomInt(17, 17); + const policyData = getRandomString(100, 200); + const isItac = getRandomBoolean(); + store.order.referralCorrelationId = referralCorrelationId; store.issConfig.parentAccountNumber = accountNumber; store.order.currentDeductible = currentDeductible; @@ -1747,6 +1756,15 @@ describe('Store', () => { store.order.policy.status = status; store.order.customer.address.state = policyState; store.order.damage.isRepair = isRepair; + store.order.policy.policyNumber = policyNumber; + store.order.insured.firstName = insuredFirstName; + store.order.insured.lastName = insuredLastName; + store.order.insured.address.zipCode = insuredZipCode; + store.order.vehicle.policyVehicleId = policyVehicleId; + store.order.vehicle.vin = vehicleVin; + store.order.policy.policyData = policyData; + store.order.policy.isItac = isItac; + globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({})); // Act @@ -1765,7 +1783,15 @@ describe('Store', () => { status, currentDeductible, noCoverage, - isRepair + isRepair, + policyNumber, + insuredFirstName, + insuredLastName, + insuredZipCode, + policyVehicleId, + vehicleVin, + policyData, + isItac }) })); }); @@ -1805,6 +1831,15 @@ describe('Store', () => { selectedAnswer: 'No' } ]; + const policyNumber = getRandomString(10, 20); + const insuredFirstName = getRandomString(10, 20); + const insuredLastName = getRandomString(10, 20); + const insuredZipCode = getRandomInt(5, 5); + const policyVehicleId = getRandomInt(1, 2); + const vehicleVin = getRandomInt(17, 17); + const policyData = getRandomString(100, 200); + const isItac = getRandomBoolean(); + store.order.referralCorrelationId = referralCorrelationId; store.issConfig.parentAccountNumber = accountNumber; store.order.currentDeductible = currentDeductible; @@ -1813,6 +1848,15 @@ describe('Store', () => { store.order.customer.address.state = policyState; store.order.policy.endorsementQuestionAnswers = endorsementAnswers; store.order.damage.isRepair = isRepair; + store.order.policy.policyNumber = policyNumber; + store.order.insured.firstName = insuredFirstName; + store.order.insured.lastName = insuredLastName; + store.order.insured.address.zipCode = insuredZipCode; + store.order.vehicle.policyVehicleId = policyVehicleId; + store.order.vehicle.vin = vehicleVin; + store.order.policy.policyData = policyData; + store.order.policy.isItac = isItac; + globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({})); // Act @@ -1832,7 +1876,15 @@ describe('Store', () => { status, currentDeductible, noCoverage, - isRepair + isRepair, + policyNumber, + insuredFirstName, + insuredLastName, + insuredZipCode, + policyVehicleId, + vehicleVin, + policyData, + isItac }) })); }); From e7d553948787dc1815bb689a2d7948f622e954ca Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Mon, 20 Nov 2023 15:33:24 -0500 Subject: [PATCH 5/7] Updating unit tests. --- src/store/index.js | 2 ++ src/store/store.spec.js | 67 +++++++++++++++++++++++++++++------------ 2 files changed, 50 insertions(+), 19 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 4e03ce52..887ee0dd 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -557,6 +557,8 @@ export const useMainStore = defineStore({ isItac: this.order.policy.isITAC } }).then((r) => { + console.log('Promise Log: '); + console.log(r); this.order.policy.policyData = r.data.policyData; this.updateDeductible(r.data.deductible); return resolve(r); diff --git a/src/store/store.spec.js b/src/store/store.spec.js index a46f77c6..3304f721 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -1699,7 +1699,14 @@ describe('Store', () => { describe('successful method call', () => { it('calls get final deductible api endpoint', () => { // Arrange - globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({})); + const response = { + data: { + deductible: getRandomInt(0, 5000), + policyData: getRandomString(100, 200) + } + }; + + globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(response)); store.order.damage.glassToReplace = [getRandomString(10, 15)]; // Act @@ -1713,7 +1720,13 @@ describe('Store', () => { }); it('returns expected response object', async () => { // Arrange - const response = { deductible: getRandomInt(0, 5000) }; + const response = { + data: { + deductible: getRandomInt(0, 5000), + policyData: getRandomString(100, 200) + } + }; + globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(response)); store.order.damage.glassToReplace = [getRandomString(10, 15)]; @@ -1725,6 +1738,13 @@ describe('Store', () => { }); it('calls api with expected payload', () => { // Arrange + const response = { + data: { + deductible: getRandomInt(0, 5000), + policyData: getRandomString(100, 200) + } + }; + const location = getRandomString(10, 15).toUpperCase(); store.order.damage.glassToReplace = [ { @@ -1743,9 +1763,9 @@ describe('Store', () => { const policyNumber = getRandomString(10, 20); const insuredFirstName = getRandomString(10, 20); const insuredLastName = getRandomString(10, 20); - const insuredZipCode = getRandomInt(5, 5); - const policyVehicleId = getRandomInt(1, 2); - const vehicleVin = getRandomInt(17, 17); + const insuredZipCode = getRandomInt(10000, 99999).toString(); + const policyVehicleId = getRandomInt(1, 2).toString(); + const vehicleVin = getRandomString(17, 17); const policyData = getRandomString(100, 200); const isItac = getRandomBoolean(); @@ -1757,15 +1777,16 @@ describe('Store', () => { store.order.customer.address.state = policyState; store.order.damage.isRepair = isRepair; store.order.policy.policyNumber = policyNumber; - store.order.insured.firstName = insuredFirstName; - store.order.insured.lastName = insuredLastName; - store.order.insured.address.zipCode = insuredZipCode; + store.order.customer.firstName = insuredFirstName; + store.order.customer.lastName = insuredLastName; + store.order.customer.address.zipCode = insuredZipCode; store.order.vehicle.policyVehicleId = policyVehicleId; store.order.vehicle.vin = vehicleVin; store.order.policy.policyData = policyData; - store.order.policy.isItac = isItac; - globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({})); + store.updatePolicyITACFlag(isItac); + + globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(response)); // Act store.getFinalDeductible(); @@ -1797,6 +1818,13 @@ describe('Store', () => { }); it('only "Yes" endorsement answers are added to payload', () => { // Arrange + const response = { + data: { + deductible: getRandomInt(0, 5000), + policyData: getRandomString(100, 200) + } + }; + const location = getRandomString(10, 15).toUpperCase(); store.order.damage.glassToReplace = [ { @@ -1834,11 +1862,11 @@ describe('Store', () => { const policyNumber = getRandomString(10, 20); const insuredFirstName = getRandomString(10, 20); const insuredLastName = getRandomString(10, 20); - const insuredZipCode = getRandomInt(5, 5); - const policyVehicleId = getRandomInt(1, 2); - const vehicleVin = getRandomInt(17, 17); + const insuredZipCode = getRandomInt(10000, 99999).toString(); + const policyVehicleId = getRandomInt(1, 2).toString(); + const vehicleVin = getRandomString(17, 17); const policyData = getRandomString(100, 200); - const isItac = getRandomBoolean(); + const isItac = false; store.order.referralCorrelationId = referralCorrelationId; store.issConfig.parentAccountNumber = accountNumber; @@ -1849,15 +1877,16 @@ describe('Store', () => { store.order.policy.endorsementQuestionAnswers = endorsementAnswers; store.order.damage.isRepair = isRepair; store.order.policy.policyNumber = policyNumber; - store.order.insured.firstName = insuredFirstName; - store.order.insured.lastName = insuredLastName; - store.order.insured.address.zipCode = insuredZipCode; + store.order.customer.firstName = insuredFirstName; + store.order.customer.lastName = insuredLastName; + store.order.customer.address.zipCode = insuredZipCode; store.order.vehicle.policyVehicleId = policyVehicleId; store.order.vehicle.vin = vehicleVin; store.order.policy.policyData = policyData; - store.order.policy.isItac = isItac; - globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({})); + store.updatePolicyITACFlag(isItac); + + globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(response)); // Act store.getFinalDeductible(); From 48ac7678eaeeb48babe2f9cd1b110b47f8da7c2b Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Mon, 20 Nov 2023 15:34:09 -0500 Subject: [PATCH 6/7] Updating unit tests. --- src/store/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 887ee0dd..4e03ce52 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -557,8 +557,6 @@ export const useMainStore = defineStore({ isItac: this.order.policy.isITAC } }).then((r) => { - console.log('Promise Log: '); - console.log(r); this.order.policy.policyData = r.data.policyData; this.updateDeductible(r.data.deductible); return resolve(r); From ec733646d736443446d3f1176d7c621acabd6f7b Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Tue, 21 Nov 2023 08:58:02 -0600 Subject: [PATCH 7/7] SSR-861 Remove SubmitToMF Flag on welcome page --- src/layouts/welcome-page/welcome-page.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index 20fc663c..382664ef 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -319,7 +319,6 @@ export default { }, navigateForward() { - this.mainStore.order.submitToMF = true; if (this.mainStore.applicationUser.duplicateOrders?.length > 0 ?? false) { this.$router.navigate( this.navigationScenarios.CLICKED_FORWARD_WITH_DUPLICATES,