From a97fe72e5e87bb23d16985e3876591ba010ef27d Mon Sep 17 00:00:00 2001 From: Matt Caimi Date: Tue, 27 Feb 2024 16:46:34 -0500 Subject: [PATCH 01/14] SSR-1081 handling payment return info from hop --- src/constants/query-strings.js | 17 +- src/constants/web-storage-constants.js | 5 + src/helpers/querystring-helper.js | 11 ++ src/layouts/payment-page/payment-page.vue | 8 +- src/layouts/payment-return/payment-return.vue | 145 ++++++++++++++++++ .../router-constants/navigation-scenarios.js | 3 + src/router/router-constants/routing-table.js | 17 ++ src/store/index.js | 79 ++++++++-- 8 files changed, 262 insertions(+), 23 deletions(-) create mode 100644 src/constants/web-storage-constants.js create mode 100644 src/helpers/querystring-helper.js create mode 100644 src/layouts/payment-return/payment-return.vue diff --git a/src/constants/query-strings.js b/src/constants/query-strings.js index 9b486517..f217dea4 100644 --- a/src/constants/query-strings.js +++ b/src/constants/query-strings.js @@ -1,5 +1,20 @@ const queryStrings = Object.freeze({ - ISS_PAGE: 'issPage' + ISS_PAGE: 'issPage', + ERROR: 'error', + SUBSCRIPTIONID: 'subscriptionid', + REFERRAL_SEQ_NUM: 'referralseqnum', + CARD_EXPIRATION_MONTH: 'card_expirationmonth', + CARD_EXPIRATION_YEAR: 'card_expirationyear', + CARD_TYPE: 'sgcardtype', + BILL_TO_POSTAL_CODE: 'billto_postalcode', + BILL_TO_FIRST_NAME: 'billto_firstname', + BILL_TO_LAST_NAME: 'billto_lastname', + REFERENCE_NUMBER: 'req_reference_number', + AUTH_CODE: 'auth_code', + TRANSACTION_ID: 'transaction_id', + TRANS_REFERENCE_NUMBER: 'auth_trans_ref_no', + LAST_FOUR: 'last_four', + DISPLAY_PAY_IN_ADVANCE_ALERT: 'displayPayInAdvanceAlert' }); export default queryStrings; diff --git a/src/constants/web-storage-constants.js b/src/constants/web-storage-constants.js new file mode 100644 index 00000000..29c814cf --- /dev/null +++ b/src/constants/web-storage-constants.js @@ -0,0 +1,5 @@ +const webStorageConstants = Object.freeze({ + SUBMITTED_ORDER: 'submittedOrder' +}); + +export default webStorageConstants; diff --git a/src/helpers/querystring-helper.js b/src/helpers/querystring-helper.js new file mode 100644 index 00000000..32900e96 --- /dev/null +++ b/src/helpers/querystring-helper.js @@ -0,0 +1,11 @@ +export default function getQuerystringParameter(key) { + const queryString = window.location.search; + const urlParams = new URLSearchParams(queryString); + const lowerCaseParams = new URLSearchParams(); + + urlParams.forEach((value, name) => { + lowerCaseParams.append(name.toLowerCase(), value); + }); + + return lowerCaseParams.get(key.toLowerCase()); +} diff --git a/src/layouts/payment-page/payment-page.vue b/src/layouts/payment-page/payment-page.vue index 7612e842..1f77de74 100644 --- a/src/layouts/payment-page/payment-page.vue +++ b/src/layouts/payment-page/payment-page.vue @@ -460,15 +460,11 @@ export default { computed: { payInAdvanceResponseUrl() { const { protocol, host } = window.location; - return `${protocol}//${host}/?issPage=${ - issPageValues.PAYMENT_RETURN - }&src=iss-nextgen`; + return `${protocol}//${host}/?issPage=${issPageValues.PAYMENT_RETURN}&src=iss-nextgen`; }, payInAdvanceCancelUrl() { const { protocol, host } = window.location; - return `${protocol}//${host}/?issPage=${ - issPageValues.PAYMENT_METHOD - }&src=iss-nextgen`; + return `${protocol}//${host}/?issPage=${issPageValues.PAYMENT_METHOD}&src=iss-nextgen`; }, dynamicCSSUrl() { const { protocol, hostname, port } = window.location; diff --git a/src/layouts/payment-return/payment-return.vue b/src/layouts/payment-return/payment-return.vue new file mode 100644 index 00000000..1ef57a4b --- /dev/null +++ b/src/layouts/payment-return/payment-return.vue @@ -0,0 +1,145 @@ + + + diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index 1406498e..f50af7d5 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -91,6 +91,9 @@ const navigationScenarios = Object.freeze({ // Payment CLICKED_PAY_NOW: 'CLICKED_PAY_NOW', + PAY_IN_ADVANCE_ERROR: 'PAY_IN_ADVANCE_ERROR', + PAY_IN_ADVANCE_CREDIT_CARD_ERROR: 'PAY_IN_ADVANCE_CREDIT_CARD_ERROR', + PAY_IN_ADVANCE_SUCCESS: 'PAY_IN_ADVANCE_SUCCESS', // Bailout CLICKED_FORWARD_WITH_BAILOUT: 'CLICKED_FORWARD_WITH_BAILOUT' diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index df960f77..badf8d68 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -629,6 +629,23 @@ const routingTable = () => [ } ] }, + { + issPageValue: issPageValues.PAYMENT_RETURN, + maps: [ + { + scenario: navigationScenarios.PAY_IN_ADVANCE_ERROR, + destinationIssPageValue: issPageValues.PAYMENT_METHOD + }, + { + scenario: navigationScenarios.PAY_IN_ADVANCE_CREDIT_CARD_ERROR, + destinationIssPageValue: issPageValues.PAYMENT_PAGE + }, + { + scenario: navigationScenarios.PAY_IN_ADVANCE_SUCCESS, + destinationIssPageValue: issPageValues.CONFIRMATION + }, + ] + }, { issPageValue: issPageValues.TPA_CONFIRMATION, maps: [ diff --git a/src/store/index.js b/src/store/index.js index 9dd4e7ce..8be154de 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -14,6 +14,7 @@ import coverageStatuses from '@/constants/coverage-statuses'; import { AppointmentTypeStrings, PREMIUM_FEE_PART_TYPE } from '@/constants/schedule-constants'; import { convertDateStringToDate, getDateDifferenceInDays, militaryToTwelveHourTime } from '@/helpers/date-helper'; import { paymentMethods } from '@/constants/payment-method-constants'; +import webStorageConstants from '@/constants/web-storage-constants'; const storeId = 'main'; @@ -150,7 +151,21 @@ const getDefaultState = () => ({ }, parentAccountNumber: 0, isPayInAdvance: null, - payInAdvanceType: null + payInAdvanceType: null, + ccToken: { + subscriptionId: null, + expMonth: null, + expYear: null, + cardType: null, + billToPostalCode: null, + billToFirstName: null, + billToLastName: null, + referenceNumber: null, + authCode: null, + transactionId: null, + transReferenceNumber: null, + lastFour: null + } }, contactInfo: { firstName: null, @@ -175,8 +190,7 @@ const getDefaultState = () => ({ eon: null, workOrderNumber: null, originalDeductible: null, - currentDeductible: null, - carrierPhoneNumber: null + currentDeductible: null }, applicationUser: { experiments: [], @@ -926,18 +940,6 @@ export const useMainStore = defineStore({ }); }, - 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)); - }); - }, - async getSupportingItems() { const glassPartsArray = this.order.lineItems.glassParts ?? []; const { carId } = this.order.vehicle; @@ -1397,6 +1399,10 @@ export const useMainStore = defineStore({ this.order.serviceLocation.searchFilter = serviceLocationInfo.searchFilter; }, + resetState() { + Object.assign(this, getDefaultState()); + }, + resetRegistrationState() { this.order.vehicle.registration.licensePlate = null; this.order.vehicle.registration.address = null; @@ -2166,7 +2172,48 @@ export const useMainStore = defineStore({ method: endpoints.GetPaymentSignature.method, endpoint: endpoints.GetPaymentSignature.url }); - } + }, + + updateCCToken(ccToken) { + this.order.payment.ccToken.subscriptionId = ccToken.subscriptionId; + this.order.payment.ccToken.expMonth = ccToken.expMonth; + this.order.payment.ccToken.expYear = ccToken.expYear; + this.order.payment.ccToken.cardType = ccToken.cardType; + this.order.payment.ccToken.billToPostalCode = ccToken.billToPostalCode; + this.order.payment.ccToken.billToFirstName = ccToken.billToFirstName; + this.order.payment.ccToken.billToLastName = ccToken.billToLastName; + this.order.payment.ccToken.referenceNumber = ccToken.referenceNumber; + this.order.payment.ccToken.authCode = ccToken.authCode; + this.order.payment.ccToken.transactionId = ccToken.transactionId; + this.order.payment.ccToken.transReferenceNumber = ccToken.transReferenceNumber; + this.order.payment.ccToken.lastFour = ccToken.lastFour; + }, + + hasSubmittedOrder() { + return window.sessionStorage.getItem(webStorageConstants.SUBMITTED_ORDER) !== null; + }, + + createSubmittedOrder() { + if (this.hasSubmittedOrder()) { + return; + } + const submittedOrder = this.order; + const { experiments } = this.applicationUser; + + // set to local storage + window.sessionStorage.setItem(webStorageConstants.SUBMITTED_ORDER, JSON.stringify(submittedOrder)); + + // clear vuex + this.resetState(); + + // restore user's experiments + this.applicationUser.experiments = experiments; + }, + + resetSubmittedOrder() { + // clear from local storage + window.sessionStorage.removeItem(webStorageConstants.SUBMITTED_ORDER); + }, }, persist: true From 9ddc157ed3616d69e273dc409dbb11805b87527a Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Mon, 4 Mar 2024 15:38:08 -0500 Subject: [PATCH 02/14] display service duration --- .../order-confirmation/order-confirmation.vue | 94 +++++++++++++++---- 1 file changed, 74 insertions(+), 20 deletions(-) diff --git a/src/layouts/order-confirmation/order-confirmation.vue b/src/layouts/order-confirmation/order-confirmation.vue index 38f2dc9e..775630ef 100644 --- a/src/layouts/order-confirmation/order-confirmation.vue +++ b/src/layouts/order-confirmation/order-confirmation.vue @@ -29,6 +29,10 @@ class="appointment-text text-center text-color--black lh-base" v-html="appointmentWordingText"> +
+
${this.providerAddress},
${this.providerCity}, ${this.providerState} ${this.providerZipCode}
`; }, appointmentWordingText() { - return this.formatWordingText(this.appointmentType); + switch (this.appointmentType) { + case 'MOBILE': + return this.mobileWordingText?.replaceAll( + '{custom:address}', + this.serviceLocationFullAddress + ); + case 'DROP OFF': + return this.dropOffAndInShopWordingText?.replaceAll( + '{custom:address}', + this.providerFullAddress + ); + case 'INSHOP': + return this.dropOffAndInShopWordingText?.replaceAll( + '{custom:address}', + this.providerFullAddress + ); + default: + return null; + } + }, + appointmentWordingText2() { + switch (this.appointmentType) { + case 'MOBILE': + return this.mobileWordingText2; + case 'DROP OFF': + return this.dropOffAndInShopWordingText2; + case 'INSHOP': + return this.dropOffAndInShopWordingText2?.replaceAll( + '{custom:inShopDuration}', + this.inShopAppointmentDuration + ); + default: + return null; + } + }, + mobileAppointment() { + return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'MOBILE'; + }, + inShopAppointment() { + return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'INSHOP'; + }, + dropOffAppointment() { + return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'DROP OFF'; + }, + inShopAppointmentDuration() { + const inshopDurationTime = getDisplayTextForDurationLength( + this.mainStore.order.schedule.jobMinMinutes, + this.mainStore.order.schedule.jobMaxMinutes + ); + return inshopDurationTime; } }, mounted() { @@ -192,23 +252,17 @@ export default { return null; } }, - formatWordingText(appointmentType) { - switch (appointmentType) { - case 'MOBILE': - return this.mobileWordingText?.replaceAll( - '{custom:address}', - this.serviceLocationFullAddress - ); - case 'DROP OFF': - return this.dropOffAndInShopWordingText?.replaceAll( - '{custom:address}', - this.providerFullAddress - ); - case 'INSHOP': - return this.dropOffAndInShopWordingText?.replaceAll( - '{custom:address}', - this.providerFullAddress - ); + processIfStatements, + getBodyText2FromCms(cmsWidgetName) { + const body2Text = this.getCmsContent(cmsWidgetName, 'BodyText2'); + return this.processIfStatements(body2Text, 'custom', this.getCustomValueFromString); + }, + getCustomValueFromString(str) { + switch (str) { + case 'inShopAppointment': + return this.inShopAppointment; + case 'dropOffAppointment': + return this.dropOffAppointment; default: return null; } From 7651441115e2f08cd49e8eee4accb4dc7eb027af Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Mon, 4 Mar 2024 15:42:00 -0500 Subject: [PATCH 03/14] style fix --- src/layouts/order-confirmation/order-confirmation.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/layouts/order-confirmation/order-confirmation.vue b/src/layouts/order-confirmation/order-confirmation.vue index 775630ef..4b299b07 100644 --- a/src/layouts/order-confirmation/order-confirmation.vue +++ b/src/layouts/order-confirmation/order-confirmation.vue @@ -26,11 +26,11 @@

{{ appointmentTimeFormatted }}

@@ -308,6 +308,7 @@ $page-side-padding: 1.5rem; .appointment-text { :deep(strong) { font-weight: $font-weight-bold; + color: $black; } } From 8e9302df405fa18d31160ebdcc422d97722cf0d1 Mon Sep 17 00:00:00 2001 From: Matt Caimi Date: Tue, 27 Feb 2024 16:46:34 -0500 Subject: [PATCH 04/14] SSR-1081 handling payment return info from hop --- src/constants/query-strings.js | 17 +- src/constants/web-storage-constants.js | 5 + src/helpers/querystring-helper.js | 11 ++ src/layouts/payment-page/payment-page.vue | 8 +- src/layouts/payment-return/payment-return.vue | 145 ++++++++++++++++++ .../router-constants/navigation-scenarios.js | 3 + src/router/router-constants/routing-table.js | 17 ++ src/store/index.js | 76 +++++++-- 8 files changed, 261 insertions(+), 21 deletions(-) create mode 100644 src/constants/web-storage-constants.js create mode 100644 src/helpers/querystring-helper.js create mode 100644 src/layouts/payment-return/payment-return.vue diff --git a/src/constants/query-strings.js b/src/constants/query-strings.js index 9b486517..f217dea4 100644 --- a/src/constants/query-strings.js +++ b/src/constants/query-strings.js @@ -1,5 +1,20 @@ const queryStrings = Object.freeze({ - ISS_PAGE: 'issPage' + ISS_PAGE: 'issPage', + ERROR: 'error', + SUBSCRIPTIONID: 'subscriptionid', + REFERRAL_SEQ_NUM: 'referralseqnum', + CARD_EXPIRATION_MONTH: 'card_expirationmonth', + CARD_EXPIRATION_YEAR: 'card_expirationyear', + CARD_TYPE: 'sgcardtype', + BILL_TO_POSTAL_CODE: 'billto_postalcode', + BILL_TO_FIRST_NAME: 'billto_firstname', + BILL_TO_LAST_NAME: 'billto_lastname', + REFERENCE_NUMBER: 'req_reference_number', + AUTH_CODE: 'auth_code', + TRANSACTION_ID: 'transaction_id', + TRANS_REFERENCE_NUMBER: 'auth_trans_ref_no', + LAST_FOUR: 'last_four', + DISPLAY_PAY_IN_ADVANCE_ALERT: 'displayPayInAdvanceAlert' }); export default queryStrings; diff --git a/src/constants/web-storage-constants.js b/src/constants/web-storage-constants.js new file mode 100644 index 00000000..29c814cf --- /dev/null +++ b/src/constants/web-storage-constants.js @@ -0,0 +1,5 @@ +const webStorageConstants = Object.freeze({ + SUBMITTED_ORDER: 'submittedOrder' +}); + +export default webStorageConstants; diff --git a/src/helpers/querystring-helper.js b/src/helpers/querystring-helper.js new file mode 100644 index 00000000..32900e96 --- /dev/null +++ b/src/helpers/querystring-helper.js @@ -0,0 +1,11 @@ +export default function getQuerystringParameter(key) { + const queryString = window.location.search; + const urlParams = new URLSearchParams(queryString); + const lowerCaseParams = new URLSearchParams(); + + urlParams.forEach((value, name) => { + lowerCaseParams.append(name.toLowerCase(), value); + }); + + return lowerCaseParams.get(key.toLowerCase()); +} diff --git a/src/layouts/payment-page/payment-page.vue b/src/layouts/payment-page/payment-page.vue index 7612e842..1f77de74 100644 --- a/src/layouts/payment-page/payment-page.vue +++ b/src/layouts/payment-page/payment-page.vue @@ -460,15 +460,11 @@ export default { computed: { payInAdvanceResponseUrl() { const { protocol, host } = window.location; - return `${protocol}//${host}/?issPage=${ - issPageValues.PAYMENT_RETURN - }&src=iss-nextgen`; + return `${protocol}//${host}/?issPage=${issPageValues.PAYMENT_RETURN}&src=iss-nextgen`; }, payInAdvanceCancelUrl() { const { protocol, host } = window.location; - return `${protocol}//${host}/?issPage=${ - issPageValues.PAYMENT_METHOD - }&src=iss-nextgen`; + return `${protocol}//${host}/?issPage=${issPageValues.PAYMENT_METHOD}&src=iss-nextgen`; }, dynamicCSSUrl() { const { protocol, hostname, port } = window.location; diff --git a/src/layouts/payment-return/payment-return.vue b/src/layouts/payment-return/payment-return.vue new file mode 100644 index 00000000..1ef57a4b --- /dev/null +++ b/src/layouts/payment-return/payment-return.vue @@ -0,0 +1,145 @@ + + + diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index 967b99d4..bd079640 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -96,6 +96,9 @@ const navigationScenarios = Object.freeze({ // Payment CLICKED_PAY_NOW: 'CLICKED_PAY_NOW', + PAY_IN_ADVANCE_ERROR: 'PAY_IN_ADVANCE_ERROR', + PAY_IN_ADVANCE_CREDIT_CARD_ERROR: 'PAY_IN_ADVANCE_CREDIT_CARD_ERROR', + PAY_IN_ADVANCE_SUCCESS: 'PAY_IN_ADVANCE_SUCCESS', // Bailout CLICKED_FORWARD_WITH_BAILOUT: 'CLICKED_FORWARD_WITH_BAILOUT' diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index d20f59cd..60d76dcd 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -641,6 +641,23 @@ const routingTable = () => [ } ] }, + { + issPageValue: issPageValues.PAYMENT_RETURN, + maps: [ + { + scenario: navigationScenarios.PAY_IN_ADVANCE_ERROR, + destinationIssPageValue: issPageValues.PAYMENT_METHOD + }, + { + scenario: navigationScenarios.PAY_IN_ADVANCE_CREDIT_CARD_ERROR, + destinationIssPageValue: issPageValues.PAYMENT_PAGE + }, + { + scenario: navigationScenarios.PAY_IN_ADVANCE_SUCCESS, + destinationIssPageValue: issPageValues.CONFIRMATION + }, + ] + }, { issPageValue: issPageValues.TPA_CONFIRMATION, maps: [ diff --git a/src/store/index.js b/src/store/index.js index 3ba028ec..cc1b2986 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -19,6 +19,7 @@ import { noCoverageForSelectedVehicle, repairWaivedForSelectedVehicle } from '@/helpers/policy-vehicle-helper'; +import webStorageConstants from '@/constants/web-storage-constants'; const storeId = 'main'; @@ -155,7 +156,21 @@ const getDefaultState = () => ({ }, parentAccountNumber: 0, isPayInAdvance: null, - payInAdvanceType: null + payInAdvanceType: null, + ccToken: { + subscriptionId: null, + expMonth: null, + expYear: null, + cardType: null, + billToPostalCode: null, + billToFirstName: null, + billToLastName: null, + referenceNumber: null, + authCode: null, + transactionId: null, + transReferenceNumber: null, + lastFour: null + } }, contactInfo: { firstName: null, @@ -934,18 +949,6 @@ export const useMainStore = defineStore({ }); }, - 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)); - }); - }, - async getSupportingItems() { const { glassParts } = this.lineItems; const { carId } = this.vehicle; @@ -1383,6 +1386,10 @@ export const useMainStore = defineStore({ this.order.serviceLocation.searchFilter = serviceLocationInfo.searchFilter; }, + resetState() { + Object.assign(this, getDefaultState()); + }, + resetRegistrationState() { this.order.vehicle.registration.licensePlate = null; this.order.vehicle.registration.address = null; @@ -2135,7 +2142,48 @@ export const useMainStore = defineStore({ method: endpoints.GetPaymentSignature.method, endpoint: endpoints.GetPaymentSignature.url }); - } + }, + + updateCCToken(ccToken) { + this.order.payment.ccToken.subscriptionId = ccToken.subscriptionId; + this.order.payment.ccToken.expMonth = ccToken.expMonth; + this.order.payment.ccToken.expYear = ccToken.expYear; + this.order.payment.ccToken.cardType = ccToken.cardType; + this.order.payment.ccToken.billToPostalCode = ccToken.billToPostalCode; + this.order.payment.ccToken.billToFirstName = ccToken.billToFirstName; + this.order.payment.ccToken.billToLastName = ccToken.billToLastName; + this.order.payment.ccToken.referenceNumber = ccToken.referenceNumber; + this.order.payment.ccToken.authCode = ccToken.authCode; + this.order.payment.ccToken.transactionId = ccToken.transactionId; + this.order.payment.ccToken.transReferenceNumber = ccToken.transReferenceNumber; + this.order.payment.ccToken.lastFour = ccToken.lastFour; + }, + + hasSubmittedOrder() { + return window.sessionStorage.getItem(webStorageConstants.SUBMITTED_ORDER) !== null; + }, + + createSubmittedOrder() { + if (this.hasSubmittedOrder()) { + return; + } + const submittedOrder = this.order; + const { experiments } = this.applicationUser; + + // set to local storage + window.sessionStorage.setItem(webStorageConstants.SUBMITTED_ORDER, JSON.stringify(submittedOrder)); + + // clear vuex + this.resetState(); + + // restore user's experiments + this.applicationUser.experiments = experiments; + }, + + resetSubmittedOrder() { + // clear from local storage + window.sessionStorage.removeItem(webStorageConstants.SUBMITTED_ORDER); + }, }, persist: true From 1a5b958b8c53309805079b319477024f53199303 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Mon, 4 Mar 2024 14:39:41 -0500 Subject: [PATCH 05/14] reorder alphabetically sans isspage --- src/constants/query-strings.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/constants/query-strings.js b/src/constants/query-strings.js index f217dea4..576d1e5b 100644 --- a/src/constants/query-strings.js +++ b/src/constants/query-strings.js @@ -1,20 +1,21 @@ const queryStrings = Object.freeze({ ISS_PAGE: 'issPage', - ERROR: 'error', - SUBSCRIPTIONID: 'subscriptionid', - REFERRAL_SEQ_NUM: 'referralseqnum', + AUTH_CODE: 'auth_code', + BILL_TO_FIRST_NAME: 'billto_firstname', + BILL_TO_LAST_NAME: 'billto_lastname', + BILL_TO_POSTAL_CODE: 'billto_postalcode', CARD_EXPIRATION_MONTH: 'card_expirationmonth', CARD_EXPIRATION_YEAR: 'card_expirationyear', CARD_TYPE: 'sgcardtype', - BILL_TO_POSTAL_CODE: 'billto_postalcode', - BILL_TO_FIRST_NAME: 'billto_firstname', - BILL_TO_LAST_NAME: 'billto_lastname', - REFERENCE_NUMBER: 'req_reference_number', - AUTH_CODE: 'auth_code', - TRANSACTION_ID: 'transaction_id', - TRANS_REFERENCE_NUMBER: 'auth_trans_ref_no', + DISPLAY_PAY_IN_ADVANCE_ALERT: 'displayPayInAdvanceAlert', + ERROR: 'error', LAST_FOUR: 'last_four', - DISPLAY_PAY_IN_ADVANCE_ALERT: 'displayPayInAdvanceAlert' + REFERENCE_NUMBER: 'req_reference_number', + REFERRAL_SEQ_NUM: 'referralseqnum', + SUBSCRIPTIONID: 'subscriptionid', + TRANS_REFERENCE_NUMBER: 'auth_trans_ref_no', + TRANSACTION_ID: 'transaction_id' + }); export default queryStrings; From ff5f8c5b29dcf2d3b84a38743bc199c70357ee6a Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Mon, 4 Mar 2024 16:06:54 -0500 Subject: [PATCH 06/14] Small tweaks --- src/helpers/order-helper.js | 37 ++++++++---- src/helpers/querystring-helper.js | 2 +- src/layouts/payment-return/payment-return.vue | 57 +++++++++++-------- src/router/index.js | 12 ++-- src/router/router-constants/routing-table.js | 4 +- src/store/index.js | 43 +++++++------- 6 files changed, 91 insertions(+), 64 deletions(-) diff --git a/src/helpers/order-helper.js b/src/helpers/order-helper.js index 85d0bec2..33e7d3c4 100644 --- a/src/helpers/order-helper.js +++ b/src/helpers/order-helper.js @@ -1,6 +1,17 @@ import { useMainStore } from '@/store'; import { updateOrCreateISSCookie } from '@/helpers/cookie-helper'; +/* + Encapsulates asynchronous Save Session logic inside a promise to allow for Save Session queuing +*/ +async function saveSessionHelper(store) { + const savedSessionInfo = await store.saveSession(); + if (savedSessionInfo) { + store.setSaveSessionInfo(savedSessionInfo.data); + } + updateOrCreateISSCookie(); +} + /* Will call API to save existing order, or create new one depending where it's called from. This will also set Referral information in the store after saving, and then @@ -8,8 +19,8 @@ import { updateOrCreateISSCookie } from '@/helpers/cookie-helper'; */ export async function saveSession({ shouldAwaitSaveSessionQueue = false }) { const store = useMainStore(); - var saveSessionPromise = store.applicationUser.saveSessionPromise - ? store.applicationUser.saveSessionPromise.then(() => { return saveSessionHelper(store); }) + const saveSessionPromise = store.applicationUser.saveSessionPromise + ? store.applicationUser.saveSessionPromise.then(() => saveSessionHelper(store)) : saveSessionHelper(store); store.setSaveSessionPromise(saveSessionPromise); @@ -20,12 +31,18 @@ export async function saveSession({ shouldAwaitSaveSessionQueue = false }) { } /* - Encapsulates asynchronous Save Session logic inside a promise to allow for Save Session queuing + Will determine if to submitWorkOrder. + TODO: Add more description to this */ -async function saveSessionHelper(store) { - const savedSessionInfo = await store.saveSession(); - if (savedSessionInfo) { - store.setSaveSessionInfo(savedSessionInfo.data); - } - updateOrCreateISSCookie(); -} \ No newline at end of file +export async function submitWorkOrder({ + pageNameToLog, + submitAfterSave = false, + createDeleteStatusWorkOrderForPia = false +}) { + await saveSession({ + pageNameToLog, + shouldAwaitSaveSessionQueue: true, + submitAfterSave, + createDeleteStatusWorkOrderForPia + }); +} diff --git a/src/helpers/querystring-helper.js b/src/helpers/querystring-helper.js index 32900e96..f4df1ed7 100644 --- a/src/helpers/querystring-helper.js +++ b/src/helpers/querystring-helper.js @@ -1,4 +1,4 @@ -export default function getQuerystringParameter(key) { +export default function getQueryStringParameter(key) { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const lowerCaseParams = new URLSearchParams(); diff --git a/src/layouts/payment-return/payment-return.vue b/src/layouts/payment-return/payment-return.vue index 1ef57a4b..329badf9 100644 --- a/src/layouts/payment-return/payment-return.vue +++ b/src/layouts/payment-return/payment-return.vue @@ -11,8 +11,10 @@ import { Form } from 'vee-validate'; import BaseFormMixin from '@/mixins/base-form-mixin.js'; import { useMainStore } from '@/store/index.js'; import queryStrings from '@/constants/query-strings'; -import getQuerystringParameter from '@/helpers/querystring-helper.js'; +import getQueryStringParameter from '@/helpers/querystring-helper.js'; import { paymentMethods } from '@/constants/payment-method-constants.js'; +import { submitWorkOrder } from '@/helpers/order-helper.js'; +import showIssLoadingModal from '@/helpers/loading-modal-helper'; export default { name: 'payment-return', @@ -22,14 +24,14 @@ export default { }, mixins: [BaseFormMixin], async mounted() { - const payInAdvanceError = getQuerystringParameter(queryStrings.ERROR); + showIssLoadingModal(true); + const payInAdvanceError = getQueryStringParameter(queryStrings.ERROR); const { payInAdvanceType } = useMainStore().order.payment; if (payInAdvanceError) { console.error(`Error during payment: ${payInAdvanceError}`); const paymentPageNavScenario = - payInAdvanceType === paymentMethods.CREDIT_CARD - || payInAdvanceType === paymentMethods.AFTERPAY; + payInAdvanceType === paymentMethods.CREDIT_CARD || payInAdvanceType === paymentMethods.AFTERPAY; if (paymentPageNavScenario) { this.$router.navigate( this.navigationScenarios.PAY_IN_ADVANCE_CREDIT_CARD_ERROR, @@ -71,10 +73,16 @@ export default { arePagePrerequisitesValid() { return true; }, - async processCreditCardResponse() { - const subscriptionId = getQuerystringParameter(queryStrings.SUBSCRIPTIONID); + async processPaypalResponse() { + const token = getQueryStringParameter(queryStrings.TOKEN); + this.mainStore.updatePaypalToken(token); - const referralSeqNum = getQuerystringParameter(queryStrings.REFERRAL_SEQ_NUM); + await this.saveAndSubmitWorkOrder(); + }, + async processCreditCardResponse() { + const subscriptionId = getQueryStringParameter(queryStrings.SUBSCRIPTIONID); + + const referralSeqNum = getQueryStringParameter(queryStrings.REFERRAL_SEQ_NUM); if (referralSeqNum !== useMainStore().order.referralSequenceNumber) { console.error(`error: unknown ref:${referralSeqNum} ${useMainStore().order.referralSequenceNumber}`); this.$router.navigate( @@ -85,19 +93,19 @@ export default { } ); } else { - const expMonth = getQuerystringParameter(queryStrings.CARD_EXPIRATION_MONTH); - const expYear = getQuerystringParameter(queryStrings.CARD_EXPIRATION_YEAR); - const cardType = getQuerystringParameter(queryStrings.CARD_TYPE); - const billToPostalCode = getQuerystringParameter(queryStrings.BILL_TO_POSTAL_CODE); - const billToFirstName = getQuerystringParameter(queryStrings.BILL_TO_FIRST_NAME); - const billToLastName = getQuerystringParameter(queryStrings.BILL_TO_LAST_NAME); - const referenceNumber = getQuerystringParameter(queryStrings.REFERENCE_NUMBER); - const authCode = getQuerystringParameter(queryStrings.AUTH_CODE); - const transactionId = getQuerystringParameter(queryStrings.TRANSACTION_ID); - const transReferenceNumber = getQuerystringParameter(queryStrings.TRANS_REFERENCE_NUMBER); - const lastFour = getQuerystringParameter(queryStrings.LAST_FOUR); + const expMonth = getQueryStringParameter(queryStrings.CARD_EXPIRATION_MONTH); + const expYear = getQueryStringParameter(queryStrings.CARD_EXPIRATION_YEAR); + const cardType = getQueryStringParameter(queryStrings.CARD_TYPE); + const billToPostalCode = getQueryStringParameter(queryStrings.BILL_TO_POSTAL_CODE); + const billToFirstName = getQueryStringParameter(queryStrings.BILL_TO_FIRST_NAME); + const billToLastName = getQueryStringParameter(queryStrings.BILL_TO_LAST_NAME); + const referenceNumber = getQueryStringParameter(queryStrings.REFERENCE_NUMBER); + const authCode = getQueryStringParameter(queryStrings.AUTH_CODE); + const transactionId = getQueryStringParameter(queryStrings.TRANSACTION_ID); + const transReferenceNumber = getQueryStringParameter(queryStrings.TRANS_REFERENCE_NUMBER); + const lastFour = getQueryStringParameter(queryStrings.LAST_FOUR); - const ccToken = { + const creditCardToken = { subscriptionId, expMonth, expYear, @@ -111,7 +119,7 @@ export default { transReferenceNumber, lastFour }; - useMainStore().updateCCToken(ccToken); + useMainStore().updateCreditCardToken(creditCardToken); await this.saveAndSubmitWorkOrder(); } }, @@ -119,9 +127,10 @@ export default { // Final work order submit after returning from pay in advance. useMainStore().resetSubmittedOrder(); try { - // do we have a function to submit a work order, - // perhaps built into saveSession? - // we need to submit the work order here + await submitWorkOrder({ + pageNameToLog: 'payment-return', + submitAfterSave: true + }); } catch (error) { console.error(`error: response from submit work order:${error.message}`); this.$router.navigate( @@ -131,9 +140,11 @@ export default { [queryStrings.DISPLAY_PAY_IN_ADVANCE_ALERT]: true } ); + showIssLoadingModal(false); return; } + showIssLoadingModal(false); useMainStore().createSubmittedOrder(); this.$router.navigate( this.navigationScenarios.PAY_IN_ADVANCE_SUCCESS, diff --git a/src/router/index.js b/src/router/index.js index 4cd2dc45..fda08794 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2,7 +2,7 @@ import { createWebHistory, createRouter } from 'vue-router'; import lazyLoadComponent from '@/router/dynamic-routing/component-loader'; import issPageValues from '@/router/router-constants/issPage-values'; -import { routingTable } from '@/router/router-constants/routing-table'; +import routingTable from '@/router/router-constants/routing-table'; import { useMainStore } from '@/store'; import eventBus from '@/helpers/event-bus/event-bus'; import { globalEvents, globalEventTypes } from '@/constants/events'; @@ -16,11 +16,9 @@ import showIssLoadingModal from '@/helpers/loading-modal-helper'; import analyticsMixin from '@/mixins/analytics-mixin'; import { saveSession } from '@/helpers/order-helper.js'; import routerParams from '@/router/router-constants/router-params'; -import bailoutCode from '@/constants/bailoutCode'; -import IssPageValues from '@/router/router-constants/issPage-values'; +import canBailoutNavigateBack from '@/helpers/bailout-helper'; +import bailoutMessage from '@/constants/bailoutMessage'; import navigationScenarios from './router-constants/navigation-scenarios'; -import canBailoutNavigateBack from "@/helpers/bailout-helper"; -import bailoutMessage from "@/constants/bailoutMessage"; const routes = [ { @@ -129,7 +127,7 @@ router.beforeEach(async (to, from) => { showIssLoadingModal(true); } - const isInIframe = fromQueryPage === IssPageValues.PAYMENT_PAGE; + const isInIframe = fromQueryPage === issPageValues.PAYMENT_PAGE; if (isInIframe) { // need to set window.top.location.href directly when navigating out of an iframe // especially when navigating with browser buttons @@ -139,7 +137,7 @@ router.beforeEach(async (to, from) => { const store = useMainStore(); // Prevent navigating backwards if we enter a bailout that we are not allowed to go back on - if (store.isBailout && from.name === IssPageValues.BAILOUT_PAGE && to.name !== 'root' && to.name !== IssPageValues.CONTACT_CONFIRMATION + if (store.isBailout && from.name === issPageValues.BAILOUT_PAGE && to.name !== 'root' && to.name !== issPageValues.CONTACT_CONFIRMATION && !canBailoutNavigateBack()) { return false; } diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 60d76dcd..99582af8 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -655,7 +655,7 @@ const routingTable = () => [ { scenario: navigationScenarios.PAY_IN_ADVANCE_SUCCESS, destinationIssPageValue: issPageValues.CONFIRMATION - }, + } ] }, { @@ -763,4 +763,4 @@ const routingTable = () => [ ]; -export { routingTable }; +export default routingTable; diff --git a/src/store/index.js b/src/store/index.js index cc1b2986..6d8f8084 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -157,7 +157,8 @@ const getDefaultState = () => ({ parentAccountNumber: 0, isPayInAdvance: null, payInAdvanceType: null, - ccToken: { + paypalToken: null, + creditCardToken: { subscriptionId: null, expMonth: null, expYear: null, @@ -1202,7 +1203,7 @@ export const useMainStore = defineStore({ submitToMainframe: !!this.order.referralNumber, loadedFromDupeCheck }, - additionalSuccessEventDataHandler: (response) => + additionalSuccessEventDataHandler: () => `Email provided: ${customer.emailAddress ? 'true' : 'false'}` }).then((response) => { if (loadedFromDupeCheck) { @@ -1304,7 +1305,23 @@ export const useMainStore = defineStore({ throw ex; } }, - + updateCreditCardToken(token) { + this.order.payment.creditCardToken.subscriptionId = token.subscriptionId; + this.order.payment.creditCardToken.expMonth = token.expMonth; + this.order.payment.creditCardToken.expYear = token.expYear; + this.order.payment.creditCardToken.cardType = token.cardType; + this.order.payment.creditCardToken.billToPostalCode = token.billToPostalCode; + this.order.payment.creditCardToken.billToFirstName = token.billToFirstName; + this.order.payment.creditCardToken.billToLastName = token.billToLastName; + this.order.payment.creditCardToken.referenceNumber = token.referenceNumber; + this.order.payment.creditCardToken.authCode = token.authCode; + this.order.payment.creditCardToken.transactionId = token.transactionId; + this.order.payment.creditCardToken.transReferenceNumber = token.transReferenceNumber; + this.order.payment.creditCardToken.lastFour = token.lastFour; + }, + updatePaypalToken(token) { + this.order.payment.paypalToken = token; + }, setSaveSessionPromise(promise) { this.applicationUser.saveSessionPromise = promise; }, @@ -1399,7 +1416,7 @@ export const useMainStore = defineStore({ this.order.vehicle.registration.firstName = null; this.order.vehicle.registration.lastName = null; }, - resetServiceLocationAndDependencies(context) { + resetServiceLocationAndDependencies() { this.resetServiceLocationAppointmentType(); this.resetServiceLocationProvider(); this.resetSchedule(); @@ -2130,7 +2147,6 @@ export const useMainStore = defineStore({ this.resetInsurance(); this.resetBailout(); }, - savePaymentMethodChoice(paymentMethod) { const isPayInAdvance = paymentMethod !== paymentMethods.PAY_AT_TIME_OF_SERVICE; this.order.payment.isPayInAdvance = isPayInAdvance; @@ -2144,21 +2160,6 @@ export const useMainStore = defineStore({ }); }, - updateCCToken(ccToken) { - this.order.payment.ccToken.subscriptionId = ccToken.subscriptionId; - this.order.payment.ccToken.expMonth = ccToken.expMonth; - this.order.payment.ccToken.expYear = ccToken.expYear; - this.order.payment.ccToken.cardType = ccToken.cardType; - this.order.payment.ccToken.billToPostalCode = ccToken.billToPostalCode; - this.order.payment.ccToken.billToFirstName = ccToken.billToFirstName; - this.order.payment.ccToken.billToLastName = ccToken.billToLastName; - this.order.payment.ccToken.referenceNumber = ccToken.referenceNumber; - this.order.payment.ccToken.authCode = ccToken.authCode; - this.order.payment.ccToken.transactionId = ccToken.transactionId; - this.order.payment.ccToken.transReferenceNumber = ccToken.transReferenceNumber; - this.order.payment.ccToken.lastFour = ccToken.lastFour; - }, - hasSubmittedOrder() { return window.sessionStorage.getItem(webStorageConstants.SUBMITTED_ORDER) !== null; }, @@ -2183,7 +2184,7 @@ export const useMainStore = defineStore({ resetSubmittedOrder() { // clear from local storage window.sessionStorage.removeItem(webStorageConstants.SUBMITTED_ORDER); - }, + } }, persist: true From 9fd65de29ef1c5f3d421becc8d784127b91798fd Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Tue, 5 Mar 2024 10:43:50 -0500 Subject: [PATCH 07/14] but missing function back --- src/store/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index 6d8f8084..2efd6470 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -949,7 +949,17 @@ export const useMainStore = defineStore({ }).then((response) => resolve(response), (error) => reject(error)); }); }, - + 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)); + }); + }, async getSupportingItems() { const { glassParts } = this.lineItems; const { carId } = this.vehicle; From cf850358ae8b2591a37f5d4bb6bd053094482ff2 Mon Sep 17 00:00:00 2001 From: Michaela Brydon Date: Tue, 5 Mar 2024 10:44:35 -0500 Subject: [PATCH 08/14] Reverting problematic change --- src/store/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 3ba028ec..5017c884 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -950,7 +950,6 @@ export const useMainStore = defineStore({ const { glassParts } = this.lineItems; const { carId } = this.vehicle; const { isRepair, numberOfChips } = this.damage; - const { parentAccountNumber } = this.issConfig; return globalMethods .callHttpClient({ @@ -959,7 +958,7 @@ export const useMainStore = defineStore({ payload: { carId, damageType: isRepair ? 'Repair' : 'Replace', - parentAccountNumber, + parentAccountNumber: applicationConfig.CASH_PARENT_ACCOUNT_NUMBER, parts: glassParts ?? [], numberOfRepairChips: isRepair ? numberOfChips : 0 } From 844d1b0215ab3cc5a7f13f2e8cddde0f32d095e3 Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Tue, 5 Mar 2024 11:22:00 -0500 Subject: [PATCH 09/14] unit tests --- .../order-confirmation.spec.js | 110 +++++++++++++++++- .../order-confirmation/order-confirmation.vue | 2 +- 2 files changed, 108 insertions(+), 4 deletions(-) diff --git a/src/layouts/order-confirmation/order-confirmation.spec.js b/src/layouts/order-confirmation/order-confirmation.spec.js index 590b5c1b..1984ef04 100644 --- a/src/layouts/order-confirmation/order-confirmation.spec.js +++ b/src/layouts/order-confirmation/order-confirmation.spec.js @@ -12,10 +12,18 @@ import { createTestingPinia } from '@pinia/testing'; jest.mock('@/helpers/layout-helper.js', () => jest.fn()); jest.mock('@/helpers/cms-content-helper', () => ({ - fetchCmsContentForPage: jest.fn() + fetchCmsContentForPage: jest.fn(), + processIfStatements: jest.fn() })); const wordingText = 'wording Text {custom:address}'; +const inShopDuration = '60-90 minutes'; +jest.mock('@/helpers/date-helper', () => ({ + getDisplayTextForDurationLength: jest.fn().mockImplementation(() => inShopDuration), + convertDateStringToDate: jest.fn(), + get12HourTimeFormat: jest.fn() +})); + const mockMixin = { methods: { getCmsContent: jest.fn().mockImplementation(() => wordingText), @@ -34,12 +42,18 @@ const headerStub = { render: () => {} }; +const vehicleBannerStub = { + render: () => {} +}; + const initialStore = { order: { schedule: { date: '2024-03-01', startTime: '09:00', - endTime: '10:00' + endTime: '10:00', + jobMinMinutes: 60, + jobMaxMinutes: 90 }, serviceLocation: { address: '123 Test Way', @@ -70,7 +84,8 @@ function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRu mountOptions.global.stubs = { siteFooter: footerStub, - siteHeader: headerStub + siteHeader: headerStub, + vehicleBanner: vehicleBannerStub }; const testingPinia = createTestingPinia({ @@ -110,6 +125,16 @@ describe('OrderConfirmation.vue', () => { // Assert expect(siteHeader.exists()).toBe(true); }); + test('Should render Vehicle Banner', () => { + // Arrange + const { wrapper } = getMountedComponent(initialStore); + + // Act + const vehicleBanner = wrapper.findComponent(vehicleBannerStub); + + // Assert + expect(vehicleBanner.exists()).toBe(true); + }); test('If Advanced flow, should display Site Footer', () => { // Arrange const testStore = { @@ -324,5 +349,84 @@ describe('OrderConfirmation.vue', () => { // Assert expect(testValue).toEqual('
123 Safelite Street,
Mesa, AZ 12345
'); }); + test('appointmentWordingText2 should return Mobile text in expected format', () => { + // Arrange + const testStore = { + order: { + schedule: { + date: '2019-01-01', + startTime: '09:00', + endTime: '10:00' + }, + serviceLocation: { + address: '123 Test Way', + address2: '#1', + city: 'Mesa', + state: 'AZ', + zipCode: '12345', + appointmentType: 'Mobile' + } + } + }; + const { wrapper } = getMountedComponent(testStore); + + // Act + const testValue = wrapper.vm.appointmentWordingText2; + + // Assert + expect(testValue).toEqual(wordingText); + }); + test('appointmentWordingText2 should return Drop Off and text in expected format', () => { + // Arrange + const testStore = { + order: { + schedule: { + date: '2019-01-01', + startTime: '09:00', + endTime: '10:00' + }, + serviceLocation: { + provider: { + address: { + streetAddress: '123 Safelite Street', + city: 'Mesa', + state: 'AZ', + zipCode: '12345' + } + }, + appointmentType: 'Drop Off' + } + } + }; + const { wrapper } = getMountedComponent(testStore); + + // Act + const testValue = wrapper.vm.appointmentWordingText2; + const expected = wrapper.vm.getBodyText2FromCms('Test Widget'); + + // Assert + expect(testValue).toEqual(expected); + }); + test('appointmentWordingText2 should return In Shop text in expected format', () => { + // Arrange + const { wrapper } = getMountedComponent(initialStore); + + // Act + const testValue = wrapper.vm.appointmentWordingText2; + const expected = wrapper.vm.getBodyText2FromCms('Test Widget'); + + // Assert + expect(testValue).toEqual(expected); + }); + test('inShopAppointmentDuration should return appointment length', () => { + // Arrange + const { wrapper } = getMountedComponent(initialStore); + + // Act + const testValue = wrapper.vm.inShopAppointmentDuration; + + // Assert + expect(testValue).toEqual(inShopDuration); + }); }); }); diff --git a/src/layouts/order-confirmation/order-confirmation.vue b/src/layouts/order-confirmation/order-confirmation.vue index 4b299b07..25911e24 100644 --- a/src/layouts/order-confirmation/order-confirmation.vue +++ b/src/layouts/order-confirmation/order-confirmation.vue @@ -120,7 +120,7 @@ export default { // This conversion ensures we don't get get GMT induced date changes const dateObject = convertDateStringToDate(this.appointmentDate); // Ex: Tuesday, April 22 - return dateObject.toLocaleDateString('en-us', { + return dateObject?.toLocaleDateString('en-us', { weekday: 'long', month: 'long', day: 'numeric' From b8712cbf5ef15051c9ffbf48baefef5b996a87ca Mon Sep 17 00:00:00 2001 From: Matt Caimi Date: Tue, 5 Mar 2024 11:24:47 -0500 Subject: [PATCH 10/14] SSR-1081 break up processCreditCardResponse --- src/layouts/payment-return/payment-return.vue | 73 ++++++++----------- 1 file changed, 30 insertions(+), 43 deletions(-) diff --git a/src/layouts/payment-return/payment-return.vue b/src/layouts/payment-return/payment-return.vue index 329badf9..8e5d3de6 100644 --- a/src/layouts/payment-return/payment-return.vue +++ b/src/layouts/payment-return/payment-return.vue @@ -23,6 +23,24 @@ export default { Form }, mixins: [BaseFormMixin], + computed: { + creditCardToken() { + return { + subscriptionId: getQueryStringParameter(queryStrings.SUBSCRIPTIONID), + expMonth: getQueryStringParameter(queryStrings.CARD_EXPIRATION_MONTH), + expYear: getQueryStringParameter(queryStrings.CARD_EXPIRATION_YEAR), + cardType: getQueryStringParameter(queryStrings.CARD_TYPE), + billToPostalCode: getQueryStringParameter(queryStrings.BILL_TO_POSTAL_CODE), + billToFirstName: getQueryStringParameter(queryStrings.BILL_TO_FIRST_NAME), + billToLastName: getQueryStringParameter(queryStrings.BILL_TO_LAST_NAME), + referenceNumber: getQueryStringParameter(queryStrings.REFERENCE_NUMBER), + authCode: getQueryStringParameter(queryStrings.AUTH_CODE), + transactionId: getQueryStringParameter(queryStrings.TRANSACTION_ID), + transReferenceNumber: getQueryStringParameter(queryStrings.TRANS_REFERENCE_NUMBER), + lastFour: getQueryStringParameter(queryStrings.LAST_FOUR) + }; + } + }, async mounted() { showIssLoadingModal(true); const payInAdvanceError = getQueryStringParameter(queryStrings.ERROR); @@ -73,6 +91,15 @@ export default { arePagePrerequisitesValid() { return true; }, + navigateOnPayInAdvanceError() { + this.$router.navigate( + this.navigationScenarios.PAY_IN_ADVANCE_ERROR, + this.$route, + { + [queryStrings.DISPLAY_PAY_IN_ADVANCE_ALERT]: true + } + ); + }, async processPaypalResponse() { const token = getQueryStringParameter(queryStrings.TOKEN); this.mainStore.updatePaypalToken(token); @@ -80,46 +107,12 @@ export default { await this.saveAndSubmitWorkOrder(); }, async processCreditCardResponse() { - const subscriptionId = getQueryStringParameter(queryStrings.SUBSCRIPTIONID); - const referralSeqNum = getQueryStringParameter(queryStrings.REFERRAL_SEQ_NUM); if (referralSeqNum !== useMainStore().order.referralSequenceNumber) { console.error(`error: unknown ref:${referralSeqNum} ${useMainStore().order.referralSequenceNumber}`); - this.$router.navigate( - this.navigationScenarios.PAY_IN_ADVANCE_ERROR, - this.$route, - { - [queryStrings.DISPLAY_PAY_IN_ADVANCE_ALERT]: true - } - ); + this.navigateOnPayInAdvanceError(); } else { - const expMonth = getQueryStringParameter(queryStrings.CARD_EXPIRATION_MONTH); - const expYear = getQueryStringParameter(queryStrings.CARD_EXPIRATION_YEAR); - const cardType = getQueryStringParameter(queryStrings.CARD_TYPE); - const billToPostalCode = getQueryStringParameter(queryStrings.BILL_TO_POSTAL_CODE); - const billToFirstName = getQueryStringParameter(queryStrings.BILL_TO_FIRST_NAME); - const billToLastName = getQueryStringParameter(queryStrings.BILL_TO_LAST_NAME); - const referenceNumber = getQueryStringParameter(queryStrings.REFERENCE_NUMBER); - const authCode = getQueryStringParameter(queryStrings.AUTH_CODE); - const transactionId = getQueryStringParameter(queryStrings.TRANSACTION_ID); - const transReferenceNumber = getQueryStringParameter(queryStrings.TRANS_REFERENCE_NUMBER); - const lastFour = getQueryStringParameter(queryStrings.LAST_FOUR); - - const creditCardToken = { - subscriptionId, - expMonth, - expYear, - cardType, - billToPostalCode, - billToFirstName, - billToLastName, - referenceNumber, - authCode, - transactionId, - transReferenceNumber, - lastFour - }; - useMainStore().updateCreditCardToken(creditCardToken); + useMainStore().updateCreditCardToken(this.creditCardToken); await this.saveAndSubmitWorkOrder(); } }, @@ -133,13 +126,7 @@ export default { }); } catch (error) { console.error(`error: response from submit work order:${error.message}`); - this.$router.navigate( - this.navigationScenarios.PAY_IN_ADVANCE_ERROR, - this.$route, - { - [queryStrings.DISPLAY_PAY_IN_ADVANCE_ALERT]: true - } - ); + this.navigateOnPayInAdvanceError(); showIssLoadingModal(false); return; } From 2f5883be5a5f6c291834f8ac99b3049025a7b8b7 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Tue, 5 Mar 2024 11:34:08 -0500 Subject: [PATCH 11/14] fix a merge issue --- src/store/index.js | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 0bbf894c..b0d7fb10 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -20,7 +20,6 @@ import { noCoverageForSelectedVehicle, repairWaivedForSelectedVehicle } from '@/helpers/policy-vehicle-helper'; -import webStorageConstants from '@/constants/web-storage-constants'; const storeId = 'main'; @@ -2196,48 +2195,6 @@ export const useMainStore = defineStore({ // clear from local storage window.sessionStorage.removeItem(webStorageConstants.SUBMITTED_ORDER); } - - updateCCToken(ccToken) { - this.order.payment.ccToken.subscriptionId = ccToken.subscriptionId; - this.order.payment.ccToken.expMonth = ccToken.expMonth; - this.order.payment.ccToken.expYear = ccToken.expYear; - this.order.payment.ccToken.cardType = ccToken.cardType; - this.order.payment.ccToken.billToPostalCode = ccToken.billToPostalCode; - this.order.payment.ccToken.billToFirstName = ccToken.billToFirstName; - this.order.payment.ccToken.billToLastName = ccToken.billToLastName; - this.order.payment.ccToken.referenceNumber = ccToken.referenceNumber; - this.order.payment.ccToken.authCode = ccToken.authCode; - this.order.payment.ccToken.transactionId = ccToken.transactionId; - this.order.payment.ccToken.transReferenceNumber = ccToken.transReferenceNumber; - this.order.payment.ccToken.lastFour = ccToken.lastFour; - }, - - hasSubmittedOrder() { - return window.sessionStorage.getItem(webStorageConstants.SUBMITTED_ORDER) !== null; - }, - - createSubmittedOrder() { - if (this.hasSubmittedOrder()) { - return; - } - const submittedOrder = this.order; - const { experiments } = this.applicationUser; - - // set to local storage - window.sessionStorage.setItem(webStorageConstants.SUBMITTED_ORDER, JSON.stringify(submittedOrder)); - - // clear vuex - this.resetState(); - - // restore user's experiments - this.applicationUser.experiments = experiments; - }, - - resetSubmittedOrder() { - // clear from local storage - window.sessionStorage.removeItem(webStorageConstants.SUBMITTED_ORDER); - }, - }, persist: true }); From ddb49a8e7ce2fb85d06ed74dd7669b9119d68b91 Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Tue, 5 Mar 2024 13:26:12 -0500 Subject: [PATCH 12/14] final fixes --- .../order-confirmation.spec.js | 17 ----------------- .../order-confirmation/order-confirmation.vue | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/layouts/order-confirmation/order-confirmation.spec.js b/src/layouts/order-confirmation/order-confirmation.spec.js index 1984ef04..d53eacbd 100644 --- a/src/layouts/order-confirmation/order-confirmation.spec.js +++ b/src/layouts/order-confirmation/order-confirmation.spec.js @@ -17,13 +17,6 @@ jest.mock('@/helpers/cms-content-helper', () => ({ })); const wordingText = 'wording Text {custom:address}'; -const inShopDuration = '60-90 minutes'; -jest.mock('@/helpers/date-helper', () => ({ - getDisplayTextForDurationLength: jest.fn().mockImplementation(() => inShopDuration), - convertDateStringToDate: jest.fn(), - get12HourTimeFormat: jest.fn() -})); - const mockMixin = { methods: { getCmsContent: jest.fn().mockImplementation(() => wordingText), @@ -418,15 +411,5 @@ describe('OrderConfirmation.vue', () => { // Assert expect(testValue).toEqual(expected); }); - test('inShopAppointmentDuration should return appointment length', () => { - // Arrange - const { wrapper } = getMountedComponent(initialStore); - - // Act - const testValue = wrapper.vm.inShopAppointmentDuration; - - // Assert - expect(testValue).toEqual(inShopDuration); - }); }); }); diff --git a/src/layouts/order-confirmation/order-confirmation.vue b/src/layouts/order-confirmation/order-confirmation.vue index 25911e24..4b299b07 100644 --- a/src/layouts/order-confirmation/order-confirmation.vue +++ b/src/layouts/order-confirmation/order-confirmation.vue @@ -120,7 +120,7 @@ export default { // This conversion ensures we don't get get GMT induced date changes const dateObject = convertDateStringToDate(this.appointmentDate); // Ex: Tuesday, April 22 - return dateObject?.toLocaleDateString('en-us', { + return dateObject.toLocaleDateString('en-us', { weekday: 'long', month: 'long', day: 'numeric' From a1b66955220c44c7bc272d858cc644d8db4ab272 Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Tue, 5 Mar 2024 14:05:00 -0500 Subject: [PATCH 13/14] PR feedback refactoring, unit test fixes --- .../order-confirmation.spec.js | 6 ++--- .../order-confirmation/order-confirmation.vue | 27 ++++++++++--------- src/store/index.js | 1 + 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/layouts/order-confirmation/order-confirmation.spec.js b/src/layouts/order-confirmation/order-confirmation.spec.js index d53eacbd..5883b9d1 100644 --- a/src/layouts/order-confirmation/order-confirmation.spec.js +++ b/src/layouts/order-confirmation/order-confirmation.spec.js @@ -233,7 +233,7 @@ describe('OrderConfirmation.vue', () => { endTime: '10:00' }, serviceLocation: { - appointmentType: 'Drop Off' + appointmentType: 'Dropoff' } } }; @@ -300,7 +300,7 @@ describe('OrderConfirmation.vue', () => { zipCode: '12345' } }, - appointmentType: 'Drop Off' + appointmentType: 'Dropoff' } } }; @@ -387,7 +387,7 @@ describe('OrderConfirmation.vue', () => { zipCode: '12345' } }, - appointmentType: 'Drop Off' + appointmentType: 'Dropoff' } } }; diff --git a/src/layouts/order-confirmation/order-confirmation.vue b/src/layouts/order-confirmation/order-confirmation.vue index 4b299b07..d6c7b2d2 100644 --- a/src/layouts/order-confirmation/order-confirmation.vue +++ b/src/layouts/order-confirmation/order-confirmation.vue @@ -61,6 +61,7 @@ import { useMainStore } from '@/store'; import { get12HourTimeFormat, get12HourTimeMobileFormat, convertDateStringToDate, getDisplayTextForDurationLength } from '@/helpers/date-helper.js'; import { toTitleCase } from '@/helpers/text-helper.js'; +import { AppointmentTypeStrings } from '@/constants/schedule-constants'; export default { name: 'order-confirmation', @@ -105,7 +106,7 @@ export default { return this.getCmsContent('OrderConfirmationContent', 'Image'); }, appointmentType() { - return this.mainStore.order.serviceLocation.appointmentType.toUpperCase(); + return this.mainStore.order.serviceLocation.appointmentType; }, appointmentDate() { return this.mainStore.order.schedule.date; @@ -179,17 +180,17 @@ export default { }, appointmentWordingText() { switch (this.appointmentType) { - case 'MOBILE': + case AppointmentTypeStrings.MOBILE || AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP: return this.mobileWordingText?.replaceAll( '{custom:address}', this.serviceLocationFullAddress ); - case 'DROP OFF': + case AppointmentTypeStrings.DROP_OFF: return this.dropOffAndInShopWordingText?.replaceAll( '{custom:address}', this.providerFullAddress ); - case 'INSHOP': + case AppointmentTypeStrings.IN_SHOP: return this.dropOffAndInShopWordingText?.replaceAll( '{custom:address}', this.providerFullAddress @@ -200,11 +201,11 @@ export default { }, appointmentWordingText2() { switch (this.appointmentType) { - case 'MOBILE': + case AppointmentTypeStrings.MOBILE || AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP: return this.mobileWordingText2; - case 'DROP OFF': + case AppointmentTypeStrings.DROP_OFF: return this.dropOffAndInShopWordingText2; - case 'INSHOP': + case AppointmentTypeStrings.IN_SHOP: return this.dropOffAndInShopWordingText2?.replaceAll( '{custom:inShopDuration}', this.inShopAppointmentDuration @@ -214,13 +215,13 @@ export default { } }, mobileAppointment() { - return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'MOBILE'; + return useMainStore().getters.isMobileAppointment; }, inShopAppointment() { - return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'INSHOP'; + return useMainStore().getters.isInShopAppointment; }, dropOffAppointment() { - return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'DROP OFF'; + return useMainStore().getters.isDropOffAppointment; }, inShopAppointmentDuration() { const inshopDurationTime = getDisplayTextForDurationLength( @@ -241,12 +242,12 @@ export default { }, formatAppointmentTime(appointmentType) { switch (appointmentType) { - case 'MOBILE': + case AppointmentTypeStrings.MOBILE || AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP: // eslint-disable-next-line max-len return `Between ${get12HourTimeMobileFormat(this.appointmentStartTime)} - ${get12HourTimeMobileFormat(this.appointmentEndTime)}`; - case 'DROP OFF': + case AppointmentTypeStrings.DROP_OFF: return 'Drop off before 9:30 AM'; - case 'INSHOP': + case AppointmentTypeStrings.IN_SHOP: return `at ${get12HourTimeFormat(this.appointmentStartTime)}`; default: return null; diff --git a/src/store/index.js b/src/store/index.js index 5017c884..e34a7fcd 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -237,6 +237,7 @@ export const useMainStore = defineStore({ isMobileAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE || state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP, isDropOffAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.DROP_OFF, + isInShopAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.IN_SHOP, isClaimRegistrationRequired: (state) => state.issConfig.isClaimRegistrationRequired, isClaimAlreadyRegistered: (state) => state.order.payment.insuranceCoverage.claimNumber !== null, isBailout: (state) => state.applicationUser.pageData[issPageValues.BAILOUT_PAGE] != null, From 018e27679afb67706f3cf004621667b526b1a1a6 Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Tue, 5 Mar 2024 14:22:12 -0500 Subject: [PATCH 14/14] logic/prereq updates --- .../order-confirmation/order-confirmation.vue | 15 +++++++++------ src/layouts/payment-method/payment-method.vue | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/layouts/order-confirmation/order-confirmation.vue b/src/layouts/order-confirmation/order-confirmation.vue index d6c7b2d2..f1bddf9e 100644 --- a/src/layouts/order-confirmation/order-confirmation.vue +++ b/src/layouts/order-confirmation/order-confirmation.vue @@ -180,7 +180,8 @@ export default { }, appointmentWordingText() { switch (this.appointmentType) { - case AppointmentTypeStrings.MOBILE || AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP: + case AppointmentTypeStrings.MOBILE: + case AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP: return this.mobileWordingText?.replaceAll( '{custom:address}', this.serviceLocationFullAddress @@ -201,7 +202,8 @@ export default { }, appointmentWordingText2() { switch (this.appointmentType) { - case AppointmentTypeStrings.MOBILE || AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP: + case AppointmentTypeStrings.MOBILE: + case AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP: return this.mobileWordingText2; case AppointmentTypeStrings.DROP_OFF: return this.dropOffAndInShopWordingText2; @@ -215,13 +217,13 @@ export default { } }, mobileAppointment() { - return useMainStore().getters.isMobileAppointment; + return this.mainStore.isMobileAppointment; }, inShopAppointment() { - return useMainStore().getters.isInShopAppointment; + return this.mainStore.isInShopAppointment; }, dropOffAppointment() { - return useMainStore().getters.isDropOffAppointment; + return this.mainStore.isDropOffAppointment; }, inShopAppointmentDuration() { const inshopDurationTime = getDisplayTextForDurationLength( @@ -242,7 +244,8 @@ export default { }, formatAppointmentTime(appointmentType) { switch (appointmentType) { - case AppointmentTypeStrings.MOBILE || AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP: + case AppointmentTypeStrings.MOBILE: + case AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP: // eslint-disable-next-line max-len return `Between ${get12HourTimeMobileFormat(this.appointmentStartTime)} - ${get12HourTimeMobileFormat(this.appointmentEndTime)}`; case AppointmentTypeStrings.DROP_OFF: diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 8b03a875..ab362f4c 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -178,7 +178,8 @@ export default { && providerLocation.zipCode ); - const isMobile = serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE; + const isMobile = serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE + || serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP; const serviceLocationReqs = (isMobile && mobileReqs) || (!isMobile && dropOffInshopReqs);