setup method to call endpoint

This commit is contained in:
Katie Kroell 2023-10-09 14:54:49 -04:00
parent 098ed84658
commit d2887fc1ef
2 changed files with 95 additions and 0 deletions

View file

@ -166,6 +166,10 @@ const endpoints = Object.freeze({
// eslint-disable-next-line max-len
url: (accountNumber, policyNumber, phoneNumber) => `/order/api/v1/order/duplicate-check/${accountNumber}/${policyNumber}/${phoneNumber}`,
method: 'GET'
},
FinalDeductible: {
url: 'coverage/api/v1/coverage/get-final-deductible',
method: 'POST'
}
});

View file

@ -385,6 +385,8 @@ export const useMainStore = defineStore({
};
}
},
// Coverage API Actions
getCoveragePolicyInfo({ accountNumber, policyNumber, dateOfLoss, zipCode }) {
const { policy } = this.order;
try {
@ -492,6 +494,95 @@ export const useMainStore = defineStore({
});
});
},
getFinalDeductible() {
return global.callHttpClient({
method: endpoints.FinalDeductible.method,
endpoint: endpoints.FinalDeductible.url,
payload:
{
correlationId: this.order.referralCorrelationId,
referralNumber: this.order.referralNumber,
accountNumber: this.issConfig.parentAccountNumber?.toString() ?? '',
sourceSystem: null,
additionalInfo: {},
fakeType: null,
responseType: null,
vin: this.order.vehicle.vin,
fleetNumber: null,
lossLocation: null,
vehicleNotFound: null,
driverNotFound: null,
isRepair: this.order.damage.isRepair,
isOEMRequested: null,
currentDeductible: this.order.currentDeductible,
noCoverage: this.order.policy.noCoverage,
endorsements: this.order.policy.endorsementQuestionAnswers, // FIX
policy: {
policyEffectiveDate: null,
expirationDate: null,
type: null,
lineOfBusiness: null,
policyNumber: this.order.policy.policyNumber,
status: this.order.policy.status,
source: null,
policyState: this.order.vehicle.registration.state, // check on this
insureds: [{
firstName: this.order.customer.firstName,
middleName: null,
lastName: this.order.customer.lastName,
businessName: null,
address: this.order.customer.address.streetAddress,
state: this.order.customer.address.state,
zipCode: this.order.customer.address.zipCode,
zipCodePlus4: null,
phones: [{
phoneNumber: this.order.customer.phoneNumber?.replaceAll(nonNumberCharRegex, ''),
type: null
}],
email: this.order.customer.emailAddress,
driverLicenseState: this.order.vehicle.registration.state, // check on this
relationToInsured: null,
roles: [{
role: null
}],
companyCode: null,
customerId: null,
isExcluded: null,
notes: []
}],
vehicles: [{
id: null,
vehicleYear: this.order.vehicle.year?.toString() ?? '',
vehicleMake: this.order.vehicle.make,
vehicleModel: this.order.vehicle.model,
vehicleStyle: this.order.vehicle.style,
licensePlate: this.order.vehicle.registration.licensePlate,
vin: this.order.vehicle.vin,
driver: null,
owner: null,
noCoverage: this.order.policy.noCoverage,
coverages: [{
code: null,
deductible: this.order.currentDeductible,
individualLimit: null,
occurrenceLimit: null,
dayLimit: null
}],
fleetNumber: null,
fleetUnitNumber: null,
endorsements: this.order.policy.endorsementQuestionAnswers, // FIX
oemRequired: null,
additionalFields: {},
notes: []
}],
agent: {},
taxExempt: null,
additionalFields: {},
notes: []
}
}
});
},
getDuplicateReferrals() {
return new Promise((resolve, reject) => {
globalMethods.callHttpClient({