fix(fanavaran): honor supplied submission payload fields

Apply every supplied JSON field over generated defaults, preserving IDs, nested values and explicit nulls across base, damage and expertise submits. Validate manual hull payloads without rewriting their values or premium, and derive an empty replacement flag for old hull licences.
This commit is contained in:
2026-11-21 13:33:41 +03:30
parent 83d7351310
commit 99e6fa0850
10 changed files with 334 additions and 90 deletions
+15 -5
View File
@@ -20,6 +20,15 @@ A PUT to `/vehicle-hull-claims/{Id}` may run before files/expertise; Parsian oft
**Send rule:** send the **hull whitelist only**. Do not send ثالث-only keys (`DamagedCount`, `HasOtherCulprit`, `CompensationReferenceId`, `DocReceivedDate`, `IsLicenseReplacement`, plaque block on base, …).
**Manual submit body:** every supplied top-level field overrides its generated
value, including IDs, arrays, nested objects, `false`, `0` and JSON `null`.
Omitted fields retain generated defaults. Arrays and nested objects replace the
corresponding value; they are not merged element by element. Lookup validation
checks a copy of manual payloads and does not refresh their supplied premium or
rewrite their values. Automatic submission without overrides keeps its existing
inquiry, normalization and validation behavior. This also applies to third-party
base/damage submits and both products' expertise submits.
**Source tags:** same as `third-party-stage-fields.md` (`system` / `lookup` / `inquiry` / `user` / `staff` / `derived`).
---
@@ -32,10 +41,11 @@ Built by `buildFanavaranSubmitPayload` then `enrichCarBodyHullBaseClaimPayload`
`CustomerFaultPercent`, `AuthorityCulpritId`, `AccidentTypeId`, `CostSeparationToDmgSections`, `IsOwnerChanged`, `PolicyId`, `ClaimExpertId`, dates/time, `CulpritTypeId`.
**IsLicenseReplaced:** derived on the server from `CulpritLicenceIssuDate` and
`AccidentDate`: `0` through the third anniversary, `null` after three years
through the tenth anniversary, and `1` after ten years. Intake accepts valid past
issue dates older than ten years; no expiry-date or replacement-checkbox input
is required. The existing missing-date fallback is `1400/01/01`.
`AccidentDate`: default `0` through the third anniversary and `null` afterward.
Do not infer replacement from licence age exceeding ten years: Parsian rejects
that `1` with «باید خالی باشد». The hull base-claim submit body may explicitly
override `IsLicenseReplaced` with `0`, `1`, or JSON `null`; omitted fields keep
the derived default. Intake accepts valid past issue dates older than ten years. The existing missing-date fallback is `1400/01/01`.
| Field | Persian | Type | Null? | Current value / source |
|-------|---------|------|-------|------------------------|
@@ -55,7 +65,7 @@ is required. The existing missing-date fallback is `1400/01/01`.
| CustomerFaultPercent | درصد تقصیر بیمه‌گذار | number | **no** | **user** expert review, else **system** `100` |
| CostSeparationToDmgSections | تفکیک هزینه به نقاط | number (ans) | **no** | **system** `0` خیر · lookup `ans` |
| IsOwnerChanged | مالک تغییر یافته؟ | number (ans) | **no** | **system** `0` · lookup `ans` |
| IsLicenseReplaced | گواهینامه تعویضی است؟ | number | often null | **derived** `1` if issue date >10y before accident, else `null` (hull name; ثالث uses `IsLicenseReplacement`) |
| IsLicenseReplaced | گواهینامه تعویضی است؟ | number | often null | **derived** `0` through three years, otherwise `null`; explicit hull submit answer is preserved (ثالث uses `IsLicenseReplacement`) |
| ActualPremium | حق بیمه واقعی | number | preferred | **inquiry** hull policy `TotalPremium` via `GET /lookups/body-policy/{PolicyId}` |
| EstimateAmount | برآورد | number | **no** | **user** expert prices / provisional |
| CulpritLicenceNo | شماره گواهینامه | string | **no** | dummy / **user** |