forked from Yara724/api
feat(depreciation): apply Fanavaran tables and age eligibility
Use the supplied part, severity and age codes for depreciation. Exclude vehicles older than ten from calculated and manual amounts, preserve historical assessments, and send zero depreciation to Fanavaran for ineligible vehicles.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { resolveClaimPriceDropAge } from "src/helpers/claim-price-drop";
|
||||
import { unlink } from "node:fs/promises";
|
||||
import { plainToInstance } from "class-transformer";
|
||||
import { validateSync } from "class-validator";
|
||||
@@ -6331,7 +6332,9 @@ export class ClaimRequestManagementService {
|
||||
}
|
||||
|
||||
const priceDrop = input.claimCase.evaluation?.priceDrop ?? {};
|
||||
const priceDropTotal = this.parseFanavaranMoney(priceDrop?.total);
|
||||
const priceDropVehicleAge = resolveClaimPriceDropAge(input.claimCase, blameForExpertIds);
|
||||
const priceDropTotal = priceDropVehicleAge != null && priceDropVehicleAge > 10
|
||||
? 0 : this.parseFanavaranMoney(priceDrop?.total);
|
||||
const submittedAt = reply?.submittedAt ?? new Date();
|
||||
const product = await this.resolveFanavaranClaimProduct(
|
||||
input.claimCase?._id ? String(input.claimCase._id) : undefined,
|
||||
|
||||
Reference in New Issue
Block a user