forked from Yara724/api
update the 2 new apis for getting expertise and files of the request
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
# Fanavaran image receipts and upload failures
|
||||
|
||||
The image ID is the external `Id` returned by Fanavaran's attachment upload, not
|
||||
the MongoDB ID of the local image. Both batch and single-image uploads persist it
|
||||
in `claimCases.fanavaranSync.attachments.files[].fileId`, together with `fileName`,
|
||||
`source`, `submittedAt`, and the response. Per-image success, failure, and skip
|
||||
events are saved in `fanavaranSync.attachments.attempts`. Failures include an error
|
||||
and, when an audited HTTP upload started, a tracking code.
|
||||
|
||||
## Read the IDs beside the claim references
|
||||
|
||||
Claim detail responses that expose `fanavaran` now include:
|
||||
|
||||
```json
|
||||
{
|
||||
"fanavaran": {
|
||||
"claimId": 5190845,
|
||||
"fileIds": [700001],
|
||||
"attachments": {
|
||||
"status": "success",
|
||||
"uploadedCount": 1,
|
||||
"lastError": null,
|
||||
"files": [
|
||||
{
|
||||
"fileId": 700001,
|
||||
"fileName": "image.jpg",
|
||||
"source": "capture:angle:front"
|
||||
}
|
||||
],
|
||||
"attempts": []
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Existing claim-reference codes remain gated on COMPLETED. Image receipts and
|
||||
status can appear earlier. The expertise preview also returns `fileIds` and
|
||||
`attachments` beside `claimId`, `dmgCaseId`, and `expertiseId`.
|
||||
|
||||
## Check every planned image and why it is pending
|
||||
|
||||
`GET /v2/fanavaran/parsian/claim-cases/{claimCaseId}/attachments/preview`
|
||||
|
||||
This returns `totalLocalImages`, `alreadySubmitted`, `pendingSubmit`, `fileIds`,
|
||||
`uploadStatus`, and one `attachments` row per local upload candidate. Each row
|
||||
includes `fileId`, `alreadySubmitted`, `localFileExists`, `status`, and `lastError`.
|
||||
Use `pendingSubmit` to check whether all current local candidates have saved
|
||||
receipts. Summary status describes recorded outcomes, not unattempted images.
|
||||
|
||||
- `success`: confirmed external file IDs are recorded.
|
||||
- `partial`: receipts exist, but another recorded image failed or was skipped.
|
||||
- `failed` / `skipped`: inspect the per-image error and `nextRetryAt` if present.
|
||||
- `not_recorded`: no upload outcome is stored; this is not proof of remote absence.
|
||||
- `unconfirmed`: legacy upload records have no valid external file ID.
|
||||
|
||||
`POST /v2/fanavaran/parsian/claim-cases/{claimCaseId}/attachments/submit` submits
|
||||
pending candidates and returns each upload's `fileId` or failure/skip reason.
|
||||
Already-recorded successful uploads are skipped. Missing local files are reported
|
||||
instead of silently excluded. A response with no external file ID is unconfirmed
|
||||
and is not automatically retried, to avoid duplicating a possibly accepted upload.
|
||||
|
||||
Older batch uploads did not persist their returned IDs. This change cannot
|
||||
reconstruct those historical receipts from the local database; verify them with
|
||||
Fanavaran before deciding to re-upload. New uploads use the shared persistence
|
||||
path and record their outcomes.
|
||||
|
||||
To verify remote receipts directly, use
|
||||
`GET /v2/fanavaran/parsian/claim-cases/{claimCaseId}/hull/files`.
|
||||
Retrieve one image and its Base64 content using `/hull/files/{fileId}`.
|
||||
See [hull retrieval](hull-retrieval.md) for all supported read routes.
|
||||
@@ -0,0 +1,62 @@
|
||||
# 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.
|
||||
Reference in New Issue
Block a user