update API request

This commit is contained in:
Katie Kroell 2023-10-31 14:15:45 -04:00
parent 5f8737a4e0
commit 985ba28f71

View file

@ -517,20 +517,43 @@ export const useMainStore = defineStore({
} }
}); });
} }
const orderItemsArray = [];
const manuaGlassNamesArray = [];
const glassInformation = this.order.damage.glassToReplace;
glassInformation.forEach((glassPiece) => {
const glassPieceObject = {
name: glassPiece.glassLocation
};
orderItemsArray.push(glassPieceObject);
manuaGlassNamesArray.push(glassPiece.glassLocation);
});
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
globalMethods.callHttpClient({ globalMethods.callHttpClient({
method: endpoints.FinalDeductible.method, method: endpoints.FinalDeductible.method,
endpoint: endpoints.FinalDeductible.url, endpoint: endpoints.FinalDeductible.url,
payload: { payload: {
referralCorrelationId: this.order.referralCorrelationId,
referralNumber: this.order.referralNumber,
accountNumber: this.issConfig.parentAccountNumber?.toString() ?? '', accountNumber: this.issConfig.parentAccountNumber?.toString() ?? '',
currentDeductible: this.order.currentDeductible, insured: {
noCoverage: this.order.policy.noCoverage, address: {
endorsements: endorsementAnswersForPayload, state: this.order.customer.address.state
}
},
lossInfo: {
vehicle: {
endorsements: endorsementAnswersForPayload
},
manualGlassNames: manuaGlassNamesArray
},
policy: { policy: {
status: 'Active', // change to this.order.policy.status after changing back end request policyState: this.order.customer.address.state,
policyState: this.order.vehicle.registration.state status: this.order.policy.status,
} currentDeductible: this.order.currentDeductible,
noCoverage: this.order.policy.noCoverage
},
orderItems: orderItemsArray
} }
}).then((r) => { }).then((r) => {
this.updateDeductible(r.data); this.updateDeductible(r.data);