commit
d0c6da9d63
4 changed files with 37 additions and 2 deletions
|
|
@ -89,6 +89,7 @@ export default {
|
|||
this.unauthorized = !authorized;
|
||||
|
||||
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}`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,6 +219,32 @@ describe('navigation', () => {
|
|||
expect(wrapper.vm.mainStore.updatePolicyData).toHaveBeenCalled();
|
||||
expect(wrapper.vm.mainStore.getCoveragePolicyInfo).toHaveBeenCalled();
|
||||
});
|
||||
test('if maxCoverageLookupAttemptsReached is true, then getCoveragePolicyInfo not called', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = getMountedComponent({});
|
||||
useMainStore().getDuplicateReferrals = jest.fn().mockImplementation(() => Promise.resolve({}));
|
||||
useMainStore().applicationUser.coverageLookupAttempts = 11;
|
||||
|
||||
// Act
|
||||
await wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.mainStore.updatePolicyData).toHaveBeenCalled();
|
||||
expect(wrapper.vm.mainStore.getCoveragePolicyInfo).not.toHaveBeenCalled();
|
||||
});
|
||||
test('if maxCoverageLookupAttemptsReached is false, then getCoveragePolicyInfo called', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = getMountedComponent({});
|
||||
useMainStore().getDuplicateReferrals = jest.fn().mockImplementation(() => Promise.resolve({}));
|
||||
useMainStore().applicationUser.coverageLookupAttempts = 10;
|
||||
|
||||
// Act
|
||||
await wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.mainStore.updatePolicyData).toHaveBeenCalled();
|
||||
expect(wrapper.vm.mainStore.getCoveragePolicyInfo).toHaveBeenCalled();
|
||||
});
|
||||
test('if policy and vehicles are found but no duplicates, navigate to policy-vehicle page', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
|
|
|||
|
|
@ -308,6 +308,9 @@ export default {
|
|||
},
|
||||
isCoverageEnabled() {
|
||||
return this.mainStore.issConfig.isCoverageEnabled;
|
||||
},
|
||||
maxCoverageLookupAttemptsReached() {
|
||||
return this.mainStore.applicationUser.coverageLookupAttempts >= 11;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -316,8 +319,10 @@ export default {
|
|||
await this.mainStore.getDuplicateReferrals()
|
||||
.then(() => {}, () => {})
|
||||
.finally(async () => {
|
||||
if (this.isCoverageEnabled) {
|
||||
if (this.isCoverageEnabled && !this.maxCoverageLookupAttemptsReached) {
|
||||
await this.mainStore.getCoveragePolicyInfo()?.then(() => {}, () => {});
|
||||
} else {
|
||||
this.mainStore.order.policy.policyLookupSuccessful = false;
|
||||
}
|
||||
this.navigateForward();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -185,7 +185,8 @@ const getDefaultState = () => ({
|
|||
lastPageVisited: null,
|
||||
triggeredSiteEntry: false, // TODO not in save session
|
||||
duplicateOrders: [],
|
||||
hasSentSaveQuoteEmail: null
|
||||
hasSentSaveQuoteEmail: null,
|
||||
coverageLookupAttempts: 0
|
||||
},
|
||||
issConfig: {
|
||||
clientName: 'Generic Insurance', // this is the default and will be overriden by the client's name
|
||||
|
|
@ -439,6 +440,8 @@ export const useMainStore = defineStore({
|
|||
getCoveragePolicyInfo() {
|
||||
const { order } = this;
|
||||
const { policy } = order;
|
||||
this.applicationUser.coverageAttempts += 1;
|
||||
console.log(`Coverage lookup attempt #${this.applicationUser.coverageAttempts}. Max attempts allowed: 10.`);
|
||||
return new Promise((resolve, reject) => {
|
||||
globalMethods.callHttpClient({
|
||||
method: endpoints.CoveragePolicyInfo.method,
|
||||
|
|
|
|||
Loading…
Reference in a new issue