From d2887fc1ef1a9880dfb014e393deea7d2bc1639f Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Mon, 9 Oct 2023 14:54:49 -0400 Subject: [PATCH] setup method to call endpoint --- src/constants/endpoints.js | 4 ++ src/store/index.js | 91 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 8429f3ad..e7ad1527 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -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' } }); diff --git a/src/store/index.js b/src/store/index.js index 77af754d..9de13a72 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -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({