INSR-523: If flag is on, includes memberNumber in all coverage requests
Also adds new (currently unused) flag to move claim registration to end of flow
This commit is contained in:
parent
8a0f3d11f7
commit
d6c1e7cd06
3 changed files with 143 additions and 87 deletions
|
|
@ -226,6 +226,10 @@ export default {
|
||||||
this.mainStore.issConfig.hiddenFields.phoneNumber = true;
|
this.mainStore.issConfig.hiddenFields.phoneNumber = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (clientFlags.CallClaimRegistrationAtEnd) {
|
||||||
|
this.mainStore.issConfig.callClaimRegistrationAtEnd = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
combineClientParameters(configParams, queryStringParams) {
|
combineClientParameters(configParams, queryStringParams) {
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,8 @@ export const getDefaultState = () => ({
|
||||||
buildInfo: (typeof __BUILD_INFO__ !== 'undefined') ? __BUILD_INFO__ : null, // Contains the build info for the website, set during the build process. Version, Time, Git info etc....
|
buildInfo: (typeof __BUILD_INFO__ !== 'undefined') ? __BUILD_INFO__ : null, // Contains the build info for the website, set during the build process. Version, Time, Git info etc....
|
||||||
siteType: null, // SiteType / SubType the site is set to (Essential/Advanced).
|
siteType: null, // SiteType / SubType the site is set to (Essential/Advanced).
|
||||||
enableNoCompQuote: false,
|
enableNoCompQuote: false,
|
||||||
useMemberNumber: false // Indicates if member number should be included for policy lookup purposes
|
useMemberNumber: false, // Indicates if member number should be included for policy lookup purposes
|
||||||
|
callClaimRegistrationAtEnd: false, // Indicates if claim registration should be called at the end of the flow.
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -646,72 +647,76 @@ export const useMainStore = defineStore({
|
||||||
const { isITAC } = this;
|
const { isITAC } = this;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const payload = {
|
||||||
|
referralCorrelationId: this.order.referralCorrelationId,
|
||||||
|
referralDate: this.order.referralDate,
|
||||||
|
referralNumber: this.order.referralNumber,
|
||||||
|
accountNumber: this.order.parentAccountNumber?.toString() ?? '',
|
||||||
|
policyData: this.order.policy.policyData,
|
||||||
|
// TODO: Remove this isRepair flag from the payload after coverage service updates are deployed.
|
||||||
|
// This is here in case we have to deploy site for other fixes before coverage service gets updated.
|
||||||
|
isRepair: this.order.damage.isRepair,
|
||||||
|
isItac: isITAC,
|
||||||
|
sourceSystem: applicationConfig.APPLICATION_NAME,
|
||||||
|
insured: {
|
||||||
|
firstName: this.order.customer.firstName,
|
||||||
|
lastName: this.order.customer.lastName,
|
||||||
|
address: {
|
||||||
|
addressLine1: this.order.customer.address.streetAddress,
|
||||||
|
addressLine2: this.order.customer.address.streetAddress2,
|
||||||
|
city: this.order.customer.address.city,
|
||||||
|
state: this.order.customer.address.state,
|
||||||
|
zipCode: this.order.customer.address.zipCode,
|
||||||
|
country: 'US' // TODO set from store
|
||||||
|
},
|
||||||
|
homePhone: {
|
||||||
|
number: this.contactInfo.homePhone?.replaceAll(nonNumberCharRegex, '') ?? ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
driver: {
|
||||||
|
firstName: this.order.customer.firstName,
|
||||||
|
lastName: this.order.customer.lastName
|
||||||
|
},
|
||||||
|
caller: {
|
||||||
|
homePhone: {}
|
||||||
|
},
|
||||||
|
policyInfo: {
|
||||||
|
policyNumber: this.order.policy.policyNumber,
|
||||||
|
safelitePolicy: {
|
||||||
|
policies: []
|
||||||
|
},
|
||||||
|
actualDeductible: this.currentDeductible.toString() ?? '',
|
||||||
|
currentRepairDeductible: this.order.currentDeductible.repair,
|
||||||
|
currentReplaceDeductible: this.order.currentDeductible.replace,
|
||||||
|
company: this.order.customer.companyCode
|
||||||
|
},
|
||||||
|
lossInfo: {
|
||||||
|
dateOfLoss: this.order.policy.dateOfLoss,
|
||||||
|
isRepair: this.order.damage.isRepair,
|
||||||
|
location: {
|
||||||
|
city: this.order.policy.damageCity,
|
||||||
|
state: this.order.policy.damageState,
|
||||||
|
country: 'US' // TODO set from store
|
||||||
|
},
|
||||||
|
vehicle: {
|
||||||
|
id: this.order.vehicle.policyVehicleId?.toString() ?? '',
|
||||||
|
year: this.order.vehicle.year?.toString() ?? '',
|
||||||
|
make: this.order.vehicle.make,
|
||||||
|
model: this.order.vehicle.model,
|
||||||
|
vin: this.order.vehicle.vin
|
||||||
|
},
|
||||||
|
cause: this.order.policy.damageCause,
|
||||||
|
damageDescription: this.order.policy.damageCause
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// Clients (i.e. USAA) may sometimes use member number, which is just policy number by a different name
|
||||||
|
if (this.issConfig.useMemberNumber) {
|
||||||
|
payload.memberNumber = this.order.policy.policyNumber;
|
||||||
|
}
|
||||||
const response = await globalMethods.callHttpClient({
|
const response = await globalMethods.callHttpClient({
|
||||||
method: endpoints.RegisterClaim.method,
|
method: endpoints.RegisterClaim.method,
|
||||||
endpoint: endpoints.RegisterClaim.url,
|
endpoint: endpoints.RegisterClaim.url,
|
||||||
payload:
|
payload,
|
||||||
{
|
|
||||||
referralCorrelationId: this.order.referralCorrelationId,
|
|
||||||
referralDate: this.order.referralDate,
|
|
||||||
referralNumber: this.order.referralNumber,
|
|
||||||
accountNumber: this.order.parentAccountNumber?.toString() ?? '',
|
|
||||||
policyData: this.order.policy.policyData,
|
|
||||||
// TODO: Remove this isRepair flag from the payload after coverage service updates are deployed.
|
|
||||||
// This is here in case we have to deploy site for other fixes before coverage service gets updated.
|
|
||||||
isRepair: this.order.damage.isRepair,
|
|
||||||
isItac: isITAC,
|
|
||||||
sourceSystem: applicationConfig.APPLICATION_NAME,
|
|
||||||
insured: {
|
|
||||||
firstName: this.order.customer.firstName,
|
|
||||||
lastName: this.order.customer.lastName,
|
|
||||||
address: {
|
|
||||||
addressLine1: this.order.customer.address.streetAddress,
|
|
||||||
addressLine2: this.order.customer.address.streetAddress2,
|
|
||||||
city: this.order.customer.address.city,
|
|
||||||
state: this.order.customer.address.state,
|
|
||||||
zipCode: this.order.customer.address.zipCode,
|
|
||||||
country: 'US' // TODO set from store
|
|
||||||
},
|
|
||||||
homePhone: {
|
|
||||||
number: this.contactInfo.homePhone?.replaceAll(nonNumberCharRegex, '') ?? ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
driver: {
|
|
||||||
firstName: this.order.customer.firstName,
|
|
||||||
lastName: this.order.customer.lastName
|
|
||||||
},
|
|
||||||
caller: {
|
|
||||||
homePhone: {}
|
|
||||||
},
|
|
||||||
policyInfo: {
|
|
||||||
policyNumber: this.order.policy.policyNumber,
|
|
||||||
safelitePolicy: {
|
|
||||||
policies: []
|
|
||||||
},
|
|
||||||
actualDeductible: this.currentDeductible.toString() ?? '',
|
|
||||||
currentRepairDeductible: this.order.currentDeductible.repair,
|
|
||||||
currentReplaceDeductible: this.order.currentDeductible.replace,
|
|
||||||
company: this.order.customer.companyCode
|
|
||||||
},
|
|
||||||
lossInfo: {
|
|
||||||
dateOfLoss: this.order.policy.dateOfLoss,
|
|
||||||
isRepair: this.order.damage.isRepair,
|
|
||||||
location: {
|
|
||||||
city: this.order.policy.damageCity,
|
|
||||||
state: this.order.policy.damageState,
|
|
||||||
country: 'US' // TODO set from store
|
|
||||||
},
|
|
||||||
vehicle: {
|
|
||||||
id: this.order.vehicle.policyVehicleId?.toString() ?? '',
|
|
||||||
year: this.order.vehicle.year?.toString() ?? '',
|
|
||||||
make: this.order.vehicle.make,
|
|
||||||
model: this.order.vehicle.model,
|
|
||||||
vin: this.order.vehicle.vin
|
|
||||||
},
|
|
||||||
cause: this.order.policy.damageCause,
|
|
||||||
damageDescription: this.order.policy.damageCause
|
|
||||||
}
|
|
||||||
},
|
|
||||||
bailoutOnError: false
|
bailoutOnError: false
|
||||||
});
|
});
|
||||||
this.order.insuranceCoverage.claimNumber = response.data.claimNumber;
|
this.order.insuranceCoverage.claimNumber = response.data.claimNumber;
|
||||||
|
|
@ -742,32 +747,38 @@ export const useMainStore = defineStore({
|
||||||
manualGlassNamesArray.push(glassPiece?.glassLocation?.toUpperCase());
|
manualGlassNamesArray.push(glassPiece?.glassLocation?.toUpperCase());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
referralCorrelationId: this.order.referralCorrelationId,
|
||||||
|
accountNumber: this.order.parentAccountNumber?.toString() ?? '',
|
||||||
|
endorsements: endorsementAnswersForPayload,
|
||||||
|
manualGlassNames: manualGlassNamesArray,
|
||||||
|
policyState: this.order.customer.address.state,
|
||||||
|
status: this.order.policy.status,
|
||||||
|
originalDeductible: this.originalDeductible,
|
||||||
|
currentDeductible: this.currentDeductible,
|
||||||
|
currentRepairDeductible: this.order.currentDeductible.repair,
|
||||||
|
currentReplaceDeductible: this.order.currentDeductible.replace,
|
||||||
|
noCoverage: false,
|
||||||
|
isRepair: this.order.damage.isRepair,
|
||||||
|
policyNumber: this.order.policy.policyNumber,
|
||||||
|
insuredFirstName: this.order.customer.firstName,
|
||||||
|
insuredLastName: this.order.customer.lastName,
|
||||||
|
insuredZipCode: this.order.customer.address.zipCode,
|
||||||
|
policyVehicleId: this.order.vehicle.policyVehicleId?.toString() ?? '',
|
||||||
|
vehicleVin: this.order.vehicle.vin,
|
||||||
|
policyData: this.order.policy.policyData,
|
||||||
|
isItac: this.isITAC
|
||||||
|
}
|
||||||
|
// Clients (i.e. USAA) may sometimes use member number, which is just policy number by a different name
|
||||||
|
if (this.issConfig.useMemberNumber) {
|
||||||
|
payload.memberNumber = this.order.policy.policyNumber;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const r = await globalMethods.callHttpClient({
|
const r = await globalMethods.callHttpClient({
|
||||||
method: endpoints.FinalDeductible.method,
|
method: endpoints.FinalDeductible.method,
|
||||||
endpoint: endpoints.FinalDeductible.url,
|
endpoint: endpoints.FinalDeductible.url,
|
||||||
payload: {
|
payload,
|
||||||
referralCorrelationId: this.order.referralCorrelationId,
|
|
||||||
accountNumber: this.order.parentAccountNumber?.toString() ?? '',
|
|
||||||
endorsements: endorsementAnswersForPayload,
|
|
||||||
manualGlassNames: manualGlassNamesArray,
|
|
||||||
policyState: this.order.customer.address.state,
|
|
||||||
status: this.order.policy.status,
|
|
||||||
originalDeductible: this.originalDeductible,
|
|
||||||
currentDeductible: this.currentDeductible,
|
|
||||||
currentRepairDeductible: this.order.currentDeductible.repair,
|
|
||||||
currentReplaceDeductible: this.order.currentDeductible.replace,
|
|
||||||
noCoverage: false,
|
|
||||||
isRepair: this.order.damage.isRepair,
|
|
||||||
policyNumber: this.order.policy.policyNumber,
|
|
||||||
insuredFirstName: this.order.customer.firstName,
|
|
||||||
insuredLastName: this.order.customer.lastName,
|
|
||||||
insuredZipCode: this.order.customer.address.zipCode,
|
|
||||||
policyVehicleId: this.order.vehicle.policyVehicleId?.toString() ?? '',
|
|
||||||
vehicleVin: this.order.vehicle.vin,
|
|
||||||
policyData: this.order.policy.policyData,
|
|
||||||
isItac: this.isITAC
|
|
||||||
},
|
|
||||||
bailoutOnError: false
|
bailoutOnError: false
|
||||||
});
|
});
|
||||||
this.order.policy.policyData = r.data.policyData;
|
this.order.policy.policyData = r.data.policyData;
|
||||||
|
|
@ -2308,6 +2319,7 @@ export const useMainStore = defineStore({
|
||||||
this.issConfig.enableNoCompQuote = false;
|
this.issConfig.enableNoCompQuote = false;
|
||||||
this.issConfig.billToAccountNumber = null;
|
this.issConfig.billToAccountNumber = null;
|
||||||
this.issConfig.useMemberNumber = false;
|
this.issConfig.useMemberNumber = false;
|
||||||
|
this.issConfig.callClaimRegistrationAtEnd = false;
|
||||||
// NOTE: Do not wipe out build info.
|
// NOTE: Do not wipe out build info.
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -518,6 +518,46 @@ describe('Store', () => {
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('calls api with memberNumber when useMemberNumber is true', async () => {
|
||||||
|
// Arrange
|
||||||
|
store.issConfig.useMemberNumber = true;
|
||||||
|
const companyCode = getRandomString(6, 6);
|
||||||
|
const policyNumber = getRandomString(6, 6);
|
||||||
|
const originalDeductible = {
|
||||||
|
replace: 500,
|
||||||
|
repair: 0
|
||||||
|
};
|
||||||
|
const currentDeductible = {
|
||||||
|
replace: 500,
|
||||||
|
repair: 0
|
||||||
|
};
|
||||||
|
store.order.originalDeductible = {
|
||||||
|
replace: originalDeductible.replace,
|
||||||
|
repair: originalDeductible.repair
|
||||||
|
};
|
||||||
|
store.order.currentDeductible = {
|
||||||
|
replace: currentDeductible.replace,
|
||||||
|
repair: currentDeductible.repair
|
||||||
|
};
|
||||||
|
store.order.customer.companyCode = companyCode;
|
||||||
|
store.order.policy.policyNumber = policyNumber;
|
||||||
|
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({}));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await store.registerClaim();
|
||||||
|
|
||||||
|
// Asserts
|
||||||
|
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
|
||||||
|
payload: expect.objectContaining({
|
||||||
|
sourceSystem: applicationConfig.APPLICATION_NAME,
|
||||||
|
memberNumber: policyNumber,
|
||||||
|
policyInfo: expect.objectContaining({
|
||||||
|
company: companyCode
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('updateContactInfo method', () => {
|
describe('updateContactInfo method', () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue