Merge branch 'develop' into feature/SSR-1113
This commit is contained in:
commit
339ec5100e
14 changed files with 700 additions and 481 deletions
|
|
@ -171,7 +171,7 @@ const endpoints = Object.freeze({
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
},
|
},
|
||||||
LoadSession: {
|
LoadSession: {
|
||||||
url: '/order/api/v1/order/load-session',
|
url: '/order/api/v1/order/load-session/iss',
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
},
|
},
|
||||||
DuplicateSearch: {
|
DuplicateSearch: {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@ export async function saveSession({ shouldAwaitSaveSessionQueue = false }) {
|
||||||
*/
|
*/
|
||||||
async function saveSessionHelper(store) {
|
async function saveSessionHelper(store) {
|
||||||
const savedSessionInfo = await store.saveSession();
|
const savedSessionInfo = await store.saveSession();
|
||||||
store.setSaveSessionInfo(savedSessionInfo.data);
|
if (savedSessionInfo) {
|
||||||
|
store.setSaveSessionInfo(savedSessionInfo.data);
|
||||||
|
}
|
||||||
updateOrCreateISSCookie();
|
updateOrCreateISSCookie();
|
||||||
}
|
}
|
||||||
23
src/helpers/policy-vehicle-helper.js
Normal file
23
src/helpers/policy-vehicle-helper.js
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
import endorsementOptions from '@/constants/endorsement-options';
|
||||||
|
|
||||||
|
export function noCoverageForSelectedVehicle(vehicle) {
|
||||||
|
return (vehicle?.coverages?.length ?? 0) === 0;
|
||||||
|
}
|
||||||
|
export function deductibleForSelectedVehicle(vehicle) {
|
||||||
|
if (!vehicle) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return vehicle.coverages?.length ?? false
|
||||||
|
? vehicle?.coverages[0].deductible
|
||||||
|
: 0;
|
||||||
|
}
|
||||||
|
export function endorsementsForSelectedVehicle(vehicle) {
|
||||||
|
if (vehicle?.endorsements?.length > 0) {
|
||||||
|
return vehicle.endorsements;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
export function repairWaivedForSelectedVehicle(vehicle) {
|
||||||
|
return vehicle?.endorsements?.includes(endorsementOptions.REPAIR_WAIVED) ?? false;
|
||||||
|
}
|
||||||
205
src/helpers/policy-vehicle-helper.spec.js
Normal file
205
src/helpers/policy-vehicle-helper.spec.js
Normal file
|
|
@ -0,0 +1,205 @@
|
||||||
|
import {
|
||||||
|
deductibleForSelectedVehicle,
|
||||||
|
endorsementsForSelectedVehicle,
|
||||||
|
noCoverageForSelectedVehicle,
|
||||||
|
repairWaivedForSelectedVehicle
|
||||||
|
} from '@/helpers/policy-vehicle-helper';
|
||||||
|
import { getRandomInt, getRandomString } from '@/helpers/data-generation';
|
||||||
|
import endorsementOptions from '@/constants/endorsement-options';
|
||||||
|
|
||||||
|
describe('policy vehicle helper', () => {
|
||||||
|
describe('noCoverageForSelectedVehicle function', () => {
|
||||||
|
it('Null vehicle => returns true', async () => {
|
||||||
|
// Arrange
|
||||||
|
const vehicle = null;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = noCoverageForSelectedVehicle(vehicle);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Empty vehicle coverages list => returns true', async () => {
|
||||||
|
// Arrange
|
||||||
|
const vehicle = {
|
||||||
|
vin: getRandomString(17, 17),
|
||||||
|
coverages: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = noCoverageForSelectedVehicle(vehicle);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Non-empty vehicle coverages list => returns false', async () => {
|
||||||
|
// Arrange
|
||||||
|
const vehicle = {
|
||||||
|
vin: getRandomString(17, 17),
|
||||||
|
coverages: [
|
||||||
|
{
|
||||||
|
deductible: 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = deductibleForSelectedVehicle(vehicle);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('deductibleForSelectedVehicle function', () => {
|
||||||
|
it('Null vehicle => returns undefined', async () => {
|
||||||
|
// Arrange
|
||||||
|
const vehicle = null;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = deductibleForSelectedVehicle(vehicle);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBe(undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Vehicle match with empty coverages list => 0 returned', async () => {
|
||||||
|
// Arrange
|
||||||
|
const vehicle = {
|
||||||
|
vin: getRandomString(17, 17),
|
||||||
|
coverages: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = deductibleForSelectedVehicle(vehicle);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Coverages list non empty => deductible from first coverage returned', async () => {
|
||||||
|
// Arrange
|
||||||
|
const firstDeductible = getRandomInt(1, 1000);
|
||||||
|
const vehicle = {
|
||||||
|
vin: getRandomString(17, 17),
|
||||||
|
coverages: [
|
||||||
|
{
|
||||||
|
deductible: firstDeductible
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deductible: getRandomInt(1, 1000)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = deductibleForSelectedVehicle(vehicle);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBe(firstDeductible);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('repairWaivedForSelectedVehicle function', () => {
|
||||||
|
it('Null vehicle => returns false', async () => {
|
||||||
|
// Arrange
|
||||||
|
const vehicle = null;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = repairWaivedForSelectedVehicle(vehicle);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Endorsements list empty => false returned', async () => {
|
||||||
|
// Arrange
|
||||||
|
const vehicle = {
|
||||||
|
vin: getRandomString(17, 17),
|
||||||
|
endorsements: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = repairWaivedForSelectedVehicle(vehicle);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Endorsements list non-empty, not containing repair waived => false returned', async () => {
|
||||||
|
// Arrange
|
||||||
|
const vehicle = {
|
||||||
|
vin: getRandomString(17, 17),
|
||||||
|
endorsements: [endorsementOptions.EDUCATOR, endorsementOptions.PARKING_GUARD]
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = repairWaivedForSelectedVehicle(vehicle);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Endorsements list contains repair waived => true returned', async () => {
|
||||||
|
// Arrange
|
||||||
|
const vehicle = {
|
||||||
|
vin: getRandomString(17, 17),
|
||||||
|
endorsements: [
|
||||||
|
endorsementOptions.EDUCATOR,
|
||||||
|
endorsementOptions.REPAIR_WAIVED,
|
||||||
|
endorsementOptions.PARKING_GUARD
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = repairWaivedForSelectedVehicle(vehicle);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('endorsementsForSelectedVehicle function', () => {
|
||||||
|
it('Null vehicle => returns empty array', async () => {
|
||||||
|
// Arrange
|
||||||
|
const vehicle = null;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = endorsementsForSelectedVehicle(vehicle);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toStrictEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Null endorsements => returns empty array', async () => {
|
||||||
|
// Arrange
|
||||||
|
const vehicle = {
|
||||||
|
vin: getRandomString(17, 17),
|
||||||
|
endorsements: null
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = endorsementsForSelectedVehicle(vehicle);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toStrictEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Endorsements list non-empty, not containing repair waived => false returned', async () => {
|
||||||
|
// Arrange
|
||||||
|
const endorsements = [endorsementOptions.EDUCATOR, endorsementOptions.PARKING_GUARD];
|
||||||
|
const vehicle = {
|
||||||
|
vin: getRandomString(17, 17),
|
||||||
|
endorsements
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = endorsementsForSelectedVehicle(vehicle);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toStrictEqual(endorsements);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -829,7 +829,7 @@ describe.skip('coverageStatement.vue', () => {
|
||||||
|
|
||||||
describe('coverageStatement.vue-working', () => {
|
describe('coverageStatement.vue-working', () => {
|
||||||
describe('ITAC flag', () => {
|
describe('ITAC flag', () => {
|
||||||
test('ITAC flag updated once component is initialized', () => {
|
test('ITAC flag updated once component is initialized', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const mainInitialState = {
|
const mainInitialState = {
|
||||||
order: {
|
order: {
|
||||||
|
|
@ -838,7 +838,10 @@ describe('coverageStatement.vue-working', () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const { wrapper } = getMountedComponent(mainInitialState);
|
const mockStoreActions = () => {
|
||||||
|
useMainStore().getPriceOrderItems = jest.fn().mockImplementation(() => Promise.resolve([]));
|
||||||
|
};
|
||||||
|
const { wrapper } = getMountedComponent(mainInitialState, {}, mockStoreActions);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.initializeComponent();
|
wrapper.vm.initializeComponent();
|
||||||
|
|
@ -847,5 +850,57 @@ describe('coverageStatement.vue-working', () => {
|
||||||
expect(wrapper.vm.mainStore.updatePolicyITACFlag)
|
expect(wrapper.vm.mainStore.updatePolicyITACFlag)
|
||||||
.toHaveBeenCalledTimes(1);
|
.toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Loaded duplicate with previously registered claim => claim registration is not called', async () => {
|
||||||
|
// Arrange
|
||||||
|
const sellingPrice = getRandomInt(50, 100);
|
||||||
|
const deductible = sellingPrice - 1;
|
||||||
|
const initialStore = {
|
||||||
|
order: {
|
||||||
|
policy: {
|
||||||
|
policyLookupSuccessful: true,
|
||||||
|
noCoverage: false,
|
||||||
|
deductible: {
|
||||||
|
repair: deductible
|
||||||
|
}
|
||||||
|
},
|
||||||
|
damage: {
|
||||||
|
isRepair: false
|
||||||
|
},
|
||||||
|
payment: {
|
||||||
|
insuranceCoverage: {
|
||||||
|
claimNumber: getRandomString(10, 10)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
issConfig: {
|
||||||
|
isClaimRegistrationRequired: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const mockStoreActions = () => {
|
||||||
|
useMainStore().getWipers = jest.fn().mockImplementation(() => Promise.resolve());
|
||||||
|
useMainStore().getRainDefense = jest.fn().mockImplementation(() => Promise.resolve());
|
||||||
|
useMainStore().getSupportingItems = jest.fn().mockImplementation(() => Promise.resolve());
|
||||||
|
useMainStore().getPriceOrderItems = jest.fn().mockImplementation(() => Promise.resolve([
|
||||||
|
{
|
||||||
|
sellingPrice,
|
||||||
|
kitPrice: 0,
|
||||||
|
laborAmount: 0
|
||||||
|
}
|
||||||
|
]));
|
||||||
|
};
|
||||||
|
const { wrapper } = getMountedComponent(initialStore, {}, mockStoreActions);
|
||||||
|
const next = (method) => { method(wrapper.vm); };
|
||||||
|
|
||||||
|
// Act
|
||||||
|
coverageStatement.beforeRouteEnter.call(wrapper.vm, undefined, undefined, next);
|
||||||
|
for (let i = 0; i < 7; i++) {
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
await nextTick();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.mainStore.registerClaim).toHaveBeenCalledTimes(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -356,9 +356,10 @@ export default {
|
||||||
async initializeComponent() {
|
async initializeComponent() {
|
||||||
useMainStore().updatePolicyITACFlag(this.verifiedITAC);
|
useMainStore().updatePolicyITACFlag(this.verifiedITAC);
|
||||||
if (this.policyLookupSuccessful
|
if (this.policyLookupSuccessful
|
||||||
&& useMainStore().order.vehicle.policyVehicleId >= 0
|
&& useMainStore().order.vehicle.policyVehicleId >= 0
|
||||||
&& useMainStore().isClaimRegistrationRequired
|
&& useMainStore().isClaimRegistrationRequired
|
||||||
&& (this.coveredAndServicePriceAboveOrEqualDeductible || this.verifiedITAC)) {
|
&& !useMainStore().isClaimAlreadyRegistered
|
||||||
|
&& (this.coveredAndServicePriceAboveOrEqualDeductible || this.verifiedITAC)) {
|
||||||
await useMainStore().registerClaim()?.catch(() => {});
|
await useMainStore().registerClaim()?.catch(() => {});
|
||||||
}
|
}
|
||||||
this.$refs.loadingModal.hideModal();
|
this.$refs.loadingModal.hideModal();
|
||||||
|
|
|
||||||
|
|
@ -519,6 +519,110 @@ describe('duplicateCheck.vue', () => {
|
||||||
expect(wrapper.vm.$router.navigate)
|
expect(wrapper.vm.$router.navigate)
|
||||||
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED, undefined);
|
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED, undefined);
|
||||||
});
|
});
|
||||||
|
test('policyLookupSuccessful true and loaded duplicate with policy vehicle => CLICKED_FORWARD_LOADED_DUPLICATE_WITH_POLICY_VEHICLE', async () => {
|
||||||
|
// Arrange
|
||||||
|
const mountOptions = getMountOptions({
|
||||||
|
router: { navigate: jest.fn() }
|
||||||
|
});
|
||||||
|
|
||||||
|
const vin = getRandomString(17, 17);
|
||||||
|
const mainInitialState = {
|
||||||
|
order: {
|
||||||
|
policy: {
|
||||||
|
policyLookupSuccessful: true,
|
||||||
|
vehicles: [{ vin }]
|
||||||
|
},
|
||||||
|
vehicle: {
|
||||||
|
vin
|
||||||
|
},
|
||||||
|
loadedFromDupeCheck: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mountOptions.global.plugins = [createTestingPinia({
|
||||||
|
initialState: {
|
||||||
|
main: mainInitialState
|
||||||
|
}
|
||||||
|
})];
|
||||||
|
|
||||||
|
const wrapper = shallowMount(duplicateCheck, mountOptions);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
|
||||||
|
expect(wrapper.vm.$router.navigate)
|
||||||
|
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_POLICY_VEHICLE, undefined);
|
||||||
|
});
|
||||||
|
test('policyLookupSuccessful true and loaded duplicate with non policy vehicle => CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NON_POLICY_VEHICLE', async () => {
|
||||||
|
// Arrange
|
||||||
|
const mountOptions = getMountOptions({
|
||||||
|
router: { navigate: jest.fn() }
|
||||||
|
});
|
||||||
|
|
||||||
|
const vin = getRandomString(17, 17);
|
||||||
|
const mainInitialState = {
|
||||||
|
order: {
|
||||||
|
policy: {
|
||||||
|
policyLookupSuccessful: true,
|
||||||
|
vehicles: [{ vin }]
|
||||||
|
},
|
||||||
|
vehicle: {
|
||||||
|
vin: null
|
||||||
|
},
|
||||||
|
loadedFromDupeCheck: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mountOptions.global.plugins = [createTestingPinia({
|
||||||
|
initialState: {
|
||||||
|
main: mainInitialState
|
||||||
|
}
|
||||||
|
})];
|
||||||
|
|
||||||
|
const wrapper = shallowMount(duplicateCheck, mountOptions);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
|
||||||
|
expect(wrapper.vm.$router.navigate)
|
||||||
|
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NON_POLICY_VEHICLE, undefined);
|
||||||
|
});
|
||||||
|
test('policyLookupSuccessful true and loaded duplicate with no policy vehicles => CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NO_POLICY_VEHICLES', async () => {
|
||||||
|
// Arrange
|
||||||
|
const mountOptions = getMountOptions({
|
||||||
|
router: { navigate: jest.fn() }
|
||||||
|
});
|
||||||
|
|
||||||
|
const mainInitialState = {
|
||||||
|
order: {
|
||||||
|
policy: {
|
||||||
|
policyLookupSuccessful: true,
|
||||||
|
vehicles: []
|
||||||
|
},
|
||||||
|
vehicle: {
|
||||||
|
vin: null
|
||||||
|
},
|
||||||
|
loadedFromDupeCheck: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mountOptions.global.plugins = [createTestingPinia({
|
||||||
|
initialState: {
|
||||||
|
main: mainInitialState
|
||||||
|
}
|
||||||
|
})];
|
||||||
|
|
||||||
|
const wrapper = shallowMount(duplicateCheck, mountOptions);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
|
||||||
|
expect(wrapper.vm.$router.navigate)
|
||||||
|
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NO_POLICY_VEHICLES, undefined);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -135,9 +135,17 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
navigateForward() {
|
navigateForward() {
|
||||||
if (useMainStore().order.policy.policyLookupSuccessful) {
|
if (!this.mainStore.order.policy.policyLookupSuccessful) {
|
||||||
const policyVehicles = useMainStore().order.policy.vehicles ?? [];
|
this.$router.navigate(
|
||||||
if (policyVehicles.length > 0) {
|
this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const policyVehicles = useMainStore().order.policy.vehicles ?? [];
|
||||||
|
if (!this.mainStore.order.loadedFromDupeCheck) {
|
||||||
|
if (policyVehicles.length !== 0) {
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
||||||
this.$route
|
this.$route
|
||||||
|
|
@ -148,9 +156,22 @@ export default {
|
||||||
this.$route
|
this.$route
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mainStore.order.vehicle.vin) {
|
||||||
|
this.$router.navigate(
|
||||||
|
this.navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_POLICY_VEHICLE,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
} else if (policyVehicles.length !== 0) {
|
||||||
|
this.$router.navigate(
|
||||||
|
this.navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NON_POLICY_VEHICLE,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
this.navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NO_POLICY_VEHICLES,
|
||||||
this.$route
|
this.$route
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,10 +102,12 @@ describe('policy-vehicles.vue', () => {
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
const vin = getRandomString(17, 17);
|
const vin = getRandomString(17, 17);
|
||||||
|
const policyVehicle = { vin };
|
||||||
await wrapper.setData({
|
await wrapper.setData({
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
|
selectedPolicyVehicle: policyVehicle,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{ vin }
|
policyVehicle
|
||||||
],
|
],
|
||||||
policyVinFound: true
|
policyVinFound: true
|
||||||
});
|
});
|
||||||
|
|
@ -202,13 +204,15 @@ describe('policy-vehicles.vue', () => {
|
||||||
|
|
||||||
const vin = getRandomString(17, 17);
|
const vin = getRandomString(17, 17);
|
||||||
const endorsements = ['Parking Guard'];
|
const endorsements = ['Parking Guard'];
|
||||||
|
const policyVehicle = {
|
||||||
|
vin,
|
||||||
|
endorsements
|
||||||
|
};
|
||||||
await wrapper.setData({
|
await wrapper.setData({
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
|
selectedPolicyVehicle: policyVehicle,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
policyVehicle
|
||||||
vin,
|
|
||||||
endorsements
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -342,12 +346,14 @@ describe('policy-vehicles.vue', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const selectedVin = getRandomString(17, 17);
|
const selectedVin = getRandomString(17, 17);
|
||||||
const otherVin = getRandomString(17, 17);
|
const otherVin = getRandomString(17, 17);
|
||||||
|
const policyVehicle = {
|
||||||
|
vin: otherVin
|
||||||
|
};
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: selectedVin,
|
selectedVehicleVin: selectedVin,
|
||||||
|
selectedPolicyVehicle: policyVehicle,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
policyVehicle
|
||||||
vin: otherVin
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -361,13 +367,15 @@ describe('policy-vehicles.vue', () => {
|
||||||
it('Coverages list empty => true', () => {
|
it('Coverages list empty => true', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const vin = getRandomString(17, 17);
|
const vin = getRandomString(17, 17);
|
||||||
|
const policyVehicle = {
|
||||||
|
vin,
|
||||||
|
coverages: []
|
||||||
|
};
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
|
selectedPolicyVehicle: policyVehicle,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
policyVehicle
|
||||||
vin,
|
|
||||||
coverages: []
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -381,17 +389,19 @@ describe('policy-vehicles.vue', () => {
|
||||||
it('Coverages list non-empty => false', () => {
|
it('Coverages list non-empty => false', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const vin = getRandomString(17, 17);
|
const vin = getRandomString(17, 17);
|
||||||
|
const policyVehicle = {
|
||||||
|
vin,
|
||||||
|
coverages: [
|
||||||
|
{
|
||||||
|
deductible: 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
|
selectedPolicyVehicle: policyVehicle,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
policyVehicle
|
||||||
vin,
|
|
||||||
coverages: [
|
|
||||||
{
|
|
||||||
deductible: 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -410,6 +420,7 @@ describe('policy-vehicles.vue', () => {
|
||||||
const otherVin = getRandomString(17, 17);
|
const otherVin = getRandomString(17, 17);
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: selectedVin,
|
selectedVehicleVin: selectedVin,
|
||||||
|
selectedPolicyVehicle: null,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
{
|
||||||
vin: otherVin
|
vin: otherVin
|
||||||
|
|
@ -427,13 +438,15 @@ describe('policy-vehicles.vue', () => {
|
||||||
it('Vehicle match with empty coverages list => 0 returned', () => {
|
it('Vehicle match with empty coverages list => 0 returned', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const vin = getRandomString(17, 17);
|
const vin = getRandomString(17, 17);
|
||||||
|
const policyVehicle = {
|
||||||
|
vin,
|
||||||
|
coverages: []
|
||||||
|
};
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
|
selectedPolicyVehicle: policyVehicle,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
policyVehicle
|
||||||
vin,
|
|
||||||
coverages: []
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -449,20 +462,22 @@ describe('policy-vehicles.vue', () => {
|
||||||
const vin = getRandomString(17, 17);
|
const vin = getRandomString(17, 17);
|
||||||
const firstDeductible = getRandomInt(1, 1000);
|
const firstDeductible = getRandomInt(1, 1000);
|
||||||
const secondDeductible = getRandomInt(1, 1000);
|
const secondDeductible = getRandomInt(1, 1000);
|
||||||
|
const policyVehicle = {
|
||||||
|
vin,
|
||||||
|
coverages: [
|
||||||
|
{
|
||||||
|
deductible: firstDeductible
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deductible: secondDeductible
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
|
selectedPolicyVehicle: policyVehicle,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
policyVehicle
|
||||||
vin,
|
|
||||||
coverages: [
|
|
||||||
{
|
|
||||||
deductible: firstDeductible
|
|
||||||
},
|
|
||||||
{
|
|
||||||
deductible: secondDeductible
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -481,6 +496,7 @@ describe('policy-vehicles.vue', () => {
|
||||||
const otherVin = getRandomString(17, 17);
|
const otherVin = getRandomString(17, 17);
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: selectedVin,
|
selectedVehicleVin: selectedVin,
|
||||||
|
selectedPolicyVehicle: null,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
{
|
||||||
vin: otherVin
|
vin: otherVin
|
||||||
|
|
@ -498,13 +514,15 @@ describe('policy-vehicles.vue', () => {
|
||||||
it('Endorsements list empty => false returned', () => {
|
it('Endorsements list empty => false returned', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const vin = getRandomString(17, 17);
|
const vin = getRandomString(17, 17);
|
||||||
|
const policyVehicle = {
|
||||||
|
vin,
|
||||||
|
endorsements: []
|
||||||
|
};
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
|
selectedPolicyVehicle: policyVehicle,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
policyVehicle
|
||||||
vin,
|
|
||||||
endorsements: []
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -518,13 +536,15 @@ describe('policy-vehicles.vue', () => {
|
||||||
it('Endorsements list non-empty, not containing repair waived => false returned', () => {
|
it('Endorsements list non-empty, not containing repair waived => false returned', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const vin = getRandomString(17, 17);
|
const vin = getRandomString(17, 17);
|
||||||
|
const policyVehicle = {
|
||||||
|
vin,
|
||||||
|
endorsements: [endorsementOptions.EDUCATOR, endorsementOptions.PARKING_GUARD]
|
||||||
|
};
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
|
selectedPolicyVehicle: policyVehicle,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
policyVehicle
|
||||||
vin,
|
|
||||||
endorsements: [endorsementOptions.EDUCATOR, endorsementOptions.PARKING_GUARD]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -538,17 +558,19 @@ describe('policy-vehicles.vue', () => {
|
||||||
it('Endorsements list contains repair waived => true returned', () => {
|
it('Endorsements list contains repair waived => true returned', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const vin = getRandomString(17, 17);
|
const vin = getRandomString(17, 17);
|
||||||
|
const policyVehicle = {
|
||||||
|
vin,
|
||||||
|
endorsements: [
|
||||||
|
endorsementOptions.EDUCATOR,
|
||||||
|
endorsementOptions.REPAIR_WAIVED,
|
||||||
|
endorsementOptions.PARKING_GUARD
|
||||||
|
]
|
||||||
|
};
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
|
selectedPolicyVehicle: policyVehicle,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
policyVehicle
|
||||||
vin,
|
|
||||||
endorsements: [
|
|
||||||
endorsementOptions.EDUCATOR,
|
|
||||||
endorsementOptions.REPAIR_WAIVED,
|
|
||||||
endorsementOptions.PARKING_GUARD
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -564,6 +586,7 @@ describe('policy-vehicles.vue', () => {
|
||||||
it('policyVehicles is null => empty endorsements array returned', () => {
|
it('policyVehicles is null => empty endorsements array returned', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const testValues = {
|
const testValues = {
|
||||||
|
selectedPolicyVehicle: null,
|
||||||
policyVehicles: null
|
policyVehicles: null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -578,6 +601,7 @@ describe('policy-vehicles.vue', () => {
|
||||||
it('policyVehicles is empty => empty endorsements array returned', () => {
|
it('policyVehicles is empty => empty endorsements array returned', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const testValues = {
|
const testValues = {
|
||||||
|
selectedPolicyVehicle: null,
|
||||||
policyVehicles: []
|
policyVehicles: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -595,6 +619,7 @@ describe('policy-vehicles.vue', () => {
|
||||||
const otherVin = getRandomString(17, 17);
|
const otherVin = getRandomString(17, 17);
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: selectedVin,
|
selectedVehicleVin: selectedVin,
|
||||||
|
selectedPolicyVehicle: null,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
{
|
||||||
vin: otherVin
|
vin: otherVin
|
||||||
|
|
@ -613,13 +638,15 @@ describe('policy-vehicles.vue', () => {
|
||||||
it('vehicle VIN match with endorsements null => empty endorsements array returned', () => {
|
it('vehicle VIN match with endorsements null => empty endorsements array returned', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const vin = getRandomString(17, 17);
|
const vin = getRandomString(17, 17);
|
||||||
|
const policyVehicle = {
|
||||||
|
vin,
|
||||||
|
endorsements: null
|
||||||
|
};
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
|
selectedPolicyVehicle: policyVehicle,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
policyVehicle
|
||||||
vin,
|
|
||||||
endorsements: null
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -634,13 +661,15 @@ describe('policy-vehicles.vue', () => {
|
||||||
it('vehicle VIN match with empty endorsements => empty endorsements array returned', () => {
|
it('vehicle VIN match with empty endorsements => empty endorsements array returned', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const vin = getRandomString(17, 17);
|
const vin = getRandomString(17, 17);
|
||||||
|
const policyVehicle = {
|
||||||
|
vin,
|
||||||
|
endorsements: []
|
||||||
|
};
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
|
selectedPolicyVehicle: policyVehicle,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
policyVehicle
|
||||||
vin,
|
|
||||||
endorsements: []
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -656,13 +685,15 @@ describe('policy-vehicles.vue', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const vin = getRandomString(17, 17);
|
const vin = getRandomString(17, 17);
|
||||||
const endorsements = [getRandomString(10, 20)];
|
const endorsements = [getRandomString(10, 20)];
|
||||||
|
const policyVehicle = {
|
||||||
|
vin,
|
||||||
|
endorsements
|
||||||
|
};
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
|
selectedPolicyVehicle: policyVehicle,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
policyVehicle
|
||||||
vin,
|
|
||||||
endorsements
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -680,6 +711,9 @@ describe('policy-vehicles.vue', () => {
|
||||||
useMainStore().order = {
|
useMainStore().order = {
|
||||||
policy: {
|
policy: {
|
||||||
vehicles: [{ vin }]
|
vehicles: [{ vin }]
|
||||||
|
},
|
||||||
|
vehicle: {
|
||||||
|
vin: null
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,12 @@ import vehicleSelectionOptions from '@/constants/vehicle-selection-options.js';
|
||||||
import endorsementOptions from '@/constants/endorsement-options.js';
|
import endorsementOptions from '@/constants/endorsement-options.js';
|
||||||
import globalRules from '@/constants/global-rules.js';
|
import globalRules from '@/constants/global-rules.js';
|
||||||
import { useMainStore } from '@/store/index.js';
|
import { useMainStore } from '@/store/index.js';
|
||||||
import bailoutCode from '@/constants/bailoutCode';
|
|
||||||
import bailoutMessage from '@/constants/bailoutMessage';
|
import bailoutMessage from '@/constants/bailoutMessage';
|
||||||
|
import {
|
||||||
|
deductibleForSelectedVehicle, endorsementsForSelectedVehicle,
|
||||||
|
noCoverageForSelectedVehicle,
|
||||||
|
repairWaivedForSelectedVehicle
|
||||||
|
} from '@/helpers/policy-vehicle-helper';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'policy-vehicles',
|
name: 'policy-vehicles',
|
||||||
|
|
@ -82,6 +86,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
policyVehicles,
|
policyVehicles,
|
||||||
selectedVehicleVin: '',
|
selectedVehicleVin: '',
|
||||||
|
selectedPolicyVehicle: null,
|
||||||
displayGeneric: true,
|
displayGeneric: true,
|
||||||
policyVinFound: true,
|
policyVinFound: true,
|
||||||
rules: {
|
rules: {
|
||||||
|
|
@ -108,33 +113,16 @@ export default {
|
||||||
return mappedData;
|
return mappedData;
|
||||||
},
|
},
|
||||||
noCoverageForSelectedVehicle() {
|
noCoverageForSelectedVehicle() {
|
||||||
const vehicle = this.policyVehicles?.find((policyVehicle) =>
|
return noCoverageForSelectedVehicle(this.selectedPolicyVehicle);
|
||||||
policyVehicle.vin === this.selectedVehicleVin);
|
|
||||||
return (vehicle?.coverages?.length ?? 0) === 0;
|
|
||||||
},
|
},
|
||||||
deductibleForSelectedVehicle() {
|
deductibleForSelectedVehicle() {
|
||||||
const vehicle = this.policyVehicles?.find((policyVehicle) =>
|
return deductibleForSelectedVehicle(this.selectedPolicyVehicle);
|
||||||
policyVehicle?.vin === this.selectedVehicleVin);
|
|
||||||
if (!vehicle) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
return vehicle.coverages?.length ?? false
|
|
||||||
? vehicle?.coverages[0].deductible
|
|
||||||
: 0;
|
|
||||||
},
|
},
|
||||||
endorsementsForSelectedVehicle() {
|
endorsementsForSelectedVehicle() {
|
||||||
const vehicle = this.policyVehicles?.find((policyVehicle) =>
|
return endorsementsForSelectedVehicle(this.selectedPolicyVehicle);
|
||||||
policyVehicle?.vin === this.selectedVehicleVin);
|
|
||||||
if (vehicle?.endorsements?.length > 0) {
|
|
||||||
return vehicle.endorsements;
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
},
|
},
|
||||||
repairWaivedForSelectedVehicle() {
|
repairWaivedForSelectedVehicle() {
|
||||||
const vehicle = this.policyVehicles?.find((policyVehicle) =>
|
return repairWaivedForSelectedVehicle(this.selectedPolicyVehicle);
|
||||||
policyVehicle.vin === this.selectedVehicleVin);
|
|
||||||
return vehicle?.endorsements?.includes(endorsementOptions.REPAIR_WAIVED) ?? false;
|
|
||||||
},
|
},
|
||||||
selectedVehicle() {
|
selectedVehicle() {
|
||||||
const vehicle = this.mainStore.lookupVehicleByVin(this.selectedVehicleVin);
|
const vehicle = this.mainStore.lookupVehicleByVin(this.selectedVehicleVin);
|
||||||
|
|
@ -147,6 +135,7 @@ export default {
|
||||||
// clear previously selected vehicle and image
|
// clear previously selected vehicle and image
|
||||||
this.mainStore.resetVehicleState();
|
this.mainStore.resetVehicleState();
|
||||||
this.displayGeneric = true;
|
this.displayGeneric = true;
|
||||||
|
this.selectedPolicyVehicle = null;
|
||||||
} else {
|
} else {
|
||||||
// get vehicle details from selected VIN
|
// get vehicle details from selected VIN
|
||||||
const vehicle = await this.lookupVehicleByVin(value);
|
const vehicle = await this.lookupVehicleByVin(value);
|
||||||
|
|
@ -155,18 +144,22 @@ export default {
|
||||||
if (vehicle?.error === true) {
|
if (vehicle?.error === true) {
|
||||||
this.mainStore.resetVehicleState();
|
this.mainStore.resetVehicleState();
|
||||||
this.displayGeneric = true;
|
this.displayGeneric = true;
|
||||||
|
this.selectedPolicyVehicle = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (vehicle) {
|
if (vehicle) {
|
||||||
// save selected vehicle to the store
|
// save selected vehicle to the store
|
||||||
this.mainStore.updateVehicle(vehicle.data);
|
this.mainStore.updateVehicle(vehicle.data);
|
||||||
this.displayGeneric = false;
|
this.displayGeneric = false;
|
||||||
|
this.selectedPolicyVehicle = this.policyVehicles.find((p) => p.vin === value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
if (this.policyVehicles?.length === 1) {
|
if (this.mainStore.order.vehicle.vin) {
|
||||||
|
this.selectedVehicleVin = this.mainStore.order.vehicle.vin;
|
||||||
|
} else if (this.policyVehicles?.length === 1) {
|
||||||
this.selectedVehicleVin = this.policyVehicles[0]?.vin;
|
this.selectedVehicleVin = this.policyVehicles[0]?.vin;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,11 @@ const navigationScenarios = Object.freeze({
|
||||||
CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES: 'CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES',
|
CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES: 'CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES',
|
||||||
SAVE_SESSION_FAILED: 'SAVE_SESSION_FAILED',
|
SAVE_SESSION_FAILED: 'SAVE_SESSION_FAILED',
|
||||||
|
|
||||||
|
// Duplicate Check
|
||||||
|
CLICKED_FORWARD_LOADED_DUPLICATE_WITH_POLICY_VEHICLE: 'CLICKED_FORWARD_LOADED_DUPLICATE_WITH_POLICY_VEHICLE',
|
||||||
|
CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NO_POLICY_VEHICLES: 'CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NO_POLICY_VEHICLES',
|
||||||
|
CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NON_POLICY_VEHICLE: 'CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NON_POLICY_VEHICLE',
|
||||||
|
|
||||||
// YMMS
|
// YMMS
|
||||||
SELECTED_YEAR: 'SELECTED_YEAR',
|
SELECTED_YEAR: 'SELECTED_YEAR',
|
||||||
SELECTED_MAKE: 'SELECTED_MAKE',
|
SELECTED_MAKE: 'SELECTED_MAKE',
|
||||||
|
|
|
||||||
|
|
@ -420,6 +420,18 @@ const routingTable = () => [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
||||||
destinationIssPageValue: issPageValues.POLICY_VEHICLES
|
destinationIssPageValue: issPageValues.POLICY_VEHICLES
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_POLICY_VEHICLE,
|
||||||
|
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NON_POLICY_VEHICLE,
|
||||||
|
destinationIssPageValue: issPageValues.VEHICLE_SELECTION
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NO_POLICY_VEHICLES,
|
||||||
|
destinationIssPageValue: issPageValues.VEHICLE_SELECTION
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,11 @@ import coverageStatuses from '@/constants/coverage-statuses';
|
||||||
import { AppointmentTypeStrings, PREMIUM_FEE_PART_TYPE } from '@/constants/schedule-constants';
|
import { AppointmentTypeStrings, PREMIUM_FEE_PART_TYPE } from '@/constants/schedule-constants';
|
||||||
import { convertDateStringToDate, getDateDifferenceInDays, militaryToTwelveHourTime } from '@/helpers/date-helper';
|
import { convertDateStringToDate, getDateDifferenceInDays, militaryToTwelveHourTime } from '@/helpers/date-helper';
|
||||||
import { paymentMethods } from '@/constants/payment-method-constants';
|
import { paymentMethods } from '@/constants/payment-method-constants';
|
||||||
|
import {
|
||||||
|
deductibleForSelectedVehicle, endorsementsForSelectedVehicle,
|
||||||
|
noCoverageForSelectedVehicle,
|
||||||
|
repairWaivedForSelectedVehicle
|
||||||
|
} from '@/helpers/policy-vehicle-helper';
|
||||||
|
|
||||||
const storeId = 'main';
|
const storeId = 'main';
|
||||||
|
|
||||||
|
|
@ -176,7 +181,9 @@ const getDefaultState = () => ({
|
||||||
workOrderNumber: null,
|
workOrderNumber: null,
|
||||||
originalDeductible: null,
|
originalDeductible: null,
|
||||||
currentDeductible: null,
|
currentDeductible: null,
|
||||||
carrierPhoneNumber: null
|
carrierPhoneNumber: null,
|
||||||
|
loadedFromDupeCheck: null,
|
||||||
|
loadedSessionClearedPreviousData: null
|
||||||
},
|
},
|
||||||
applicationUser: {
|
applicationUser: {
|
||||||
experiments: [],
|
experiments: [],
|
||||||
|
|
@ -231,6 +238,7 @@ export const useMainStore = defineStore({
|
||||||
|| state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP,
|
|| state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP,
|
||||||
isDropOffAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.DROP_OFF,
|
isDropOffAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.DROP_OFF,
|
||||||
isClaimRegistrationRequired: (state) => state.issConfig.isClaimRegistrationRequired,
|
isClaimRegistrationRequired: (state) => state.issConfig.isClaimRegistrationRequired,
|
||||||
|
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,
|
||||||
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);
|
||||||
|
|
@ -1063,6 +1071,14 @@ export const useMainStore = defineStore({
|
||||||
saveSession() {
|
saveSession() {
|
||||||
const { vehicle, damage, policy, customer, contactInfo, payment,
|
const { vehicle, damage, policy, customer, contactInfo, payment,
|
||||||
lineItems, serviceLocation, schedule } = this.order;
|
lineItems, serviceLocation, schedule } = this.order;
|
||||||
|
|
||||||
|
// We don't want to save the session for a loaded session until the car ID is set
|
||||||
|
if (this.order.loadedFromDupeCheck && !vehicle.carId) {
|
||||||
|
return Promise.resolve(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadedFromDupeCheck = !!(this.order.loadedFromDupeCheck && !this.order.loadedSessionClearedPreviousData);
|
||||||
|
|
||||||
const newGlassToReplace = convertGlassPieceNamingForApi(damage.glassToReplace);
|
const newGlassToReplace = convertGlassPieceNamingForApi(damage.glassToReplace);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
globalMethods.callHttpClient({
|
globalMethods.callHttpClient({
|
||||||
|
|
@ -1123,7 +1139,7 @@ export const useMainStore = defineStore({
|
||||||
state: customer.address?.state,
|
state: customer.address?.state,
|
||||||
zipCode: customer.address?.zipCode?.toString()
|
zipCode: customer.address?.zipCode?.toString()
|
||||||
},
|
},
|
||||||
emailAddress: contactInfo.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,
|
phoneNumber: contactInfo.phoneNumber,
|
||||||
|
|
@ -1180,19 +1196,26 @@ export const useMainStore = defineStore({
|
||||||
referralCorrelationId: this.order.referralCorrelationId,
|
referralCorrelationId: this.order.referralCorrelationId,
|
||||||
referralSequenceNumber: this.order.referralSequenceNumber,
|
referralSequenceNumber: this.order.referralSequenceNumber,
|
||||||
eon: this.order.eon,
|
eon: this.order.eon,
|
||||||
submitToMainframe: !!this.order.referralNumber
|
submitToMainframe: !!this.order.referralNumber,
|
||||||
|
loadedFromDupeCheck
|
||||||
},
|
},
|
||||||
additionalSuccessEventDataHandler: (response) =>
|
additionalSuccessEventDataHandler: (response) =>
|
||||||
`Email provided: ${customer.emailAddress ? 'true' : 'false'}`
|
`Email provided: ${customer.emailAddress ? 'true' : 'false'}`
|
||||||
}).then((response) => resolve(response), (error) => reject(error));
|
}).then((response) => {
|
||||||
|
if (loadedFromDupeCheck) {
|
||||||
|
this.order.loadedSessionClearedPreviousData = true;
|
||||||
|
}
|
||||||
|
resolve(response);
|
||||||
|
}, (error) => reject(error));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
loadSession() {
|
async loadSession() {
|
||||||
const { applicationUser, order, issConfig } = this;
|
const { applicationUser, order, issConfig } = this;
|
||||||
// TODO how to get savedSessionId for a duplicate referral?
|
// TODO how to get savedSessionId for a duplicate referral?
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
globalMethods.callHttpClient({
|
try {
|
||||||
|
const response = await globalMethods.callHttpClient({
|
||||||
method: endpoints.LoadSession.method,
|
method: endpoints.LoadSession.method,
|
||||||
endpoint: endpoints.LoadSession.url,
|
endpoint: endpoints.LoadSession.url,
|
||||||
payload: {
|
payload: {
|
||||||
|
|
@ -1202,118 +1225,81 @@ export const useMainStore = defineStore({
|
||||||
parentAccountNumber: issConfig.parentAccountNumber,
|
parentAccountNumber: issConfig.parentAccountNumber,
|
||||||
referralCorrelationId: order.referralCorrelationId
|
referralCorrelationId: order.referralCorrelationId
|
||||||
}
|
}
|
||||||
}).then((response) => {
|
|
||||||
const { data } = response;
|
|
||||||
if (!data) {
|
|
||||||
// TODO how should we handle this case?
|
|
||||||
return resolve(data);
|
|
||||||
}
|
|
||||||
applicationUser.crmCustomerId = data.applicationUser?.crmCustomerId;
|
|
||||||
applicationUser.experiments = data.applicationUser?.experiments ?? [];
|
|
||||||
applicationUser.lastPageVisited = data.applicationUser?.lastPage;
|
|
||||||
applicationUser.pageData = data.applicationUser?.pageData ?? {};
|
|
||||||
applicationUser.savedSessionId = data.applicationUser?.savedSessionId; // TODO this might just be what is passed
|
|
||||||
applicationUser.hasSentSaveQuoteEmail = data.applicationUser?.hasSentSaveQuoteEmail;
|
|
||||||
|
|
||||||
order.vehicle.registration.licensePlate = data.order?.vehicle?.registration?.licensePlateNumber;
|
|
||||||
order.vehicle.imageUrl = data.order?.vehicle?.imageUrl;
|
|
||||||
order.vehicle.imageColor = data.order?.vehicle?.imageVifColor;
|
|
||||||
order.vehicle.imageVifNumber = data.order?.vehicle?.imageVifNumber;
|
|
||||||
order.vehicle.year = data.order?.vehicle?.year;
|
|
||||||
order.vehicle.make = data.order?.vehicle?.make;
|
|
||||||
order.vehicle.model = data.order?.vehicle?.model;
|
|
||||||
order.vehicle.style = data.order?.vehicle?.style;
|
|
||||||
order.vehicle.carId = data.order?.vehicle?.carId;
|
|
||||||
order.vehicle.category = data.order?.vehicle?.category;
|
|
||||||
order.vehicle.vin = data.order?.vehicle?.vin;
|
|
||||||
|
|
||||||
order.customer.emailAddress = data.order?.customer?.emailAddress;
|
|
||||||
order.customer.firstName = data.order?.policy?.policyHolder?.policyFirstName;
|
|
||||||
order.customer.lastName = data.order?.policy?.policyHolder?.policyLastName;
|
|
||||||
order.customer.phoneNumber = data.order?.policy?.policyHolder?.policyPhoneNumber;
|
|
||||||
|
|
||||||
order.customer.address.streetAddress = data.order?.customer?.address?.streetAddress;
|
|
||||||
order.customer.address.streetAddress2 = data.order?.customer?.address?.streetAddress2;
|
|
||||||
order.customer.address.city = data.order?.customer?.address?.city;
|
|
||||||
order.customer.address.state = data.order?.customer?.address?.state;
|
|
||||||
order.customer.address.zipCode = data.order?.customer?.address?.zipCode;
|
|
||||||
|
|
||||||
order.damage.isRepair = data.order?.damage?.isRepair;
|
|
||||||
order.damage.numberOfChips = data.order?.damage?.numberOfChips;
|
|
||||||
order.damage.glassToReplace = data.order?.damage?.glassToReplace;
|
|
||||||
order.damage.capabilityQuestionAnswers = data.order?.damage?.capabilityQuestionAnswers;
|
|
||||||
order.damage.moldingQuestionAnswers = data.order?.damage?.moldingQuestionAnswers;
|
|
||||||
order.damage.partQuestionAnswers = data.order?.damage?.partQuestionAnswers;
|
|
||||||
|
|
||||||
order.policy.policyNumber = data.order?.policy?.policyNumber;
|
|
||||||
order.policy.policyZipCode = data.order?.policy?.policyZipCode;
|
|
||||||
order.policy.noCoverage = data.order?.policy?.noCoverage;
|
|
||||||
order.policy.policyLookupSuccessful = data.order?.policy?.policyLookupSuccessful; // TODO probably don't need to load this
|
|
||||||
order.policy.dateOfLoss = data.order?.damage?.dateOfLoss;
|
|
||||||
order.policy.damageCause = data.order?.damage?.damageCause;
|
|
||||||
order.policy.damageState = data.order?.damage?.damageState;
|
|
||||||
order.policy.damageCity = data.order?.damage?.damageCity;
|
|
||||||
order.policy.isDamageGlassOnly = data.order?.damage?.isDamageGlassOnly;
|
|
||||||
|
|
||||||
order.originalDeductible = data.order?.policy?.originalDeductible;
|
|
||||||
order.currentDeductible = data.order?.policy?.currentDeductible;
|
|
||||||
|
|
||||||
order.lineItems.glassParts = data.order?.lineItems?.glassParts;
|
|
||||||
// TODO otherParts
|
|
||||||
order.lineItems.supportingItems = data.order?.lineItems?.supportingItems;
|
|
||||||
order.lineItems.vaps = data.order?.lineItems?.vaps;
|
|
||||||
|
|
||||||
order.payment.insuranceCoverage.isVerified = data.order?.payment?.insuranceCoverage?.isVerified;
|
|
||||||
order.payment.insuranceCoverage.coverageStatus = data.order?.payment?.insuranceCoverage?.coverageStatus;
|
|
||||||
const parentAccountNumber = Number.isNaN(data.order?.payment?.parentAccountNumber)
|
|
||||||
? 0
|
|
||||||
: data.order?.payment?.parentAccountNumber;
|
|
||||||
order.payment.parentAccountNumber = parentAccountNumber;
|
|
||||||
issConfig.parentAccountNumber = parentAccountNumber;
|
|
||||||
order.payment.insuranceCoverage.claimNumber = data.order?.payment?.insuranceCoverage?.claimNumber;
|
|
||||||
|
|
||||||
order.serviceLocation.address = data.order?.serviceLocation?.streetAddress;
|
|
||||||
order.serviceLocation.address2 = data.order?.serviceLocation?.streetAddress2;
|
|
||||||
order.serviceLocation.city = data.order?.serviceLocation?.city;
|
|
||||||
order.serviceLocation.state = data.order?.serviceLocation?.state;
|
|
||||||
order.serviceLocation.zipCode = data.order?.serviceLocation?.zipCode;
|
|
||||||
order.serviceLocation.zipCodeCtu = data.order?.serviceLocation?.zipCodeCtu;
|
|
||||||
order.serviceLocation.appointmentType = data.order?.serviceLocation?.appointmentType;
|
|
||||||
order.serviceLocation.isVehicleProtected = data.order?.serviceLocation?.isVehicleProtected;
|
|
||||||
order.serviceLocation.provider.providerNumber = data.order?.serviceLocation?.provider?.providerNumber;
|
|
||||||
order.serviceLocation.provider.address.streetAddress = data.order?.serviceLocation?.provider?.address?.streetAddress;
|
|
||||||
order.serviceLocation.provider.address.city = data.order?.serviceLocation?.provider?.address?.city;
|
|
||||||
order.serviceLocation.provider.address.state = data.order?.serviceLocation?.provider?.address?.state;
|
|
||||||
order.serviceLocation.provider.address.zipCode = data.order?.serviceLocation?.provider?.address?.zipCode;
|
|
||||||
order.serviceLocation.provider.address.zipCodeCtu = data.order?.serviceLocation?.provider?.address?.zipCodeCtu;
|
|
||||||
|
|
||||||
order.contactInfo.firstName = data.order?.customer?.firstName;
|
|
||||||
order.contactInfo.lastName = data.order?.customer?.lastName;
|
|
||||||
order.contactInfo.emailAddress = data.order?.customer?.emailAddress;
|
|
||||||
order.contactInfo.phoneNumber = data.order?.customer?.phoneNumber;
|
|
||||||
order.contactInfo.requestTextUpdates = data.order?.customer?.isSmsOptIn; // TODO confirm
|
|
||||||
order.contactInfo.notesForTechnician = data.order?.serviceLocation?.techNotes;
|
|
||||||
// TODO service phone number ??
|
|
||||||
// TODO isSmsOptIn service ??
|
|
||||||
|
|
||||||
order.schedule.date = data.order?.schedule?.date;
|
|
||||||
order.schedule.startTime = data.order?.schedule?.startTime;
|
|
||||||
order.schedule.endTime = data.order?.schedule?.endTime;
|
|
||||||
order.schedule.routeCode = data.order?.schedule?.routeCode;
|
|
||||||
order.schedule.jobMaxMinutes = data.order?.schedule?.jobMaxMinutes;
|
|
||||||
order.schedule.jobMinMinutes = data.order?.schedule?.jobMinMinutes;
|
|
||||||
|
|
||||||
order.referralNumber = data.order?.referralNumber;
|
|
||||||
order.referralDate = data.order?.referralDate;
|
|
||||||
order.referralCorrelationId = data.order?.referralCorrelationId;
|
|
||||||
order.referralSequenceNumber = data.order?.referralSequenceNumber;
|
|
||||||
order.eon = data.order?.eon;
|
|
||||||
// TODO order.workOrderNumber not set, but this likely is not an issue since WON => will not return
|
|
||||||
return resolve(data);
|
|
||||||
}, (error) => {
|
|
||||||
reject(error);
|
|
||||||
});
|
});
|
||||||
});
|
const { data } = response;
|
||||||
|
if (!data) {
|
||||||
|
// TODO how should we handle this case?
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
applicationUser.crmCustomerId = data.applicationUser?.crmCustomerId;
|
||||||
|
applicationUser.experiments = data.applicationUser?.experiments ?? [];
|
||||||
|
applicationUser.savedSessionId = data.applicationUser?.savedSessionId;
|
||||||
|
|
||||||
|
if (order.policy.policyLookupSuccessful) {
|
||||||
|
order.customer.emailAddress = data.customer?.emailAddress;
|
||||||
|
order.customer.firstName = data.customer?.firstName;
|
||||||
|
order.customer.lastName = data.customer?.lastName;
|
||||||
|
order.customer.phoneNumber = data?.customer?.phoneNumber;
|
||||||
|
|
||||||
|
order.customer.address.streetAddress = data.customer?.address?.streetAddress;
|
||||||
|
order.customer.address.streetAddress2 = data.customer?.address?.streetAddress2;
|
||||||
|
order.customer.address.city = data.customer?.address?.city;
|
||||||
|
order.customer.address.state = data.customer?.address?.state;
|
||||||
|
order.customer.address.zipCode = data.customer?.address?.zipCode;
|
||||||
|
|
||||||
|
order.contactInfo.firstName = data?.customer?.firstName;
|
||||||
|
order.contactInfo.lastName = data?.customer?.lastName;
|
||||||
|
order.contactInfo.emailAddress = data?.customer?.emailAddress;
|
||||||
|
order.contactInfo.phoneNumber = data?.customer?.phoneNumber;
|
||||||
|
order.contactInfo.requestTextUpdates = data?.customer?.isSmsOptIn;
|
||||||
|
|
||||||
|
order.payment.insuranceCoverage.isVerified = data?.payment?.insuranceCoverage?.isVerified;
|
||||||
|
order.payment.insuranceCoverage.coverageStatus = data?.payment?.insuranceCoverage?.coverageStatus;
|
||||||
|
order.payment.insuranceCoverage.claimNumber = data?.payment?.insuranceCoverage?.claimNumber;
|
||||||
|
|
||||||
|
if (order.policy.vehicles.length !== 0 && data.vehicle?.carId) {
|
||||||
|
order.vehicle.registration.licensePlate = data?.vehicle?.licensePlateNumber;
|
||||||
|
if (data.vehicle.vin) {
|
||||||
|
const vehicle = order.policy.vehicles.find((v) => v.vin === data.vehicle.vin);
|
||||||
|
if (vehicle) {
|
||||||
|
const vehicleResponse = await this.lookupVehicleByVin(vehicle.vin);
|
||||||
|
if (vehicleResponse) {
|
||||||
|
Object.assign(
|
||||||
|
vehicleResponse.data,
|
||||||
|
{
|
||||||
|
policyVehicleId: vehicle.id,
|
||||||
|
vin: vehicle.vin,
|
||||||
|
noCoverage: noCoverageForSelectedVehicle(vehicle),
|
||||||
|
deductible: deductibleForSelectedVehicle(vehicle),
|
||||||
|
repairWaived: repairWaivedForSelectedVehicle(vehicle),
|
||||||
|
endorsements: endorsementsForSelectedVehicle(vehicle)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.updateVehicle(vehicleResponse.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
order.vehicle.year = data.vehicle.year;
|
||||||
|
order.vehicle.make = data.vehicle.make;
|
||||||
|
order.vehicle.model = data.vehicle.model;
|
||||||
|
order.vehicle.style = data.vehicle.style;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
order.referralNumber = data?.referralNumber;
|
||||||
|
order.referralDate = data?.referralDate;
|
||||||
|
order.referralCorrelationId = data?.referralCorrelationId;
|
||||||
|
order.referralSequenceNumber = data?.referralSequenceNumber;
|
||||||
|
order.eon = data?.eon;
|
||||||
|
order.loadedFromDupeCheck = true;
|
||||||
|
order.loadedSessionClearedPreviousData = false;
|
||||||
|
return data;
|
||||||
|
} catch (ex) {
|
||||||
|
// TODO how should we handle this case?
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setSaveSessionPromise(promise) {
|
setSaveSessionPromise(promise) {
|
||||||
|
|
@ -1441,6 +1427,12 @@ export const useMainStore = defineStore({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resetInsurance() {
|
||||||
|
this.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
|
||||||
|
this.order.payment.insuranceCoverage.claimNumber = null;
|
||||||
|
this.order.payment.insuranceCoverage.isVerified = false;
|
||||||
|
},
|
||||||
|
|
||||||
updateSupportingItems(partsData) {
|
updateSupportingItems(partsData) {
|
||||||
this.order.lineItems.supportingItems = partsData;
|
this.order.lineItems.supportingItems = partsData;
|
||||||
},
|
},
|
||||||
|
|
@ -1466,9 +1458,12 @@ export const useMainStore = defineStore({
|
||||||
|
|
||||||
// These could be undefined
|
// These could be undefined
|
||||||
this.order.policy.noCoverage = vehicle.noCoverage;
|
this.order.policy.noCoverage = vehicle.noCoverage;
|
||||||
this.order.payment.insuranceCoverage.coverageStatus = vehicle.noCoverage
|
if (this.order.payment.insuranceCoverage.coverageStatus === coverageStatuses.PENDING) {
|
||||||
? coverageStatuses.NO_COMP
|
this.order.payment.insuranceCoverage.coverageStatus = vehicle.noCoverage
|
||||||
: coverageStatuses.PENDING;
|
? coverageStatuses.NO_COMP
|
||||||
|
: coverageStatuses.PENDING;
|
||||||
|
}
|
||||||
|
|
||||||
this.order.policy.deductible.replace = vehicle.deductible;
|
this.order.policy.deductible.replace = vehicle.deductible;
|
||||||
this.order.policy.deductible.repair = vehicle?.repairWaived ?? false ? 0 : vehicle.deductible;
|
this.order.policy.deductible.repair = vehicle?.repairWaived ?? false ? 0 : vehicle.deductible;
|
||||||
this.order.policy.endorsements = vehicle?.endorsements;
|
this.order.policy.endorsements = vehicle?.endorsements;
|
||||||
|
|
@ -2150,8 +2145,11 @@ export const useMainStore = defineStore({
|
||||||
this.order.customer.address.zipCode = null;
|
this.order.customer.address.zipCode = null;
|
||||||
this.order.customer.address.streetAddress = null;
|
this.order.customer.address.streetAddress = null;
|
||||||
this.order.customer.address.streetAddress2 = null;
|
this.order.customer.address.streetAddress2 = null;
|
||||||
|
this.order.loadedFromDupeCheck = null;
|
||||||
|
this.order.loadedSessionClearedPreviousData = null;
|
||||||
this.resetVehicleState();
|
this.resetVehicleState();
|
||||||
this.resetDamageState();
|
this.resetDamageState();
|
||||||
|
this.resetInsurance();
|
||||||
this.resetBailout();
|
this.resetBailout();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,8 @@ describe('Store', () => {
|
||||||
noCoverage: expectedNoCoverage
|
noCoverage: expectedNoCoverage
|
||||||
};
|
};
|
||||||
|
|
||||||
|
store.order.payment.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
store.updateVehicle(vehicle);
|
store.updateVehicle(vehicle);
|
||||||
|
|
||||||
|
|
@ -961,10 +963,8 @@ describe('Store', () => {
|
||||||
const applicationUser = {
|
const applicationUser = {
|
||||||
crmCustomerId: getRandomString(6, 6),
|
crmCustomerId: getRandomString(6, 6),
|
||||||
experiments: getRandomString(6, 6),
|
experiments: getRandomString(6, 6),
|
||||||
lastPage: getRandomString(6, 6),
|
|
||||||
pageData: getRandomString(6, 6),
|
pageData: getRandomString(6, 6),
|
||||||
savedSessionId: getRandomString(6, 6),
|
savedSessionId: getRandomString(6, 6)
|
||||||
hasSentSaveQuoteEmail: getRandomBoolean()
|
|
||||||
};
|
};
|
||||||
const vehicle = {
|
const vehicle = {
|
||||||
year: getRandomString(6, 6),
|
year: getRandomString(6, 6),
|
||||||
|
|
@ -973,40 +973,7 @@ describe('Store', () => {
|
||||||
style: getRandomString(6, 6),
|
style: getRandomString(6, 6),
|
||||||
vin: getRandomString(6, 6),
|
vin: getRandomString(6, 6),
|
||||||
carId: getRandomString(6, 6),
|
carId: getRandomString(6, 6),
|
||||||
category: getRandomString(6, 6),
|
licensePlateNumber: getRandomString(6, 6)
|
||||||
registration: {
|
|
||||||
licensePlateNumber: getRandomString(6, 6)
|
|
||||||
},
|
|
||||||
imageUrl: getRandomString(6, 6),
|
|
||||||
imageVifNumber: getRandomString(6, 6),
|
|
||||||
imageVifColor: getRandomString(6, 6)
|
|
||||||
};
|
|
||||||
const damage = {
|
|
||||||
numberOfChips: getRandomString(6, 6),
|
|
||||||
isRepair: getRandomBoolean(),
|
|
||||||
glassToReplace: getRandomString(6, 6),
|
|
||||||
capabilityQuestionAnswers: getRandomString(6, 6),
|
|
||||||
moldingQuestionAnswers: getRandomString(6, 6),
|
|
||||||
partQuestionAnswers: getRandomString(6, 6),
|
|
||||||
dateOfLoss: getRandomString(6, 6),
|
|
||||||
damageCause: getRandomString(6, 6),
|
|
||||||
damageState: getRandomString(6, 6),
|
|
||||||
damageCity: getRandomString(6, 6),
|
|
||||||
isDamageGlassOnly: getRandomBoolean()
|
|
||||||
};
|
|
||||||
const policy = {
|
|
||||||
policyNumber: getRandomString(6, 6),
|
|
||||||
policyZipCode: getRandomBoolean(),
|
|
||||||
noCoverage: getRandomString(6, 6),
|
|
||||||
policyLookupSuccessful: getRandomBoolean(),
|
|
||||||
policyHolder: {
|
|
||||||
policyFirstName: getRandomString(6, 6),
|
|
||||||
policyLastName: getRandomString(6, 6),
|
|
||||||
policyPhoneNumber: getRandomString(6, 6),
|
|
||||||
policyState: getRandomString(6, 6)
|
|
||||||
},
|
|
||||||
originalDeductible: getRandomString(6, 6),
|
|
||||||
currentDeductible: getRandomString(6, 6)
|
|
||||||
};
|
};
|
||||||
const customer = {
|
const customer = {
|
||||||
firstName: getRandomString(6, 6),
|
firstName: getRandomString(6, 6),
|
||||||
|
|
@ -1023,76 +990,22 @@ describe('Store', () => {
|
||||||
zipCodeCtu: getRandomString(6, 6)
|
zipCodeCtu: getRandomString(6, 6)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const provider = {
|
|
||||||
providerNumber: getRandomString(6, 6),
|
|
||||||
address: {
|
|
||||||
streetAddress: getRandomString(6, 6),
|
|
||||||
streetAddress2: getRandomString(6, 6),
|
|
||||||
city: getRandomString(6, 6),
|
|
||||||
state: getRandomString(6, 6),
|
|
||||||
zipCode: getRandomString(6, 6),
|
|
||||||
zipCodeCtu: getRandomString(6, 6)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const serviceLocation = {
|
|
||||||
streetAddress: getRandomString(6, 6),
|
|
||||||
streetAddress2: getRandomString(6, 6),
|
|
||||||
city: getRandomString(6, 6),
|
|
||||||
state: getRandomString(6, 6),
|
|
||||||
zipCode: getRandomString(6, 6),
|
|
||||||
zipCodeCtu: getRandomString(6, 6),
|
|
||||||
appointmentType: getRandomString(6, 6),
|
|
||||||
isVehicleProtected: getRandomBoolean(),
|
|
||||||
provider,
|
|
||||||
techNotes: getRandomString(6, 6),
|
|
||||||
phoneNumber: getRandomString(6, 6),
|
|
||||||
isSmsOptIn: getRandomBoolean()
|
|
||||||
};
|
|
||||||
const lineItems = {
|
|
||||||
glassParts: getRandomString(6, 6),
|
|
||||||
supportingItems: getRandomString(6, 6),
|
|
||||||
vaps: getRandomString(6, 6),
|
|
||||||
serverData: getRandomString(6, 6)
|
|
||||||
};
|
|
||||||
const payment = {
|
|
||||||
insuranceCoverage: {
|
|
||||||
isVerified: getRandomBoolean(),
|
|
||||||
coverageStatus: getRandomString(6, 6),
|
|
||||||
claimNumber: getRandomString(6, 6)
|
|
||||||
},
|
|
||||||
parentAccountNumber: getRandomString(6, 6)
|
|
||||||
};
|
|
||||||
const schedule = {
|
|
||||||
date: getRandomString(6, 6),
|
|
||||||
startTime: getRandomString(6, 6),
|
|
||||||
endTime: getRandomString(6, 6),
|
|
||||||
routeCode: getRandomString(6, 6),
|
|
||||||
jobMaxMinutes: getRandomString(6, 6),
|
|
||||||
jobMinMinutes: getRandomString(6, 6)
|
|
||||||
};
|
|
||||||
const fullApiResponse = {
|
const fullApiResponse = {
|
||||||
data: {
|
data: {
|
||||||
applicationUser,
|
applicationUser,
|
||||||
order: {
|
vehicle,
|
||||||
vehicle,
|
customer,
|
||||||
damage,
|
referralNumber: getRandomString(6, 6),
|
||||||
policy,
|
referralDate: getRandomString(6, 6),
|
||||||
customer,
|
referralCorrelationId: getRandomString(6, 6),
|
||||||
serviceLocation,
|
referralSequenceNumber: getRandomString(6, 6),
|
||||||
lineItems,
|
eon: getRandomString(6, 6)
|
||||||
payment,
|
|
||||||
schedule,
|
|
||||||
referralNumber: getRandomString(6, 6),
|
|
||||||
referralDate: getRandomString(6, 6),
|
|
||||||
referralCorrelationId: getRandomString(6, 6),
|
|
||||||
referralSequenceNumber: getRandomString(6, 6),
|
|
||||||
eon: getRandomString(6, 6)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
it('calls load session api endpoint', async () => {
|
it('calls load session api endpoint', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({}));
|
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({ data: {} }));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
store.loadSession();
|
store.loadSession();
|
||||||
|
|
@ -1105,7 +1018,7 @@ describe('Store', () => {
|
||||||
});
|
});
|
||||||
it('Returns expected response object', async () => {
|
it('Returns expected response object', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const response = { data: {ReferralNumber: getRandomString(6, 6)} };
|
const response = { data: { ReferralNumber: getRandomString(6, 6) } };
|
||||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(response));
|
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(response));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -1117,37 +1030,21 @@ describe('Store', () => {
|
||||||
it('sets expected application user data', async () => {
|
it('sets expected application user data', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));
|
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));
|
||||||
const originalSavedSessionTimeout = store.applicationUser.savedSessionTimeout;
|
|
||||||
const originalEventBus = store.applicationUser.eventBus;
|
|
||||||
const originalSaveSessionPromise = store.applicationUser.saveSessionPromise;
|
|
||||||
const originalTriggeredSiteEntry = store.applicationUser.triggeredSiteEntry;
|
|
||||||
const originalDuplicateOrders = store.applicationUser.duplicateOrders;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await store.loadSession();
|
await store.loadSession();
|
||||||
|
|
||||||
// Asserts
|
// Asserts
|
||||||
expect(store.applicationUser.experiments).toEqual(applicationUser.experiments);
|
expect(store.applicationUser.experiments).toEqual(applicationUser.experiments);
|
||||||
expect(store.applicationUser.pageData).toBe(applicationUser.pageData);
|
|
||||||
expect(store.applicationUser.savedSessionId).toBe(applicationUser.savedSessionId);
|
expect(store.applicationUser.savedSessionId).toBe(applicationUser.savedSessionId);
|
||||||
expect(store.applicationUser.crmCustomerId).toBe(applicationUser.crmCustomerId);
|
expect(store.applicationUser.crmCustomerId).toBe(applicationUser.crmCustomerId);
|
||||||
expect(store.applicationUser.lastPageVisited).toBe(applicationUser.lastPage);
|
|
||||||
expect(store.applicationUser.hasSentSaveQuoteEmail).toBe(applicationUser.hasSentSaveQuoteEmail);
|
|
||||||
expect(store.applicationUser.eventBus).toEqual(originalEventBus);
|
|
||||||
expect(store.applicationUser.savedSessionTimeout).toBe(originalSavedSessionTimeout);
|
|
||||||
expect(store.applicationUser.saveSessionPromise).toBe(originalSaveSessionPromise);
|
|
||||||
expect(store.applicationUser.triggeredSiteEntry).toBe(originalTriggeredSiteEntry);
|
|
||||||
expect(store.applicationUser.duplicateOrders).toEqual(originalDuplicateOrders);
|
|
||||||
});
|
});
|
||||||
it('sets expected vehicle data', async () => {
|
it('sets expected vehicle data', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));
|
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));
|
||||||
const originalRegistrationAddress = store.vehicle.registration.address;
|
|
||||||
const originalRegistrationCity = store.vehicle.registration.city;
|
store.order.policy.policyLookupSuccessful = true;
|
||||||
const originalRegistrationState = store.vehicle.registration.state;
|
store.policy.vehicles = [{ vin: vehicle.vin }];
|
||||||
const originalRegistrationZipCode = store.vehicle.registration.zipCode;
|
|
||||||
const originalRegistrationFirstName = store.vehicle.registration.firstName;
|
|
||||||
const originalRegistrationLastName = store.vehicle.registration.lastName;
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await store.loadSession();
|
await store.loadSession();
|
||||||
|
|
@ -1157,65 +1054,16 @@ describe('Store', () => {
|
||||||
expect(store.vehicle.make).toBe(vehicle.make);
|
expect(store.vehicle.make).toBe(vehicle.make);
|
||||||
expect(store.vehicle.model).toBe(vehicle.model);
|
expect(store.vehicle.model).toBe(vehicle.model);
|
||||||
expect(store.vehicle.style).toBe(vehicle.style);
|
expect(store.vehicle.style).toBe(vehicle.style);
|
||||||
expect(store.vehicle.carId).toBe(vehicle.carId);
|
|
||||||
expect(store.vehicle.category).toBe(vehicle.category);
|
|
||||||
expect(store.vehicle.vin).toBe(vehicle.vin);
|
expect(store.vehicle.vin).toBe(vehicle.vin);
|
||||||
expect(store.vehicle.imageUrl).toBe(vehicle.imageUrl);
|
expect(store.vehicle.registration.licensePlate).toBe(vehicle.licensePlateNumber);
|
||||||
expect(store.vehicle.imageVifNumber).toBe(vehicle.imageVifNumber);
|
|
||||||
expect(store.vehicle.imageColor).toBe(vehicle.imageVifColor);
|
|
||||||
expect(store.vehicle.registration.licensePlate).toBe(vehicle.registration.licensePlateNumber);
|
|
||||||
expect(store.vehicle.registration.address).toBe(originalRegistrationAddress);
|
|
||||||
expect(store.vehicle.registration.city).toBe(originalRegistrationCity);
|
|
||||||
expect(store.vehicle.registration.state).toBe(originalRegistrationState);
|
|
||||||
expect(store.vehicle.registration.zipCode).toBe(originalRegistrationZipCode);
|
|
||||||
expect(store.vehicle.registration.firstName).toBe(originalRegistrationFirstName);
|
|
||||||
expect(store.vehicle.registration.lastName).toBe(originalRegistrationLastName);
|
|
||||||
});
|
|
||||||
it('sets expected damage data', async () => {
|
|
||||||
// Arrange
|
|
||||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));
|
|
||||||
|
|
||||||
// Act
|
|
||||||
await store.loadSession();
|
|
||||||
|
|
||||||
// Asserts
|
|
||||||
expect(store.damage.isRepair).toBe(damage.isRepair);
|
|
||||||
expect(store.damage.numberOfChips).toBe(damage.numberOfChips);
|
|
||||||
expect(store.damage.glassToReplace).toBe(damage.glassToReplace);
|
|
||||||
expect(store.damage.partQuestionAnswers).toBe(damage.partQuestionAnswers);
|
|
||||||
expect(store.damage.moldingQuestionAnswers).toBe(damage.moldingQuestionAnswers);
|
|
||||||
expect(store.damage.capabilityQuestionAnswers).toBe(damage.capabilityQuestionAnswers);
|
|
||||||
});
|
|
||||||
it('sets expected policy data', async () => {
|
|
||||||
// Arrange
|
|
||||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));
|
|
||||||
const originalRepairDeductible = store.policy.deductible.repair;
|
|
||||||
const originalReplaceDeductible = store.policy.deductible.replace;
|
|
||||||
const originalVehicles = store.policy.vehicles;
|
|
||||||
const originalEndorsementQuestionAnswers = store.policy.endorsementQuestionAnswers;
|
|
||||||
|
|
||||||
// Act
|
|
||||||
await store.loadSession();
|
|
||||||
|
|
||||||
// Asserts
|
|
||||||
expect(store.policy.policyNumber).toBe(policy.policyNumber);
|
|
||||||
expect(store.policy.policyZipCode).toBe(policy.policyZipCode);
|
|
||||||
expect(store.policy.dateOfLoss).toBe(damage.dateOfLoss);
|
|
||||||
expect(store.policy.damageCause).toBe(damage.damageCause);
|
|
||||||
expect(store.policy.damageState).toBe(damage.damageState);
|
|
||||||
expect(store.policy.damageCity).toBe(damage.damageCity);
|
|
||||||
expect(store.policy.isDamageGlassOnly).toBe(damage.isDamageGlassOnly);
|
|
||||||
expect(store.policy.policyLookupSuccessful).toBe(policy.policyLookupSuccessful);
|
|
||||||
expect(store.policy.noCoverage).toBe(policy.noCoverage);
|
|
||||||
expect(store.policy.deductible.repair).toBe(originalRepairDeductible);
|
|
||||||
expect(store.policy.deductible.replace).toBe(originalReplaceDeductible);
|
|
||||||
expect(store.policy.vehicles).toEqual(originalVehicles);
|
|
||||||
expect(store.policy.endorsementQuestionAnswers).toBe(originalEndorsementQuestionAnswers);
|
|
||||||
});
|
});
|
||||||
it('sets expected customer data', async () => {
|
it('sets expected customer data', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));
|
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));
|
||||||
|
|
||||||
|
store.order.policy.policyLookupSuccessful = true;
|
||||||
|
store.policy.vehicles = [{ vin: vehicle.vin }];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await store.loadSession();
|
await store.loadSession();
|
||||||
|
|
||||||
|
|
@ -1225,90 +1073,10 @@ describe('Store', () => {
|
||||||
expect(store.order.customer.address.city).toBe(customer.address.city);
|
expect(store.order.customer.address.city).toBe(customer.address.city);
|
||||||
expect(store.order.customer.address.state).toBe(customer.address.state);
|
expect(store.order.customer.address.state).toBe(customer.address.state);
|
||||||
expect(store.order.customer.address.zipCode).toBe(customer.address.zipCode);
|
expect(store.order.customer.address.zipCode).toBe(customer.address.zipCode);
|
||||||
expect(store.order.customer.firstName).toBe(policy.policyHolder.policyFirstName);
|
expect(store.order.customer.firstName).toBe(customer.firstName);
|
||||||
expect(store.order.customer.lastName).toBe(policy.policyHolder.policyLastName);
|
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(policy.policyHolder.policyPhoneNumber);
|
expect(store.order.customer.phoneNumber).toBe(customer.phoneNumber);
|
||||||
});
|
|
||||||
it('sets expected serviceLocation data', async () => {
|
|
||||||
// Arrange
|
|
||||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));
|
|
||||||
|
|
||||||
// Act
|
|
||||||
await store.loadSession();
|
|
||||||
|
|
||||||
// Asserts
|
|
||||||
expect(store.order.serviceLocation.address).toBe(serviceLocation.streetAddress);
|
|
||||||
expect(store.order.serviceLocation.address2).toBe(serviceLocation.streetAddress2);
|
|
||||||
expect(store.order.serviceLocation.city).toBe(serviceLocation.city);
|
|
||||||
expect(store.order.serviceLocation.state).toBe(serviceLocation.state);
|
|
||||||
expect(store.order.serviceLocation.zipCode).toBe(serviceLocation.zipCode);
|
|
||||||
expect(store.order.serviceLocation.zipCodeCtu).toBe(serviceLocation.zipCodeCtu);
|
|
||||||
expect(store.order.serviceLocation.appointmentType).toBe(serviceLocation.appointmentType);
|
|
||||||
expect(store.order.serviceLocation.isVehicleProtected).toBe(serviceLocation.isVehicleProtected);
|
|
||||||
expect(store.order.serviceLocation.provider.providerNumber).toBe(provider.providerNumber);
|
|
||||||
expect(store.order.serviceLocation.provider.address.streetAddress).toBe(provider.address.streetAddress);
|
|
||||||
expect(store.order.serviceLocation.provider.address.city).toBe(provider.address.city);
|
|
||||||
expect(store.order.serviceLocation.provider.address.state).toBe(provider.address.state);
|
|
||||||
expect(store.order.serviceLocation.provider.address.zipCode).toBe(provider.address.zipCode);
|
|
||||||
expect(store.order.serviceLocation.provider.address.zipCodeCtu).toBe(provider.address.zipCodeCtu);
|
|
||||||
});
|
|
||||||
it('sets expected lineItems data', async () => {
|
|
||||||
// Arrange
|
|
||||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));
|
|
||||||
const originalOtherParts = store.order.lineItems.otherParts;
|
|
||||||
|
|
||||||
// Act
|
|
||||||
await store.loadSession();
|
|
||||||
|
|
||||||
// Asserts
|
|
||||||
expect(store.order.lineItems.glassParts).toBe(lineItems.glassParts);
|
|
||||||
expect(store.order.lineItems.otherParts).toBe(originalOtherParts);
|
|
||||||
expect(store.order.lineItems.supportingItems).toBe(lineItems.supportingItems);
|
|
||||||
expect(store.order.lineItems.vaps).toBe(lineItems.vaps);
|
|
||||||
});
|
|
||||||
it('sets expected payment data', async () => {
|
|
||||||
// Arrange
|
|
||||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));
|
|
||||||
|
|
||||||
// Act
|
|
||||||
await store.loadSession();
|
|
||||||
|
|
||||||
// Asserts
|
|
||||||
expect(store.order.payment.insuranceCoverage.isVerified).toBe(payment.insuranceCoverage.isVerified);
|
|
||||||
expect(store.order.payment.insuranceCoverage.coverageStatus).toBe(payment.insuranceCoverage.coverageStatus);
|
|
||||||
expect(store.order.payment.parentAccountNumber).toBe(payment.parentAccountNumber);
|
|
||||||
expect(store.issConfig.parentAccountNumber).toBe(payment.parentAccountNumber);
|
|
||||||
expect(store.order.payment.insuranceCoverage.claimNumber).toBe(payment.insuranceCoverage.claimNumber);
|
|
||||||
});
|
|
||||||
it('sets expected contactInfo data', async () => {
|
|
||||||
// Arrange
|
|
||||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));
|
|
||||||
|
|
||||||
// Act
|
|
||||||
await store.loadSession();
|
|
||||||
|
|
||||||
// Asserts
|
|
||||||
expect(store.order.contactInfo.firstName).toBe(customer.firstName);
|
|
||||||
expect(store.order.contactInfo.lastName).toBe(customer.lastName);
|
|
||||||
expect(store.order.contactInfo.emailAddress).toBe(customer.emailAddress);
|
|
||||||
expect(store.order.contactInfo.phoneNumber).toBe(customer.phoneNumber);
|
|
||||||
expect(store.order.contactInfo.requestTextUpdates).toBe(customer.isSmsOptIn);
|
|
||||||
expect(store.order.contactInfo.notesForTechnician).toBe(serviceLocation.techNotes);
|
|
||||||
});
|
|
||||||
it('sets expected schedule data', async () => {
|
|
||||||
// Arrange
|
|
||||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(fullApiResponse));
|
|
||||||
|
|
||||||
// Act
|
|
||||||
await store.loadSession();
|
|
||||||
|
|
||||||
// Asserts
|
|
||||||
expect(store.order.schedule.date).toBe(schedule.date);
|
|
||||||
expect(store.order.schedule.startTime).toBe(schedule.startTime);
|
|
||||||
expect(store.order.schedule.endTime).toBe(schedule.endTime);
|
|
||||||
expect(store.order.schedule.routeCode).toBe(schedule.routeCode);
|
|
||||||
expect(store.order.schedule.jobMaxMinutes).toBe(schedule.jobMaxMinutes);
|
|
||||||
});
|
});
|
||||||
it('sets expected remaining order data', async () => {
|
it('sets expected remaining order data', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -1319,14 +1087,12 @@ describe('Store', () => {
|
||||||
await store.loadSession();
|
await store.loadSession();
|
||||||
|
|
||||||
// Asserts
|
// Asserts
|
||||||
expect(store.order.referralNumber).toBe(fullApiResponse.data.order.referralNumber);
|
expect(store.order.referralNumber).toBe(fullApiResponse.data.referralNumber);
|
||||||
expect(store.order.referralDate).toBe(fullApiResponse.data.order.referralDate);
|
expect(store.order.referralDate).toBe(fullApiResponse.data.referralDate);
|
||||||
expect(store.order.referralCorrelationId).toBe(fullApiResponse.data.order.referralCorrelationId);
|
expect(store.order.referralCorrelationId).toBe(fullApiResponse.data.referralCorrelationId);
|
||||||
expect(store.order.referralSequenceNumber).toBe(fullApiResponse.data.order.referralSequenceNumber);
|
expect(store.order.referralSequenceNumber).toBe(fullApiResponse.data.referralSequenceNumber);
|
||||||
expect(store.order.eon).toBe(fullApiResponse.data.order.eon);
|
expect(store.order.eon).toBe(fullApiResponse.data.eon);
|
||||||
expect(store.order.workOrderNumber).toBe(originalWorkOrderNumber);
|
expect(store.order.workOrderNumber).toBe(originalWorkOrderNumber);
|
||||||
expect(store.order.originalDeductible).toBe(policy.originalDeductible);
|
|
||||||
expect(store.order.currentDeductible).toBe(policy.currentDeductible);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('api call throws exception', async () => {
|
it('api call throws exception', async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue