Merge branch 'develop' into feature/SSR-1114
This commit is contained in:
commit
7f53105827
31 changed files with 1006 additions and 553 deletions
|
|
@ -45,7 +45,8 @@ module.exports = {
|
||||||
}],
|
}],
|
||||||
'import/extensions': ['error', 'always', { js: 'ignorePackages' }],
|
'import/extensions': ['error', 'always', { js: 'ignorePackages' }],
|
||||||
'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: ['item'] }],
|
'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: ['item'] }],
|
||||||
'no-restricted-syntax': ['off', 'ForOfStatement']
|
'no-restricted-syntax': ['off', 'ForOfStatement'],
|
||||||
|
'no-return-await': 'off'
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
'import/resolver': {
|
'import/resolver': {
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@ const applicationConfig = Object.freeze({
|
||||||
SAFELITE_HOP: process.env.VUE_APP_SAFELITE_HOP,
|
SAFELITE_HOP: process.env.VUE_APP_SAFELITE_HOP,
|
||||||
ISS_DEV_CMS_DOMAIN: 'https://digitalisscms.dev.safelite.io',
|
ISS_DEV_CMS_DOMAIN: 'https://digitalisscms.dev.safelite.io',
|
||||||
CASH_PARENT_ACCOUNT_NUMBER: 167132,
|
CASH_PARENT_ACCOUNT_NUMBER: 167132,
|
||||||
ITAC_FAIR_AND_REASONABLE_BILLTO: '214616', // Lib Mutal FnR BillTo
|
|
||||||
ITAC_CASH_BILLTO: '283393', // Lib Mutal ITAC Cash BillTo
|
|
||||||
GOOGLE_CALENDAR: 'https://www.google.com/calendar/render?action=TEMPLATE',
|
GOOGLE_CALENDAR: 'https://www.google.com/calendar/render?action=TEMPLATE',
|
||||||
YAHOO_CALENDAR: 'https://calendar.yahoo.com/?v=60',
|
YAHOO_CALENDAR: 'https://calendar.yahoo.com/?v=60',
|
||||||
OUTLOOK_CALENDAR:
|
OUTLOOK_CALENDAR:
|
||||||
|
|
|
||||||
8
src/constants/coverage-statement-page-variations.js
Normal file
8
src/constants/coverage-statement-page-variations.js
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
const coverageStatementPageVariations = Object.freeze({
|
||||||
|
DEDUCTIBLE: 0,
|
||||||
|
ITAC: 1,
|
||||||
|
NO_COMP: 2,
|
||||||
|
UNVERIFIED: 3
|
||||||
|
});
|
||||||
|
|
||||||
|
export default coverageStatementPageVariations;
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
const CONTENT_BASE_URL = '/content/api/v1/content';
|
|
||||||
const LOCATION_BASE_URL = '/location/api/v1/location';
|
|
||||||
const SCHEDULE_BASE_URL = '/schedule/api/v1/schedule';
|
|
||||||
const PARTS_BASE_URL = '/parts/api/v1/parts';
|
|
||||||
const VEHICLE_BASE_URL = '/vehicle/api/v1/vehicle';
|
|
||||||
const PRICE_BASE_URL = '/price/api/v1/price';
|
|
||||||
const ACCOUNT_BASE_URL = '/account/api/v1/account';
|
const ACCOUNT_BASE_URL = '/account/api/v1/account';
|
||||||
const EXPERIMENTS_BASE_URL = '/experiments/api/v1/experiments';
|
|
||||||
const ANALYTICS_BASE_URL = '/analytics/api/v1/analytics';
|
const ANALYTICS_BASE_URL = '/analytics/api/v1/analytics';
|
||||||
const CLIENT_AUTH_BASE_URL = '/clientauth/api/v1/clientauth';
|
const CLIENT_AUTH_BASE_URL = '/clientauth/api/v1/clientauth';
|
||||||
|
const CONTENT_BASE_URL = '/content/api/v1/content';
|
||||||
const COVERAGE_BASE_URL = '/coverage/api/v1/coverage';
|
const COVERAGE_BASE_URL = '/coverage/api/v1/coverage';
|
||||||
|
const EXPERIMENTS_BASE_URL = '/experiments/api/v1/experiments';
|
||||||
|
const LOCATION_BASE_URL = '/location/api/v1/location';
|
||||||
const ORDER_BASE_URL = '/order/api/v1/order';
|
const ORDER_BASE_URL = '/order/api/v1/order';
|
||||||
|
const PARTS_BASE_URL = '/parts/api/v1/parts';
|
||||||
|
const PRICE_BASE_URL = '/price/api/v1/price';
|
||||||
|
const SCHEDULE_BASE_URL = '/schedule/api/v1/schedule';
|
||||||
|
const VEHICLE_BASE_URL = '/vehicle/api/v1/vehicle';
|
||||||
|
|
||||||
const endpoints = Object.freeze({
|
const endpoints = Object.freeze({
|
||||||
GetRouteInfo: {
|
GetRouteInfo: {
|
||||||
|
|
@ -24,6 +24,10 @@ const endpoints = Object.freeze({
|
||||||
url: (applicationAbbreviation, pageName) => `${CONTENT_BASE_URL}/${applicationAbbreviation}/${pageName}`,
|
url: (applicationAbbreviation, pageName) => `${CONTENT_BASE_URL}/${applicationAbbreviation}/${pageName}`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
},
|
},
|
||||||
|
GetBillToInfo: {
|
||||||
|
url: `${ACCOUNT_BASE_URL}/bill-to-info`,
|
||||||
|
method: 'POST'
|
||||||
|
},
|
||||||
GetAlertReasons: {
|
GetAlertReasons: {
|
||||||
url: `${LOCATION_BASE_URL}/alert-reasons`,
|
url: `${LOCATION_BASE_URL}/alert-reasons`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
|
|
@ -72,10 +76,6 @@ const endpoints = Object.freeze({
|
||||||
url: `${PRICE_BASE_URL}/order-items-with-insurance-pricing`,
|
url: `${PRICE_BASE_URL}/order-items-with-insurance-pricing`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
},
|
},
|
||||||
GetPriceOrderItems: {
|
|
||||||
url: `${PRICE_BASE_URL}/order-items`,
|
|
||||||
method: 'GET'
|
|
||||||
},
|
|
||||||
GetProviders: {
|
GetProviders: {
|
||||||
url: `${LOCATION_BASE_URL}/providers`,
|
url: `${LOCATION_BASE_URL}/providers`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,18 @@ export async function getPricedMobileFeePart(serviceZipCode) {
|
||||||
if (!serviceZipCode) {
|
if (!serviceZipCode) {
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
const zipCodeData = await getZipCodeData(serviceZipCode);
|
|
||||||
|
|
||||||
// Get the Mobile Fee Part
|
// Get the Mobile Fee Part
|
||||||
const mobileFeePart = await useMainStore().getMobileFeePart();
|
const mobileFeePart = await useMainStore().getMobileFeePart();
|
||||||
|
|
||||||
|
|
||||||
|
if (mobileFeePart.data == null || mobileFeePart.data === '') {
|
||||||
|
return Promise.resolve(null);
|
||||||
|
}
|
||||||
|
|
||||||
// Get the Mobile Fee Part Price
|
// Get the Mobile Fee Part Price
|
||||||
const pricingResults = await useMainStore()
|
const pricingResults = await useMainStore()
|
||||||
.priceOrderItemsAndSaveServerData([mobileFeePart.data], serviceZipCode, zipCodeData.zipCodeCtu);
|
.getPriceOrderItems([mobileFeePart.data]);
|
||||||
|
|
||||||
return Promise.resolve(pricingResults[0]);
|
return Promise.resolve(pricingResults[0]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -313,115 +313,6 @@ describe('cart-dropdown component', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('computed', () => {
|
describe('computed', () => {
|
||||||
describe('isUnverified', () => {
|
|
||||||
test('returns false when no comp', () => {
|
|
||||||
// Arrange
|
|
||||||
const storeData = {
|
|
||||||
order: {
|
|
||||||
policy: {
|
|
||||||
isITAC: false,
|
|
||||||
noCoverage: true
|
|
||||||
},
|
|
||||||
currentDeductible: null
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
const result = wrapper.vm.isUnverified;
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
|
||||||
test('returns false when itac', () => {
|
|
||||||
// Arrange
|
|
||||||
const storeData = {
|
|
||||||
order: {
|
|
||||||
payment: {
|
|
||||||
insuranceCoverage: {
|
|
||||||
coverageStatus: coverageStatuses.PENDING
|
|
||||||
}
|
|
||||||
},
|
|
||||||
policy: {
|
|
||||||
isITAC: true
|
|
||||||
},
|
|
||||||
currentDeductible: null
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
const result = wrapper.vm.isUnverified;
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
|
||||||
test('returns false when deductible not null and verified coverage status', () => {
|
|
||||||
// Arrange
|
|
||||||
const storeData = {
|
|
||||||
order: {
|
|
||||||
payment: {
|
|
||||||
insuranceCoverage: {
|
|
||||||
coverageStatus: coverageStatuses.VERIFIED
|
|
||||||
}
|
|
||||||
},
|
|
||||||
policy: {
|
|
||||||
isITAC: false
|
|
||||||
},
|
|
||||||
currentDeductible: 23
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
const result = wrapper.vm.isUnverified;
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
|
||||||
test('returns true when not no comp, not itac, and deductible is null', () => {
|
|
||||||
// Arrange
|
|
||||||
const storeData = {
|
|
||||||
order: {
|
|
||||||
policy: {
|
|
||||||
isITAC: false,
|
|
||||||
noCoverage: false
|
|
||||||
},
|
|
||||||
currentDeductible: null
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
const result = wrapper.vm.isUnverified;
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(result).toBeTruthy();
|
|
||||||
});
|
|
||||||
test('returns true when not no comp, not itac, and coverage status is not verified', () => {
|
|
||||||
// Arrange
|
|
||||||
const storeData = {
|
|
||||||
order: {
|
|
||||||
payment: {
|
|
||||||
insuranceCoverage: {
|
|
||||||
coverageStatus: coverageStatuses.PENDING
|
|
||||||
}
|
|
||||||
},
|
|
||||||
policy: {
|
|
||||||
isITAC: false
|
|
||||||
},
|
|
||||||
currentDeductible: 12
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
const result = wrapper.vm.isUnverified;
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(result).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('amountDue', () => {
|
describe('amountDue', () => {
|
||||||
test('returns 0 when showAsPaid is true', () => {
|
test('returns 0 when showAsPaid is true', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -556,15 +447,22 @@ describe('cart-dropdown component', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const storeData = {
|
const storeData = {
|
||||||
order: {
|
order: {
|
||||||
|
policyLookupSuccessful: true,
|
||||||
|
currentDeductible: 250,
|
||||||
lineItems: {
|
lineItems: {
|
||||||
glassParts: null,
|
glassParts: null,
|
||||||
otherParts: null,
|
otherParts: null,
|
||||||
supportingItems: null,
|
supportingItems: null,
|
||||||
vaps: null
|
vaps: null
|
||||||
|
},
|
||||||
|
payment: {
|
||||||
|
insuranceCoverage: { isVerified: true }
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
isClaimRegistrationRequired: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
const { wrapper } = getMountedComponent(storeData);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -578,6 +476,8 @@ describe('cart-dropdown component', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const storeData = {
|
const storeData = {
|
||||||
order: {
|
order: {
|
||||||
|
policyLookupSuccessful: true,
|
||||||
|
currentDeductible: 250,
|
||||||
lineItems: {
|
lineItems: {
|
||||||
glassParts: [
|
glassParts: [
|
||||||
{ partType: 'mock', salesTax: null },
|
{ partType: 'mock', salesTax: null },
|
||||||
|
|
@ -591,7 +491,13 @@ describe('cart-dropdown component', () => {
|
||||||
{ partType: 'mock', salesTax: null },
|
{ partType: 'mock', salesTax: null },
|
||||||
{ partType: 'mock', salesTax: undefined }
|
{ partType: 'mock', salesTax: undefined }
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
payment: {
|
||||||
|
insuranceCoverage: { isVerified: true }
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
isClaimRegistrationRequired: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
const { wrapper } = getMountedComponent(storeData);
|
||||||
|
|
@ -606,6 +512,8 @@ describe('cart-dropdown component', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const storeData = {
|
const storeData = {
|
||||||
order: {
|
order: {
|
||||||
|
policyLookupSuccessful: true,
|
||||||
|
currentDeductible: 250,
|
||||||
lineItems: {
|
lineItems: {
|
||||||
glassParts: [{ partType: 'mock', salesTax: 10 }],
|
glassParts: [{ partType: 'mock', salesTax: 10 }],
|
||||||
supportingItems: [
|
supportingItems: [
|
||||||
|
|
@ -619,10 +527,11 @@ describe('cart-dropdown component', () => {
|
||||||
vaps: []
|
vaps: []
|
||||||
},
|
},
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: {
|
insuranceCoverage: { isVerified: false }
|
||||||
isVerified: false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
isClaimRegistrationRequired: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
const { wrapper } = getMountedComponent(storeData);
|
||||||
|
|
@ -636,15 +545,25 @@ describe('cart-dropdown component', () => {
|
||||||
|
|
||||||
test('Returns sum of vaps sales tax when coverage is unverified and order has vaps.', () => {
|
test('Returns sum of vaps sales tax when coverage is unverified and order has vaps.', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const storeData = useMainStore().$state;
|
const storeData = {
|
||||||
storeData.order.lineItems.glassParts = [
|
order: {
|
||||||
{ partType: 'mock', salesTax: 10 }
|
policyLookupSuccessful: true,
|
||||||
];
|
currentDeductible: 250,
|
||||||
storeData.order.lineItems.vaps = [
|
lineItems: {
|
||||||
{ partType: 'mock', salesTax: 1 },
|
glassParts: [{ partType: 'mock', salesTax: 10 }],
|
||||||
{ partType: 'mock', salesTax: 2 }
|
vaps: [
|
||||||
];
|
{ partType: 'mock', salesTax: 1 },
|
||||||
storeData.order.payment.insuranceCoverage.isVerified = false;
|
{ partType: 'mock', salesTax: 2 }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
payment: {
|
||||||
|
insuranceCoverage: { isVerified: false }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
isClaimRegistrationRequired: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
const { wrapper } = getMountedComponent(storeData);
|
||||||
|
|
||||||
|
|
@ -657,16 +576,30 @@ describe('cart-dropdown component', () => {
|
||||||
|
|
||||||
test('Returns Recycle Fee tax when coverage is Verified-Deductible, replace service, and no vaps.', () => {
|
test('Returns Recycle Fee tax when coverage is Verified-Deductible, replace service, and no vaps.', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const storeData = useMainStore().$state;
|
const storeData = {
|
||||||
storeData.order.currentDeductible = 250;
|
order: {
|
||||||
storeData.order.lineItems.glassParts = [
|
policyLookupSuccessful: true,
|
||||||
{ partType: 'mock', salesTax: 10, sellingPrice: 150 }
|
currentDeductible: 250,
|
||||||
];
|
lineItems: {
|
||||||
storeData.order.lineItems.supportingItems = [
|
glassParts: [{ partType: 'mock', salesTax: 10, sellingPrice: 150 }],
|
||||||
{ partNumber: partNumberStrings.RECYCLE_FEE, partType: 'mock', salesTax: 10, sellingPrice: 39.99 }
|
supportingItems: [
|
||||||
];
|
{
|
||||||
storeData.order.lineItems.vaps = null;
|
partNumber: partNumberStrings.RECYCLE_FEE,
|
||||||
storeData.order.payment.insuranceCoverage.isVerified = true;
|
partType: 'mock',
|
||||||
|
salesTax: 10,
|
||||||
|
sellingPrice: 39.99
|
||||||
|
}
|
||||||
|
],
|
||||||
|
vaps: null
|
||||||
|
},
|
||||||
|
payment: {
|
||||||
|
insuranceCoverage: { isVerified: true }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
isClaimRegistrationRequired: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
const { wrapper } = getMountedComponent(storeData);
|
||||||
|
|
||||||
|
|
@ -679,24 +612,30 @@ describe('cart-dropdown component', () => {
|
||||||
|
|
||||||
test('Returns sum of vaps + recycle fee sales tax when Verified-Deductible, replace service, and has vaps.', () => {
|
test('Returns sum of vaps + recycle fee sales tax when Verified-Deductible, replace service, and has vaps.', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const storeData = useMainStore().$state;
|
const storeData = {
|
||||||
storeData.order.currentDeductible = 250;
|
order: {
|
||||||
storeData.order.lineItems.glassParts = [
|
policyLookupSuccessful: true,
|
||||||
{ partType: 'mock', salesTax: 10, sellingPrice: 100 }
|
currentDeductible: 250,
|
||||||
];
|
lineItems: {
|
||||||
storeData.order.lineItems.otherParts = [
|
glassParts: [{ partType: 'mock', salesTax: 10, sellingPrice: 100 }],
|
||||||
{ partType: 'mock', salesTax: 10, kitPrice: 100 }
|
otherParts: [{ partType: 'mock', salesTax: 10, kitPrice: 100 }],
|
||||||
];
|
supportingItems: [
|
||||||
storeData.order.lineItems.supportingItems = [
|
{ partNumber: partNumberStrings.RECYCLE_FEE, partType: 'mock', salesTax: 10, sellingPrice: 39.99 },
|
||||||
{ partNumber: partNumberStrings.RECYCLE_FEE, partType: 'mock', salesTax: 10, sellingPrice: 39.99 },
|
{ partType: 'mock', salesTax: 10, kitPrice: 100 }
|
||||||
{ partType: 'mock', salesTax: 10, kitPrice: 100 }
|
],
|
||||||
];
|
vaps: [
|
||||||
storeData.order.lineItems.vaps = [
|
{ partType: 'mock', salesTax: 2 },
|
||||||
{ partType: 'mock', salesTax: 2 },
|
{ partType: 'mock', salesTax: 3 }
|
||||||
{ partType: 'mock', salesTax: 3 }
|
]
|
||||||
];
|
},
|
||||||
storeData.order.payment.insuranceCoverage.isVerified = true;
|
payment: {
|
||||||
|
insuranceCoverage: { isVerified: true }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
isClaimRegistrationRequired: true
|
||||||
|
}
|
||||||
|
};
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
const { wrapper } = getMountedComponent(storeData);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -708,23 +647,27 @@ describe('cart-dropdown component', () => {
|
||||||
|
|
||||||
test('Returns sum of sales tax when Verified-ITAC.', () => {
|
test('Returns sum of sales tax when Verified-ITAC.', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const storeData = useMainStore().$state;
|
const storeData = {
|
||||||
storeData.order.currentDeductible = 0;
|
order: {
|
||||||
storeData.order.lineItems.glassParts = [
|
policyLookupSuccessful: true,
|
||||||
{ partType: 'mock', salesTax: 10, sellingPrice: 100 }
|
currentDeductible: 0,
|
||||||
];
|
lineItems: {
|
||||||
storeData.order.lineItems.otherParts = [
|
glassParts: [{ partType: 'mock', salesTax: 10, sellingPrice: 100 }],
|
||||||
{ partType: 'mock', salesTax: 10, kitPrice: 100 }
|
otherParts: [{ partType: 'mock', salesTax: 10, kitPrice: 100 }],
|
||||||
];
|
supportingItems: [{ partType: 'mock', salesTax: 10, kitPrice: 100 }],
|
||||||
storeData.order.lineItems.supportingItems = [
|
vaps: [{ partType: 'mock', salesTax: 5 }]
|
||||||
{ partType: 'mock', salesTax: 10, kitPrice: 100 }
|
},
|
||||||
];
|
payment: {
|
||||||
storeData.order.lineItems.vaps = [
|
insuranceCoverage: { isVerified: true }
|
||||||
{ partType: 'mock', salesTax: 5 }
|
},
|
||||||
];
|
policy: {
|
||||||
storeData.order.payment.insuranceCoverage.isVerified = true;
|
isITAC: true
|
||||||
storeData.order.policy.isITAC = true;
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
isClaimRegistrationRequired: true
|
||||||
|
}
|
||||||
|
};
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
const { wrapper } = getMountedComponent(storeData);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -736,23 +679,28 @@ describe('cart-dropdown component', () => {
|
||||||
|
|
||||||
test('Returns sum of sales tax when Verified-NoComp.', () => {
|
test('Returns sum of sales tax when Verified-NoComp.', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const storeData = useMainStore().$state;
|
const storeData = {
|
||||||
storeData.order.currentDeductible = 0;
|
order: {
|
||||||
storeData.order.lineItems.glassParts = [
|
policyLookupSuccessful: true,
|
||||||
{ partType: 'mock', salesTax: 10, sellingPrice: 100 }
|
currentDeductible: 0,
|
||||||
];
|
lineItems: {
|
||||||
storeData.order.lineItems.otherParts = [
|
glassParts: [{ partType: 'mock', salesTax: 10, sellingPrice: 100 }],
|
||||||
{ partType: 'mock', salesTax: 10, kitPrice: 100 }
|
otherParts: [{ partType: 'mock', salesTax: 10, kitPrice: 100 }],
|
||||||
];
|
supportingItems: [{ partType: 'mock', salesTax: 10, kitPrice: 100 }],
|
||||||
storeData.order.lineItems.supportingItems = [
|
vaps: [{ partType: 'mock', salesTax: 5 }]
|
||||||
{ partType: 'mock', salesTax: 10, kitPrice: 100 }
|
},
|
||||||
];
|
payment: {
|
||||||
storeData.order.lineItems.vaps = [
|
insuranceCoverage: { isVerified: true }
|
||||||
{ partType: 'mock', salesTax: 5 }
|
},
|
||||||
];
|
policy: {
|
||||||
storeData.order.payment.insuranceCoverage.isVerified = true;
|
noCoverage: true
|
||||||
storeData.order.policy.noCoverage = true;
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
isClaimRegistrationRequired: true,
|
||||||
|
enableNoCompQuote: true
|
||||||
|
}
|
||||||
|
};
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
const { wrapper } = getMountedComponent(storeData);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -1791,21 +1739,19 @@ describe('cart-dropdown component', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const storeData = {
|
const storeData = {
|
||||||
order: {
|
order: {
|
||||||
payment: {
|
|
||||||
insuranceCoverage: {
|
|
||||||
coverageStatus: coverageStatuses.VERIFIED
|
|
||||||
}
|
|
||||||
},
|
|
||||||
policy: {
|
policy: {
|
||||||
isITAC: false
|
isITAC: false,
|
||||||
|
isNoComp: false
|
||||||
},
|
},
|
||||||
currentDeductible: 321
|
currentDeductible: 321,
|
||||||
|
policyLookupSuccessful: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
const { wrapper } = getMountedComponent(storeData);
|
||||||
const amount = 123;
|
const amount = 123;
|
||||||
const dollarAmount = '$84.00';
|
const dollarAmount = '$84.00';
|
||||||
formatAmountInDollars.mockImplementationOnce(() => dollarAmount);
|
formatAmountInDollars
|
||||||
|
.mockImplementationOnce((value) => (value === amount ? dollarAmount : 1));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.getDisplayed(amount);
|
const result = wrapper.vm.getDisplayed(amount);
|
||||||
|
|
|
||||||
|
|
@ -160,14 +160,16 @@ describe('contactDetails.vue', () => {
|
||||||
const firstName = getRandomString(4, 15);
|
const firstName = getRandomString(4, 15);
|
||||||
const lastName = getRandomString(4, 15);
|
const lastName = getRandomString(4, 15);
|
||||||
const emailAddress = getRandomString(10, 20);
|
const emailAddress = getRandomString(10, 20);
|
||||||
const phoneNumber = getRandomInt(1000000000, 9999999999);
|
const servicePhone = getRandomInt(1000000000, 9999999999).toString();
|
||||||
const mainInitialState = {
|
const mainInitialState = {
|
||||||
order: {
|
order: {
|
||||||
customer: {
|
customer: {
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress
|
||||||
phoneNumber
|
},
|
||||||
|
contactInfo: {
|
||||||
|
servicePhone
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -185,7 +187,7 @@ describe('contactDetails.vue', () => {
|
||||||
expect(wrapper.vm.firstName).toBe(firstName);
|
expect(wrapper.vm.firstName).toBe(firstName);
|
||||||
expect(wrapper.vm.lastName).toBe(lastName);
|
expect(wrapper.vm.lastName).toBe(lastName);
|
||||||
expect(wrapper.vm.emailAddress).toBe(emailAddress);
|
expect(wrapper.vm.emailAddress).toBe(emailAddress);
|
||||||
expect(wrapper.vm.phoneNumber).toBe(phoneNumber);
|
expect(wrapper.vm.phoneNumber).toBe(servicePhone);
|
||||||
});
|
});
|
||||||
test('Mock store with contact info yields expected data', () => {
|
test('Mock store with contact info yields expected data', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -199,7 +201,7 @@ describe('contactDetails.vue', () => {
|
||||||
firstName: getRandomString(4, 15),
|
firstName: getRandomString(4, 15),
|
||||||
lastName: getRandomString(4, 15),
|
lastName: getRandomString(4, 15),
|
||||||
emailAddress: getRandomString(10, 20),
|
emailAddress: getRandomString(10, 20),
|
||||||
phoneNumber: getRandomInt(1000000000, 9999999999),
|
servicePhone: getRandomInt(1000000000, 9999999999),
|
||||||
requestTextUpdates: getRandomBoolean(),
|
requestTextUpdates: getRandomBoolean(),
|
||||||
notesForTechnician: getRandomString(50, 100)
|
notesForTechnician: getRandomString(50, 100)
|
||||||
};
|
};
|
||||||
|
|
@ -224,7 +226,7 @@ describe('contactDetails.vue', () => {
|
||||||
expect(wrapper.vm.firstName).toBe(contactInfo.firstName);
|
expect(wrapper.vm.firstName).toBe(contactInfo.firstName);
|
||||||
expect(wrapper.vm.lastName).toBe(contactInfo.lastName);
|
expect(wrapper.vm.lastName).toBe(contactInfo.lastName);
|
||||||
expect(wrapper.vm.emailAddress).toBe(contactInfo.emailAddress);
|
expect(wrapper.vm.emailAddress).toBe(contactInfo.emailAddress);
|
||||||
expect(wrapper.vm.phoneNumber).toBe(contactInfo.phoneNumber);
|
expect(wrapper.vm.phoneNumber).toBe(contactInfo.servicePhone);
|
||||||
expect(wrapper.vm.requestTextUpdates).toBe(contactInfo.requestTextUpdates);
|
expect(wrapper.vm.requestTextUpdates).toBe(contactInfo.requestTextUpdates);
|
||||||
expect(wrapper.vm.notesForTechnician).toBe(contactInfo.notesForTechnician);
|
expect(wrapper.vm.notesForTechnician).toBe(contactInfo.notesForTechnician);
|
||||||
});
|
});
|
||||||
|
|
@ -315,7 +317,7 @@ describe('contactDetails.vue', () => {
|
||||||
const firstName = getRandomString(4, 15);
|
const firstName = getRandomString(4, 15);
|
||||||
const lastName = getRandomString(4, 15);
|
const lastName = getRandomString(4, 15);
|
||||||
const emailAddress = getRandomString(10, 20);
|
const emailAddress = getRandomString(10, 20);
|
||||||
const phoneNumber = getRandomInt(1000000000, 9999999999);
|
const phoneNumber = getRandomInt(1000000000, 9999999999).toString();
|
||||||
const requestTextUpdates = getRandomBoolean();
|
const requestTextUpdates = getRandomBoolean();
|
||||||
const notesForTechnician = getRandomString(1, 100);
|
const notesForTechnician = getRandomString(1, 100);
|
||||||
wrapper.setData({
|
wrapper.setData({
|
||||||
|
|
@ -335,11 +337,60 @@ describe('contactDetails.vue', () => {
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber,
|
|
||||||
requestTextUpdates,
|
requestTextUpdates,
|
||||||
notesForTechnician
|
notesForTechnician
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Forward button click updates phone numbers request text updates', () => {
|
||||||
|
// Arrange
|
||||||
|
const mountOptions = getMountOptions({
|
||||||
|
router: {
|
||||||
|
navigate: jest.fn()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const wrapper = shallowMount(contactDetails, mountOptions);
|
||||||
|
const phoneNumber = getRandomInt(1000000000, 9999999999).toString();
|
||||||
|
const requestTextUpdates = true;
|
||||||
|
wrapper.setData({
|
||||||
|
phoneNumber,
|
||||||
|
requestTextUpdates
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(useMainStore().updatePhoneNumbers).toHaveBeenCalledWith({
|
||||||
|
service: phoneNumber,
|
||||||
|
alternative: phoneNumber
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Forward button click updates phone numbers dot not request text updates', () => {
|
||||||
|
// Arrange
|
||||||
|
const mountOptions = getMountOptions({
|
||||||
|
router: {
|
||||||
|
navigate: jest.fn()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const wrapper = shallowMount(contactDetails, mountOptions);
|
||||||
|
const phoneNumber = getRandomInt(1000000000, 9999999999).toString();
|
||||||
|
const requestTextUpdates = false;
|
||||||
|
wrapper.setData({
|
||||||
|
phoneNumber,
|
||||||
|
requestTextUpdates
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(useMainStore().updatePhoneNumbers).toHaveBeenCalledWith({
|
||||||
|
home: phoneNumber,
|
||||||
|
service: phoneNumber
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Mocked store with no contact info yields expected data', () => {
|
test('Mocked store with no contact info yields expected data', () => {
|
||||||
|
|
@ -349,20 +400,19 @@ describe('contactDetails.vue', () => {
|
||||||
const firstName = getRandomString(4, 15);
|
const firstName = getRandomString(4, 15);
|
||||||
const lastName = getRandomString(4, 15);
|
const lastName = getRandomString(4, 15);
|
||||||
const emailAddress = getRandomString(10, 20);
|
const emailAddress = getRandomString(10, 20);
|
||||||
const phoneNumber = getRandomInt(1000000000, 9999999999);
|
const servicePhone = getRandomInt(1000000000, 9999999999);
|
||||||
const mainInitialState = {
|
const mainInitialState = {
|
||||||
order: {
|
order: {
|
||||||
customer: {
|
customer: {
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress
|
||||||
phoneNumber
|
|
||||||
},
|
},
|
||||||
contactInfo: {
|
contactInfo: {
|
||||||
firstName: null,
|
firstName: null,
|
||||||
lastName: null,
|
lastName: null,
|
||||||
emailAddress: null,
|
emailAddress: null,
|
||||||
phoneNumber: null,
|
servicePhone,
|
||||||
requestTextUpdates: null,
|
requestTextUpdates: null,
|
||||||
notesForTechnician: null
|
notesForTechnician: null
|
||||||
}
|
}
|
||||||
|
|
@ -382,7 +432,7 @@ describe('contactDetails.vue', () => {
|
||||||
expect(wrapper.vm.firstName).toBe(firstName);
|
expect(wrapper.vm.firstName).toBe(firstName);
|
||||||
expect(wrapper.vm.lastName).toBe(lastName);
|
expect(wrapper.vm.lastName).toBe(lastName);
|
||||||
expect(wrapper.vm.emailAddress).toBe(emailAddress);
|
expect(wrapper.vm.emailAddress).toBe(emailAddress);
|
||||||
expect(wrapper.vm.phoneNumber).toBe(phoneNumber);
|
expect(wrapper.vm.phoneNumber).toBe(servicePhone);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Mock store with contact info yields expected data', () => {
|
test('Mock store with contact info yields expected data', () => {
|
||||||
|
|
@ -397,7 +447,7 @@ describe('contactDetails.vue', () => {
|
||||||
firstName: getRandomString(4, 15),
|
firstName: getRandomString(4, 15),
|
||||||
lastName: getRandomString(4, 15),
|
lastName: getRandomString(4, 15),
|
||||||
emailAddress: getRandomString(10, 20),
|
emailAddress: getRandomString(10, 20),
|
||||||
phoneNumber: getRandomInt(1000000000, 9999999999),
|
servicePhone: getRandomInt(1000000000, 9999999999),
|
||||||
requestTextUpdates: getRandomBoolean(),
|
requestTextUpdates: getRandomBoolean(),
|
||||||
notesForTechnician: getRandomString(50, 100)
|
notesForTechnician: getRandomString(50, 100)
|
||||||
};
|
};
|
||||||
|
|
@ -422,7 +472,7 @@ describe('contactDetails.vue', () => {
|
||||||
expect(wrapper.vm.firstName).toBe(contactInfo.firstName);
|
expect(wrapper.vm.firstName).toBe(contactInfo.firstName);
|
||||||
expect(wrapper.vm.lastName).toBe(contactInfo.lastName);
|
expect(wrapper.vm.lastName).toBe(contactInfo.lastName);
|
||||||
expect(wrapper.vm.emailAddress).toBe(contactInfo.emailAddress);
|
expect(wrapper.vm.emailAddress).toBe(contactInfo.emailAddress);
|
||||||
expect(wrapper.vm.phoneNumber).toBe(contactInfo.phoneNumber);
|
expect(wrapper.vm.phoneNumber).toBe(contactInfo.servicePhone);
|
||||||
expect(wrapper.vm.requestTextUpdates).toBe(contactInfo.requestTextUpdates);
|
expect(wrapper.vm.requestTextUpdates).toBe(contactInfo.requestTextUpdates);
|
||||||
expect(wrapper.vm.notesForTechnician).toBe(contactInfo.notesForTechnician);
|
expect(wrapper.vm.notesForTechnician).toBe(contactInfo.notesForTechnician);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -139,14 +139,14 @@ export default {
|
||||||
const { firstName,
|
const { firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber,
|
servicePhone,
|
||||||
requestTextUpdates,
|
requestTextUpdates,
|
||||||
notesForTechnician } = useMainStore().contactInfo;
|
notesForTechnician } = useMainStore().contactInfo;
|
||||||
return {
|
return {
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber,
|
phoneNumber: servicePhone,
|
||||||
requestTextUpdates,
|
requestTextUpdates,
|
||||||
notesForTechnician,
|
notesForTechnician,
|
||||||
widget: {
|
widget: {
|
||||||
|
|
@ -196,11 +196,23 @@ export default {
|
||||||
firstName: this.firstName,
|
firstName: this.firstName,
|
||||||
lastName: this.lastName,
|
lastName: this.lastName,
|
||||||
emailAddress: this.emailAddress,
|
emailAddress: this.emailAddress,
|
||||||
phoneNumber: this.phoneNumber,
|
|
||||||
requestTextUpdates: this.requestTextUpdates,
|
requestTextUpdates: this.requestTextUpdates,
|
||||||
notesForTechnician: this.notesForTechnician
|
notesForTechnician: this.notesForTechnician
|
||||||
};
|
};
|
||||||
useMainStore().updateContactInfo(contactInfo);
|
useMainStore().updateContactInfo(contactInfo);
|
||||||
|
|
||||||
|
if (this.requestTextUpdates) {
|
||||||
|
useMainStore().updatePhoneNumbers({
|
||||||
|
service: this.phoneNumber,
|
||||||
|
alternative: this.phoneNumber
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
useMainStore().updatePhoneNumbers({
|
||||||
|
home: this.phoneNumber,
|
||||||
|
service: this.phoneNumber
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const scenario = useMainStore().order.serviceLocation.IsSafeliteProvider === false
|
const scenario = useMainStore().order.serviceLocation.IsSafeliteProvider === false
|
||||||
? this.navigationScenarios.CLICKED_FORWARD_WITH_NON_SAFELITE_SHOP
|
? this.navigationScenarios.CLICKED_FORWARD_WITH_NON_SAFELITE_SHOP
|
||||||
: this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE_SHOP;
|
: this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE_SHOP;
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,11 @@ exports[`coverageStatement.vue-working returns the initial data 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"baseServiceLineItems": Array [],
|
"baseServiceLineItems": Array [],
|
||||||
"deductibleText": "Your deductible is",
|
"deductibleText": "Your deductible is",
|
||||||
"isNoComp": false,
|
|
||||||
"isRepair": true,
|
|
||||||
"loadingText": Array [
|
"loadingText": Array [
|
||||||
"Connecting to your insurance company",
|
"Connecting to your insurance company",
|
||||||
"Nearly there",
|
"Nearly there",
|
||||||
"Finishing up",
|
"Finishing up",
|
||||||
],
|
],
|
||||||
"policyLookupSuccessful": true,
|
|
||||||
"rules": Object {
|
"rules": Object {
|
||||||
"selectionRequired": "option-required",
|
"selectionRequired": "option-required",
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import navigationScenarios from '@/router/router-constants/navigation-scenarios.
|
||||||
import { getRandomString, getRandomInt } from '@/helpers/data-generation.js';
|
import { getRandomString, getRandomInt } from '@/helpers/data-generation.js';
|
||||||
import settleAllPromises from '@/helpers/layout-helper.js';
|
import settleAllPromises from '@/helpers/layout-helper.js';
|
||||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||||
import { useMainStore } from '@/store/index.js';
|
import { useMainStore, getDefaultState } from '@/store';
|
||||||
import getPriceOfLineItems from '@/helpers/price-calculator.js';
|
import getPriceOfLineItems from '@/helpers/price-calculator.js';
|
||||||
|
|
||||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||||
|
|
@ -90,6 +90,14 @@ function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRu
|
||||||
return { wrapper };
|
return { wrapper };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
const store = useMainStore();
|
||||||
|
const defaultState = getDefaultState();
|
||||||
|
Object.keys(defaultState).forEach((key) => {
|
||||||
|
store[key] = defaultState[key];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('coverageStatement.vue-working', () => {
|
describe('coverageStatement.vue-working', () => {
|
||||||
test('returns the initial data', () => {
|
test('returns the initial data', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -99,8 +107,8 @@ describe('coverageStatement.vue-working', () => {
|
||||||
isRepair: true
|
isRepair: true
|
||||||
},
|
},
|
||||||
policy: {
|
policy: {
|
||||||
policyLookupSuccessful: true,
|
noCoverage: false,
|
||||||
noCoverage: false
|
policyLookupSuccessful: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -164,43 +172,67 @@ describe('coverageStatement.vue-working', () => {
|
||||||
});
|
});
|
||||||
describe('Computed', () => {
|
describe('Computed', () => {
|
||||||
describe('verifiedNoComp', () => {
|
describe('verifiedNoComp', () => {
|
||||||
test.each([true, false])('returns false when policyLookupSuccessful false', (isNoComp) => {
|
describe('isNoCompQuoteVisible true', () => {
|
||||||
// Arrange
|
const enableNoCompQuote = true;
|
||||||
const mainInitialState = {
|
test.each([true, false])('returns false when policyLookupSuccessful false', (isNoComp) => {
|
||||||
order: {
|
// Arrange
|
||||||
policy: {
|
const mainInitialState = {
|
||||||
noCoverage: isNoComp,
|
order: {
|
||||||
policyLookupSuccessful: false
|
policy: {
|
||||||
}
|
noCoverage: isNoComp,
|
||||||
}
|
policyLookupSuccessful: false
|
||||||
};
|
}
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
},
|
||||||
|
issConfig: { enableNoCompQuote }
|
||||||
|
};
|
||||||
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedNoComp;
|
const result = wrapper.vm.isNoCompQuoteVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
|
});
|
||||||
|
test.each([true, false])('returns false when isNoComp false', (policyLookupSuccessful) => {
|
||||||
|
// Arrange
|
||||||
|
const mainInitialState = {
|
||||||
|
order: {
|
||||||
|
policy: {
|
||||||
|
noCoverage: false,
|
||||||
|
policyLookupSuccessful
|
||||||
|
}
|
||||||
|
},
|
||||||
|
issConfig: { enableNoCompQuote }
|
||||||
|
};
|
||||||
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = wrapper.vm.isNoCompQuoteVisible;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeFalsy();
|
||||||
|
});
|
||||||
|
test('returns true when policyLookupSuccessful true, noCoverage true, and enableNoCompQuote true', () => {
|
||||||
|
// Arrange
|
||||||
|
const mainInitialState = {
|
||||||
|
order: {
|
||||||
|
policy: {
|
||||||
|
noCoverage: true,
|
||||||
|
policyLookupSuccessful: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
issConfig: { enableNoCompQuote }
|
||||||
|
};
|
||||||
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = wrapper.vm.isNoCompQuoteVisible;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
test.each([true, false])('returns false when isNoComp false', (policyLookupSuccessful) => {
|
test('returns false when policyLookupSuccessful true, noCoverage true and enableNoCompQuote false', () => {
|
||||||
// Arrange
|
|
||||||
const mainInitialState = {
|
|
||||||
order: {
|
|
||||||
policy: {
|
|
||||||
noCoverage: false,
|
|
||||||
policyLookupSuccessful
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
const result = wrapper.vm.verifiedNoComp;
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
|
||||||
test('returns true when policyLookupSuccessful true and policyLookupSuccessful true', () => {
|
|
||||||
// Arrange
|
// Arrange
|
||||||
const mainInitialState = {
|
const mainInitialState = {
|
||||||
order: {
|
order: {
|
||||||
|
|
@ -208,18 +240,21 @@ describe('coverageStatement.vue-working', () => {
|
||||||
noCoverage: true,
|
noCoverage: true,
|
||||||
policyLookupSuccessful: true
|
policyLookupSuccessful: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
enableNoCompQuote: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedNoComp;
|
const result = wrapper.vm.isNoCompQuoteVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeTruthy();
|
expect(result).toBeFalsy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('verifiedITAC', () => {
|
describe('isITACQuoteVisible', () => {
|
||||||
const priceOfLineItems = 213;
|
const priceOfLineItems = 213;
|
||||||
test.each([true, false])('returns false when policyLookupSuccessful false', (isNoComp) => {
|
test.each([true, false])('returns false when policyLookupSuccessful false', (isNoComp) => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -236,7 +271,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedITAC;
|
const result = wrapper.vm.isITACQuoteVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
|
|
@ -256,7 +291,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedITAC;
|
const result = wrapper.vm.isITACQuoteVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
|
|
@ -281,7 +316,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedITAC;
|
const result = wrapper.vm.isITACQuoteVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
|
|
@ -308,7 +343,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedITAC;
|
const result = wrapper.vm.isITACQuoteVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
|
|
@ -329,13 +364,13 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedITAC;
|
const result = wrapper.vm.isITACQuoteVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeTruthy();
|
expect(result).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('verifiedDeductible', () => {
|
describe('isDeductibleVisible', () => {
|
||||||
const servicePrice = 123;
|
const servicePrice = 123;
|
||||||
describe('claim registration required', () => {
|
describe('claim registration required', () => {
|
||||||
const issConfig = { isClaimRegistrationRequired: true };
|
const issConfig = { isClaimRegistrationRequired: true };
|
||||||
|
|
@ -351,7 +386,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
},
|
},
|
||||||
policy: {
|
policy: {
|
||||||
noCoverage: false,
|
noCoverage: false,
|
||||||
policyLookupSuccessful: false
|
policyLookupSuccessful: true
|
||||||
},
|
},
|
||||||
currentDeductible: servicePrice - 1
|
currentDeductible: servicePrice - 1
|
||||||
}
|
}
|
||||||
|
|
@ -365,7 +400,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedDeductible;
|
const result = wrapper.vm.isDeductibleVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
|
|
@ -377,7 +412,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedDeductible;
|
const result = wrapper.vm.isDeductibleVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
|
|
@ -387,7 +422,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const { wrapper } = getMountedComponent(verifiedDeductibleStoreState);
|
const { wrapper } = getMountedComponent(verifiedDeductibleStoreState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedDeductible;
|
const result = wrapper.vm.isDeductibleVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeTruthy();
|
expect(result).toBeTruthy();
|
||||||
|
|
@ -420,7 +455,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedDeductible;
|
const result = wrapper.vm.isDeductibleVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
|
|
@ -430,7 +465,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const { wrapper } = getMountedComponent(verifiedDeductibleStoreState);
|
const { wrapper } = getMountedComponent(verifiedDeductibleStoreState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedDeductible;
|
const result = wrapper.vm.isDeductibleVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeTruthy();
|
expect(result).toBeTruthy();
|
||||||
|
|
@ -459,7 +494,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const { wrapper } = getMountedComponent(storeState);
|
const { wrapper } = getMountedComponent(storeState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedDeductible;
|
const result = wrapper.vm.isDeductibleVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
|
|
@ -486,7 +521,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const { wrapper } = getMountedComponent(storeState);
|
const { wrapper } = getMountedComponent(storeState);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.verifiedDeductible;
|
const result = wrapper.vm.isDeductibleVisible;
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
|
|
@ -683,7 +718,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
});
|
});
|
||||||
test('returns true when isNoComp true', () => {
|
test('returns false when isNoComp true and enableNoCompQuote false', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const mainInitialState = {
|
const mainInitialState = {
|
||||||
order: {
|
order: {
|
||||||
|
|
@ -692,6 +727,32 @@ describe('coverageStatement.vue-working', () => {
|
||||||
noCoverage: true
|
noCoverage: true
|
||||||
},
|
},
|
||||||
currentDeductible: priceOfLineItems
|
currentDeductible: priceOfLineItems
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
enableNoCompQuote: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
getPriceOfLineItems.mockImplementationOnce(() => priceOfLineItems);
|
||||||
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = wrapper.vm.isQuoteDisplayed;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeFalsy();
|
||||||
|
});
|
||||||
|
test('returns true when isNoComp true and enableNoCompQuote true', () => {
|
||||||
|
// Arrange
|
||||||
|
const mainInitialState = {
|
||||||
|
order: {
|
||||||
|
policy: {
|
||||||
|
policyLookupSuccessful: true,
|
||||||
|
noCoverage: true
|
||||||
|
},
|
||||||
|
currentDeductible: priceOfLineItems
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
enableNoCompQuote: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getPriceOfLineItems.mockImplementationOnce(() => priceOfLineItems);
|
getPriceOfLineItems.mockImplementationOnce(() => priceOfLineItems);
|
||||||
|
|
@ -712,7 +773,10 @@ describe('coverageStatement.vue-working', () => {
|
||||||
shouldRegisterClaimStoreStateItac = {
|
shouldRegisterClaimStoreStateItac = {
|
||||||
order: {
|
order: {
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: { claimNumber: null }
|
insuranceCoverage: {
|
||||||
|
claimNumber: null,
|
||||||
|
isVerified: true // Added
|
||||||
|
}
|
||||||
},
|
},
|
||||||
policy: {
|
policy: {
|
||||||
policyLookupSuccessful: true,
|
policyLookupSuccessful: true,
|
||||||
|
|
@ -801,6 +865,7 @@ describe('coverageStatement.vue-working', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
test('returns false when insuranceCoverage not verified', () => {});
|
||||||
describe('returns true when policy lookup success, vehicleId set to %p, claim reg req, claim not yet reg', () => {
|
describe('returns true when policy lookup success, vehicleId set to %p, claim reg req, claim not yet reg', () => {
|
||||||
test('and itac', () => {
|
test('and itac', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -1010,6 +1075,9 @@ describe('coverageStatement.vue-working', () => {
|
||||||
noCoverage: true,
|
noCoverage: true,
|
||||||
policyLookupSuccessful: true
|
policyLookupSuccessful: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
enableNoCompQuote: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
@ -1038,6 +1106,9 @@ describe('coverageStatement.vue-working', () => {
|
||||||
noCoverage: true,
|
noCoverage: true,
|
||||||
policyLookupSuccessful: true
|
policyLookupSuccessful: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
enableNoCompQuote: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
const { wrapper } = getMountedComponent(mainInitialState);
|
||||||
|
|
@ -1166,11 +1237,15 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const initialStore = {
|
const initialStore = {
|
||||||
order: {
|
order: {
|
||||||
payment: {
|
payment: {
|
||||||
insuranceCoverage: { claimNumber: null }
|
insuranceCoverage: {
|
||||||
|
claimNumber: null,
|
||||||
|
isVerified: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
policy: {
|
policy: {
|
||||||
policyLookupSuccessful: true,
|
noCoverage: false,
|
||||||
noCoverage: false
|
isITAC: false,
|
||||||
|
policyLookupSuccessful: true
|
||||||
},
|
},
|
||||||
vehicle: {
|
vehicle: {
|
||||||
policyVehicleId: 1
|
policyVehicleId: 1
|
||||||
|
|
@ -1191,6 +1266,8 @@ describe('coverageStatement.vue-working', () => {
|
||||||
const { wrapper } = getMountedComponent(initialStore, {}, mockStoreActions);
|
const { wrapper } = getMountedComponent(initialStore, {}, mockStoreActions);
|
||||||
const next = (method) => { method(wrapper.vm); };
|
const next = (method) => { method(wrapper.vm); };
|
||||||
|
|
||||||
|
console.log(wrapper.vm.pageVariation);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
coverageStatement.beforeRouteEnter.call(wrapper.vm, undefined, undefined, next);
|
coverageStatement.beforeRouteEnter.call(wrapper.vm, undefined, undefined, next);
|
||||||
for (let i = 0; i < 7; i++) {
|
for (let i = 0; i < 7; i++) {
|
||||||
|
|
|
||||||
|
|
@ -33,23 +33,23 @@
|
||||||
v-html="secondaryText">
|
v-html="secondaryText">
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="verifiedDeductible"
|
v-if="isDeductibleVisible"
|
||||||
class="d-flex justify-content-center cost">
|
class="d-flex justify-content-center cost">
|
||||||
{{ deductibleForDisplay }}
|
{{ formatAmountInDollars(deductibleValue) }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="isQuoteDisplayed"
|
v-if="isQuoteDisplayed"
|
||||||
class="d-flex justify-content-center cost mb-0">
|
class="d-flex justify-content-center cost mb-0">
|
||||||
{{ servicePriceForDisplay }}
|
{{ formatAmountInDollars(totalServicePrice) }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="verifiedITAC"
|
v-if="isITACQuoteVisible"
|
||||||
class="d-flex justify-content-center mb-4 deductible-text">
|
class="d-flex justify-content-center mb-4 deductible-text">
|
||||||
{{ deductibleText }}
|
{{ deductibleText }}
|
||||||
<span class="text-success fw-bold">{{ deductibleForDisplay }}</span>
|
<span class="text-success fw-bold">{{ formatAmountInDollars(deductibleValue) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<alert
|
<alert
|
||||||
v-if="verifiedITAC"
|
v-if="isITACQuoteVisible"
|
||||||
ref="verifiedITACAlert"
|
ref="verifiedITACAlert"
|
||||||
class="mb-5"
|
class="mb-5"
|
||||||
cmsWidgetName="VerifiedITACAlert"
|
cmsWidgetName="VerifiedITACAlert"
|
||||||
|
|
@ -116,6 +116,7 @@ import contentGroupModal from '@/iss-components/content-group-modal/content-grou
|
||||||
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
|
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
|
||||||
import loadingModal from '@/iss-components/loading-modal/loading-modal.vue';
|
import loadingModal from '@/iss-components/loading-modal/loading-modal.vue';
|
||||||
import textBlock from '@/digital-components/text-block/text-block.vue';
|
import textBlock from '@/digital-components/text-block/text-block.vue';
|
||||||
|
import pageVariations from '@/constants/coverage-statement-page-variations';
|
||||||
|
|
||||||
// Import Supporting Files
|
// Import Supporting Files
|
||||||
import { fetchCmsContentForPage, setupModalLinks, processIfStatements } from '@/helpers/cms-content-helper.js';
|
import { fetchCmsContentForPage, setupModalLinks, processIfStatements } from '@/helpers/cms-content-helper.js';
|
||||||
|
|
@ -171,6 +172,7 @@ export default {
|
||||||
const clonedGlassParts = useMainStore().lineItems.glassParts
|
const clonedGlassParts = useMainStore().lineItems.glassParts
|
||||||
? JSON.parse(JSON.stringify(useMainStore().lineItems.glassParts))
|
? JSON.parse(JSON.stringify(useMainStore().lineItems.glassParts))
|
||||||
: [];
|
: [];
|
||||||
|
// TODO SSR-1165: Recycle fee needs removed from quote calculation
|
||||||
const availableLineItems = [
|
const availableLineItems = [
|
||||||
...(resultMap.supportingItems ?? []),
|
...(resultMap.supportingItems ?? []),
|
||||||
...(clonedGlassParts ?? [])
|
...(clonedGlassParts ?? [])
|
||||||
|
|
@ -178,7 +180,8 @@ export default {
|
||||||
|
|
||||||
let hasBailedOut = false;
|
let hasBailedOut = false;
|
||||||
let pricingResults = [];
|
let pricingResults = [];
|
||||||
if (useMainStore().policy.policyLookupSuccessful && useMainStore().vehicle.policyVehicleId >= 0) {
|
const { policy, vehicle } = useMainStore();
|
||||||
|
if (policy.policyLookupSuccessful && vehicle.policyVehicleId >= 0) {
|
||||||
await useMainStore().getFinalDeductible();
|
await useMainStore().getFinalDeductible();
|
||||||
pricingResults = await useMainStore().getPriceOrderItems(availableLineItems)
|
pricingResults = await useMainStore().getPriceOrderItems(availableLineItems)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
@ -207,12 +210,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const { isRepair } = useMainStore().damage;
|
|
||||||
const { policyLookupSuccessful, noCoverage } = useMainStore().policy;
|
|
||||||
return {
|
return {
|
||||||
isRepair,
|
|
||||||
policyLookupSuccessful,
|
|
||||||
isNoComp: noCoverage ?? false,
|
|
||||||
baseServiceLineItems: [],
|
baseServiceLineItems: [],
|
||||||
selectedProvider: '',
|
selectedProvider: '',
|
||||||
deductibleText: 'Your deductible is',
|
deductibleText: 'Your deductible is',
|
||||||
|
|
@ -236,6 +234,46 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
pageVariation() {
|
||||||
|
const {
|
||||||
|
isNoComp,
|
||||||
|
issConfig,
|
||||||
|
policy,
|
||||||
|
payment,
|
||||||
|
isClaimRegistrationRequired
|
||||||
|
} = useMainStore();
|
||||||
|
const registerClaimSuccessful = payment.insuranceCoverage.isVerified;
|
||||||
|
|
||||||
|
if (!policy.policyLookupSuccessful) {
|
||||||
|
return pageVariations.UNVERIFIED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNoComp) {
|
||||||
|
if (issConfig.enableNoCompQuote) {
|
||||||
|
return pageVariations.NO_COMP;
|
||||||
|
}
|
||||||
|
return pageVariations.UNVERIFIED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.deductibleValue == null) {
|
||||||
|
return pageVariations.UNVERIFIED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO this should be determined based on the result of the ITAC price call
|
||||||
|
// TODO it seems that ITAC now requires claim registration calls. If this call fails
|
||||||
|
// should the page become unverified?
|
||||||
|
if (this.deductibleValue > this.totalServicePrice) {
|
||||||
|
return pageVariations.ITAC;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isClaimRegistrationRequired) {
|
||||||
|
if (registerClaimSuccessful) {
|
||||||
|
return pageVariations.DEDUCTIBLE;
|
||||||
|
}
|
||||||
|
return pageVariations.UNVERIFIED;
|
||||||
|
}
|
||||||
|
return pageVariations.DEDUCTIBLE;
|
||||||
|
},
|
||||||
coverageStatementSubHeader() {
|
coverageStatementSubHeader() {
|
||||||
return this.getTextFromCmsWithCustomIfStatements(
|
return this.getTextFromCmsWithCustomIfStatements(
|
||||||
this.widget.subheader,
|
this.widget.subheader,
|
||||||
|
|
@ -249,10 +287,14 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
verifiedItacAlertBody() {
|
verifiedItacAlertBody() {
|
||||||
|
const itacCostSavings = this.deductibleValue - this.totalServicePrice;
|
||||||
return this.getCmsContent(
|
return this.getCmsContent(
|
||||||
this.widget.verifiedItacAlert,
|
this.widget.verifiedItacAlert,
|
||||||
widgetFields.ALERT_WIDGET.BODY_TEXT
|
widgetFields.ALERT_WIDGET.BODY_TEXT
|
||||||
)?.replaceAll('{custom:costSavings}', this.itacCostSavingsForDisplay);
|
)?.replaceAll(
|
||||||
|
'{custom:costSavings}',
|
||||||
|
formatAmountInDollars(itacCostSavings)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
secondaryText() {
|
secondaryText() {
|
||||||
return this.getTextFromCmsWithCustomIfStatements(
|
return this.getTextFromCmsWithCustomIfStatements(
|
||||||
|
|
@ -285,50 +327,25 @@ export default {
|
||||||
deductibleValue() {
|
deductibleValue() {
|
||||||
return useMainStore().order.currentDeductible;
|
return useMainStore().order.currentDeductible;
|
||||||
},
|
},
|
||||||
deductibleForDisplay() {
|
isNoCompQuoteVisible() {
|
||||||
return formatAmountInDollars(this.deductibleValue);
|
return this.pageVariation === pageVariations.NO_COMP;
|
||||||
},
|
},
|
||||||
registerClaimSuccessful() {
|
isITACQuoteVisible() {
|
||||||
return useMainStore().payment.insuranceCoverage.isVerified;
|
return this.pageVariation === pageVariations.ITAC;
|
||||||
},
|
},
|
||||||
verifiedNoComp() {
|
isDeductibleVisible() {
|
||||||
return this.policyLookupSuccessful && this.isNoComp;
|
return this.pageVariation === pageVariations.DEDUCTIBLE;
|
||||||
},
|
},
|
||||||
verifiedITAC() {
|
isUnverifiedVisible() {
|
||||||
return this.policyLookupSuccessful
|
return this.pageVariation === pageVariations.UNVERIFIED;
|
||||||
&& !this.isNoComp
|
|
||||||
&& this.deductibleValue > this.totalServicePrice;
|
|
||||||
},
|
|
||||||
coveredAndServicePriceAboveOrEqualDeductible() {
|
|
||||||
return !this.verifiedNoComp && this.totalServicePrice >= this.deductibleValue;
|
|
||||||
},
|
|
||||||
verifiedDeductible() {
|
|
||||||
return useMainStore().isClaimRegistrationRequired
|
|
||||||
? this.registerClaimSuccessful
|
|
||||||
&& this.coveredAndServicePriceAboveOrEqualDeductible
|
|
||||||
&& this.deductibleValue !== null
|
|
||||||
: this.policyLookupSuccessful
|
|
||||||
&& this.coveredAndServicePriceAboveOrEqualDeductible;
|
|
||||||
},
|
|
||||||
unverified() {
|
|
||||||
return !this.verifiedDeductible && !this.verifiedITAC && !this.verifiedNoComp;
|
|
||||||
},
|
},
|
||||||
isADAS() {
|
isADAS() {
|
||||||
const parts = useMainStore().order.lineItems.glassParts;
|
const { glassParts } = useMainStore().order.lineItems;
|
||||||
return parts !== null && !!parts.find((part) => part.requiresRecalibration);
|
return glassParts !== null && !!glassParts.find((part) => part.requiresRecalibration);
|
||||||
},
|
},
|
||||||
totalServicePrice() {
|
totalServicePrice() {
|
||||||
return getPriceOfLineItems(this.baseServiceLineItems);
|
return getPriceOfLineItems(this.baseServiceLineItems);
|
||||||
},
|
},
|
||||||
servicePriceForDisplay() {
|
|
||||||
return formatAmountInDollars(this.totalServicePrice);
|
|
||||||
},
|
|
||||||
itacCostSavings() {
|
|
||||||
return this.deductibleValue - this.totalServicePrice;
|
|
||||||
},
|
|
||||||
itacCostSavingsForDisplay() {
|
|
||||||
return formatAmountInDollars(this.itacCostSavings);
|
|
||||||
},
|
|
||||||
serviceProviderQuestionText() {
|
serviceProviderQuestionText() {
|
||||||
return this.getCmsContent(
|
return this.getCmsContent(
|
||||||
this.widget.serviceProviderQuestion,
|
this.widget.serviceProviderQuestion,
|
||||||
|
|
@ -342,15 +359,22 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
isQuoteDisplayed() {
|
isQuoteDisplayed() {
|
||||||
return this.verifiedITAC || this.verifiedNoComp;
|
return this.isITACQuoteVisible || this.isNoCompQuoteVisible;
|
||||||
},
|
},
|
||||||
shouldRegisterClaim() {
|
shouldRegisterClaim() {
|
||||||
return this.policyLookupSuccessful
|
const {
|
||||||
&& useMainStore().vehicle.policyVehicleId != null
|
policy,
|
||||||
&& useMainStore().vehicle.policyVehicleId >= 0
|
vehicle,
|
||||||
&& useMainStore().isClaimRegistrationRequired
|
isClaimRegistrationRequired,
|
||||||
&& !useMainStore().isClaimAlreadyRegistered
|
isClaimAlreadyRegistered
|
||||||
&& (this.coveredAndServicePriceAboveOrEqualDeductible || this.verifiedITAC);
|
} = useMainStore();
|
||||||
|
const { policyVehicleId } = vehicle;
|
||||||
|
return policy.policyLookupSuccessful
|
||||||
|
&& policyVehicleId != null
|
||||||
|
&& policyVehicleId >= 0
|
||||||
|
&& isClaimRegistrationRequired
|
||||||
|
&& !isClaimAlreadyRegistered
|
||||||
|
&& (this.isDeductibleVisible || this.isITACQuoteVisible);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
@ -373,8 +397,9 @@ export default {
|
||||||
return !!useMainStore().vehicle.carId;
|
return !!useMainStore().vehicle.carId;
|
||||||
},
|
},
|
||||||
async initializeComponent() {
|
async initializeComponent() {
|
||||||
useMainStore().updatePolicyITACFlag(this.verifiedITAC);
|
useMainStore().updatePolicyITACFlag(this.isITACQuoteVisible);
|
||||||
const coverageStatus = this.verifiedITAC || this.verifiedNoComp
|
// TODO how should coverage status be updated
|
||||||
|
const coverageStatus = this.isITACQuoteVisible || this.isNoCompQuoteVisible
|
||||||
? coverageStatuses.VERIFIED
|
? coverageStatuses.VERIFIED
|
||||||
: coverageStatuses.PENDING;
|
: coverageStatuses.PENDING;
|
||||||
useMainStore().updateCoverageStatus(coverageStatus);
|
useMainStore().updateCoverageStatus(coverageStatus);
|
||||||
|
|
@ -384,10 +409,10 @@ export default {
|
||||||
this.$refs.loadingModal.hideModal();
|
this.$refs.loadingModal.hideModal();
|
||||||
},
|
},
|
||||||
async navigateForward() {
|
async navigateForward() {
|
||||||
if (this.unverified || this.verifiedDeductible) {
|
if (this.isUnverifiedVisible || this.isDeductibleVisible) {
|
||||||
useMainStore().updateSupportingItems(this.supportingItems);
|
useMainStore().updateSupportingItems(this.supportingItems);
|
||||||
this.navigateWithScenario(navigationScenarios.CLICKED_FORWARD);
|
this.navigateWithScenario(navigationScenarios.CLICKED_FORWARD);
|
||||||
} else if (this.verifiedITAC || this.verifiedNoComp) {
|
} else if (this.isITACQuoteVisible || this.isNoCompQuoteVisible) {
|
||||||
useMainStore().updateIsSafeliteProvider(this.selectedProvider === SAFELITE_PROVIDER);
|
useMainStore().updateIsSafeliteProvider(this.selectedProvider === SAFELITE_PROVIDER);
|
||||||
if (this.selectedProvider === SAFELITE_PROVIDER) {
|
if (this.selectedProvider === SAFELITE_PROVIDER) {
|
||||||
useMainStore().updateSupportingItems(this.supportingItems);
|
useMainStore().updateSupportingItems(this.supportingItems);
|
||||||
|
|
@ -409,25 +434,26 @@ export default {
|
||||||
return processIfStatements(rawText, 'custom', this.getCustomValueFromString);
|
return processIfStatements(rawText, 'custom', this.getCustomValueFromString);
|
||||||
},
|
},
|
||||||
getCustomValueFromString(str) {
|
getCustomValueFromString(str) {
|
||||||
|
const { isRepair } = useMainStore().damage;
|
||||||
switch (str) {
|
switch (str) {
|
||||||
case 'coverageUnverified':
|
case 'coverageUnverified':
|
||||||
return this.unverified;
|
return this.isUnverifiedVisible;
|
||||||
case 'verifiedDeductible':
|
case 'verifiedDeductible':
|
||||||
return this.verifiedDeductible;
|
return this.isDeductibleVisible;
|
||||||
case 'verifiedITAC':
|
case 'verifiedITAC':
|
||||||
return this.verifiedITAC;
|
return this.isITACQuoteVisible;
|
||||||
case 'verifiedNoComp':
|
case 'verifiedNoComp':
|
||||||
return this.verifiedNoComp;
|
return this.isNoCompQuoteVisible;
|
||||||
case 'ADASReplace':
|
case 'ADASReplace':
|
||||||
return !this.isRepair && this.isADAS;
|
return !isRepair && this.isADAS;
|
||||||
case 'nonADASReplace':
|
case 'nonADASReplace':
|
||||||
return !this.isRepair && !this.isADAS;
|
return !isRepair && !this.isADAS;
|
||||||
case 'nonADASRepair':
|
case 'nonADASRepair':
|
||||||
return this.isRepair;
|
return isRepair;
|
||||||
case 'deductibleOverZero':
|
case 'deductibleOverZero':
|
||||||
return this.verifiedDeductible && this.deductibleValue !== 0; // TODO what if deductible is negative?
|
return this.isDeductibleVisible && this.deductibleValue !== 0; // TODO what if deductible is negative?
|
||||||
case 'isDeductibleZero':
|
case 'isDeductibleZero':
|
||||||
return this.verifiedDeductible && this.deductibleValue === 0;
|
return this.isDeductibleVisible && this.deductibleValue === 0;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -437,7 +463,8 @@ export default {
|
||||||
},
|
},
|
||||||
setBaseServiceLineItems(lineItems) {
|
setBaseServiceLineItems(lineItems) {
|
||||||
this.baseServiceLineItems = lineItems;
|
this.baseServiceLineItems = lineItems;
|
||||||
}
|
},
|
||||||
|
formatAmountInDollars
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,25 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
},
|
},
|
||||||
mounted() {
|
async mounted() {
|
||||||
this.validateClientTagOnEntry();
|
const queryStringParams = this.parseQueryParms();
|
||||||
|
|
||||||
|
const { isAuthorized, clientData } = await this.validateClientTagOnEntry(queryStringParams);
|
||||||
|
|
||||||
|
this.unauthorized = !isAuthorized;
|
||||||
|
|
||||||
|
if (isAuthorized) {
|
||||||
|
await this.populateISSConfigValues(clientData);
|
||||||
|
|
||||||
|
if (clientData.parameters?.length > 0) {
|
||||||
|
const finalParams = this.combineClientParameters(clientData.parameters, queryStringParams);
|
||||||
|
this.populateStoreItemsFromParams(finalParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mainStore.applicationUser.coverageAttempts = 0;
|
||||||
|
// Forced full location redirect here. We do not want the entry page as part of the router/flow/path history.
|
||||||
|
window.location = `/?issPage=${issPageValues.WELCOME_PAGE}`;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods:
|
methods:
|
||||||
{
|
{
|
||||||
|
|
@ -53,11 +70,11 @@ export default {
|
||||||
|
|
||||||
return queryStringParams;
|
return queryStringParams;
|
||||||
},
|
},
|
||||||
async validateClientTagOnEntry() {
|
async validateClientTagOnEntry(queryStringParams) {
|
||||||
const queryStringParams = this.parseQueryParms();
|
|
||||||
const clientTag = queryStringParams.clienttag;
|
const clientTag = queryStringParams.clienttag;
|
||||||
const clientTagPresent = !!clientTag;
|
const clientTagPresent = !!clientTag;
|
||||||
let authorized = false;
|
let authorized = false;
|
||||||
|
let clientData = null;
|
||||||
|
|
||||||
if (clientTagPresent) {
|
if (clientTagPresent) {
|
||||||
const resp = await validateISSClientTag(clientTag);
|
const resp = await validateISSClientTag(clientTag);
|
||||||
|
|
@ -76,23 +93,12 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authorized) {
|
if (authorized) {
|
||||||
await this.populateISSConfigValues(resp.data);
|
clientData = resp.data;
|
||||||
|
|
||||||
if (resp.data.parameters?.length > 0) {
|
|
||||||
const finalParams = this.combineClientParameters(resp.data.parameters, queryStringParams);
|
|
||||||
this.populateStoreItemsFromParams(finalParams);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.unauthorized = !authorized;
|
return { isAuthorized: authorized, clientData };
|
||||||
|
|
||||||
if (authorized) {
|
|
||||||
this.mainStore.applicationUser.coverageAttempts = 0;
|
|
||||||
// Forced full location redirect here. We do not want the entry page as part of the router/flow/path history.
|
|
||||||
window.location = `/?issPage=${issPageValues.WELCOME_PAGE}`;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async populateISSConfigValues(data) {
|
async populateISSConfigValues(data) {
|
||||||
this.mainStore.issConfig.clientName = data.accountName;
|
this.mainStore.issConfig.clientName = data.accountName;
|
||||||
|
|
@ -117,6 +123,10 @@ export default {
|
||||||
if (clientFlags.ClaimRegistrationRequired) {
|
if (clientFlags.ClaimRegistrationRequired) {
|
||||||
this.mainStore.issConfig.isClaimRegistrationRequired = true;
|
this.mainStore.issConfig.isClaimRegistrationRequired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (clientFlags.EnableNoCompQuote) {
|
||||||
|
this.mainStore.issConfig.enableNoCompQuote = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Error parsing client flags: ${e}`);
|
console.error(`Error parsing client flags: ${e}`);
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ const initialStore = {
|
||||||
contactInfo: {
|
contactInfo: {
|
||||||
firstName: 'Test',
|
firstName: 'Test',
|
||||||
lastName: 'Test',
|
lastName: 'Test',
|
||||||
phoneNumber: '111-111-1111',
|
servicePhone: '111-111-1111',
|
||||||
emailAddress: 'test@email.com'
|
emailAddress: 'test@email.com'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -341,7 +341,7 @@ export default {
|
||||||
const contactInfoReqs = !!(
|
const contactInfoReqs = !!(
|
||||||
contactInfo.firstName
|
contactInfo.firstName
|
||||||
&& contactInfo.lastName
|
&& contactInfo.lastName
|
||||||
&& contactInfo.phoneNumber
|
&& contactInfo.servicePhone
|
||||||
&& contactInfo.emailAddress
|
&& contactInfo.emailAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,28 @@ import paymentMethod from '@/layouts/payment-method/payment-method.vue';
|
||||||
|
|
||||||
// Supporting Files
|
// Supporting Files
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
|
import { createTestingPinia } from '@pinia/testing';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore, getDefaultState } from '@/store';
|
||||||
import issPageValues from '@/router/router-constants/issPage-values';
|
import issPageValues from '@/router/router-constants/issPage-values';
|
||||||
import { paymentMethods } from '@/constants/payment-method-constants';
|
import { paymentMethods } from '@/constants/payment-method-constants';
|
||||||
import queryStrings from '@/constants/query-strings';
|
import queryStrings from '@/constants/query-strings';
|
||||||
import { experimentSettings } from '@/constants/experiments';
|
import { experimentSettings } from '@/constants/experiments';
|
||||||
|
|
||||||
function setupMocks({ customMountOptions = {}, queryString }) {
|
function setupMocks({ customMountOptions = {}, queryString }, mainInitialState = {}, customMixin = null) {
|
||||||
const mountOptions = getMountOptions({
|
const mountOptions = getMountOptions({
|
||||||
...customMountOptions,
|
...customMountOptions,
|
||||||
route: { query: { issPage: issPageValues.PAYMENT_METHOD, ...queryString }, params: {} }
|
route: { query: { issPage: issPageValues.PAYMENT_METHOD, ...queryString }, params: {} }
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockMixin = {
|
const testingPinia = createTestingPinia({
|
||||||
|
initialState: {
|
||||||
|
main: mainInitialState
|
||||||
|
}
|
||||||
|
});
|
||||||
|
useMainStore(testingPinia);
|
||||||
|
|
||||||
|
const mockMixin = customMixin ?? {
|
||||||
methods: {
|
methods: {
|
||||||
getSettingValue: jest.fn((settingName) => {
|
getSettingValue: jest.fn((settingName) => {
|
||||||
if (settingName === experimentSettings.ISS_DISPLAY_PAY_IN_ADVANCE) {
|
if (settingName === experimentSettings.ISS_DISPLAY_PAY_IN_ADVANCE) {
|
||||||
|
|
@ -28,6 +36,7 @@ function setupMocks({ customMountOptions = {}, queryString }) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mountOptions.global.plugins = [testingPinia];
|
||||||
mountOptions.global.mixins = [mockMixin];
|
mountOptions.global.mixins = [mockMixin];
|
||||||
|
|
||||||
const wrapper = shallowMount(paymentMethod, mountOptions);
|
const wrapper = shallowMount(paymentMethod, mountOptions);
|
||||||
|
|
@ -35,31 +44,53 @@ function setupMocks({ customMountOptions = {}, queryString }) {
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
const store = useMainStore();
|
||||||
|
const defaultState = getDefaultState();
|
||||||
|
Object.keys(defaultState).forEach((key) => {
|
||||||
|
store[key] = defaultState[key];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('payment-method.vue', () => {
|
describe('payment-method.vue', () => {
|
||||||
describe('Payment Method Type', () => {
|
describe('Payment Method Type', () => {
|
||||||
test('getting payment method when method is pay later', async () => {
|
test('getting payment method when method is pay later', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const wrapper = setupMocks({});
|
const payLaterMethod = paymentMethods.PAY_AT_TIME_OF_SERVICE;
|
||||||
const payLaterPaymentMethod = paymentMethods.PAY_AT_TIME_OF_SERVICE;
|
const store = {
|
||||||
useMainStore().savePaymentMethodChoice(payLaterPaymentMethod);
|
order: {
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: false,
|
||||||
|
payInAdvanceType: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const wrapper = setupMocks({}, store);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const paymethod = wrapper.vm.getPaymentMethodFromStore();
|
const paymethod = wrapper.vm.getPaymentMethodFromStore();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(paymethod).toBe(payLaterPaymentMethod);
|
expect(paymethod).toBe(payLaterMethod);
|
||||||
});
|
});
|
||||||
test('getting payment method when method is pay in advance', async () => {
|
test('getting payment method when method is pay in advance', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const wrapper = setupMocks({});
|
const payInAdvanceMethod = paymentMethods.CREDIT_CARD;
|
||||||
const payInAdvancePaymentMethod = paymentMethods.CREDIT_CARD;
|
const store = {
|
||||||
useMainStore().savePaymentMethodChoice(payInAdvancePaymentMethod);
|
order: {
|
||||||
|
payment: {
|
||||||
|
isPayInAdvance: true,
|
||||||
|
payInAdvanceType: payInAdvanceMethod
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const wrapper = setupMocks({}, store);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const paymethod = wrapper.vm.getPaymentMethodFromStore();
|
const paymethod = wrapper.vm.getPaymentMethodFromStore();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(paymethod).not.toBe(payInAdvancePaymentMethod);
|
expect(paymethod).toBe(payInAdvanceMethod);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -86,4 +117,138 @@ describe('payment-method.vue', () => {
|
||||||
expect(payInAdvanceErrorAlert.exists()).toBeFalsy();
|
expect(payInAdvanceErrorAlert.exists()).toBeFalsy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('isPayInAdvanceDisabled', () => {
|
||||||
|
let store = {};
|
||||||
|
let mixin = {
|
||||||
|
methods: {
|
||||||
|
getSettingValue: jest.fn((settingName) => {
|
||||||
|
if (settingName === experimentSettings.ISS_DISPLAY_PAY_IN_ADVANCE) {
|
||||||
|
return 'true';
|
||||||
|
}
|
||||||
|
return 'false';
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
beforeEach(() => {
|
||||||
|
store = {
|
||||||
|
order: {
|
||||||
|
policy: {
|
||||||
|
isITAC: false,
|
||||||
|
noCoverage: false
|
||||||
|
},
|
||||||
|
payment: {
|
||||||
|
insuranceCoverage: {
|
||||||
|
isVerified: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
currentDeductible: 123,
|
||||||
|
policyLookupSuccessful: true
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
isClaimRegistrationRequired: true,
|
||||||
|
enableNoCompQuote: true
|
||||||
|
},
|
||||||
|
applicationUser: {
|
||||||
|
experiments: [
|
||||||
|
{
|
||||||
|
settings: {
|
||||||
|
ISSDisplayPIAInsurance_ISS: 'true'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
test('returns true when policyLookupSuccessful false', () => {
|
||||||
|
// Arrange
|
||||||
|
store.order.policyLookupSuccessful = false;
|
||||||
|
const wrapper = setupMocks({}, store, mixin);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = wrapper.vm.isPayInAdvanceDisabled;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
});
|
||||||
|
test('returns true when no comp and enableNoCompQuote false', () => {
|
||||||
|
// Arrange
|
||||||
|
store.order.policy.noCoverage = true;
|
||||||
|
store.issConfig.enableNoCompQuote = false;
|
||||||
|
const wrapper = setupMocks({}, store, mixin);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = wrapper.vm.isPayInAdvanceDisabled;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
});
|
||||||
|
test('returns true when not no comp and currentDeductible null', () => {
|
||||||
|
// Arrange
|
||||||
|
store.order.policy.noCoverage = false;
|
||||||
|
store.order.currentDeductible = null;
|
||||||
|
const wrapper = setupMocks({}, store, mixin);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = wrapper.vm.isPayInAdvanceDisabled;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
});
|
||||||
|
test('returns true when isClaimRegistrationRequired true and insurance coverage not verified', () => {
|
||||||
|
// Arrange
|
||||||
|
store.order.payment.insuranceCoverage.isVerified = false;
|
||||||
|
store.issConfig.isClaimRegistrationRequired = true;
|
||||||
|
const wrapper = setupMocks({}, store, mixin);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = wrapper.vm.isPayInAdvanceDisabled;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
});
|
||||||
|
test('returns false when no comp, enableNoCompQuote true, and currentDeductible null and pia enabled', () => {
|
||||||
|
// Arrange
|
||||||
|
store.order.policy.noCoverage = true;
|
||||||
|
store.issConfig.enableNoCompQuote = true;
|
||||||
|
store.order.currentDeductible = null;
|
||||||
|
const wrapper = setupMocks({}, store, mixin);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = wrapper.vm.isPayInAdvanceDisabled;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeFalsy();
|
||||||
|
});
|
||||||
|
test('returns false when not no comp, currentDeductible not null and pia enabled', () => {
|
||||||
|
// Arrange
|
||||||
|
const wrapper = setupMocks({}, store, mixin);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = wrapper.vm.isPayInAdvanceDisabled;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeFalsy();
|
||||||
|
});
|
||||||
|
test('returns true when pia not enabled', () => {
|
||||||
|
// Arrange
|
||||||
|
mixin = {
|
||||||
|
methods: {
|
||||||
|
getSettingValue: jest.fn((settingName) => {
|
||||||
|
if (settingName === experimentSettings.ISS_DISPLAY_PAY_IN_ADVANCE) {
|
||||||
|
return 'false';
|
||||||
|
}
|
||||||
|
return 'true';
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const wrapper = setupMocks({}, store, mixin);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = wrapper.vm.isPayInAdvanceDisabled;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -129,12 +129,10 @@ export default {
|
||||||
let hasBailedOut = false;
|
let hasBailedOut = false;
|
||||||
const pricedVaps = await useMainStore().getPriceOrderItems(unpricedVaps)
|
const pricedVaps = await useMainStore().getPriceOrderItems(unpricedVaps)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
useMainStore().setBailout(
|
useMainStore().setBailout(bailoutMessage.pricingResponseError(
|
||||||
bailoutMessage.pricingResponseError(
|
unpricedVaps.map((li) => li.partNumber),
|
||||||
unpricedVaps.map((li) => li.partNumber),
|
{ code: err.code, message: err.message, data: err.data }
|
||||||
{ code: err.code, message: err.message, data: err.data }
|
));
|
||||||
)
|
|
||||||
);
|
|
||||||
hasBailedOut = true;
|
hasBailedOut = true;
|
||||||
next(`/?issPage=${issPageValues.BAILOUT_PAGE}`);
|
next(`/?issPage=${issPageValues.BAILOUT_PAGE}`);
|
||||||
});
|
});
|
||||||
|
|
@ -179,11 +177,7 @@ export default {
|
||||||
const piaExperience = this.getSettingValue(experimentSettings.ISS_DISPLAY_PAY_IN_ADVANCE);
|
const piaExperience = this.getSettingValue(experimentSettings.ISS_DISPLAY_PAY_IN_ADVANCE);
|
||||||
const isEnabled = piaExperience === 'true';
|
const isEnabled = piaExperience === 'true';
|
||||||
|
|
||||||
return !isEnabled || this.isUnverified;
|
return !isEnabled || useMainStore().isUnverified;
|
||||||
},
|
|
||||||
isUnverified() {
|
|
||||||
return !useMainStore().isNoComp && !useMainStore().isITAC
|
|
||||||
&& (useMainStore().order.currentDeductible == null || !useMainStore().isVerifiedCoverageStatus);
|
|
||||||
},
|
},
|
||||||
paymentMethod() {
|
paymentMethod() {
|
||||||
return this.paymentMethodInternalModel;
|
return this.paymentMethodInternalModel;
|
||||||
|
|
@ -247,14 +241,22 @@ export default {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Customer
|
// Customer
|
||||||
const { firstName, lastName, phoneNumber, emailAddress } = useMainStore().order.customer;
|
const { firstName, lastName, emailAddress } = useMainStore().order.customer;
|
||||||
const customerReqs = !!(
|
const customerReqs = !!(
|
||||||
firstName
|
firstName
|
||||||
&& lastName
|
&& lastName
|
||||||
&& phoneNumber
|
|
||||||
&& emailAddress
|
&& emailAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Contact Info
|
||||||
|
const { contactInfo } = useMainStore().order;
|
||||||
|
const contactInfoReqs = !!(
|
||||||
|
contactInfo.firstName
|
||||||
|
&& contactInfo.lastName
|
||||||
|
&& contactInfo.servicePhone
|
||||||
|
&& contactInfo.emailAddress
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
vehicleReqs
|
vehicleReqs
|
||||||
&& damageReqs
|
&& damageReqs
|
||||||
|
|
@ -262,6 +264,7 @@ export default {
|
||||||
&& serviceLocationReqs
|
&& serviceLocationReqs
|
||||||
&& scheduleReqs
|
&& scheduleReqs
|
||||||
&& customerReqs
|
&& customerReqs
|
||||||
|
&& contactInfoReqs
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
getPaymentMethodFromStore() {
|
getPaymentMethodFromStore() {
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ describe('payment-page.vue', () => {
|
||||||
firstName: 'first',
|
firstName: 'first',
|
||||||
lastName: 'last',
|
lastName: 'last',
|
||||||
emailAddress: 'builddigitaltest@safelite.com',
|
emailAddress: 'builddigitaltest@safelite.com',
|
||||||
phoneNumber: '555-555-5555'
|
servicePhone: '555-555-5555'
|
||||||
},
|
},
|
||||||
damage: {
|
damage: {
|
||||||
isRepair: false,
|
isRepair: false,
|
||||||
|
|
|
||||||
|
|
@ -419,9 +419,6 @@ export default {
|
||||||
|
|
||||||
const paymentSignaturePromise = await useMainStore().getPaymentSignature();
|
const paymentSignaturePromise = await useMainStore().getPaymentSignature();
|
||||||
|
|
||||||
const wipersPromise = useMainStore().getWipers();
|
|
||||||
const rainDefensePromise = useMainStore().getRainDefense();
|
|
||||||
|
|
||||||
// Settle promises and get results
|
// Settle promises and get results
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
{
|
{
|
||||||
|
|
@ -431,41 +428,14 @@ export default {
|
||||||
{
|
{
|
||||||
resultKey: 'paymentSignature',
|
resultKey: 'paymentSignature',
|
||||||
promise: paymentSignaturePromise
|
promise: paymentSignaturePromise
|
||||||
},
|
|
||||||
{
|
|
||||||
resultKey: 'wipers',
|
|
||||||
promise: wipersPromise
|
|
||||||
},
|
|
||||||
{
|
|
||||||
resultKey: 'rainDefense',
|
|
||||||
promise: rainDefensePromise
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
// use resultMap to populate layout content.
|
// use resultMap to populate layout content.
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
const lineItemsFromStore = useMainStore().lineItems;
|
|
||||||
const glassParts = lineItemsFromStore.glassParts ?? [];
|
|
||||||
const supportingItems = lineItemsFromStore.supportingItems ?? [];
|
|
||||||
|
|
||||||
const lineItemsToTax = [
|
|
||||||
resultMap.rainDefense,
|
|
||||||
...supportingItems,
|
|
||||||
...resultMap.wipers,
|
|
||||||
...glassParts
|
|
||||||
];
|
|
||||||
const availableVaps = [resultMap.rainDefense, ...resultMap.wipers];
|
|
||||||
const pricedLineItemsToTax = await useMainStore().priceOrderItemsAndSaveServerData(lineItemsToTax);
|
|
||||||
const taxedLineItems = await useMainStore().taxOrderItemsAndSaveServerData(pricedLineItemsToTax);
|
|
||||||
|
|
||||||
// Match all line items to the line items as they are in the store
|
|
||||||
// and rebuild the original structure.
|
|
||||||
const taxLineItems = useMainStore().mapTaxedLineItemsToStoreFormat(taxedLineItems, lineItemsFromStore);
|
|
||||||
const taxedVaps = useMainStore().mapTaxedLineItemsToStoreFormat(taxedLineItems, availableVaps);
|
|
||||||
|
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.setData(taxedVaps, taxLineItems);
|
|
||||||
|
|
||||||
vm.$nextTick(() => {
|
vm.$nextTick(() => {
|
||||||
if (vm.$refs.cart) {
|
if (vm.$refs.cart) {
|
||||||
|
|
@ -500,7 +470,7 @@ export default {
|
||||||
zipCode: this.getZipCode(),
|
zipCode: this.getZipCode(),
|
||||||
firstName: useMainStore().order.contactInfo.firstName,
|
firstName: useMainStore().order.contactInfo.firstName,
|
||||||
lastName: useMainStore().order.contactInfo.lastName,
|
lastName: useMainStore().order.contactInfo.lastName,
|
||||||
phoneNumber: useMainStore().order.contactInfo.phoneNumber,
|
phoneNumber: useMainStore().order.contactInfo.servicePhone,
|
||||||
ctu: useMainStore().order.serviceLocation.zipCodeCtu,
|
ctu: useMainStore().order.serviceLocation.zipCodeCtu,
|
||||||
referralCorrelationId: useMainStore().order.referralCorrelationId,
|
referralCorrelationId: useMainStore().order.referralCorrelationId,
|
||||||
workOrderNumber: this.getWorkOrderNumber(),
|
workOrderNumber: this.getWorkOrderNumber(),
|
||||||
|
|
@ -597,7 +567,7 @@ export default {
|
||||||
const contactInfoReqs = !!(
|
const contactInfoReqs = !!(
|
||||||
contactInfo.firstName
|
contactInfo.firstName
|
||||||
&& contactInfo.lastName
|
&& contactInfo.lastName
|
||||||
&& contactInfo.phoneNumber
|
&& contactInfo.servicePhone
|
||||||
&& contactInfo.emailAddress
|
&& contactInfo.emailAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -614,10 +584,6 @@ export default {
|
||||||
&& paymentMethodReqs
|
&& paymentMethodReqs
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
setData(taxedVaps, taxLineItems) {
|
|
||||||
this.availableVaps = taxedVaps;
|
|
||||||
this.lineItems = taxLineItems;
|
|
||||||
},
|
|
||||||
getWorkOrderNumber() {
|
getWorkOrderNumber() {
|
||||||
const { workOrderNumber } = useMainStore().order;
|
const { workOrderNumber } = useMainStore().order;
|
||||||
if (workOrderNumber) {
|
if (workOrderNumber) {
|
||||||
|
|
|
||||||
|
|
@ -18,18 +18,6 @@ const mockMixin = {
|
||||||
getCmsContent: jest.fn().mockImplementation(() => ''),
|
getCmsContent: jest.fn().mockImplementation(() => ''),
|
||||||
setCmsContent: jest.fn(),
|
setCmsContent: jest.fn(),
|
||||||
dispatchStoreAction: jest.fn().mockImplementation((storeAction) => {
|
dispatchStoreAction: jest.fn().mockImplementation((storeAction) => {
|
||||||
if (storeAction === 'priceOrderItemsAndSaveServerData') {
|
|
||||||
return Promise.resolve([
|
|
||||||
{
|
|
||||||
partNumber: 'EARLY BIRD',
|
|
||||||
description: null,
|
|
||||||
partType: 'EARLY BIRD',
|
|
||||||
laborAmount: 0,
|
|
||||||
sellingPrice: 14.99,
|
|
||||||
kitPrice: 0
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if (storeAction === 'saveSupportingItemsSuppressingStateResetting') {
|
if (storeAction === 'saveSupportingItemsSuppressingStateResetting') {
|
||||||
return Promise.resolve([
|
return Promise.resolve([
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ export default {
|
||||||
|
|
||||||
const premiumFeeWithPricePromise = premiumFeePromise.then((result) => {
|
const premiumFeeWithPricePromise = premiumFeePromise.then((result) => {
|
||||||
if (result.data) {
|
if (result.data) {
|
||||||
return useMainStore().priceOrderItemsAndSaveServerData(result.data);
|
return useMainStore().getPriceOrderItems(result.data);
|
||||||
}
|
}
|
||||||
return result.data;
|
return result.data;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
class="mt-5"
|
class="mt-5"
|
||||||
cmsWidgetName="SiteFooterWidget"
|
cmsWidgetName="SiteFooterWidget"
|
||||||
:isForwardActionDisabled="!meta.valid || displayNoShopsAlert"
|
:isForwardActionDisabled="!meta.valid || displayNoShopsAlert"
|
||||||
@backClicked="navigateBack"
|
@backClicked="navigateBack(this, navigateBackScenario)"
|
||||||
@forwardClicked="forwardButtonAction" />
|
@forwardClicked="forwardButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -327,6 +327,12 @@ export default {
|
||||||
},
|
},
|
||||||
displayServiceableMobileOnly() {
|
displayServiceableMobileOnly() {
|
||||||
return this.isServiceableMobile && !this.isServiceableInshop;
|
return this.isServiceableMobile && !this.isServiceableInshop;
|
||||||
|
},
|
||||||
|
navigateBackScenario() {
|
||||||
|
const { isNoComp, isITAC } = useMainStore();
|
||||||
|
return isNoComp || isITAC
|
||||||
|
? this.navigationScenarios.CLICKED_BACK_CANNOT_REACH_TPA_FLOW
|
||||||
|
: this.navigationScenarios.CLICKED_BACK_CAN_REACH_TPA_FLOW;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,14 @@ describe('contact-details-drawer', () => {
|
||||||
const firstName = 'Frederick';
|
const firstName = 'Frederick';
|
||||||
const lastName = 'Taylor';
|
const lastName = 'Taylor';
|
||||||
const emailAddress = 'fred.tay@gmail.com';
|
const emailAddress = 'fred.tay@gmail.com';
|
||||||
const phoneNumber = '606-009-2943';
|
const servicePhone = '606-009-2943';
|
||||||
const mainInitialState = {
|
const mainInitialState = {
|
||||||
order: {
|
order: {
|
||||||
contactInfo: {
|
contactInfo: {
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber
|
servicePhone
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -81,7 +81,7 @@ describe('contact-details-drawer', () => {
|
||||||
firstName: 'Frederick',
|
firstName: 'Frederick',
|
||||||
lastName: 'Taylor',
|
lastName: 'Taylor',
|
||||||
emailAddress: 'fred.tay@gmail.com',
|
emailAddress: 'fred.tay@gmail.com',
|
||||||
phoneNumber: '606-009-2943'
|
servicePhone: '606-009-2943'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -96,7 +96,9 @@ describe('contact-details-drawer', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.emitted()['update-contact-details']).toBeTruthy();
|
expect(wrapper.emitted()['update-contact-details']).toBeTruthy();
|
||||||
expect(useMainStore().updateContactInfo).toBeCalledTimes(1);
|
expect(useMainStore().updateContactInfo).toBeCalledTimes(1);
|
||||||
expect(useMainStore().updateContactInfo).toBeCalledWith({ firstName, lastName, emailAddress, phoneNumber });
|
expect(useMainStore().updateContactInfo).toBeCalledWith({ firstName, lastName, emailAddress });
|
||||||
|
expect(useMainStore().updatePhoneNumbers).toBeCalledTimes(1);
|
||||||
|
expect(useMainStore().updatePhoneNumbers).toBeCalledWith({ home: phoneNumber, service: phoneNumber });
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -67,13 +67,13 @@ export default {
|
||||||
const { firstName,
|
const { firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber } = useMainStore().contactInfo;
|
servicePhone } = useMainStore().contactInfo;
|
||||||
return {
|
return {
|
||||||
isModalOpened: false,
|
isModalOpened: false,
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber,
|
phoneNumber: servicePhone,
|
||||||
widget: {
|
widget: {
|
||||||
title: 'ContactDetailsDrawerHeaderWidget',
|
title: 'ContactDetailsDrawerHeaderWidget',
|
||||||
firstNameQuestion: 'FirstNameQuestionWidget',
|
firstNameQuestion: 'FirstNameQuestionWidget',
|
||||||
|
|
@ -119,21 +119,24 @@ export default {
|
||||||
const contactInfo = {
|
const contactInfo = {
|
||||||
firstName: this.firstName,
|
firstName: this.firstName,
|
||||||
lastName: this.lastName,
|
lastName: this.lastName,
|
||||||
emailAddress: this.emailAddress,
|
emailAddress: this.emailAddress
|
||||||
phoneNumber: this.phoneNumber
|
|
||||||
};
|
};
|
||||||
useMainStore().updateContactInfo(contactInfo);
|
useMainStore().updateContactInfo(contactInfo);
|
||||||
|
useMainStore().updatePhoneNumbers({
|
||||||
|
home: this.phoneNumber,
|
||||||
|
service: this.phoneNumber
|
||||||
|
});
|
||||||
this.$emit('update-contact-details');
|
this.$emit('update-contact-details');
|
||||||
},
|
},
|
||||||
resetFormValues() {
|
resetFormValues() {
|
||||||
const { firstName,
|
const { firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber } = useMainStore().contactInfo;
|
servicePhone } = useMainStore().contactInfo;
|
||||||
this.firstName = firstName;
|
this.firstName = firstName;
|
||||||
this.lastName = lastName;
|
this.lastName = lastName;
|
||||||
this.emailAddress = emailAddress;
|
this.emailAddress = emailAddress;
|
||||||
this.phoneNumber = phoneNumber;
|
this.phoneNumber = servicePhone;
|
||||||
},
|
},
|
||||||
openModal() {
|
openModal() {
|
||||||
this.modal.openModal();
|
this.modal.openModal();
|
||||||
|
|
|
||||||
|
|
@ -499,14 +499,14 @@ describe('tpa-submit', () => {
|
||||||
const firstName = 'Jones';
|
const firstName = 'Jones';
|
||||||
const lastName = 'Eddison';
|
const lastName = 'Eddison';
|
||||||
const emailAddress = 'myname@gmail.com';
|
const emailAddress = 'myname@gmail.com';
|
||||||
const phoneNumber = '0001112222';
|
const servicePhone = '0001112222';
|
||||||
const initialStore = {
|
const initialStore = {
|
||||||
order: {
|
order: {
|
||||||
contactInfo: {
|
contactInfo: {
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber
|
servicePhone
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -514,7 +514,7 @@ describe('tpa-submit', () => {
|
||||||
const expectedLine1 = 'Jones Eddison';
|
const expectedLine1 = 'Jones Eddison';
|
||||||
const expectedLine2 = emailAddress;
|
const expectedLine2 = emailAddress;
|
||||||
const expectedLine3 = 'some value returned';
|
const expectedLine3 = 'some value returned';
|
||||||
toDisplayPhoneNumber.mockImplementation((number) => (number === phoneNumber ? expectedLine3 : ''));
|
toDisplayPhoneNumber.mockImplementation((number) => (number === servicePhone ? expectedLine3 : ''));
|
||||||
const contactInfoSectionIndex = 3;
|
const contactInfoSectionIndex = 3;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -530,7 +530,7 @@ describe('tpa-submit', () => {
|
||||||
expect(contactInfoSection.lines[0]).toBe(expectedLine1);
|
expect(contactInfoSection.lines[0]).toBe(expectedLine1);
|
||||||
expect(contactInfoSection.lines[1]).toBe(expectedLine2);
|
expect(contactInfoSection.lines[1]).toBe(expectedLine2);
|
||||||
expect(contactInfoSection.lines[2]).toBe(expectedLine3);
|
expect(contactInfoSection.lines[2]).toBe(expectedLine3);
|
||||||
expect(toDisplayPhoneNumber).toHaveBeenCalledWith(phoneNumber);
|
expect(toDisplayPhoneNumber).toHaveBeenCalledWith(servicePhone);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('computed', () => {
|
describe('computed', () => {
|
||||||
|
|
|
||||||
|
|
@ -236,11 +236,11 @@ export default {
|
||||||
return [toTitleCase(this.companyName ?? ''), displayAddress, displayPhoneNumber];
|
return [toTitleCase(this.companyName ?? ''), displayAddress, displayPhoneNumber];
|
||||||
},
|
},
|
||||||
getContactInfoLines() {
|
getContactInfoLines() {
|
||||||
const { firstName, lastName, emailAddress, phoneNumber } = useMainStore().contactInfo;
|
const { firstName, lastName, emailAddress, servicePhone } = useMainStore().contactInfo;
|
||||||
return [
|
return [
|
||||||
`${firstName} ${lastName}`,
|
`${firstName} ${lastName}`,
|
||||||
emailAddress ?? '',
|
emailAddress ?? '',
|
||||||
toDisplayPhoneNumber(phoneNumber)
|
toDisplayPhoneNumber(servicePhone)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -197,6 +197,8 @@ import states from '@/constants/states';
|
||||||
import globalRules from '@/constants/global-rules';
|
import globalRules from '@/constants/global-rules';
|
||||||
import routerParams from '@/router/router-constants/router-params';
|
import routerParams from '@/router/router-constants/router-params';
|
||||||
import MaskaFormattedMasks from '@/constants/maska-masks';
|
import MaskaFormattedMasks from '@/constants/maska-masks';
|
||||||
|
import globalMethods from '@/global-methods';
|
||||||
|
import { endpoints } from '@/constants/endpoints';
|
||||||
|
|
||||||
// define validation rules
|
// define validation rules
|
||||||
defineRule('damage-option-required', required(errorMessages.DAMAGE_OPTION_REQUIRED));
|
defineRule('damage-option-required', required(errorMessages.DAMAGE_OPTION_REQUIRED));
|
||||||
|
|
@ -323,6 +325,20 @@ export default {
|
||||||
.then(async (zipInfo) => {
|
.then(async (zipInfo) => {
|
||||||
if (zipInfo?.data?.isValid === true) {
|
if (zipInfo?.data?.isValid === true) {
|
||||||
this.mainStore.updatePolicyData(this.welcomePageModel);
|
this.mainStore.updatePolicyData(this.welcomePageModel);
|
||||||
|
|
||||||
|
this.mainStore.order.serviceLocation.zipCodeCtu = zipInfo.data.zipCodeCtu?.toString();
|
||||||
|
|
||||||
|
const billToInfo = await this.getBillToInfo(
|
||||||
|
this.mainStore.issConfig.parentAccountNumber,
|
||||||
|
this.mainStore.order.serviceLocation.zipCodeCtu
|
||||||
|
);
|
||||||
|
|
||||||
|
if (billToInfo !== null) {
|
||||||
|
this.mainStore.issConfig.billToAccountNumber = billToInfo.billToAccountNumber;
|
||||||
|
this.mainStore.issConfig.itacCashBillToNumber = billToInfo.itacCashBillToNumber;
|
||||||
|
this.mainStore.issConfig.itacFnrBillToNumber = billToInfo.itacFnrBillToNumber;
|
||||||
|
}
|
||||||
|
|
||||||
await this.mainStore.getDuplicateReferrals()
|
await this.mainStore.getDuplicateReferrals()
|
||||||
.then(() => {}, () => {})
|
.then(() => {}, () => {})
|
||||||
.finally(async () => {
|
.finally(async () => {
|
||||||
|
|
@ -339,6 +355,31 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async getBillToInfo(parentAccountNumber, providerNumber) {
|
||||||
|
try {
|
||||||
|
const payload = {
|
||||||
|
parentAccountNumber: parentAccountNumber.toString(),
|
||||||
|
providerNumber: providerNumber.toString(),
|
||||||
|
billToSelectionCriteria: {
|
||||||
|
typeOfClaim: 'GLASS ONLY',
|
||||||
|
lineOfBusiness: 'PERSONAL'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await globalMethods.callHttpClient({
|
||||||
|
method: endpoints.GetBillToInfo.method,
|
||||||
|
endpoint: endpoints.GetBillToInfo.url,
|
||||||
|
payload
|
||||||
|
});
|
||||||
|
|
||||||
|
return response.data;
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Error Status Code: ${err.data?.status}: ${err.data?.title}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
navigateForward() {
|
navigateForward() {
|
||||||
if (this.mainStore.applicationUser.duplicateOrders?.length > 0 ?? false) {
|
if (this.mainStore.applicationUser.duplicateOrders?.length > 0 ?? false) {
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,10 @@ export default {
|
||||||
const footerInfoBox = document.querySelector('.footer#infoBox');
|
const footerInfoBox = document.querySelector('.footer#infoBox');
|
||||||
return footerInfoBox ? footerInfoBox.offsetHeight : 0;
|
return footerInfoBox ? footerInfoBox.offsetHeight : 0;
|
||||||
},
|
},
|
||||||
navigateBack(vm) {
|
navigateBack(vm, scenario = this.navigationScenarios.CLICKED_BACK) {
|
||||||
const self = vm ?? this;
|
const self = vm ?? this;
|
||||||
|
|
||||||
self.$router.navigateWithSpinner(this.navigationScenarios.CLICKED_BACK, self.$route);
|
self.$router.navigateWithSpinner(scenario, self.$route);
|
||||||
},
|
},
|
||||||
savePageDataToStore(page, data) {
|
savePageDataToStore(page, data) {
|
||||||
useMainStore().updatePageData({ page, data });
|
useMainStore().updatePageData({ page, data });
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,10 @@ const navigationScenarios = Object.freeze({
|
||||||
EDIT_PREFERRED_SHOP: 'EDIT_PREFERRED_SHOP',
|
EDIT_PREFERRED_SHOP: 'EDIT_PREFERRED_SHOP',
|
||||||
EDIT_CONTACT_DETAILS: 'EDIT_CONTACT_DETAILS',
|
EDIT_CONTACT_DETAILS: 'EDIT_CONTACT_DETAILS',
|
||||||
|
|
||||||
|
// Service location
|
||||||
|
CLICKED_BACK_CANNOT_REACH_TPA_FLOW: 'CLICKED_BACK_CANNOT_REACH_TPA_FLOW',
|
||||||
|
CLICKED_BACK_CAN_REACH_TPA_FLOW: 'CLICKED_BACK_CAN_REACH_TPA_FLOW',
|
||||||
|
|
||||||
// Provider Preference
|
// Provider Preference
|
||||||
CLICKED_FORWARD_WITH_SAFELITE: 'CLICKED_FORWARD_WITH_SAFELITE',
|
CLICKED_FORWARD_WITH_SAFELITE: 'CLICKED_FORWARD_WITH_SAFELITE',
|
||||||
CLICKED_FORWARD_WITH_TPA_ENABLED: 'CLICKED_FORWARD_WITH_TPA_ENABLED',
|
CLICKED_FORWARD_WITH_TPA_ENABLED: 'CLICKED_FORWARD_WITH_TPA_ENABLED',
|
||||||
|
|
|
||||||
|
|
@ -559,7 +559,11 @@ const routingTable = () => [
|
||||||
issPageValue: issPageValues.SERVICE_LOCATION,
|
issPageValue: issPageValues.SERVICE_LOCATION,
|
||||||
maps: [
|
maps: [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK,
|
scenario: navigationScenarios.CLICKED_BACK_CANNOT_REACH_TPA_FLOW,
|
||||||
|
destinationIssPageValue: issPageValues.COVERAGE_STATEMENT
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_CAN_REACH_TPA_FLOW,
|
||||||
destinationIssPageValue: issPageValues.PROVIDER_PREFERENCE
|
destinationIssPageValue: issPageValues.PROVIDER_PREFERENCE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import {
|
||||||
} from '@/helpers/policy-vehicle-helper';
|
} from '@/helpers/policy-vehicle-helper';
|
||||||
import partTypeStrings from '@/constants/part-type-strings';
|
import partTypeStrings from '@/constants/part-type-strings';
|
||||||
import bailoutMessage from '@/constants/bailoutMessage';
|
import bailoutMessage from '@/constants/bailoutMessage';
|
||||||
import bailoutCode from "@/constants/bailoutCode";
|
import bailoutCode from '@/constants/bailoutCode';
|
||||||
|
|
||||||
const storeId = 'main';
|
const storeId = 'main';
|
||||||
|
|
||||||
|
|
@ -119,8 +119,7 @@ export const getDefaultState = () => ({
|
||||||
},
|
},
|
||||||
firstName: null,
|
firstName: null,
|
||||||
lastName: null,
|
lastName: null,
|
||||||
emailAddress: null,
|
emailAddress: null
|
||||||
phoneNumber: null
|
|
||||||
},
|
},
|
||||||
serviceLocation: {
|
serviceLocation: {
|
||||||
address: null,
|
address: null,
|
||||||
|
|
@ -182,7 +181,9 @@ export const getDefaultState = () => ({
|
||||||
firstName: null,
|
firstName: null,
|
||||||
lastName: null,
|
lastName: null,
|
||||||
emailAddress: null,
|
emailAddress: null,
|
||||||
phoneNumber: null,
|
homePhone: null,
|
||||||
|
alternativePhone: null,
|
||||||
|
servicePhone: null,
|
||||||
requestTextUpdates: false,
|
requestTextUpdates: false,
|
||||||
notesForTechnician: ''
|
notesForTechnician: ''
|
||||||
},
|
},
|
||||||
|
|
@ -227,6 +228,9 @@ export const getDefaultState = () => ({
|
||||||
clientHeader: {},
|
clientHeader: {},
|
||||||
styleSheet: '', // Stylesheet used by the client.
|
styleSheet: '', // Stylesheet used by the client.
|
||||||
parentAccountNumber: 0, // Parent account number used by the client.
|
parentAccountNumber: 0, // Parent account number used by the client.
|
||||||
|
billToAccountNumber: null,
|
||||||
|
itacCashBillToNumber: null,
|
||||||
|
itacFnrBillToNumber: null,
|
||||||
isCoverageEnabled: false, // Indicates if we should be calling coverage on this flow.
|
isCoverageEnabled: false, // Indicates if we should be calling coverage on this flow.
|
||||||
isClaimRegistrationRequired: false, // Indicates if the claim registration call needs to be made for a client to complete coverage verification.
|
isClaimRegistrationRequired: false, // Indicates if the claim registration call needs to be made for a client to complete coverage verification.
|
||||||
isAuthenticated: false, // Indicates if user is authenticated or not.
|
isAuthenticated: false, // Indicates if user is authenticated or not.
|
||||||
|
|
@ -238,7 +242,8 @@ export const getDefaultState = () => ({
|
||||||
policyZipCode: null,
|
policyZipCode: null,
|
||||||
dateOfLoss: null
|
dateOfLoss: null
|
||||||
},
|
},
|
||||||
siteType: null
|
siteType: null,
|
||||||
|
enableNoCompQuote: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -248,9 +253,20 @@ export const useMainStore = defineStore({
|
||||||
id: storeId,
|
id: storeId,
|
||||||
state: () => state,
|
state: () => state,
|
||||||
getters: {
|
getters: {
|
||||||
hasRecalibrationPart: (state) => getHasRecalibrationPart(state),
|
billToNumberToUse(storeState) {
|
||||||
vehicle: (state) => state.order.vehicle,
|
if (this.isITAC) {
|
||||||
damage: (state) => state.order.damage,
|
return storeState.issConfig.itacCashBillToNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isNoComp) {
|
||||||
|
return storeState.issConfig.itacFnrBillToNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
return storeState.issConfig.billToAccountNumber;
|
||||||
|
},
|
||||||
|
hasRecalibrationPart: (storeState) => getHasRecalibrationPart(storeState),
|
||||||
|
vehicle: (storeState) => storeState.order.vehicle,
|
||||||
|
damage: (storeState) => storeState.order.damage,
|
||||||
lineItems: (state) => state.order.lineItems,
|
lineItems: (state) => state.order.lineItems,
|
||||||
payment: (state) => state.order.payment,
|
payment: (state) => state.order.payment,
|
||||||
policy: (state) => state.order.policy,
|
policy: (state) => state.order.policy,
|
||||||
|
|
@ -265,8 +281,26 @@ export const useMainStore = defineStore({
|
||||||
isClaimAlreadyRegistered: (state) => state.order.payment.insuranceCoverage.claimNumber !== null,
|
isClaimAlreadyRegistered: (state) => state.order.payment.insuranceCoverage.claimNumber !== null,
|
||||||
isBailout: (state) => state.applicationUser.pageData[issPageValues.BAILOUT_PAGE] != null,
|
isBailout: (state) => state.applicationUser.pageData[issPageValues.BAILOUT_PAGE] != null,
|
||||||
bailoutCode: (state) => state.applicationUser.pageData[issPageValues.BAILOUT_PAGE]?.bailoutCode,
|
bailoutCode: (state) => state.applicationUser.pageData[issPageValues.BAILOUT_PAGE]?.bailoutCode,
|
||||||
isNoComp: (state) => !!state.order.policy.noCoverage,
|
isNoComp: (s) => !!s.order.policy.noCoverage,
|
||||||
isITAC: (state) => !!state.order.policy.isITAC,
|
isITAC: (state) => !!state.order.policy.isITAC,
|
||||||
|
isUnverified: (s) => {
|
||||||
|
const { policyLookupSuccessful, payment, currentDeductible } = s.order;
|
||||||
|
const registerClaimSuccessful = !!payment.insuranceCoverage.isVerified;
|
||||||
|
if (!policyLookupSuccessful) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (s.isNoComp && !s.issConfig.enableNoCompQuote) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!s.isNoComp && currentDeductible == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (s.isClaimRegistrationRequired && !registerClaimSuccessful) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
// TODO condense verification logic
|
||||||
isVerifiedCoverageStatus: (state) => state.order.payment.insuranceCoverage.coverageStatus === coverageStatuses.VERIFIED,
|
isVerifiedCoverageStatus: (state) => state.order.payment.insuranceCoverage.coverageStatus === coverageStatuses.VERIFIED,
|
||||||
eventBusItem: (state) => (eventCategory, eventSubCategory) => {
|
eventBusItem: (state) => (eventCategory, eventSubCategory) => {
|
||||||
const matchedEvent = state.applicationUser.eventBus.find(({ category, subCategory }) => category === eventCategory && subCategory === eventSubCategory);
|
const matchedEvent = state.applicationUser.eventBus.find(({ category, subCategory }) => category === eventCategory && subCategory === eventSubCategory);
|
||||||
|
|
@ -308,7 +342,9 @@ export const useMainStore = defineStore({
|
||||||
firstName: s.order.contactInfo.firstName ?? s.order.customer.firstName,
|
firstName: s.order.contactInfo.firstName ?? s.order.customer.firstName,
|
||||||
lastName: s.order.contactInfo.lastName ?? s.order.customer.lastName,
|
lastName: s.order.contactInfo.lastName ?? s.order.customer.lastName,
|
||||||
emailAddress: s.order.contactInfo.emailAddress ?? s.order.customer.emailAddress,
|
emailAddress: s.order.contactInfo.emailAddress ?? s.order.customer.emailAddress,
|
||||||
phoneNumber: s.order.contactInfo.phoneNumber ?? s.order.customer.phoneNumber,
|
homePhone: s.order.contactInfo.homePhone,
|
||||||
|
alternativePhone: s.order.contactInfo.alternativePhone,
|
||||||
|
servicePhone: s.order.contactInfo.servicePhone,
|
||||||
requestTextUpdates: s.order.contactInfo.requestTextUpdates ?? false,
|
requestTextUpdates: s.order.contactInfo.requestTextUpdates ?? false,
|
||||||
notesForTechnician: s.order.contactInfo.notesForTechnician
|
notesForTechnician: s.order.contactInfo.notesForTechnician
|
||||||
}),
|
}),
|
||||||
|
|
@ -554,7 +590,7 @@ export const useMainStore = defineStore({
|
||||||
country: 'US' // TODO set from store
|
country: 'US' // TODO set from store
|
||||||
},
|
},
|
||||||
homePhone: {
|
homePhone: {
|
||||||
number: this.order.customer.phoneNumber?.replaceAll(nonNumberCharRegex, '') ?? ''
|
number: this.contactInfo.homePhone?.replaceAll(nonNumberCharRegex, '') ?? ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
driver: {
|
driver: {
|
||||||
|
|
@ -814,7 +850,7 @@ export const useMainStore = defineStore({
|
||||||
startDate,
|
startDate,
|
||||||
endDate,
|
endDate,
|
||||||
applicationName: applicationConfig.APPLICATION_NAME,
|
applicationName: applicationConfig.APPLICATION_NAME,
|
||||||
billToAccountNumber: this.issConfig.parentAccountNumber.toString(), // TODO: MAKE THIS REAL
|
billToAccountNumber: this.billToNumberToUse,
|
||||||
parentAccountNumber: this.issConfig.parentAccountNumber, // this.payment.parentAccountNumber,
|
parentAccountNumber: this.issConfig.parentAccountNumber, // this.payment.parentAccountNumber,
|
||||||
carId: vehicle.carId,
|
carId: vehicle.carId,
|
||||||
lineItems,
|
lineItems,
|
||||||
|
|
@ -877,7 +913,7 @@ export const useMainStore = defineStore({
|
||||||
endDate,
|
endDate,
|
||||||
shopAppointmentType,
|
shopAppointmentType,
|
||||||
applicationName: applicationConfig.APPLICATION_NAME,
|
applicationName: applicationConfig.APPLICATION_NAME,
|
||||||
billToAccountNumber: order.policy.isITAC ? applicationConfig.ITAC_CASH_BILLTO : applicationConfig.ITAC_FAIR_AND_REASONABLE_BILLTO, // TODO: MAKE THIS REAL
|
billToAccountNumber: this.billToNumberToUse,
|
||||||
parentAccountNumber: this.issConfig.parentAccountNumber, // this.payment.parentAccountNumber,
|
parentAccountNumber: this.issConfig.parentAccountNumber, // this.payment.parentAccountNumber,
|
||||||
carId: vehicle.carId,
|
carId: vehicle.carId,
|
||||||
lineItems,
|
lineItems,
|
||||||
|
|
@ -1002,6 +1038,7 @@ export const useMainStore = defineStore({
|
||||||
|
|
||||||
let queryString =
|
let queryString =
|
||||||
`ParentAccountNumber=${this.order.accountNumber}`
|
`ParentAccountNumber=${this.order.accountNumber}`
|
||||||
|
+ `&BillToAccountNumber=${this.billToNumberToUse}`
|
||||||
+ `&CTU=${ctuToUse}`
|
+ `&CTU=${ctuToUse}`
|
||||||
+ `&Deductible=${deductibleToUse}`
|
+ `&Deductible=${deductibleToUse}`
|
||||||
+ `&ZipCode=${zipCodeToUse}`
|
+ `&ZipCode=${zipCodeToUse}`
|
||||||
|
|
@ -1030,12 +1067,10 @@ export const useMainStore = defineStore({
|
||||||
|
|
||||||
getMobileFeePart() {
|
getMobileFeePart() {
|
||||||
const damageType = this.damage.isRepair ? 'Repair' : 'Replace';
|
const damageType = this.damage.isRepair ? 'Repair' : 'Replace';
|
||||||
const parentAccountNumber = 167132; // TODO: MAKE THIS REAL
|
|
||||||
const billToAccountNumber = 87291; // TODO: MAKE THIS REAL
|
|
||||||
|
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetMobileFeePart.method,
|
method: endpoints.GetMobileFeePart.method,
|
||||||
endpoint: `${endpoints.GetMobileFeePart.url}/${damageType}/${parentAccountNumber}/${billToAccountNumber}`
|
endpoint: `${endpoints.GetMobileFeePart.url}/${damageType}/${this.order.accountNumber}/${this.billToNumberToUse}`
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1204,7 +1239,7 @@ export const useMainStore = defineStore({
|
||||||
policyHolder: {
|
policyHolder: {
|
||||||
policyFirstName: customer.firstName,
|
policyFirstName: customer.firstName,
|
||||||
policyLastName: customer.lastName,
|
policyLastName: customer.lastName,
|
||||||
policyPhoneNumber: customer.phoneNumber,
|
policyPhoneNumber: contactInfo.servicePhone,
|
||||||
policyEmail: customer.emailAddress,
|
policyEmail: customer.emailAddress,
|
||||||
policyState: customer.address.state
|
policyState: customer.address.state
|
||||||
},
|
},
|
||||||
|
|
@ -1228,8 +1263,10 @@ export const useMainStore = defineStore({
|
||||||
emailAddress: contactInfo.emailAddress || customer.emailAddress,
|
emailAddress: contactInfo.emailAddress || customer.emailAddress,
|
||||||
firstName: contactInfo.firstName || customer.firstName,
|
firstName: contactInfo.firstName || customer.firstName,
|
||||||
lastName: contactInfo.lastName || customer.lastName,
|
lastName: contactInfo.lastName || customer.lastName,
|
||||||
phoneNumber: contactInfo.phoneNumber,
|
homePhone: contactInfo.homePhone,
|
||||||
optInSms: contactInfo.requestTextUpdates ?? false
|
servicePhone: contactInfo.servicePhone,
|
||||||
|
alternativePhone: contactInfo.alternativePhone,
|
||||||
|
isSmsOptIn: contactInfo.requestTextUpdates ?? false
|
||||||
},
|
},
|
||||||
lineItems: {
|
lineItems: {
|
||||||
glassParts: lineItems.glassParts,
|
glassParts: lineItems.glassParts,
|
||||||
|
|
@ -1325,7 +1362,6 @@ export const useMainStore = defineStore({
|
||||||
order.customer.emailAddress = data.customer?.emailAddress;
|
order.customer.emailAddress = data.customer?.emailAddress;
|
||||||
order.customer.firstName = data.customer?.firstName;
|
order.customer.firstName = data.customer?.firstName;
|
||||||
order.customer.lastName = data.customer?.lastName;
|
order.customer.lastName = data.customer?.lastName;
|
||||||
order.customer.phoneNumber = data?.customer?.phoneNumber;
|
|
||||||
|
|
||||||
order.customer.address.streetAddress = data.customer?.address?.streetAddress;
|
order.customer.address.streetAddress = data.customer?.address?.streetAddress;
|
||||||
order.customer.address.streetAddress2 = data.customer?.address?.streetAddress2;
|
order.customer.address.streetAddress2 = data.customer?.address?.streetAddress2;
|
||||||
|
|
@ -1336,7 +1372,8 @@ export const useMainStore = defineStore({
|
||||||
order.contactInfo.firstName = data?.customer?.firstName;
|
order.contactInfo.firstName = data?.customer?.firstName;
|
||||||
order.contactInfo.lastName = data?.customer?.lastName;
|
order.contactInfo.lastName = data?.customer?.lastName;
|
||||||
order.contactInfo.emailAddress = data?.customer?.emailAddress;
|
order.contactInfo.emailAddress = data?.customer?.emailAddress;
|
||||||
order.contactInfo.phoneNumber = data?.customer?.phoneNumber;
|
order.contactInfo.homePhone = data?.customer?.phoneNumber;
|
||||||
|
order.contactInfo.servicephone = data?.customer?.phoneNumber;
|
||||||
order.contactInfo.requestTextUpdates = data?.customer?.isSmsOptIn;
|
order.contactInfo.requestTextUpdates = data?.customer?.isSmsOptIn;
|
||||||
|
|
||||||
order.payment.insuranceCoverage.isVerified = data?.payment?.insuranceCoverage?.isVerified;
|
order.payment.insuranceCoverage.isVerified = data?.payment?.insuranceCoverage?.isVerified;
|
||||||
|
|
@ -1673,6 +1710,10 @@ export const useMainStore = defineStore({
|
||||||
this.issConfig.disabledFields.policyZipCode = false;
|
this.issConfig.disabledFields.policyZipCode = false;
|
||||||
this.issConfig.disabledFields.dateOfLoss = false;
|
this.issConfig.disabledFields.dateOfLoss = false;
|
||||||
this.issConfig.siteType = null;
|
this.issConfig.siteType = null;
|
||||||
|
this.issConfig.enableNoCompQuote = false;
|
||||||
|
this.issConfig.billToAccountNumber = null;
|
||||||
|
this.issConfig.itacCashBillToNumber = null;
|
||||||
|
this.issConfig.itacFnrBillToNumber = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
disableKeyFields() {
|
disableKeyFields() {
|
||||||
|
|
@ -1775,8 +1816,11 @@ export const useMainStore = defineStore({
|
||||||
this.order.policy.damageState = welcomePageModel?.damageState;
|
this.order.policy.damageState = welcomePageModel?.damageState;
|
||||||
this.order.policy.damageCity = welcomePageModel?.damageCity;
|
this.order.policy.damageCity = welcomePageModel?.damageCity;
|
||||||
this.order.policy.isDamageGlassOnly = welcomePageModel?.isDamageGlassOnly;
|
this.order.policy.isDamageGlassOnly = welcomePageModel?.isDamageGlassOnly;
|
||||||
this.order.customer.phoneNumber = welcomePageModel?.phoneNumber;
|
|
||||||
this.order.customer.emailAddress = welcomePageModel?.email;
|
this.order.customer.emailAddress = welcomePageModel?.email;
|
||||||
|
this.updatePhoneNumbers({
|
||||||
|
home: welcomePageModel?.phoneNumber,
|
||||||
|
service: welcomePageModel?.phoneNumber
|
||||||
|
});
|
||||||
},
|
},
|
||||||
updatePolicyHolderDetails(customerQuestions) {
|
updatePolicyHolderDetails(customerQuestions) {
|
||||||
this.order.customer.address.streetAddress = customerQuestions.addressQuestions.streetAddress;
|
this.order.customer.address.streetAddress = customerQuestions.addressQuestions.streetAddress;
|
||||||
|
|
@ -1856,51 +1900,10 @@ export const useMainStore = defineStore({
|
||||||
this.updateCapabilityQuestionAnswers(capabilityQuestionAnswersArray);
|
this.updateCapabilityQuestionAnswers(capabilityQuestionAnswersArray);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Price order actions
|
|
||||||
async priceOrderItemsAndSaveServerData(availableLineItems, serviceZipCode, serviceZipCodeCtu) {
|
|
||||||
const zipCodeToUse = serviceZipCode || this.order.serviceLocation.zipCode;
|
|
||||||
const ctuToUse = serviceZipCodeCtu || this.order.serviceLocation.zipCodeCtu;
|
|
||||||
const flattenedLineItemsWithChildParts = getFlattenedArrayOfLineItemsWithChildParts(availableLineItems);
|
|
||||||
const lineItemsWithOnlyPartNumbers = flattenedLineItemsWithChildParts.map((lineItem) => ({
|
|
||||||
partNumber: lineItem.partNumber
|
|
||||||
}));
|
|
||||||
const availableLineItemsFormattedForRequest =
|
|
||||||
buildQueryStringParameterFromArrayOfComplexObjects(
|
|
||||||
lineItemsWithOnlyPartNumbers,
|
|
||||||
'lineItems'
|
|
||||||
);
|
|
||||||
|
|
||||||
const { vehicle } = this.order;
|
|
||||||
|
|
||||||
let queryString =
|
|
||||||
`ParentAccountNumber=${applicationConfig.CASH_PARENT_ACCOUNT_NUMBER}`
|
|
||||||
+ `&CTU=${ctuToUse}`
|
|
||||||
+ `&CarId=${vehicle.carId}`
|
|
||||||
+ `&Make=${vehicle.make}`
|
|
||||||
+ `&Model=${vehicle.model}`
|
|
||||||
+ `&Year=${vehicle.year}`
|
|
||||||
+ `&EON=${this.order.eon}`
|
|
||||||
+ `&ZipCode=${zipCodeToUse}`
|
|
||||||
+ `&${availableLineItemsFormattedForRequest}`;
|
|
||||||
|
|
||||||
const lineItemServerData = this.order.lineItems.serverData;
|
|
||||||
if (lineItemServerData) {
|
|
||||||
queryString += `&ServerData=${encodeURIComponent(lineItemServerData)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await globalMethods.callHttpClient({
|
|
||||||
method: endpoints.GetPriceOrderItems.method,
|
|
||||||
endpoint: `${endpoints.GetPriceOrderItems.url}?${queryString}`
|
|
||||||
});
|
|
||||||
|
|
||||||
// context.commit(storeMutations.UPDATE_LINE_ITEMS_SERVER_DATA, response.data.serverData);
|
|
||||||
return addPricesToLineItems(availableLineItems, response.data.lineItems);
|
|
||||||
},
|
|
||||||
// Tax order actions
|
// Tax order actions
|
||||||
async taxOrderItemsAndSaveServerData(pricedLineItems) {
|
async taxOrderItemsAndSaveServerData(pricedLineItems) {
|
||||||
const { order } = this;
|
const { order } = this;
|
||||||
const { serviceLocation } = order;
|
const { serviceLocation } = order;
|
||||||
const billToAccountNumber = this.issConfig.parentAccountNumber.toString(); // payment
|
|
||||||
const { providerNumber } = serviceLocation.provider;
|
const { providerNumber } = serviceLocation.provider;
|
||||||
const { appointmentType } = serviceLocation;
|
const { appointmentType } = serviceLocation;
|
||||||
const serviceLocationCity = serviceLocation.city;
|
const serviceLocationCity = serviceLocation.city;
|
||||||
|
|
@ -1926,7 +1929,7 @@ export const useMainStore = defineStore({
|
||||||
|| appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP) {
|
|| appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP) {
|
||||||
queryString =
|
queryString =
|
||||||
`ParentAccountNumber=${applicationConfig.CASH_PARENT_ACCOUNT_NUMBER}`
|
`ParentAccountNumber=${applicationConfig.CASH_PARENT_ACCOUNT_NUMBER}`
|
||||||
+ `&BillToAccountNumber=${billToAccountNumber}`
|
+ `&BillToAccountNumber=${this.billToNumberToUse}`
|
||||||
+ `&ProviderNumber=${providerNumber}`
|
+ `&ProviderNumber=${providerNumber}`
|
||||||
+ `&AppointmentType=${appointmentType}`
|
+ `&AppointmentType=${appointmentType}`
|
||||||
+ `&ServiceLocation.City=${serviceLocationCity}`
|
+ `&ServiceLocation.City=${serviceLocationCity}`
|
||||||
|
|
@ -1936,7 +1939,7 @@ export const useMainStore = defineStore({
|
||||||
} else {
|
} else {
|
||||||
queryString =
|
queryString =
|
||||||
`ParentAccountNumber=${applicationConfig.CASH_PARENT_ACCOUNT_NUMBER}`
|
`ParentAccountNumber=${applicationConfig.CASH_PARENT_ACCOUNT_NUMBER}`
|
||||||
+ `&BillToAccountNumber=${billToAccountNumber}`
|
+ `&BillToAccountNumber=${this.billToNumberToUse}`
|
||||||
+ `&ProviderNumber=${providerNumber}`
|
+ `&ProviderNumber=${providerNumber}`
|
||||||
+ `&AppointmentType=${appointmentType}`
|
+ `&AppointmentType=${appointmentType}`
|
||||||
+ `&${pricedLineItemsFormattedForRequest}`;
|
+ `&${pricedLineItemsFormattedForRequest}`;
|
||||||
|
|
@ -2123,11 +2126,17 @@ export const useMainStore = defineStore({
|
||||||
this.order.contactInfo.firstName = contactInfo?.firstName ?? '';
|
this.order.contactInfo.firstName = contactInfo?.firstName ?? '';
|
||||||
this.order.contactInfo.lastName = contactInfo?.lastName ?? '';
|
this.order.contactInfo.lastName = contactInfo?.lastName ?? '';
|
||||||
this.order.contactInfo.emailAddress = contactInfo?.emailAddress ?? '';
|
this.order.contactInfo.emailAddress = contactInfo?.emailAddress ?? '';
|
||||||
this.order.contactInfo.phoneNumber = contactInfo?.phoneNumber ?? '';
|
|
||||||
this.order.contactInfo.requestTextUpdates = contactInfo?.requestTextUpdates ?? false;
|
this.order.contactInfo.requestTextUpdates = contactInfo?.requestTextUpdates ?? false;
|
||||||
this.order.contactInfo.notesForTechnician = contactInfo?.notesForTechnician ?? '';
|
this.order.contactInfo.notesForTechnician = contactInfo?.notesForTechnician ?? '';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updatePhoneNumbers(phoneNumbers) {
|
||||||
|
const contact = this.order.contactInfo;
|
||||||
|
contact.homePhone = phoneNumbers.home !== undefined ? phoneNumbers.home : contact.homePhone;
|
||||||
|
contact.alternativePhone = phoneNumbers.alternative !== undefined ? phoneNumbers.alternative : contact.alternativePhone;
|
||||||
|
contact.servicePhone = phoneNumbers.service !== undefined ? phoneNumbers.service : contact.servicePhone;
|
||||||
|
},
|
||||||
|
|
||||||
GetExperimentsByUser(userId) {
|
GetExperimentsByUser(userId) {
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetExperimentsByUser.method,
|
method: endpoints.GetExperimentsByUser.method,
|
||||||
|
|
@ -2262,13 +2271,13 @@ export const useMainStore = defineStore({
|
||||||
|
|
||||||
setBailout(bailoutData) {
|
setBailout(bailoutData) {
|
||||||
const params = new URL(document.location.toString()).searchParams;
|
const params = new URL(document.location.toString()).searchParams;
|
||||||
const currentPage = params.get('issPage');
|
const currentPage = params.get('issPage');
|
||||||
|
|
||||||
this.updatePageData({
|
this.updatePageData({
|
||||||
page: issPageValues.BAILOUT_PAGE,
|
page: issPageValues.BAILOUT_PAGE,
|
||||||
data: {
|
data: {
|
||||||
url: window.location.href,
|
url: window.location.href,
|
||||||
page: currentPage || 'Unknown Page',
|
page: currentPage || 'Unknown Page',
|
||||||
bailoutCode: bailoutData.code,
|
bailoutCode: bailoutData.code,
|
||||||
errorMessage: bailoutData.message,
|
errorMessage: bailoutData.message,
|
||||||
submit: false
|
submit: false
|
||||||
|
|
@ -2279,8 +2288,11 @@ export const useMainStore = defineStore({
|
||||||
setBailoutContactInfo(contact) {
|
setBailoutContactInfo(contact) {
|
||||||
this.order.customer.firstName = contact.firstName;
|
this.order.customer.firstName = contact.firstName;
|
||||||
this.order.customer.lastName = contact.lastName;
|
this.order.customer.lastName = contact.lastName;
|
||||||
this.order.customer.phoneNumber = contact.phoneNumber;
|
|
||||||
this.order.customer.emailAddress = contact.email;
|
this.order.customer.emailAddress = contact.email;
|
||||||
|
this.updatePhoneNumbers({
|
||||||
|
home: contact.phoneNumber,
|
||||||
|
service: contact.phoneNumber
|
||||||
|
});
|
||||||
this.pageData(issPageValues.BAILOUT_PAGE).submit = true;
|
this.pageData(issPageValues.BAILOUT_PAGE).submit = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -2311,7 +2323,6 @@ export const useMainStore = defineStore({
|
||||||
this.order.policy.damageCity = null;
|
this.order.policy.damageCity = null;
|
||||||
this.order.policy.damageState = null;
|
this.order.policy.damageState = null;
|
||||||
this.order.policy.isITAC = false;
|
this.order.policy.isITAC = false;
|
||||||
this.order.customer.phoneNumber = null;
|
|
||||||
this.order.customer.emailAddress = null;
|
this.order.customer.emailAddress = null;
|
||||||
this.order.customer.firstName = null;
|
this.order.customer.firstName = null;
|
||||||
this.order.customer.lastName = null;
|
this.order.customer.lastName = null;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { setActivePinia, createPinia } from 'pinia';
|
import { setActivePinia, createPinia } from 'pinia';
|
||||||
import { useMainStore } from '@/store/index.js';
|
import { useMainStore, getDefaultState } from '@/store/index.js';
|
||||||
import globalMethods from '@/global-methods.js';
|
import globalMethods from '@/global-methods.js';
|
||||||
import { getRandomString, getRandomGuid, getRandomInt, getRandomBoolean } from '@/helpers/data-generation.js';
|
import { getRandomString, getRandomGuid, getRandomInt, getRandomBoolean } from '@/helpers/data-generation.js';
|
||||||
import coverageStatuses from '@/constants/coverage-statuses.js';
|
import coverageStatuses from '@/constants/coverage-statuses.js';
|
||||||
|
|
@ -14,7 +14,13 @@ describe('Store', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const pinia = createPinia();
|
const pinia = createPinia();
|
||||||
setActivePinia(pinia);
|
setActivePinia(pinia);
|
||||||
|
|
||||||
store = useMainStore();
|
store = useMainStore();
|
||||||
|
const defaultState = getDefaultState();
|
||||||
|
Object.keys(defaultState).forEach((key) => {
|
||||||
|
store[key] = defaultState[key];
|
||||||
|
});
|
||||||
|
|
||||||
store.applicationUser.eventBus = [];
|
store.applicationUser.eventBus = [];
|
||||||
jest.resetAllMocks();
|
jest.resetAllMocks();
|
||||||
});
|
});
|
||||||
|
|
@ -478,7 +484,6 @@ describe('Store', () => {
|
||||||
const firstName = getRandomString(4, 10);
|
const firstName = getRandomString(4, 10);
|
||||||
const lastName = getRandomString(5, 15);
|
const lastName = getRandomString(5, 15);
|
||||||
const emailAddress = false;
|
const emailAddress = false;
|
||||||
const phoneNumber = getRandomInt(1000000000, 9999999999);
|
|
||||||
const requestTextUpdates = getRandomBoolean();
|
const requestTextUpdates = getRandomBoolean();
|
||||||
const notesForTechnician = getRandomString(50, 150);
|
const notesForTechnician = getRandomString(50, 150);
|
||||||
|
|
||||||
|
|
@ -486,7 +491,6 @@ describe('Store', () => {
|
||||||
store.updateContactInfo({ firstName,
|
store.updateContactInfo({ firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber,
|
|
||||||
requestTextUpdates,
|
requestTextUpdates,
|
||||||
notesForTechnician });
|
notesForTechnician });
|
||||||
|
|
||||||
|
|
@ -494,10 +498,27 @@ describe('Store', () => {
|
||||||
expect(store.contactInfo.firstName).toEqual(firstName);
|
expect(store.contactInfo.firstName).toEqual(firstName);
|
||||||
expect(store.contactInfo.lastName).toEqual(lastName);
|
expect(store.contactInfo.lastName).toEqual(lastName);
|
||||||
expect(store.contactInfo.emailAddress).toEqual(emailAddress);
|
expect(store.contactInfo.emailAddress).toEqual(emailAddress);
|
||||||
expect(store.contactInfo.phoneNumber).toEqual(phoneNumber);
|
|
||||||
expect(store.contactInfo.requestTextUpdates).toEqual(requestTextUpdates);
|
expect(store.contactInfo.requestTextUpdates).toEqual(requestTextUpdates);
|
||||||
expect(store.contactInfo.notesForTechnician).toEqual(notesForTechnician);
|
expect(store.contactInfo.notesForTechnician).toEqual(notesForTechnician);
|
||||||
});
|
});
|
||||||
|
it('updatePhoneNumbers updates phone info in store', () => {
|
||||||
|
// Arrange
|
||||||
|
const homePhone = getRandomInt(1000000000, 9999999999);
|
||||||
|
const servicePhone = getRandomInt(1000000000, 9999999999);
|
||||||
|
const altPhone = getRandomInt(1000000000, 9999999999);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
store.updatePhoneNumbers({
|
||||||
|
home: homePhone,
|
||||||
|
service: servicePhone,
|
||||||
|
alternative: altPhone
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(store.contactInfo.homePhone).toEqual(homePhone);
|
||||||
|
expect(store.contactInfo.servicePhone).toEqual(servicePhone);
|
||||||
|
expect(store.contactInfo.alternativePhone).toEqual(altPhone);
|
||||||
|
});
|
||||||
it('All null values => contact info set in store to all nulls', () => {
|
it('All null values => contact info set in store to all nulls', () => {
|
||||||
// Act
|
// Act
|
||||||
store.updateContactInfo({});
|
store.updateContactInfo({});
|
||||||
|
|
@ -506,7 +527,6 @@ describe('Store', () => {
|
||||||
expect(store.contactInfo.firstName).toEqual('');
|
expect(store.contactInfo.firstName).toEqual('');
|
||||||
expect(store.contactInfo.lastName).toEqual('');
|
expect(store.contactInfo.lastName).toEqual('');
|
||||||
expect(store.contactInfo.emailAddress).toEqual('');
|
expect(store.contactInfo.emailAddress).toEqual('');
|
||||||
expect(store.contactInfo.phoneNumber).toEqual('');
|
|
||||||
expect(store.contactInfo.requestTextUpdates).toEqual(false);
|
expect(store.contactInfo.requestTextUpdates).toEqual(false);
|
||||||
expect(store.contactInfo.notesForTechnician).toEqual('');
|
expect(store.contactInfo.notesForTechnician).toEqual('');
|
||||||
});
|
});
|
||||||
|
|
@ -666,8 +686,9 @@ describe('Store', () => {
|
||||||
store.order.customer.firstName = customerFirstName;
|
store.order.customer.firstName = customerFirstName;
|
||||||
store.order.customer.lastName = customerLastName;
|
store.order.customer.lastName = customerLastName;
|
||||||
store.order.customer.emailAddress = customerEmail;
|
store.order.customer.emailAddress = customerEmail;
|
||||||
store.order.customer.phoneNumber = customerPhoneNumber;
|
|
||||||
store.order.customer.address.state = customerState;
|
store.order.customer.address.state = customerState;
|
||||||
|
store.order.contactInfo.homePhone = customerPhoneNumber;
|
||||||
|
store.order.contactInfo.servicePhone = customerPhoneNumber;
|
||||||
store.order.policy.policyNumber = policyNumber;
|
store.order.policy.policyNumber = policyNumber;
|
||||||
store.order.policy.policyZipCode = policyZipCode;
|
store.order.policy.policyZipCode = policyZipCode;
|
||||||
store.order.policy.policyLookupSuccessful = policyLookupSuccessful;
|
store.order.policy.policyLookupSuccessful = policyLookupSuccessful;
|
||||||
|
|
@ -708,12 +729,16 @@ describe('Store', () => {
|
||||||
const contactFirstName = getRandomString(6, 6);
|
const contactFirstName = getRandomString(6, 6);
|
||||||
const contactLastName = getRandomString(6, 6);
|
const contactLastName = getRandomString(6, 6);
|
||||||
const contactEmail = getRandomString(6, 6);
|
const contactEmail = getRandomString(6, 6);
|
||||||
const contactPhoneNumber = getRandomString(6, 6);
|
const contactHomePhone = getRandomString(6, 6);
|
||||||
|
const contactServicePhone = getRandomString(6, 6);
|
||||||
|
const contactAlternativePhone = getRandomString(6, 6);
|
||||||
const requestTextUpdates = getRandomBoolean();
|
const requestTextUpdates = getRandomBoolean();
|
||||||
store.order.contactInfo.firstName = contactFirstName;
|
store.order.contactInfo.firstName = contactFirstName;
|
||||||
store.order.contactInfo.lastName = contactLastName;
|
store.order.contactInfo.lastName = contactLastName;
|
||||||
store.order.contactInfo.emailAddress = contactEmail;
|
store.order.contactInfo.emailAddress = contactEmail;
|
||||||
store.order.contactInfo.phoneNumber = contactPhoneNumber;
|
store.order.contactInfo.homePhone = contactHomePhone;
|
||||||
|
store.order.contactInfo.servicePhone = contactServicePhone;
|
||||||
|
store.order.contactInfo.alternativePhone = contactAlternativePhone;
|
||||||
store.order.contactInfo.requestTextUpdates = requestTextUpdates;
|
store.order.contactInfo.requestTextUpdates = requestTextUpdates;
|
||||||
store.order.customer.address.streetAddress = streetAddress;
|
store.order.customer.address.streetAddress = streetAddress;
|
||||||
store.order.customer.address.streetAddress2 = streetAddress2;
|
store.order.customer.address.streetAddress2 = streetAddress2;
|
||||||
|
|
@ -740,8 +765,10 @@ describe('Store', () => {
|
||||||
emailAddress: contactEmail,
|
emailAddress: contactEmail,
|
||||||
firstName: contactFirstName,
|
firstName: contactFirstName,
|
||||||
lastName: contactLastName,
|
lastName: contactLastName,
|
||||||
phoneNumber: contactPhoneNumber,
|
homePhone: contactHomePhone,
|
||||||
optInSms: requestTextUpdates
|
servicePhone: contactServicePhone,
|
||||||
|
alternativePhone: contactAlternativePhone,
|
||||||
|
isSmsOptIn: requestTextUpdates
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
|
@ -1122,7 +1149,7 @@ describe('Store', () => {
|
||||||
expect(store.order.customer.firstName).toBe(customer.firstName);
|
expect(store.order.customer.firstName).toBe(customer.firstName);
|
||||||
expect(store.order.customer.lastName).toBe(customer.lastName);
|
expect(store.order.customer.lastName).toBe(customer.lastName);
|
||||||
expect(store.order.customer.emailAddress).toBe(customer.emailAddress);
|
expect(store.order.customer.emailAddress).toBe(customer.emailAddress);
|
||||||
expect(store.order.customer.phoneNumber).toBe(customer.phoneNumber);
|
expect(store.order.contactInfo.homePhone).toBe(customer.phoneNumber);
|
||||||
});
|
});
|
||||||
it('sets expected remaining order data', async () => {
|
it('sets expected remaining order data', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -1438,6 +1465,79 @@ describe('Store', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('isUnverified', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
store.order.policy.isITAC = false;
|
||||||
|
store.order.policy.noCoverage = false;
|
||||||
|
store.order.payment.insuranceCoverage.isVerified = true;
|
||||||
|
store.order.currentDeductible = 123;
|
||||||
|
store.order.policyLookupSuccessful = true;
|
||||||
|
store.issConfig.isClaimRegistrationRequired = true;
|
||||||
|
store.issConfig.enableNoCompQuote = true;
|
||||||
|
});
|
||||||
|
it('returns true when policyLookupSuccessful false', () => {
|
||||||
|
// Arrange
|
||||||
|
store.order.policyLookupSuccessful = false;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = store.isUnverified;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
});
|
||||||
|
it('returns true when no comp and enableNoCompQuote false', () => {
|
||||||
|
// Arrange
|
||||||
|
store.order.policy.noCoverage = true;
|
||||||
|
store.issConfig.enableNoCompQuote = false;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = store.isUnverified;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
});
|
||||||
|
it('returns true when not no comp and currentDeductible null', () => {
|
||||||
|
// Arrange
|
||||||
|
store.order.policy.noCoverage = false;
|
||||||
|
store.order.currentDeductible = null;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = store.isUnverified;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
});
|
||||||
|
it('returns true when isClaimRegistrationRequired true and insurance coverage not verified', () => {
|
||||||
|
// Arrange
|
||||||
|
store.order.payment.insuranceCoverage.isVerified = false;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = store.isUnverified;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
});
|
||||||
|
it('returns false when no comp, enableNoCompQuote true, and currentDeductible null', () => {
|
||||||
|
// Arrange
|
||||||
|
store.order.policy.noCoverage = true;
|
||||||
|
store.order.currentDeductible = null;
|
||||||
|
store.issConfig.enableNoCompQuote = true;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = store.isUnverified;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeFalsy();
|
||||||
|
});
|
||||||
|
it('returns false when not no comp, currentDeductible not null', () => {
|
||||||
|
// Act
|
||||||
|
const result = store.isUnverified;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('isMobileAppointment', () => {
|
describe('isMobileAppointment', () => {
|
||||||
it('Should return true for mobile appointments', () => {
|
it('Should return true for mobile appointments', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -1948,4 +2048,34 @@ describe('Store', () => {
|
||||||
expect(store.order.payment.paypalToken).toEqual(paypalToken);
|
expect(store.order.payment.paypalToken).toEqual(paypalToken);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('billToNumberToUse getter', () => {
|
||||||
|
it('returns itacCashBillToNumber when in ITAC flow', () => {
|
||||||
|
// Arrange
|
||||||
|
store.order.policy.isITAC = true;
|
||||||
|
store.issConfig.itacCashBillToNumber = '12345';
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(store.billToNumberToUse).toEqual(store.issConfig.itacCashBillToNumber);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns itacFnrBillToNumber when in NoComp flow', () => {
|
||||||
|
// Arrange
|
||||||
|
store.order.policy.noCoverage = true;
|
||||||
|
store.issConfig.itacFnrBillToNumber = '12345';
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(store.billToNumberToUse).toEqual(store.issConfig.itacFnrBillToNumber);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns billToAccountNumber when not ITAC and not NoComp', () => {
|
||||||
|
// Arrange
|
||||||
|
store.order.policy.isITAC = null;
|
||||||
|
store.order.policy.noCoverage = null;
|
||||||
|
store.issConfig.billToAccountNumber = '12345';
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(store.billToNumberToUse).toEqual(store.issConfig.billToAccountNumber);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue