Files
yara724api/docs/fanavaran/hull-retrieval.md
T

63 lines
2.9 KiB
Markdown

# Retrieve submitted hull files and expertise sections
Implemented from the supplied Fanavaran V2.0 customer documents:
- `CAR.VHUD.APIH.GEN.05 - سرویس فایل های پیوست خسارت بدنه.docx`
- `CAR.VHUD.APIH.GEN.12 - سرویس بازیابی نقاط آسیب دیده کارشناسی خسارت بدنه.docx`
All routes require the existing actor Bearer token and access to the local claim.
The path's `claimCaseId` is a local MongoDB ObjectId. The backend resolves the
saved external `claimId` (never `claimNo`), hull ContractId, and the claim staff's
Location using the submission header resolver. Non-hull claims are rejected.
## Routes
Base: `/v2/fanavaran/{client}/claim-cases/{claimCaseId}/hull`
| Local GET route | Fanavaran GET resource | Result |
|---|---|---|
| `/files` | `/car/vehicle-hull-claims/{claimId}/files` | Live file metadata: `Id`, `ClaimId`, `FileName`, `FileTypeId`, `Status` |
| `/files/{fileId}` | `/car/vehicle-hull-claims/{claimId}/files/{fileId}` | One file with the same metadata plus Base64 `Data` |
| `/expertise/dmg-sections` | `/car/vehicle-hull-claims/{claimId}/expertise/{expertiseId}/dmg-sections` | Damage sections, nested costs, section/cost IDs, and provider tracking codes |
The sections route defaults to the saved `expertiseId`. To read a historical
expertise on this same claim, supply `?expertiseId=44237`. A missing saved
expertise ID without an explicit override returns 400. File and expertise IDs
must be positive safe integers.
Every response wraps the unmodified vendor body in `data`, with `clientKey`,
`claimCaseId`, `claimId`, and the selected `fileId` or `expertiseId` when relevant:
```json
{
"clientKey": "parsian",
"claimCaseId": "6af4594a32d485128a55742d",
"claimId": 5190845,
"data": [
{
"Id": 2008737,
"ClaimId": 5190845,
"FileName": "1.jpg",
"FileTypeId": 70,
"Status": 2003
}
]
}
```
The list response does **not** contain image bytes. Retrieve the desired file ID
with the single-file route to obtain `data.Data` as Base64. Preserve the numeric
`Status` value; its meaning belongs to Fanavaran's
`/common/code-list/file-status` lookup and is not inferred by these routes.
GEN.12 responses preserve `Id`, `ExpertiseId`, `AccessoryKindId`,
`VehicleHullAccessoryId`, `DmgKindId`, `Count`, `WasteValue`, `DmgAmount`, `Desc`,
`CINumber`, `CITrackingCode`, and `DmgSectionCosts` when returned. Each nested cost
can include its own `Id`, `DmgSectionId`, `DmgCostKindId`, `Caption`, and `Amount`.
These reads call Fanavaran directly without resubmitting claims/files/expertise,
using local upload receipt caches, or changing local claim records. In particular,
the remote file list can reveal historical uploads whose file IDs were not saved
by the old batch uploader. Vendor errors retain their original `Message` and
`RuleName`; transient errors participate in the shared tenant backoff.