From bfbcfcab3750cd3cc9fc6804376fcbbddea37ed3 Mon Sep 17 00:00:00 2001 From: SepehrYahyaee <7heycallmegray@gmail.com> Date: Mon, 17 Aug 2026 17:18:49 +0330 Subject: [PATCH] Added documentation --- docs/blame-claim-flow-architecture.fa.html | 1506 ++++++++++++++++ docs/blame-claim-flow-architecture.html | 1893 ++++++++++++++++++++ docs/external-integrations-reference.html | 593 ++++++ docs/panel-roles-reference.fa.html | 624 +++++++ docs/panel-roles-reference.html | 616 +++++++ 5 files changed, 5232 insertions(+) create mode 100644 docs/blame-claim-flow-architecture.fa.html create mode 100644 docs/blame-claim-flow-architecture.html create mode 100644 docs/external-integrations-reference.html create mode 100644 docs/panel-roles-reference.fa.html create mode 100644 docs/panel-roles-reference.html diff --git a/docs/blame-claim-flow-architecture.fa.html b/docs/blame-claim-flow-architecture.fa.html new file mode 100644 index 0000000..6961e64 --- /dev/null +++ b/docs/blame-claim-flow-architecture.fa.html @@ -0,0 +1,1506 @@ + +
+ ++ تمام جریانهای فعال — V1 (قدیمی) · V2 · V3 · V4 · V5 · V6 — به همراه نقشها، + پیشوندهای مسیر و ترتیب مراحل +
+ + +| جریان | +بازیگر تقصیر | +بازیگر خسارت / بررسی | +
|---|---|---|
| V1 / V2 (کاربر) | +USER | ++ USER + + DAMAGE_EXPERT + | +
| پنل کارشناس تقصیر | ++ EXPERT + FIELD_EXPERT + | +— | +
| پنل کارشناس خسارت | +— | ++ DAMAGE_EXPERT + FIELD_EXPERT + FILE_REVIEWER + FILE_MAKER + | +
| V2 کارشناس میدانی (mirror) | ++ FIELD_EXPERT + | ++ FIELD_EXPERT + | +
| V3 | ++ FIELD_EXPERT + | ++ FIELD_EXPERT + | +
| V4 | ++ FILE_MAKER + | ++ FILE_REVIEWER + | +
| V5 | ++ FILE_MAKER + | ++ FILE_REVIEWER + + + FILE_MAKER + (تأیید نهایی) + | +
| V6 | ++ CALL_CENTER + + USER + (از طریق لینک) + | ++ USER + + DAMAGE_EXPERT + (جریان استاندارد V2) + | +
| جریان | +پیشوند تقصیر | +پیشوند خسارت / بررسی | +
|---|---|---|
| V1 (قدیمی) | +blame-request-management/ |
+ claim-request-management/ |
+
| V2 کاربر | +v2/blame-request-management/ |
+ v2/claim-request-management/ |
+
| V2 کارشناس میدانی (mirror) | +v2/expert-initiated/blame-request-management/ |
+ همان کنترلر (بدون پیشوند جداگانه) | +
| پنل کارشناس تقصیر V2 | +v2/expert-blame/ |
+ v2/expert-claim/ |
+
| V3 | +v3/expert-initiated/blame-request-management/ |
+ همان کنترلر | +
| V4 | +v4/file-maker/blame-request-management/ |
+ v4/file-reviewer/blame-request-management/ |
+
| V5 | +v5/file-maker/blame-request-management/ |
+ v5/file-reviewer/blame-request-management/ + v5/file-maker/claim-approval/ |
+
| V6 | +v6/call-center-blame/ (اپراتور) + v2/blame-request-management/ (کاربر لینک) |
+ v2/claim-request-management/ |
+
+ جریان کاربری استاندارد. هر طرف روی دستگاه خودش اپ را باز میکند.
+ طرف اول اطلاعات تقصیر را پر میکند و طرف دوم را با لینک SMS دعوت میکند.
+ بررسی کارشناسی تقصیر اختیاری است. پس از تکمیل تقصیر، طرف خسارتدیده
+ پرونده خسارت باز میکند که توسط کارشناس قیمتگذاری میشود.
+ V1 = مسیرهای قدیمی (منسوخ) · V2 = همان منطق با پیشوند v2/.
+
+ FIELD_EXPERT در صحنه تصادف تمام مراحل را به نمایندگی از هر دو طرف پر میکند.
+ پیشوند مسیر دقیقاً آینهی API کاربری است —
+ v2/expert-initiated/blame-request-management/ — تا فرانتاند بتواند
+ صفحات یکسانی را با تعویض پیشوند استفاده کند. اولین طرف ثبتشده همیشه مقصر است.
+ پس از هر دو امضا، تقصیر بلافاصله تکمیل میشود (بدون صف بررسی کارشناسی).
+
+ بازیگر یکسان با V2 میرور (FIELD_EXPERT)، نتیجه یکسان، اما مراحل بازچینی شدهاند:
+ تمام مراحل روایی طرفین (OTP، استعلام، صدا، موقعیت، توضیح، امضا) ابتدا برای هر دو طرف انجام میشود،
+ سپس مراحل ارزیابی خسارت (فیلدهای حادثه، مدارک، انتخاب قطعات، کپچر، ویدیو)
+ در یک پاس جداگانه دنبال میشوند.
+ تقصیر و خسارت هر دو در یک کنترلر:
+ v3/expert-initiated/blame-request-management/.
+
+ دو بازیگر کار یکسان V3 را در دو کنترلر جداگانه انجام میدهند.
+ FileMaker (v4/file-maker/blame-request-management/)
+ مراحل روایی طرفین (OTP، استعلام، جزئیات، امضا) و آپلود مدارک اولیه را انجام میدهد.
+ FileReviewer (v4/file-reviewer/blame-request-management/)
+ ارزیابی خسارت را انجام میدهد.
+ ویدیو تقصیر نهایی (upload-video) در V4 بیعملکرد است — تقصیر از طریق car-capture تکمیل میشود.
+
v4/file-maker/blame-request-management/
+ v4/file-reviewer/blame-request-management/
+
+ مراحل FileMaker با V4 یکسان است، با این تفاوت که
+ requiresFileMakerApproval=true هنگام ایجاد ست میشود.
+ مراحل FileReviewer نیز با V4 یکسان است. تنها تفاوت در انتهای جریان است:
+ پس از تکمیل بررسی کارشناس خسارت و امضای صاحب پرونده، خسارت به جای ارسال مستقیم به فناوران
+ به وضعیت WAITING_FOR_FILE_MAKER_APPROVAL منتقل میشود.
+ FileMaker سپس تأیید (→ فناوران) یا رد میکند (→ بازگشت به WAITING_FOR_DAMAGE_EXPERT، حداکثر ۲ بار رد).
+
+ همان ترتیب زیر
+ v5/file-maker/blame-request-management/
+ — بدون تغییر.
+
+ اپراتور CALL_CENTER اطلاعات طرف مقصر را تلفنی دریافت میکند
+ (پلاک + کد ملی یا شاسی/VIN)، استعلام بیمه را اجرا میکند، سپس لینک تقصیر را
+ از طریق SMS ارسال میکند. طرف مقصر لینک را باز میکند و فرم را از طریق جریان
+ استاندارد V2 تکمیل میکند — اما مرحله فرم اولیه/استعلام بهطور خودکار رد میشود
+ (skipInitialFormStep=true) چون اپراتور قبلاً آن را اجرا کرده است.
+ برای فایلهای THIRD_PARTY، فقط اطلاعات طرف مقصر توسط اپراتور جمعآوری میشود.
+ جریان خسارت پس از تکمیل تقصیر، جریان استاندارد V2 خسارت است.
+
v6/call-center-blame/
+ v2/blame-request-management/
+ v2/expert-blame/
+ | متد | +مسیر | +هدف | +
|---|---|---|
| GET | +/ |
+ فهرست پروندههای تقصیر برای بررسی | +
| GET | +/:id |
+ جزئیات پرونده | +
| POST | +/:id/assign |
+ دریافت و قفلکردن پرونده | +
| PUT | +/reply/submit/:id |
+ ثبت رأی نهایی | +
| PUT | +/reply/resend/:id |
+ درخواست ارسال مجدد مدارک | +
| PUT | +/reply/inPerson/:id |
+ ثبت رأی بازدید حضوری | +
| GET | +/report/unified-file-statuses |
+ کاتالوگ وضعیتها و تعداد | +
v2/expert-claim/
+ | متد | +مسیر | +هدف | +
|---|---|---|
| GET | +/requests |
+ فهرست صف خسارت | +
| GET | +/request/:id |
+ جزئیات خسارت | +
| POST | +/assign/:id |
+ دریافت و قفلکردن | +
| PUT | +/reply/submit/:id |
+ ثبت ارزیابی خسارت | +
| PUT | +/reply/resend/:id |
+ درخواست ارسال مجدد | +
| GET/PUT | +/request/:id/price-drop |
+ محاسبه کاهش قیمت | +
| PATCH | +/validate-factors/:id |
+ اعتبارسنجی ضرایب تعمیر | +
| PATCH | +/:id/visit |
+ درخواست بازدید حضوری | +
| بُعد | +V1 / V2 کاربر | +V2 کارشناس میدانی | +V3 | +V4 | +V5 | +V6 | +
|---|---|---|---|---|---|---|
| چه کسی تقصیر را پر میکند؟ | +هر طرف روی دستگاه خودش | +FIELD_EXPERT برای هر دو | +FIELD_EXPERT برای هر دو | +FILE_MAKER | +FILE_MAKER | +CALL_CENTER (استعلام) + USER (بقیه، از طریق لینک) | +
| چه کسی ارزیابی میکند؟ | +کاربر، سپس کارشناس بررسی میکند | +FIELD_EXPERT | +FIELD_EXPERT (همان جلسه) | +FILE_REVIEWER | +FILE_REVIEWER | +USER + DAMAGE_EXPERT (خسارت استاندارد V2) | +
| بررسی کارشناس تقصیر؟ | +صف اختیاری | +خیر — تکمیل فوری پس از accident-fields | +WAITING_FOR_EXPERT پس از upload-video | +COMPLETED پس از car-capture | +COMPLETED پس از car-capture | +صف اختیاری (مانند V2 کاربر) | +
| بررسی خسارت | +DAMAGE_EXPERT | +DAMAGE_EXPERT | +DAMAGE_EXPERT | +DAMAGE_EXPERT ← امضای صاحب پرونده (FileReviewer) | +DAMAGE_EXPERT ← امضا ← تأیید FileMaker | +DAMAGE_EXPERT (استاندارد V2) | +
| مرحله استعلام | +کاربر initial-form را پر میکند | +کارشناس run-inquiries به ازای هر طرف | +کارشناس run-inquiries به ازای هر طرف | +FileMaker run-inquiries به ازای هر طرف | +FileMaker run-inquiries به ازای هر طرف | +اپراتور از قبل پر میکند؛ کاربر رد میکند | +
| مرحله upload-video | +در جریان V2 کاربر وجود ندارد | +بله — upload-video برای هر طرف (mirror) | +بله — آخرین مرحله → WAITING_FOR_EXPERT | +بیعملکرد (تقصیر با car-capture تکمیل شد) | +بیعملکرد (تقصیر با car-capture تکمیل شد) | +مربوط نیست | +
| پیشوند مسیر تقصیر | +v2/blame-request-management/ |
+ v2/expert-initiated/blame.../ |
+ v3/expert-initiated/blame.../ |
+ v4/file-maker/blame.../ |
+ v5/file-maker/blame.../ |
+ v6/call-center-blame/ |
+
| پیشوند مسیر ارزیابی | +v2/claim-request-management/ |
+ همان کنترلر | +همان کنترلر | +v4/file-reviewer/blame.../ |
+ v5/file-reviewer/blame.../ |
+ v2/claim-request-management/ |
+
+ All active flows — V1 (legacy) · V2 · V3 · V4 · V5 · V6 — with roles, + route prefixes, and step sequences. +
+ + +| Flow | +Blame actor | +Claim/Review actor | +
|---|---|---|
| V1 / V2 (user) | +USER | ++ USER + + DAMAGE_EXPERT + | +
| Expert blame panel | ++ EXPERT + FIELD_EXPERT + | +— | +
| Expert claim panel | +— | ++ DAMAGE_EXPERT + FIELD_EXPERT + FILE_REVIEWER + FILE_MAKER + | +
| V2 expert-init (mirror) | ++ FIELD_EXPERT + | ++ FIELD_EXPERT + | +
| V3 | ++ FIELD_EXPERT + | ++ FIELD_EXPERT + | +
| V4 | ++ FILE_MAKER + | ++ FILE_REVIEWER + | +
| V5 | ++ FILE_MAKER + | ++ FILE_REVIEWER + + + FILE_MAKER + (approval) + | +
| V6 | ++ CALL_CENTER + + USER + (via link) + | ++ USER + + DAMAGE_EXPERT + (standard V2 claim) + | +
| Flow | +Blame prefix | +Claim / Review prefix | +
|---|---|---|
| V1 (legacy) | +blame-request-management/ |
+ claim-request-management/ |
+
| V2 user | +v2/blame-request-management/ |
+ v2/claim-request-management/ |
+
| V2 expert-init (mirror) | +
+ v2/expert-initiated/blame-request-management/
+ |
+ + same controller (no separate claim prefix) + | +
| V2 expert blame panel | +v2/expert-blame/ |
+ v2/expert-claim/ |
+
| V3 | +
+ v3/expert-initiated/blame-request-management/
+ |
+ same controller | +
| V4 | +
+ v4/file-maker/blame-request-management/
+ |
+
+ v4/file-reviewer/blame-request-management/
+ |
+
| V5 | +
+ v5/file-maker/blame-request-management/
+ |
+
+ v5/file-reviewer/blame-request-management/
+ +
+ v5/file-maker/claim-approval/
+ |
+
| V6 | +
+ v6/call-center-blame/
+ (agent) +
+ v2/blame-request-management/
+ (user link)
+ |
+
+ v2/claim-request-management/
+ (standard)
+ |
+
+ The canonical user flow. Each party opens the app on their own device.
+ First party fills blame info and invites the second party via SMS link.
+ An expert blame review is optional. After blame completes the damaged
+ party opens a claim which a damage expert prices.
+ V1 = legacy routes (deprecated, @ApiExcludeController) ·
+ V2 = same logic, v2/ prefix, GlobalGuard + RolesGuard (USER).
+
+ A FIELD_EXPERT at the accident scene fills every step on
+ behalf of both parties. The route prefix mirrors the user API exactly —
+ v2/expert-initiated/blame-request-management/ — so the
+ frontend can reuse the same pages by swapping only the prefix. The FIRST
+ party registered is always the guilty party. After both signatures the
+ blame completes immediately (no expert review queue).
+ The expert also handles the claim steps on the same controller as the
+ user flow (under v2/expert-initiated/claim-request-management/
+ if needed, or via the standard V2 claim controller).
+
+ Same actor as V2 mirror (FIELD_EXPERT), same end result, but steps are
+ reorganised: all party narrative steps (OTPs, inquiries, voice, location,
+ description, sign) come first for both parties, then the damage-assessment
+ steps (accident fields, documents, part selection, capture, walk-around
+ video) follow in a single dedicated pass. Blame + Claim share a single
+ controller:
+ v3/expert-initiated/blame-request-management/.
+
+ Two actors handle the same V3 work split across two controllers.
+ FileMaker (v4/file-maker/blame-request-management/)
+ handles the party narrative (OTPs, inquiries, details, signatures) and
+ uploads the initial claim documents. FileReviewer
+ (v4/file-reviewer/blame-request-management/) handles the
+ damage assessment pass. The final blame video (upload-video) is a no-op
+ in V4 — blame is already COMPLETED by car-capture.
+
v4/file-maker/blame-request-management/
+ v4/file-reviewer/blame-request-management/
+
+ FileMaker steps are identical to V4 except
+ requiresFileMakerApproval=true is set at creation. The
+ FileReviewer steps are also identical to V4. The only difference is the
+ tail: after the damage expert completes their review and the owner signs,
+ the claim moves to
+ WAITING_FOR_FILE_MAKER_APPROVAL instead of proceeding
+ directly to fanavaran submission. The FileMaker then approves (→ fanavaran)
+ or rejects (→ back to WAITING_FOR_DAMAGE_EXPERT, max 2 rejections).
+
+ Same sequence under
+ v5/file-maker/blame-request-management/
+ — no changes.
+
+ A CALL_CENTER agent takes the guilty party's details
+ over the phone (plate + national code, or chassis/VIN), runs the
+ insurance inquiry, then sends the blame link via SMS. The guilty party
+ opens the link and completes the form through the standard V2 user flow
+ — but the initial-form / inquiry step is automatically skipped
+ (skipInitialFormStep=true) because the agent already ran it.
+ For THIRD_PARTY files only the guilty party's data is
+ collected by the agent; the damaged party fills their portion normally
+ after the link is opened. The downstream claim flow (after blame
+ completes) is the standard V2 claim flow.
+
v6/call-center-blame/
+ v2/blame-request-management/
+ v2/expert-blame/
+ | Method | +Route | +Purpose | +
|---|---|---|
| GET | +/ |
+ List blame cases for review | +
| GET | +/:id |
+ Case details | +
| POST | +/:id/assign |
+ Assign & lock case | +
| PUT | +/reply/submit/:id |
+ Submit verdict | +
| PUT | +/reply/resend/:id |
+ Request document resend | +
| PUT | +/reply/inPerson/:id |
+ Submit in-person visit verdict | +
| GET | +/report/unified-file-statuses |
+ Status catalog & counts | +
v2/expert-claim/
+ | Method | +Route | +Purpose | +
|---|---|---|
| GET | +/requests |
+ List claim queue | +
| GET | +/request/:id |
+ Claim details | +
| POST | +/assign/:id |
+ Assign & lock | +
| PUT | +/reply/submit/:id |
+ Submit damage assessment | +
| PUT | +/reply/resend/:id |
+ Request resend | +
| GET/PUT | +/request/:id/price-drop |
+ Price drop calculation | +
| PATCH | +/validate-factors/:id |
+ Validate repair factors | +
| PATCH | +/:id/visit |
+ Request in-person visit | +
| Dimension | +V1 / V2 User | +V2 Expert-Init | +V3 | +V4 | +V5 | +V6 | +
|---|---|---|---|---|---|---|
| Who fills blame? | +Each party on own device | +FIELD_EXPERT for both | +FIELD_EXPERT for both | +FILE_MAKER | +FILE_MAKER | +CALL_CENTER (inquiry) + USER (rest, via link) | +
| Who does assessment? | +User, then expert reviews | +FIELD_EXPERT | +FIELD_EXPERT (same session) | +FILE_REVIEWER | +FILE_REVIEWER | +USER + DAMAGE_EXPERT (standard V2 claim) | +
| Expert blame review? | +Optional queue | +No — immediate COMPLETED after accident-fields | +WAITING_FOR_EXPERT after upload-video | +COMPLETED after car-capture | +COMPLETED after car-capture | +Optional queue (same as V2 user) | +
| Claim review | +DAMAGE_EXPERT | +DAMAGE_EXPERT | +DAMAGE_EXPERT | +DAMAGE_EXPERT → owner sign (FileReviewer) | +DAMAGE_EXPERT → owner sign → FileMaker approval | +DAMAGE_EXPERT (standard V2) | +
| Inquiry step | +User fills initial-form | +Expert fills run-inquiries per party | +Expert fills run-inquiries per party | +FileMaker fills run-inquiries per party | +FileMaker fills run-inquiries per party | +Agent pre-fills; user skips it | +
| Upload-video step | +Not in V2 user flow | +Yes — upload-video per party (mirror) | +Yes — last step → WAITING_FOR_EXPERT | +No-op (blame done by car-capture) | +No-op (blame done by car-capture) | +Not applicable | +
| Blame route prefix | +v2/blame-request-management/ |
+ v2/expert-initiated/blame.../ |
+ v3/expert-initiated/blame.../ |
+ v4/file-maker/blame.../ |
+ v5/file-maker/blame.../ |
+ v6/call-center-blame/ |
+
| Assessment route prefix | +v2/claim-request-management/ |
+ same controller | +same controller | +v4/file-reviewer/blame.../ |
+ v5/file-reviewer/blame.../ |
+ v2/claim-request-management/ |
+
+ Every outbound integration: what it does, when it fires, how auth works, + retry behaviour, fallbacks, and all environment variables. Internal-only + services (captcha, offline inquiry seed) are included for completeness. +
+ + +
+ Every blame file starts with a "run-inquiries" call that fetches the
+ guilty party's insurance policy from an external provider. Which provider
+ is actually called depends on three factors: the tenant (CLIENT_ID),
+ the file type (THIRD_PARTY vs CAR_BODY), and whether live API mode is
+ enabled in system settings. The offline-inquiry seed layer sits in front
+ of all three providers.
+
CLIENT_ID=8 (Parsian/ESG tenant) → route to ESG /inquiry/policyByPlate or /inquiry/policyByChassis./block-inquiry-tejarat (THIRD_PARTY) or /block-inquiry-tejarat/badane (CAR_BODY).system_settings.externalApis.sandHubUseLiveApi = false (default) → return mock response instead of making HTTP calls.CLIENT_ID=8 → ESG /inquiry/person and /inquiry/sheba./personal-inquiry/tejarat-no, /driver-license-check, /ownership, /sheba/sheba-tejaratno.+ SandHub endpoints are only used in legacy code paths. All active V2+ blame flows go through the Tejarat or ESG providers. +
+
+ Fanavaran (apimanager.iraneit.com) is the national insurance
+ damage-case platform. After the damage expert submits their assessment,
+ the system auto-submits a structured claim to Fanavaran through a
+ four-step protocol. Fanavaran also serves as the lookup source for
+ code-lists (accident types, car components, city codes, etc.) used
+ across the platform.
+
POST /EITAuthentication/GetAppToken with appname + secret headers. Returns apptoken header.POST /EITAuthentication/Login with appToken + userName + password headers. Returns authenticationToken header.fanavaran_auth_tokens). Valid until midnight Asia/Tehran — the first call after 00:00 fetches a fresh token.authenticationToken, CorpId, ContractId, Location — tenant-specific, hardcoded per FANAVARAN_CLIENT key.+ A config fingerprint (hash of appName + secret + username + password + corpId + contractId + location) + forces a fresh login when any credential changes, even before midnight. +
+POST /car/third-party-car-financial-claims. Sends owner, driver, insurance, vehicle, and accident data. Returns a Fanavaran claimId and claimNo. SMS is sent to the owner with both identifiers.POST /car/third-party-car-financial-claims/{claimId}/dmg-cases. One entry per damaged part with component ID, severity, and price. Cap: total ≤ 53 000 000 Toman.POST /car/third-party-car-financial-claims/{claimId}/files. Documents, car-capture images, and videos referenced by file ID.POST /car/third-party-car-financial-claims/{claimId}/expertise. Expert assessment metadata (expert role, date, result). Finalises the submission.
+ All four steps are recorded in the fanavaran_audit_logs collection with full request/response bodies, HTTP status, duration, and tracking code for debugging.
+
All under https://apimanager.iraneit.com/BimeApiManager/api/BimeApi/v2.0/. Results are cached to disk (per client key) and in the lookups MongoDB collection. Parsian tenant reads DB before hitting the API; others go to the API first.
| Path | Used for |
|---|---|
/car/base-info/accident-causes | accidentReason dropdown options (mapped to local IDs) |
/car/code-list/accident-report-type | accidentWay options |
/car/base-info/vehicle-use-types | vehicle usage classification |
/car/code-list/dmg-pay-method | damage payment method |
/car/base-info/driving-licence-types | licence type options |
/car/code-list/accident-culprit-type | guilty-party classification |
/car/code-list/inspection-place | inspection location options |
/car/code-list/drop-amount-status | price-drop status codes |
/car/base-info/car-components | component catalog (maps to outer/inner parts) |
/car/code-list/accident-level | accident severity options |
/common/code-list/insurance-corp | resolve INSURANCE_CORP_ID → Fanavaran corpId |
/common/base-info/cities, /common/base-info/Provinces | city/province pickers |
/car/third-party-car-policies/{policyId} | fetch full policy by ID after inquiry |
/car/vehicles/inquiry-by-vin?vin=… | VIN-based vehicle lookup |
/common/Policies/inquiry-my-policies | list policies for a national code |
/common/customers/{customerId} | fetch customer record by ID |
/common/parties/inquiry-by-unique-identifier | party lookup by national code + birth date |
| Mechanism | Detail |
|---|---|
| Retry | 3 attempts, 500 ms → 1 000 ms exponential backoff on all HTTP calls. |
| Transient backoff | When Fanavaran returns the Persian "try again later" message (or tracking-code 500), a tenant-wide 5-minute pause is activated. All calls during this window get 503 ServiceUnavailable immediately — no hammering. |
| Token invalidation | On 401, token is cleared from memory and MongoDB; next call triggers a fresh GetAppToken + Login. |
| Inflight de-dup | Concurrent login requests for the same tenant are collapsed to a single in-flight Promise. |
| Audit log | Every step (GET_APP_TOKEN, LOGIN, and all four submission steps) is written to fanavaran_audit_logs with STARTED / SUCCESS / FAILURE status, full headers, body, and duration. |
| Timeout | 20–30 s per HTTP call. |
FANAVARAN_CLIENT)Three pre-seeded tenant profiles exist. The active one is chosen by the FANAVARAN_CLIENT env var. Each profile carries its own appName, secret, username, password, CorpId, ContractId, and Location headers, plus payload defaults (AccidentCityId, etc.).
| Key | Insurance company |
|---|---|
parsian | Parsian Insurance |
tejaratno | Tejaratno Insurance |
moallem | Moallem Insurance |
+ INSURANCE_CORP_ID is a display-caption string (e.g. "بیمه پارسیان") that is resolved against the live Fanavaran insurance-corp list to produce the numeric corpId used in submissions. The resolved ID is cached to disk.
+
+ SandHub is the original inquiry gateway. It is still present in the
+ codebase but all active blame flows (V2+) have been migrated to the
+ Tejarat inquiry provider. SandHub endpoints remain callable but are
+ only reached through legacy code paths. Its mock mode is controlled
+ by the same sandHubUseLiveApi system setting.
+
+ POST {SANHUB_BASE_URL}/user/login with username + password JSON body.
+ Token cached in memory for 55 minutes. On 401, token is cleared and one retry is made.
+ 3 attempts with 1 000 ms → 2 000 ms exponential backoff.
+
| Method | Path | What it does |
|---|---|---|
| POST | /block-inquiry-tejarat | Plate-based insurance policy inquiry (THIRD_PARTY). Body: leftTwoDigits, serialLetter, threeDigits, rightTwoDigits, nationalCode. |
| POST | /block-inquiry-tejarat/badane | CAR_BODY policy inquiry. Timeout 50 s (longer than standard). |
| POST | /personal-inquiry/tejarat-no | Personal identity check. Body: nationalCode + Gregorian birthDate (converted from Jalali internally). |
| POST | /driver-license-check | Driving licence validation. Returns IsSucceed flag. |
| POST | /ownership | Vehicle ownership check. Returns IsSuccess flag. |
| POST | /sheba/sheba-tejaratno | Sheba / bank account validation. Returns ReturnValue + HasError. |
+ All endpoints support full mock responses when sandHubUseLiveApi=false in system settings (default). Mock data is deterministic and produced locally without any HTTP calls.
+
+ The active block-inquiry gateway for all non-ESG tenants. Used in every
+ V2+ run-inquiries call where CLIENT_ID ≠ 8.
+ The base URL is configurable; in production it points to the same host
+ as SandHub but uses separate credentials.
+
+ POST {TEJARAT_INQUIRY_BASE_URL}/user/login with email + password JSON body.
+ Token cached for 55 minutes. 2 attempts with 500 ms → 1 000 ms backoff.
+ Separate from SandHub credentials — uses TEJARAT_INQUIRY_EMAIL / TEJARAT_INQUIRY_PASSWORD.
+
| Method | Path | What it does |
|---|---|---|
| POST | /block-inquiry-tejarat | THIRD_PARTY plate inquiry. Body: plate fields + nationalCode. Offline seed checked first. |
| POST | /block-inquiry-tejarat/badane | CAR_BODY plate inquiry. Body: part1–part4 (numeric) + nationalCode. Always goes live (no mock for badane path). |
+ When sandHubUseLiveApi=false, the THIRD_PARTY path returns a mock response without HTTP. The CAR_BODY path always calls the live API regardless of this flag.
+
+ ESG is an internal insurance API gateway used exclusively by the Parsian
+ tenant (CLIENT_ID=8). It replaces Tejarat/SandHub for all
+ inquiry types when this tenant is active. It has a different response
+ shape, a dynamic token TTL, and expects birth dates in Jalali
+ format (not Gregorian, unlike SandHub/Tejarat).
+
+ POST {ESG_URL}/auth/login with { username, password } JSON body.
+ Token TTL is read from the response expiresIn field (default 14 min).
+ 2 attempts with 500 ms → 1 000 ms backoff. On 401, token cleared and one retry.
+ Default URL: http://192.168.20.22:8085 (internal network).
+
| Method | Path | What it does |
|---|---|---|
| POST | /inquiry/policyByPlate | Plate-based policy lookup (THIRD_PARTY). Body: nationalCode, plk1–plk4. Response is mapped to the old Tejarat format before being stored. |
| POST | /inquiry/policyByChassis | VIN/chassis-based alternative to plate inquiry. Called by run-inquiries-vin endpoints. Uses ESG chassis lookup (not the SandHub path). Body: nationalCode, chassis. |
| POST | /inquiry/person | Personal identity check. Body: nationalCode, birthDate (Jalali, NOT Gregorian). |
| POST | /inquiry/sheba | Sheba / bank account validation. |
+ ESG wraps every response as { success: boolean, data: … }. A success=false body is translated to a Persian "استعلام در دسترس نیست" (inquiry unavailable) error.
+ The offline-inquiry seed check still runs first, before any ESG HTTP call.
+
+ Two SMS providers are supported: Kavenegar (default)
+ and Parsian SMS Gateway. The active provider is chosen
+ by the SMS_PROVIDER (or SMS) env var. Both
+ providers implement the same internal gateway interface so the
+ orchestration layer is provider-agnostic.
+
| Env var | Value | Active provider |
|---|---|---|
SMS_PROVIDER (or SMS) | kavenegar (default) | Kavenegar — api.kavenegar.com |
SMS_PROVIDER (or SMS) | parsian | Parsian SMS Gateway — PARSIAN_SMS_URL |
Base URL: https://api.kavenegar.com/v1/{SMS_API_KEY}/
| Method | Path | When used |
|---|---|---|
| POST | sms/send.json | Plain-text messages (e.g. key-based notification texts stored in sms_texts collection). |
| GET | verify/lookup.json | All template-based messages (OTPs, invite links, expert notifications). Params: receptor, token[, token2, token3, token10], template. |
Base URL from PARSIAN_SMS_URL. Auth: X-PACKAGE-API-KEY header + Authorization: Basic {PARSIAN_BASIC_TOKEN}. Sends as a GET with URL-encoded ReceiverNumbers and Message query params. Template messages are pre-rendered into a plain text body before sending (no verify/lookup equivalent).
| Template name | Trigger | Tokens |
|---|---|---|
AUTH_SMS_TEMPLATE (env) | User / actor OTP login, forget-password, party OTPs | token = OTP code |
yara724-invite-link | Second party receives blame invite link via SMS | token = publicId, token2 = link |
yara-field-expert-link | Field expert sends link to a party | token = file type, token2 = expert surname, token3 = link |
yara-blame-agreement | Notify party that the other side agreed to the expert verdict | token = publicId, token2 = link |
yara-claim-link | Damaged party notified to open claim flow after blame is complete | token = publicId, token2 = link |
yara-expert-lock | Expert locks a blame or claim file | token = "تصادف"/"خسارت", token2 = publicId, token3 = expert surname |
yara-resend-documents | Expert requests document resend | token = file kind, token2 = publicId, token3 = link |
yara-signature | Party notified to sign the expert's damage assessment | token = file kind, token2 = publicId, token3 = expert surname, token10 = link |
yara-fanavaran-claim | Fanavaran submission confirmed — sent to claim owner with Fanavaran claim number and ID | token = publicId, token2 = Fanavaran claimId, token3 = Fanavaran claimNo |
+ All SMS calls are fire-and-forget — they never throw. Failures are logged but do not block the main flow.
+ An sms_send_logs MongoDB collection records every outbound message with its kind (OTP vs TEMPLATE), provider, template name, and success/failure status.
+ Notification text messages (parties-disagree, one-party-signed, etc.) are seeded into the sms_texts collection on startup and editable at runtime.
+
+ An image-based car damage detection service is integrated in the
+ codebase but its HTTP calls are fully commented out.
+ The module initialises on startup, attempts a login (silently swallowed
+ if it fails), and exposes an aiRequestImage method — but
+ the underlying axios calls are disabled. The service does not affect
+ any production flow.
+
| Method | Path | What it does |
|---|---|---|
| POST | {AI_URL_V2}/auth/login | Authenticate with username + password. Returns accessToken. |
| GET | {AI_URL_V2}/auth/profile | Fetch apiKey.key needed as the gateway-api-key request header. |
| POST | {AI_URL_V2}/services/car-damage/detector?version=ai-v7 | Submit a car part image (multipart). Returns downloadLink with annotated result. |
+ Status: all three calls are wrapped in commented-out axios.request(…) blocks.
+ CW_URL is not in .env.example. To re-enable, uncomment the login, getApiKey, and aiRequestImage axios calls, and configure AI_URL_V2, AI_USERNAME, AI_PASSWORD.
+
+ Used only during damage-expert price-drop calculation. When an expert + provides per-part severity values the system fetches real-time market + prices for the damaged car model, then computes the price-drop using + the formula: carPrice × yearCoefficient × sumOfPartCoefficients ÷ 400. + The service has two data sources (endpoints) that are tried in parallel. +
+ +| Method | Path | What it does |
|---|---|---|
| GET | {CW_URL}price?akharin | Fetch car market prices from the "Akharin" source. Returns array of { carName, marketPrice }. |
| GET | {CW_URL}price?hamrah | Fetch car market prices from the "Hamrah" source. Same response shape. |
+ Both endpoints are tried; results are merged and de-duplicated. The best match for + the damaged car's name is found using Levenshtein distance (fuzzy string match). + If both endpoints fail or return empty, the price-drop calculation is skipped (marked incomplete) — it does not block claim submission. +
+
+ CW_URL is not documented in .env.example.
+ This service will silently produce no price-drop if the variable is unset.
+
+ The offline inquiry layer intercepts plate-based inquiry calls before + any external HTTP is made. It is primarily used for development and + testing (pre-seeded known plates) but also acts as a resilience fallback + when live inquiry services are unavailable. It is controlled by a + runtime database flag, not an env var. +
+ +| Aspect | Detail |
|---|---|
| Storage | MongoDB collection offline-inquiries. Documents contain clientKey, normalised plate fields, nationalCode, and the pre-built raw + mapped response to return. |
| Master switch | system_settings.offlineInquiry.enabled — defaults to true. Toggle via PATCH /super-admin/system-settings/offline-inquiry. |
| Lookup order | Normalised plate (digits-only, Arabic→Persian) + national code + Fanavaran client key must all match. If found, returned immediately; no HTTP call is made. |
| Scope | Only applies to plate-based block-inquiry (THIRD_PARTY). CAR_BODY inquiry (/badane) always hits the live API. |
| Live API flag | system_settings.externalApis.sandHubUseLiveApi — when false (default), even if no offline seed matches, a built-in mock response is returned rather than calling Tejarat/ESG. |
+ All env vars across all integrations, grouped by service.
+ Variables marked * are not present in .env.example.
+
| Variable | Description |
|---|---|
FANAVARAN_CLIENT | Active tenant profile key: parsian | tejaratno | moallem |
INSURANCE_CORP_ID | Display caption of the insurer company (e.g. "بیمه پارسیان") — resolved to a numeric corpId at startup against the Fanavaran insurance-corp list. |
Per-tenant credentials (appName, secret, username, password, CorpId, ContractId, Location) are hardcoded in src/core/config/fanavaran-client.config.ts under SEED_FANAVARAN_CLIENT_PROFILES.
| Variable | Description |
|---|---|
SANHUB_BASE_URL | Base URL for SandHub. Default: http://82.99.202.245:3027 |
SANHUB_URL_LOGIN | Full login URL (usually base + /user/login) |
SANHUB_USERNAME | SandHub login email |
SANHUB_PASSWORD | SandHub login password |
| Variable | Description |
|---|---|
TEJARAT_INQUIRY_BASE_URL | Base URL. Default: http://82.99.202.245:3027 |
TEJARAT_INQUIRY_EMAIL | Login email |
TEJARAT_INQUIRY_PASSWORD | Login password |
| Variable | Description |
|---|---|
CLIENT_ID | Set to 8 to activate the ESG inquiry provider for the Parsian tenant. |
ESG_URL | ESG base URL. Default: http://192.168.20.22:8085 (internal network) |
ESG_USERNAME | ESG login username |
ESG_PASSWORD | ESG login password |
| Variable | Description |
|---|---|
SMS_PROVIDER (or SMS) | kavenegar (default) or parsian |
SMS_API_KEY | Kavenegar API key (required when provider = kavenegar) |
AUTH_SMS_TEMPLATE | Kavenegar template name for OTP messages (e.g. yara-otp) |
PARSIAN_SMS_URL | Parsian SMS Gateway base URL (required when provider = parsian) |
PARSIAN_API_KEY | Parsian SMS X-PACKAGE-API-KEY header value |
PARSIAN_BASIC_TOKEN | Base64-encoded credentials for Authorization: Basic … header |
URL | Frontend base URL — used to build all invite + claim links embedded in SMS messages |
| Variable | Description |
|---|---|
AI_URL_V2 | AI gateway base URL. Default: https://ai-gw.ittalie.ir (unused — service is disabled) |
AI_USERNAME | AI service login username (unused) |
AI_PASSWORD | AI service login password (unused) |
| Variable | Description |
|---|---|
CW_URL * | Base URL for car market price API (e.g. https://…/). Not in .env.example. Price-drop silently skipped if unset. |
| Variable | Description |
|---|---|
PORT | HTTP port (default 3000). Used by the Fanavaran insurance-corp fallback to call its own local lookup endpoint. |
CAPTCHA_ENABLED | true / false — enables/disables login CAPTCHA challenge. Internal, no external service. |
EXP_CAPTCHA_TIME | CAPTCHA challenge TTL in minutes. |
EXP_OTP_TIME | OTP TTL in minutes. |
+ آنچه هر نقش میتواند ببیند و انجام دهد — اندپوینتها، مسئولیتها و + مراحل فرآیند. سوپر ادمین در این مستند نیست. +
+ + +| وظیفه اصلی | +محدوده | +پنل ورود | +enum نقش | +
|---|---|---|---|
| مشاهده تمام فایلها؛ مدیریت شعب و کارشناسان؛ گزارشگیری؛ امتیازدهی به کارشناسان | +سطح تنانت | +پورتال بیمهگر | +company |
+
| قفلکردن پروندههای تقصیر، بررسی اسناد طرفین، صدور رأی یا درخواست ارسال مجدد | +صف DISAGREEMENT تنانت | +پنل کارشناس تقصیر | +expert |
+
| قفلکردن خسارت، قیمتگذاری، اعتبارسنجی فاکتورها، درخواست ارسال مجدد/بازدید | +صف خسارت تنانت | +پنل خسارت | +damage_expert |
+
| ثبت حضوری تقصیر + خسارت در V2/V3؛ دسترسی به پنلهای تقصیر/خسارت | +فایلهای ساختهشده توسط خود | +پنل کارشناس میدانی | +field_expert |
+
| روایت طرفین V4/V5 (OTP، استعلام، جزئیات، امضا)؛ تأیید خسارت در V5 | +فایلهای ساختهشده توسط خود | +پنل فایلساز | +file_maker |
+
| ارزیابی خسارت V4/V5 (فیلدهای تصادف، قطعات، عکسها، امضای مالک) | +فایلهای تخصیصیافته | +پنل بازبین فایل | +file_reviewer |
+
| ثبت حضوری اداری تقصیر + خسارت به نمایندگی از طرفین | +فایلهای ساختهشده توسط خود | +پنل ثبات | +registrar |
+
| ثبت تلفنی V6: اجرای استعلام، ارسال لینک؛ کاربر بقیه را تکمیل میکند | +فایلهای ساختهشده توسط خود | +پنل مرکز تماس | +call_center |
+
+ به ازای هر تنانت شرکت بیمه یک اکتور company وجود دارد. پورتال بیمهگر
+ لایه مدیریتی است: میتواند همه چیز زیر تنانت خود را ببیند، لیست کارشناسان را مدیریت
+ کند، شعب را اداره کند، تنظیمات رسانهای هر تنانت را پیکربندی کند و گزارشهای آماری
+ استخراج کند. بیمهگر هرگز مستقیماً با مراحل تقصیر/خسارت درگیر نمیشود — فقط نظارهگر
+ و امتیازدهنده است.
+
expert-insurer/| متد | مسیر | توضیح |
|---|---|---|
| GET | expert-insurer/files | فهرست تمام فایلهای تقصیر + خسارت تنانت (ادغامشده بر اساس publicId). فیلترپذیر بر اساس وضعیت، نوع فایل، جستجو، مرتبسازی، صفحه. |
| GET | expert-insurer/files/:publicId | جزئیات کامل یک فایل بر اساس publicId. |
| GET | expert-insurer/files/:publicId/timeline | تایملاین فعالیت به ترتیب زمانی (تمام رویدادهای تاریخچه: منبع، نوع، اکتور، متادیتا). |
| GET | expert-insurer/files/:publicId/report | دادههای ساختاریافته گزارش برای تولید PDF (بخشهای مالک، راننده، بیمه، خودرو، تصادف). |
| PUT | expert-insurer/files/:publicId/rating | امتیازدهی به کارشناسان یک فایل (۱–۵ در هر بُعد: روش تصادف، بهموقعبودن، دقت علت، دقت شناسایی مقصر، امتیاز ربات). |
| GET | expert-insurer/report/unified-file-statuses | کاتالوگ وضعیت یکپارچه + تعداد به ازای هر وضعیت برای کل پرتفولیوی تنانت. فیلترپذیر بر اساس fileType و بازه تاریخ. |
| GET | expert-insurer/report/status-counts | منسوخشده — از unified-file-statuses استفاده کنید. |
expert-insurer/branches| متد | مسیر | توضیح |
|---|---|---|
| GET | expert-insurer/branches | فهرست تمام شعب این بیمهگر. پارامترها: جستجو، بازه تاریخ from/to، فیلتر isActive. |
| POST | expert-insurer/branches | افزودن شعبه جدید (نام، کد، آدرس، شهر، تلفن و غیره). |
| PUT | expert-insurer/branches/:branchId/status | فعال یا غیرفعال کردن یک شعبه. |
expert-insurer/experts| متد | مسیر | توضیح |
|---|---|---|
| POST | expert-insurer/experts/blame | ایجاد حساب کارشناس تقصیر جدید زیر این بیمهگر. |
| POST | expert-insurer/experts/claim | ایجاد حساب کارشناس خسارت جدید زیر این بیمهگر. |
| POST | expert-insurer/experts/file-maker | ایجاد حساب فایلساز جدید زیر این بیمهگر. |
| POST | expert-insurer/experts/file-reviewer | ایجاد حساب بازبین فایل جدید زیر این بیمهگر. |
| GET | expert-insurer/experts/list | فهرست صفحهبندیشده تمام حسابهای کارشناس در این تنانت. |
| GET | expert-insurer/experts/top | برترین کارشناسان تقصیر و خسارت رتبهبندیشده بر اساس میانگین امتیاز کلی (حداکثر ۱۰ نفر از هر نوع). |
| GET | expert-insurer/top-experts | نام مستعار experts/top (سازگاری با فرانتاند). |
| GET | expert-insurer/:expertId | فایلهای رسیدگیشده توسط یک کارشناس (ردیفهای خلاصه — تقصیر یا خسارت بسته به نوع کارشناس). |
| متد | مسیر | توضیح |
|---|---|---|
| GET | expert-insurer/statistics | کارتهای KPI: totalFilesReviewed، averageUserRating، inPersonCount، filesThisMonth، objectionPercentage و غیره. فیلترپذیر بر اساس بازه تاریخ. |
| GET | expert-insurer/top-files | ۱۰ فایل خسارت برتر بر اساس بالاترین امتیاز (ترکیبی از امتیاز بیمهگر + کاربر). |
| GET | expert-insurer/expert-work-log | لاگ کاری هر کارشناس: totalHandled، currentlyChecking، distinctFilesCheckedInPeriod. فیلترپذیر بر اساس expertKind و بازه تاریخ. |
| GET | reports/report/insurer/requests | تعداد خسارت + وضعیت تقصیر + تعداد فایل یکپارچه برای تنانت. |
| GET | reports/report/insurer/per-month-requests | همان خلاصه، تفکیکشده بر اساس ۵ ماه تقویمی اخیر. |
| GET | reports/report/insurer/checked-requests | همان خلاصه، فیلترشده بر اساس بازه زمانی اختیاری createdAt. |
| GET | reports/report/insurer/expert-work-log | لاگ کاری کارشناسان (مجموعههای کارشناس تقصیر و خسارت، نه کارشناسان میدانی). |
| GET | reports/report/insurer/expert-work-log/per-month | همان لاگ کاری تفکیکشده بر اساس ماه تقویمی (۵ ماه اخیر). |
client-panel/| متد | مسیر | توضیح |
|---|---|---|
| GET | client-panel/settings | دریافت محدودیتهای رسانهای هر تنانت (حداکثر بایت ویدیو/تصویر/صوت) و پنجره زمانی تصادف CAR_BODY (روز). |
| PATCH | client-panel/settings | بهروزرسانی جزئی این تنظیمات. نمیتواند از سقفهای سطح سیستم تجاوز کند. |
+ فایلهای تقصیر در صف DISAGREEMENT را بررسی میکند — پروندههایی که دو طرف درباره
+ مقصر بودن توافق ندارند. پس از بررسی اسناد و اظهارات طرفین، کارشناس پرونده را قفل
+ میکند، سپس یا رأی صادر میکند، درخواست ارسال مجدد اسناد میدهد، یا نتیجه بازدید
+ حضوری را ثبت میکند. تمام اندپوینتها زیر v2/expert-blame/ هستند.
+
+ ۱ مرور فهرست ← ۲ تخصیص (قفل) پرونده ← ۳ بررسی مدارک طرفین (ویدیو، صدا، اسناد) ← + ۴الف صدور رأی یا ۴ب درخواست ارسال مجدد اسناد یا ۴پ ثبت بازدید حضوری. +
+v2/expert-blame/| متد | مسیر | توضیح |
|---|---|---|
| GET | v2/expert-blame/ | فهرست پروندههای تقصیر در صف DISAGREEMENT (موجود، قفلشده توسط من، یا تصمیمگرفتهشده توسط من). پارامترها: search، sortBy، sortOrder، page، limit، unifiedStatus، fileType. |
| GET | v2/expert-blame/:id | جزئیات کامل یک پرونده تقصیر (اظهارات، عکس، صدا، ویدیو طرفین). |
| POST | v2/expert-blame/:id/assign | بررسی در دسترس بودن و قفل پرونده برای این کارشناس. بازمیگرداند: assigned، already_assigned_to_you، یا ۴۰۹ در صورتی که شخص دیگری آن را نگه داشته باشد. |
| PUT | v2/expert-blame/reply/submit/:id | ارسال رأی (accidentWay، accidentReason، accidentType، تصمیم طرف مقصر). پرونده را آزاد میکند و به COMPLETED منتقل میکند. |
| PUT | v2/expert-blame/reply/resend/:id | درخواست از طرفین برای بارگذاری مجدد اسناد. تقصیر را به WAITING_FOR_RESEND تنظیم میکند. یک درخواست ارسال مجدد در هر چرخه عمر. |
| PUT | v2/expert-blame/reply/inPerson/:id | ثبت اینکه بازدید حضوری انجام شده و صدور رأی. |
| GET | v2/expert-blame/report/unified-file-statuses | کاتالوگ وضعیت + تعداد به ازای هر وضعیت برای پرتفولیوی این کارشناس. |
| GET | v2/expert-blame/report/status-counts | منسوخشده — از unified-file-statuses استفاده کنید. |
| PUT | v2/expert-blame/lock/:id | اندپوینت قفل منسوخشده — از POST assign استفاده کنید. |
+ فایلهای خسارت را پس از ارسال مدارک خسارت توسط کاربر بررسی میکند. کارشناس
+ هر قطعه آسیبدیده را قیمتگذاری میکند، بهصورت اختیاری کاهش قیمت (استهلاک)
+ محاسبه میکند، و میتواند از کاربر بخواهد مدارک را مجدداً ارسال کند، حضوری مراجعه
+ کند، یا فاکتورهای تعمیرگاه را هنگام نیاز به قیمتگذاری کارگاهی بارگذاری کند.
+ تمام اندپوینتها زیر v2/expert-claim/ هستند.
+
+ ۱ مرور فهرست ← ۲ تخصیص (قفل) خسارت ← ۳ بررسی عکسها و اسناد خسارت ← + ۴ ویرایش اختیاری قطعات انتخابشده یا محاسبه کاهش قیمت ← + ۵الف ارسال پاسخ قیمتگذاریشده یا ۵ب درخواست ارسال مجدد یا ۵پ درخواست بازدید حضوری ← + ۶ در صورت وجود قطعات فاکتوردار: اعتبارسنجی فاکتورهای تعمیرگاه بارگذاریشده. +
+v2/expert-claim/| متد | مسیر | توضیح |
|---|---|---|
| GET | v2/expert-claim/requests | فهرست خسارتها در صف WAITING_FOR_DAMAGE_EXPERT + صف اعتبارسنجی فاکتور. پارامترها: search، sortBy، page، limit، unifiedStatus، fileType. |
| GET | v2/expert-claim/request/:claimRequestId | جزئیات کامل خسارت: قطعات آسیبدیده، تصاویر گرفتهشده، اسناد، priceDrop، داده طرف بلیم، آدرسهای ویدیو. |
| POST | v2/expert-claim/assign/:claimRequestId | قفل خسارت برای این کارشناس. بازمیگرداند: assigned، already_assigned_to_you، یا ۴۰۹. |
| GET | v2/expert-claim/request/:claimRequestId/price-drop | محتوای کاهش قیمت: برچسبهای شدت، کاتالوگ ضریب، قطعات آسیبدیده + نگاشت، سال پیشنهادی خودرو از استعلام تقصیر. |
| PUT | v2/expert-claim/request/:claimRequestId/price-drop | محاسبه و ذخیره کاهش قیمت: قیمت خودرو × ضریب سال × مجموع ضرایب ÷ ۴۰۰. |
| PUT | v2/expert-claim/reply/submit/:claimRequestId | ارسال پاسخ ارزیابی خسارت (لیست قطعات قیمتگذاریشده، داغی، branchId). سقف: کل ≤ ۵۳،۰۰۰،۰۰۰ تومان. بسته به پرچمهای factorNeeded، خسارت را به owner-sign، mixed-factors-pending، یا صف اعتبارسنجی فاکتور منتقل میکند. |
| PUT | v2/expert-claim/reply/resend/:claimRequestId | درخواست از کاربر برای ارسال مجدد اسناد/عکسها. یک ارسال مجدد در هر چرخه خسارت؛ در صورت تکمیل قبلی ۴۲۲ برمیگرداند. |
| PATCH | v2/expert-claim/:claimRequestId/visit | درخواست از کاربر برای مراجعه حضوری. خسارت را آزاد میکند، وضعیت claimStatus را به NEEDS_REVISION تنظیم میکند. |
| PATCH | v2/expert-claim/validate-factors/:claimRequestId | اعتبارسنجی فاکتورهای تعمیرگاه بارگذاریشده. تأیید یا رد هر خط فاکتور با totalPayment. سقف برای تمام خطوط اعمال میشود (≤ ۵۳،۰۰۰،۰۰۰ تومان). پس از تصمیمگیری درباره تمام خطوط، بهصورت خودکار تکمیل میشود. |
| PATCH | v2/expert-claim/request/:claimRequestId/damaged-parts | ویرایش قطعات آسیبدیده انتخابشده در حالی که خسارت توسط این کارشناس قفل است (EXPERT_REVIEWING). |
| GET | v2/expert-claim/outer-parts-catalog | کاتالوگ قطعات بیرونی خودرو فناوران (مشترک با جریان کاربر). |
| GET | v2/expert-claim/inner-parts-catalog | JSON ثابت کاتالوگ قطعات داخلی خودرو. |
| GET | v2/expert-claim/branches | شعب بیمهگر برای تنانت این کارشناس (برای انتخاب داغی/شعبه در پیلود پاسخ). |
| GET | v2/expert-claim/stream/:id/video | پخش ویدیوی خسارت (ویدیوی دور زدن خودرو یا ویدیوی تصادف). پارامتر: query=car-capture|accident. |
| GET | v2/expert-claim/report/unified-file-statuses | کاتالوگ وضعیت + تعداد برای پرتفولیوی خسارت این کارشناس. |
| GET | v2/expert-claim/report/status-counts | منسوخشده — از unified-file-statuses استفاده کنید. |
| PUT | v2/expert-claim/lock/:claimRequestId | اندپوینت قفل منسوخشده — از POST assign استفاده کنید. |
+ به صحنه تصادف میرود و فرمهای هر دو طرف را حضوری پر میکند (جریان V2 mirror / V3). + کارشناس میدانی همچنین دسترسی خواندن به پنلهای expert-blame و expert-claim دارد + (محدود به فایلهای خودش). تنها نقشی است که هم ثبت تقصیر و هم + ثبت خسارت را در یک جلسه انجام میدهد. +
+ +v2/expert-initiated/blame-request-management/آینهای از API تقصیر کاربر. فرانتاند همان صفحات را با تغییر فقط پیشوند مسیر بازاستفاده میکند.
+| متد | مسیر | توضیح |
|---|---|---|
| POST | POST / | ایجاد فایل تقصیر IN_PERSON. |
| POST | send-party-otp/:id | ارسال OTP به یک طرف از طریق شماره تلفن (بدون لینک دعوت). |
| POST | verify-party-otp/:id | تأیید OTP یک طرف و اتصال حساب آنها. |
| POST | blame-confession/:id | ثبت اعتراف تقصیر طرف. |
| POST | car-body-form/:id | [فقط CAR_BODY] فرم نوع تصادف. |
| POST | run-inquiries/:id / run-inquiries-vin/:id | فرم اولیه / استعلام پلاک یا VIN برای طرف فعلی. |
| POST | upload-video/:id | بارگذاری ویدیوی طرف اول. |
| POST | add-detail-location/:id | افزودن موقعیت GPS برای طرف فعلی. |
| POST | upload-voice/:id | بارگذاری ضبط صوتی برای طرف فعلی. |
| POST | add-detail-description/:id | افزودن توضیحات برای طرف فعلی. |
| POST | add-second-party/:phone/:id/ | پیشروی به طرف دوم (بدون ارسال لینک SMS). |
| PUT | sign/:id | بارگذاری امضای طرف (اول سپس دوم، پارامتر partyRole). |
| POST | accident-fields/:id | ذخیره فیلدهای تصادف و تکمیل فوری تقصیر (بدون صف کارشناس). |
v3/expert-initiated/blame-request-management/ترتیب مراحل بازسازماندهیشده: ابتدا تمام روایت طرفین، سپس ارزیابی خسارت. هم تقصیر هم خسارت در این کنترلر واحد مدیریت میشوند.
+| متد | مسیر | توضیح |
|---|---|---|
| POST | POST / ← send-party-otp ← verify-party-otp ← run-inquiries ← add-detail-* ← sign (×۲) | مرحله روایت طرفین (مراحل ۱–۸) — اندپوینتهای یکسان با mirror، همان قرارداد. |
| POST | accident-fields/:id | مرحله ۹: ذخیره فیلدهای تصادف پس از امضای هر دو طرف. |
| GET | claim-id/:requestId | مرحله ۱۰: دریافت شناسه خسارت ایجادشده بهصورت خودکار. |
| POST | upload-document/:claimId | مرحله ۱۱: بارگذاری اسناد گواهینامه / کارت خودرو. |
| PATCH | select-outer-parts/:claimId / select-other-parts/:claimId | مراحل ۱۲–۱۳: انتخاب قطعات آسیبدیده. |
| POST | capture-part/:claimId | مرحله ۱۴: عکسبرداری از قطعات + زوایا. |
| PATCH | car-capture/:claimId | مرحله ۱۵: ویدیوی دور زدن خودرو. |
| POST | upload-video/:requestId | مرحله ۱۶: ویدیوی تصادف تقصیر (نهایی) ← WAITING_FOR_EXPERT (THIRD_PARTY) یا COMPLETED (CAR_BODY). |
+ FIELD_EXPERT مسیر v2/expert-blame/ را محدود به فایلهای ساختهشده توسط خودش میبیند (نه صف اختلاف).
+ همچنین v2/expert-claim/ را برای خسارتهای مرتبط با فایلهای تقصیرش میبیند.
+ اندپوینتهای یکسان با پنلهای کارشناس تقصیر و کارشناس خسارت در بالا.
+
+ اولین اکتور در تقسیم V4/V5. فایلساز روایت طرفین را در محل انجام میدهد: + OTPها، استعلامها، موقعیت/توضیحات/صدا و امضاها برای هر دو طرف. + همچنین اسناد اولیه خسارت (گواهینامهها، کارتهای خودرو) را بارگذاری میکند. پس از + امضای دوم، فایل برای تحویل به بازبین فایل «مهرومومه» میشود. در V5، فایلساز + در انتها بازمیگردد تا خسارت تکمیلشده را قبل از ارسال به فناوران تأیید یا رد کند. +
+ +v4/file-maker/blame-request-management/ و v5/…اندپوینتهای V4 و V5 یکسان هستند — فقط پیشوند تغییر میکند. V5 هنگام ایجاد requiresFileMakerApproval=true را تنظیم میکند.
| متد | مسیر | توضیح |
|---|---|---|
| POST | POST / | ایجاد فایل تقصیر IN_PERSON. |
| GET | my-files | فهرست تمام فایلهای تقصیر ایجادشده توسط این فایلساز. |
| GET | my-files/:requestId | جزئیات کامل یک فایل (طرفین، گردش کار، شناسه خسارت مرتبط). |
| GET | claim-id/:requestId | دریافت شناسه خسارت ایجادشده بهصورت خودکار پس از استعلام طرف مقصر. |
| POST | send-party-otp/:id / verify-party-otp/:id | ارسال + تأیید OTP برای یک طرف در هر بار (ابتدا مقصر، سپس زیاندیده). |
| POST | car-body-form/:id | [فقط CAR_BODY] فرم نوع تصادف. |
| POST | run-inquiries/:id / run-inquiries-vin/:id | اجرای استعلام پلاک یا VIN. فراخوانی اول = مقصر (+ خودکار خسارت ایجاد میکند). فراخوانی دوم = زیاندیده (فقط THIRD_PARTY). |
| POST | add-detail-location/:id / add-detail-description/:id / upload-voice/:id | افزودن موقعیت، توضیحات و صدا برای طرف فعلی (پارامتر partyRole، FIRST/SECOND را انتخاب میکند). |
| PUT | sign/:id | بارگذاری امضای طرف (partyRole=FIRST سپس SECOND). پس از امضای دوم، فایل مهرومومه میشود. |
| POST | upload-document/:claimId | بارگذاری گواهینامه / کارتهای خودرو روی خسارت ایجادشده بهصورت خودکار. |
| GET | capture-requirements/:claimId | الزامات عکسبرداری آگاه از مرحله (فازها: اسناد پیش از عکسبرداری در مقابل قطعات آسیبدیده + شاسی/موتور). |
v5/file-maker/claim-approval/فقط در V5 استفاده میشود. پس از بررسی کارشناس خسارت و امضای مالک، خسارت وارد WAITING_FOR_FILE_MAKER_APPROVAL میشود.
| متد | مسیر | توضیح |
|---|---|---|
| POST | approve/:claimId | تأیید خسارت تکمیلشده ← ارسال SMS امضای مالک را فعال میکند ← پس از امضای مالک به فناوران ارسال میشود. |
| POST | reject/:claimId | رد به بازبین فایل ← خسارت به WAITING_FOR_DAMAGE_EXPERT برمیگردد. محدودیت: حداکثر ۲ رد در هر خسارت؛ تلاش سوم ۴۲۲ با کد FILE_MAKER_REJECTION_LIMIT_EXCEEDED برمیگرداند. |
+ دومین اکتور در تقسیم V4/V5. بازبین فایل فایلهای مهرومومهشده (پس از اتمام کار + فایلساز) را تحویل میگیرد و مرحله کامل ارزیابی خسارت را انجام میدهد: فیلدهای + تصادف، دریافت الزامات عکسبرداری، بارگذاری اسناد (شاسی/موتور)، انتخاب قطعات، + عکسهای قطعات، ویدیوی دور زدن خودرو، امضای مالک. تقصیر با car-capture به + COMPLETED علامتگذاری میشود. بازبین فایل همچنین دسترسی خواندن به پنل expert-claim + برای خسارتهایی که بررسی میکند دارد. +
+ +v4/file-reviewer/blame-request-management/ و v5/…اندپوینتهای V4 و V5 یکسان هستند — فقط پیشوند تغییر میکند.
+| متد | مسیر | توضیح |
|---|---|---|
| GET | my-files | فهرست تمام فایلهای تخصیصیافته به این بازبین فایل. |
| GET | my-files/:requestId | جزئیات کامل یک فایل (طرفین، گردش کار، فیلدهای کارشناس، شناسه خسارت مرتبط). |
| GET | claim-id/:requestId | دریافت شناسه خسارت ایجادشده بهصورت خودکار (از استعلام طرف مقصر فایلساز). |
| POST | accident-fields/:requestId | مرحله ۱ (بازبین): ذخیره فیلدهای تصادف (accidentWay، accidentReason، accidentType). |
| GET | capture-requirements/:claimId | الزامات عکسبرداری آگاه از مرحله (فاز اسناد پیش از عکسبرداری در مقابل فاز عکسبرداری قطعات). |
| POST | upload-document/:claimId | بارگذاری اسناد شاسی / موتور / پلاک فلزی. |
| PATCH | select-outer-parts/:claimId | انتخاب قطعات آسیبدیده بیرونی (بدنه). |
| PATCH | select-other-parts/:claimId | انتخاب سایر قطعات آسیبدیده (غیر بدنه). |
| POST | capture-part/:claimId | عکسبرداری از قطعات + زوایا برای هر قطعه آسیبدیده انتخابشده. |
| PATCH | car-capture/:claimId | ویدیوی دور زدن خودرو (آخرین مرحله عکسبرداری بازبین). خسارت ← WAITING_FOR_DAMAGE_EXPERT، تقصیر ← COMPLETED. |
| PUT | claim-sign/:claimId | ثبت امضای مالک روی قیمتگذاری کارشناس به نمایندگی از طرف زیاندیده (موافقت + branchId + تصویر امضا). |
| POST | upload-video/:requestId | در V4/V5 بیاثر است — تقصیر از قبل توسط car-capture COMPLETED شده. موفقیت idempotent برمیگرداند. |
+ FILE_REVIEWER در نقشهای مجاز برای v2/expert-claim/ است.
+ میتواند جزئیات خسارت را مشاهده کند و جریان assign/lock را برای خسارتهای
+ مرتبط با فایلهایش اجرا کند. نمیتواند بهطور مستقل درخواست ارسال مجدد
+ کارشناس خسارت را آغاز کند.
+
+ نقش اداری که تقصیر و خسارت حضوری را به نمایندگی از طرفین ثبت میکند. + از جریان OTP دستهای استفاده میکند (OTPهای هر دو طرف بهصورت همزمان ارسال و + تأیید میشوند) به جای OTP یکبهیک که توسط کارشناسان میدانی استفاده میشود. + پس از تقصیر، ثبات آینه API خسارت کاربر را دنبال میکند تا انتخاب قطعات، اسناد + و عکسبرداری را پر کند. سپس فایل وارد چرخه عادی بررسی کارشناس خسارت میشود. +
+ +registrar-initiated-blame/توجه: @ApiExcludeController — مسیرها وجود دارند اما در مستندات Swagger نمایش داده نمیشوند.
| متد | مسیر | توضیح |
|---|---|---|
| POST | registrar-initiated-blame/create | ایجاد فایل تقصیر IN_PERSON. |
| GET | registrar-initiated-blame/my-files | فهرست تمام فایلهای تقصیر ایجادشده توسط این ثبات. |
| GET | registrar-initiated-blame/blame/:requestId | جزئیات کامل یک فایل تقصیر. |
| POST | registrar-initiated-blame/send-party-otps/:id | ارسال OTP به هر دو طرف بهصورت همزمان. |
| POST | registrar-initiated-blame/verify-party-otps/:id | تأیید OTPهای هر دو طرف در یک فراخوانی. |
| POST | registrar-initiated-blame/complete-blame-data/:id | ارسال تمام دادههای فرم تقصیر هر دو طرف در یک پیلود. |
| POST | registrar-initiated-blame/upload-video/:id | بارگذاری ویدیوی تقصیر. |
| POST | registrar-initiated-blame/upload-voice/:id | بارگذاری ضبط صوتی. |
| POST | registrar-initiated-blame/add-accident-fields/:id | ذخیره فیلدهای تصادف و تکمیل تقصیر. |
| POST | registrar-initiated-blame/upload-party-signature/:id | بارگذاری امضای یک طرف (partyRole=FIRST/SECOND). |
v2/registrar/claim-request-management/آینهای از API خسارت کاربر. فرانتاند همان صفحات خسارت را با تغییر فقط پیشوند بازاستفاده میکند.
+| متد | مسیر | توضیح |
|---|---|---|
| POST | create-from-blame/:blameId | ایجاد خسارت از یک فایل تقصیر تکمیلشده. |
| GET | outer-parts-catalog / car-other-part | کاتالوگ قطعات (قطعات بیرونی بدنه + JSON سایر قطعات). |
| GET | branches/:insuranceId | فهرست شعب بیمهگر (برای انتخاب شعبه در مرحله امضای خسارت). |
| PATCH | select-outer-parts/:claimId | انتخاب قطعات آسیبدیده بیرونی. |
| PATCH | select-other-parts/:claimId | انتخاب سایر قطعات آسیبدیده + اطلاعات بانکی. |
| POST | upload-document/:claimId | بارگذاری اسناد خسارت (گواهینامه، کارت خودرو). |
| POST | capture-part/:claimId | عکسبرداری از قطعات + زوایا. |
| PATCH | car-capture/:claimId | ویدیوی دور زدن خودرو (مرحله نهایی) ← WAITING_FOR_DAMAGE_EXPERT. |
+ ثبت تقصیر تلفنی V6 را مدیریت میکند. اپراتور دادههای طرف مقصر را از طریق تلفن + جمعآوری میکند، استعلام بیمه را اجرا میکند و لینک تقصیر را از طریق SMS ارسال + میکند. کاربر سپس بقیه فرم را از طریق جریان استاندارد V2 تکمیل میکند + (با رد شدن مرحله فرم اولیه/استعلام). کار اپراتور مرکز تماس پس از send-link + پایان مییابد؛ میتواند پیشرفت را از طریق اندپوینتهای خواندن پایش کند. +
+ +v6/call-center-blame/| متد | مسیر | توضیح |
|---|---|---|
| POST | create | ایجاد فایل تقصیر LINK. بدنه: { type: "THIRD_PARTY" | "CAR_BODY" }. |
| POST | run-inquiry/:requestId | اجرای استعلام بیمه پلاک + کد ملی برای طرف مقصر. نتیجه را روی سند تقصیر ذخیره میکند. |
| POST | run-inquiry-vin/:requestId | VIN/شاسی جایگزین برای run-inquiry. از جستجوی شاسی ESG استفاده میکند. |
| POST | send-link/:requestId | در صورت لزوم کاربر را ثبتنام میکند، بهعنوان طرف اول ذخیره میکند، لینک دعوت تقصیر را از طریق SMS ارسال میکند. بدنه: { phoneNumber }. |
| GET | my-files | فهرست تمام فایلهای تقصیر شروعشده توسط این اپراتور. |
| GET | blame/:requestId | وضعیت فعلی و مرحله گردش کار یک فایل (برای بررسی اینکه کاربر لینک را باز کرده و پیشرفت کرده است). |
+ پس از send-link، کاربر فرم را از طریق
+ v2/blame-request-management/ (جریان استاندارد V2) تکمیل میکند.
+ مرحله فرم اولیه / استعلام بهصورت خودکار رد میشود
+ (skipInitialFormStep=true). جریان خسارت پاییندستی همان
+ جریان استاندارد خسارت V2 است.
+
+ تمام اکتورهای پنل (هر نقش به جز user) از طریق همان اندپوینت
+ POST actor/login با کپچا احراز هویت میکنند. بازنشانی رمز عبور از
+ طریق OTP ایمیل است. خواندن و ویرایش پروفایل نیز مشترک است.
+
actor/| متد | مسیر | توضیح |
|---|---|---|
| GET | actor/captcha | صدور یک چالش کپچای ورود جدید (captchaId + تصویر SVG را برمیگرداند). |
| POST | actor/login | احراز هویت هر نقش اکتور. بدنه: role، username/email/nationalCode، password، captchaId، captcha. توکنهای JWT دسترسی + رفرش را برمیگرداند. |
| POST | actor/forget-password | ارسال OTP بازنشانی رمز عبور به ایمیل. |
| POST | actor/forget-password-verify | تأیید OTP و تنظیم رمز عبور جدید. |
| GET | actor/profile | دریافت پروفایل اکتور فعلی. |
| PATCH | actor/profile | بهروزرسانی پروفایل اکتور فعلی. |
+ What every actor role can see and do — endpoints, responsibilities, and + process steps. Super-admin excluded. +
+ + +| Role enum | +Login panel | +Scope | +Primary job | +
|---|---|---|---|
company |
+ Insurer portal | +Tenant-wide | +View all files; manage branches, experts; run reports; rate experts | +
expert |
+ Blame expert panel | +Tenant DISAGREEMENT queue | +Lock blame cases, review party submissions, submit verdict or request resend | +
damage_expert |
+ Claim/damage panel | +Tenant claim queue | +Lock claims, price damage, validate repair factors, request resend/visit | +
field_expert |
+ Field expert panel | +Own created files | +V2/V3 in-person blame + claim filing; also sees blame/claim review panels | +
file_maker |
+ FileMaker panel | +Own created files | +V4/V5 party narrative (OTPs, inquiries, details, signatures); V5 claim approval | +
file_reviewer |
+ FileReviewer panel | +Assigned files | +V4/V5 damage assessment (accident fields, parts, captures, owner sign) | +
registrar |
+ Registrar panel | +Own created files | +Office-based in-person blame + claim filing on behalf of parties | +
call_center |
+ Call-center panel | +Own created files | +V6 phone-initiated blame: run inquiry, send link; user completes the rest | +
+ One company actor per insurance-company tenant. The insurer portal is the
+ management layer: it can see everything under its tenant, manage the expert roster,
+ manage branches, configure per-tenant media settings, and pull statistical reports.
+ The insurer never touches blame/claim steps directly — it only observes and rates.
+
expert-insurer/| Method | Route | What it does |
|---|---|---|
| GET | expert-insurer/files | List all blame + claim files for the tenant (merged by publicId). Filterable by status, file type, search, sort, page. |
| GET | expert-insurer/files/:publicId | Full detail for one file by publicId. |
| GET | expert-insurer/files/:publicId/timeline | Chronological activity timeline (all history events: source, type, actor, metadata). |
| GET | expert-insurer/files/:publicId/report | Structured report data for PDF generation (owner, driver, insurance, vehicle, accident sections). |
| PUT | expert-insurer/files/:publicId/rating | Rate the experts on a file (1–5 per dimension: collision method, timeliness, cause accuracy, guilty-ID accuracy, bot rating). |
| GET | expert-insurer/report/unified-file-statuses | Unified status catalog + per-status counts for the whole tenant portfolio. Filterable by fileType and date range. |
| GET | expert-insurer/report/status-counts | Deprecated — prefer unified-file-statuses. |
expert-insurer/branches| Method | Route | What it does |
|---|---|---|
| GET | expert-insurer/branches | List all branches for this insurer. Query: search, from/to date, isActive filter. |
| POST | expert-insurer/branches | Add a new branch (name, code, address, city, phone, etc.). |
| PUT | expert-insurer/branches/:branchId/status | Activate or deactivate a branch. |
expert-insurer/experts| Method | Route | What it does |
|---|---|---|
| POST | expert-insurer/experts/blame | Create a new blame-expert account under this insurer. |
| POST | expert-insurer/experts/claim | Create a new damage-expert (claim) account under this insurer. |
| POST | expert-insurer/experts/file-maker | Create a new FileMaker account under this insurer. |
| POST | expert-insurer/experts/file-reviewer | Create a new FileReviewer account under this insurer. |
| GET | expert-insurer/experts/list | Paginated list of all expert accounts on this tenant. |
| GET | expert-insurer/experts/top | Top blame vs claim experts ranked by overall average rating (up to 10 each). |
| GET | expert-insurer/top-experts | Alias for experts/top (frontend compat). |
| GET | expert-insurer/:expertId | Files handled by one expert (slim summary rows — blame or claim depending on expert type). |
| Method | Route | What it does |
|---|---|---|
| GET | expert-insurer/statistics | KPI cards: totalFilesReviewed, averageUserRating, inPersonCount, filesThisMonth, objectionPercentage, etc. Filterable by date range. |
| GET | expert-insurer/top-files | Top 10 highest-rated claim files (combined insurer + user score). |
| GET | expert-insurer/expert-work-log | Per-expert work log: totalHandled, currentlyChecking, distinctFilesCheckedInPeriod. Filterable by expertKind and date range. |
| GET | reports/report/insurer/requests | Claim + blame status bucket counts + unified file count for the tenant. |
| GET | reports/report/insurer/per-month-requests | Same summary, broken down by the last 5 calendar months. |
| GET | reports/report/insurer/checked-requests | Same summary filtered by optional createdAt date range. |
| GET | reports/report/insurer/expert-work-log | Expert work log (blame + damage expert collections, not field experts). |
| GET | reports/report/insurer/expert-work-log/per-month | Same work log per calendar month (last 5). |
client-panel/| Method | Route | What it does |
|---|---|---|
| GET | client-panel/settings | Get per-tenant media limits (video/image/voice maxBytes) and CAR_BODY accident window (days). |
| PATCH | client-panel/settings | Update those settings (partial). Cannot exceed system-level route ceilings. |
+ Reviews blame files in the DISAGREEMENT queue — cases where the two parties do not
+ agree on who is at fault. After reviewing submitted documents and party statements
+ the expert locks the case, then either submits a verdict, asks the parties to resend
+ documents, or records an in-person visit outcome. All endpoints are under
+ v2/expert-blame/.
+
+ 1 Browse list → 2 Assign (lock) the case → 3 Review party evidence (videos, voices, documents) → + 4a Submit verdict or 4b Request document resend or 4c Record in-person visit. +
+v2/expert-blame/| Method | Route | What it does |
|---|---|---|
| GET | v2/expert-blame/ | List blame cases in the DISAGREEMENT queue (available, locked by me, or decided by me). Query: search, sortBy, sortOrder, page, limit, unifiedStatus, fileType. |
| GET | v2/expert-blame/:id | Full detail for one blame case (party statements, photos, voices, videos). |
| POST | v2/expert-blame/:id/assign | Check availability and lock the case to this expert. Returns assigned, already_assigned_to_you, or 409 if someone else holds it. |
| PUT | v2/expert-blame/reply/submit/:id | Submit verdict (accidentWay, accidentReason, accidentType, guilty party decision). Unlocks the case and moves it to COMPLETED. |
| PUT | v2/expert-blame/reply/resend/:id | Request parties to re-upload documents. Sets blame to WAITING_FOR_RESEND. One resend request per lifecycle. |
| PUT | v2/expert-blame/reply/inPerson/:id | Record that an in-person visit was made and submit verdict. |
| GET | v2/expert-blame/report/unified-file-statuses | Status catalog + per-status counts for this expert's portfolio. |
| GET | v2/expert-blame/report/status-counts | Deprecated — prefer unified-file-statuses. |
| PUT | v2/expert-blame/lock/:id | Deprecated lock endpoint — use POST assign. |
+ Reviews claim files after the user has submitted their damage evidence. The expert
+ prices each damaged part, optionally calculates a price-drop (depreciation), and
+ can ask the user to resend documents, come in person, or upload repair factor invoices
+ when workshop pricing is needed. All endpoints are under v2/expert-claim/.
+
+ 1 Browse list → 2 Assign (lock) the claim → 3 Review damage photos and documents → + 4 Optionally edit selected parts or calculate price-drop → + 5a Submit priced reply or 5b Request resend or 5c Request in-person visit → + 6 If factor parts present: validate uploaded factor invoices. +
+v2/expert-claim/| Method | Route | What it does |
|---|---|---|
| GET | v2/expert-claim/requests | List claims in WAITING_FOR_DAMAGE_EXPERT queue + factor-validation queue. Query: search, sortBy, page, limit, unifiedStatus, fileType. |
| GET | v2/expert-claim/request/:claimRequestId | Full claim detail: damaged parts, captured images, documents, priceDrop, blameCase party data, video URLs. |
| POST | v2/expert-claim/assign/:claimRequestId | Lock claim to this expert. Returns assigned, already_assigned_to_you, or 409. |
| GET | v2/expert-claim/request/:claimRequestId/price-drop | Price-drop context: severity labels, coefficient catalog, damaged parts + mapping, suggested car year from blame inquiry. |
| PUT | v2/expert-claim/request/:claimRequestId/price-drop | Calculate and persist price-drop: carPrice × yearCoeff × sumOfCoeffs ÷ 400. |
| PUT | v2/expert-claim/reply/submit/:claimRequestId | Submit damage assessment reply (priced parts list, daghi, branchId). Cap: total ≤ 53 000 000 Toman. Depending on factorNeeded flags moves claim to owner-sign, mixed-factors-pending, or factor-validation queue. |
| PUT | v2/expert-claim/reply/resend/:claimRequestId | Request user to resend documents/photos. One resend per claim lifecycle; returns 422 if already fulfilled. |
| PATCH | v2/expert-claim/:claimRequestId/visit | Ask user to come in person. Unlocks claim, sets claimStatus to NEEDS_REVISION. |
| PATCH | v2/expert-claim/validate-factors/:claimRequestId | Validate uploaded repair factor invoices. Approve or reject each factor line with totalPayment. Cap applies across all lines (≤ 53 000 000 Toman). Auto-completes when all lines are decided. |
| PATCH | v2/expert-claim/request/:claimRequestId/damaged-parts | Edit selected damaged parts while the claim is locked by this expert (EXPERT_REVIEWING). |
| GET | v2/expert-claim/outer-parts-catalog | Fanavaran outer car-components catalog (shared with user flow). |
| GET | v2/expert-claim/inner-parts-catalog | Static inner car-parts catalog JSON. |
| GET | v2/expert-claim/branches | Insurer branches for this expert's tenant (for daghi/branch selection in reply payload). |
| GET | v2/expert-claim/stream/:id/video | Stream claim video (car-capture walk-around or accident video). Query: query=car-capture|accident. |
| GET | v2/expert-claim/report/unified-file-statuses | Status catalog + counts for this expert's claim portfolio. |
| GET | v2/expert-claim/report/status-counts | Deprecated — prefer unified-file-statuses. |
| PUT | v2/expert-claim/lock/:claimRequestId | Deprecated lock endpoint — use POST assign. |
+ Goes to the accident scene and fills both parties' forms in-person (V2 mirror / V3 flows). + The field expert also has read access to the expert-blame and expert-claim panels + (scoped to their own files). They are the only role that spans both + blame filing and claim filing in the same session. +
+ +v2/expert-initiated/blame-request-management/Mirror of the user blame API. Frontend reuses same pages by swapping prefix only.
+| Method | Route | What it does |
|---|---|---|
| POST | POST / | Create IN_PERSON blame file. |
| POST | send-party-otp/:id | Send OTP to one party by phone number (no invite link). |
| POST | verify-party-otp/:id | Verify one party's OTP and bind their account. |
| POST | blame-confession/:id | Record party's blame confession. |
| POST | car-body-form/:id | [CAR_BODY only] Accident type form. |
| POST | run-inquiries/:id / run-inquiries-vin/:id | Initial form / plate or VIN inquiry for current party. |
| POST | upload-video/:id | Upload first-party video. |
| POST | add-detail-location/:id | Add GPS location for current party. |
| POST | upload-voice/:id | Upload voice recording for current party. |
| POST | add-detail-description/:id | Add description for current party. |
| POST | add-second-party/:phone/:id/ | Advance to second party (no SMS link sent). |
| PUT | sign/:id | Upload party signature (FIRST then SECOND, partyRole param). |
| POST | accident-fields/:id | Save accident fields and complete blame immediately (no expert queue). |
v3/expert-initiated/blame-request-management/Reorganised step order: all party narrative first, then damage assessment. Blame and claim both handled in this single controller.
+| Method | Route | What it does |
|---|---|---|
| POST | POST / → send-party-otp → verify-party-otp → run-inquiries → add-detail-* → sign (×2) | Party narrative phase (steps 1–8) — identical endpoints to mirror, same contract. |
| POST | accident-fields/:id | Step 9: save accident fields after both parties have signed. |
| GET | claim-id/:requestId | Step 10: get auto-created claim ID. |
| POST | upload-document/:claimId | Step 11: upload licence / car card documents. |
| PATCH | select-outer-parts/:claimId / select-other-parts/:claimId | Steps 12–13: select damaged parts. |
| POST | capture-part/:claimId | Step 14: capture part photos + angles. |
| PATCH | car-capture/:claimId | Step 15: walk-around video. |
| POST | upload-video/:requestId | Step 16: blame accident video (final) → WAITING_FOR_EXPERT (THIRD_PARTY) or COMPLETED (CAR_BODY). |
+ FIELD_EXPERT sees v2/expert-blame/ scoped to their own created files (not the disagreement queue).
+ They also see v2/expert-claim/ for claims linked to their blame files.
+ Same endpoints as blame-expert and damage-expert panels above.
+
+ The first actor in the V4/V5 split. FileMaker handles the party narrative on-site: + OTPs, inquiries, location/description/voice, and signatures for both parties. + They also upload the initial claim documents (licences, car cards). After the second + signature the file is "sealed" for FileReviewer pickup. In V5, FileMaker comes + back at the end to approve or reject the completed claim before fanavaran submission. +
+ +v4/file-maker/blame-request-management/ and v5/…V4 and V5 endpoints are identical — only the prefix changes. V5 sets requiresFileMakerApproval=true at creation.
| Method | Route | What it does |
|---|---|---|
| POST | POST / | Create IN_PERSON blame file. |
| GET | my-files | List all blame files created by this FileMaker. |
| GET | my-files/:requestId | Full detail for one file (parties, workflow, linked claim ID). |
| GET | claim-id/:requestId | Get the auto-created claim ID after guilty-party run-inquiries. |
| POST | send-party-otp/:id / verify-party-otp/:id | Send + verify OTP for one party at a time (guilty first, then damaged). |
| POST | car-body-form/:id | [CAR_BODY only] Accident type form. |
| POST | run-inquiries/:id / run-inquiries-vin/:id | Run plate or VIN inquiry. First call = guilty (+ auto-creates claim). Second call = damaged (THIRD_PARTY only). |
| POST | add-detail-location/:id / add-detail-description/:id / upload-voice/:id | Add location, description, and voice for current party (partyRole param selects FIRST/SECOND). |
| PUT | sign/:id | Upload party signature (partyRole=FIRST then SECOND). After second signature, file is sealed. |
| POST | upload-document/:claimId | Upload licences / car cards against the auto-created claim. |
| GET | capture-requirements/:claimId | Step-aware capture requirements (phases: pre-capture docs vs damaged parts + chassis/engine). |
v5/file-maker/claim-approval/Used only in V5. After damage expert review and owner sign, claim enters WAITING_FOR_FILE_MAKER_APPROVAL.
| Method | Route | What it does |
|---|---|---|
| POST | approve/:claimId | Approve the completed claim → triggers owner sign SMS → fanavaran submission after owner signs. |
| POST | reject/:claimId | Reject back to FileReviewer → claim returns to WAITING_FOR_DAMAGE_EXPERT. Limit: max 2 rejections per claim; 3rd attempt returns 422 FILE_MAKER_REJECTION_LIMIT_EXCEEDED. |
+ The second actor in the V4/V5 split. FileReviewer picks up sealed files (after + FileMaker is done) and performs the full damage assessment pass: accident fields, + capture requirements lookup, document upload (chassis/engine), part selection, + part photos, walk-around video, owner signature. The blame is marked COMPLETED + by car-capture. FileReviewer also has read access to the expert-claim panel for + claims they are reviewing. +
+ +v4/file-reviewer/blame-request-management/ and v5/…V4 and V5 endpoints are identical — only the prefix changes.
+| Method | Route | What it does |
|---|---|---|
| GET | my-files | List all files assigned to this FileReviewer. |
| GET | my-files/:requestId | Full detail for one file (parties, workflow, expert fields, linked claim ID). |
| GET | claim-id/:requestId | Get the auto-created claim ID (from FileMaker's guilty-party inquiry). |
| POST | accident-fields/:requestId | Step 1 (FileReviewer): save accident fields (accidentWay, accidentReason, accidentType). |
| GET | capture-requirements/:claimId | Step-aware capture requirements (pre-capture docs phase vs capture-parts phase). |
| POST | upload-document/:claimId | Upload chassis / engine / metal-plate documents. |
| PATCH | select-outer-parts/:claimId | Select outer (body) damaged parts. |
| PATCH | select-other-parts/:claimId | Select other (non-body) damaged parts. |
| POST | capture-part/:claimId | Capture part photos + angles for each selected damaged part. |
| PATCH | car-capture/:claimId | Walk-around video (final FileReviewer capture step). Claim → WAITING_FOR_DAMAGE_EXPERT, blame → COMPLETED. |
| PUT | claim-sign/:claimId | Submit owner signature on expert pricing on behalf of the damaged party (agree + branchId + signature image). |
| POST | upload-video/:requestId | No-op in V4/V5 — blame already COMPLETED by car-capture. Returns idempotent success. |
+ FILE_REVIEWER is in the allowed roles for v2/expert-claim/.
+ They can view claim details and run the assign/lock flow for claims associated
+ with their files. They cannot initiate a damage-expert resend independently.
+
+ Office-based role that files in-person blame and claim on behalf of parties. + Uses a bulk-OTP flow (both parties' OTPs sent and verified in one call each) + rather than the one-at-a-time OTP used by field experts. After blame, the + registrar mirrors the user claim API to fill part selection, documents, and + captures. The file then enters the normal damage-expert review lifecycle. +
+ +registrar-initiated-blame/Note: @ApiExcludeController — routes exist but not surfaced in Swagger docs.
| Method | Route | What it does |
|---|---|---|
| POST | registrar-initiated-blame/create | Create IN_PERSON blame file. |
| GET | registrar-initiated-blame/my-files | List all blame files created by this registrar. |
| GET | registrar-initiated-blame/blame/:requestId | Full detail for one blame file. |
| POST | registrar-initiated-blame/send-party-otps/:id | Send OTPs to both parties simultaneously. |
| POST | registrar-initiated-blame/verify-party-otps/:id | Verify both parties' OTPs in one call. |
| POST | registrar-initiated-blame/complete-blame-data/:id | Submit all blame form data for both parties in one payload. |
| POST | registrar-initiated-blame/upload-video/:id | Upload blame video. |
| POST | registrar-initiated-blame/upload-voice/:id | Upload voice recording. |
| POST | registrar-initiated-blame/add-accident-fields/:id | Save accident fields and complete blame. |
| POST | registrar-initiated-blame/upload-party-signature/:id | Upload a party's signature (partyRole=FIRST/SECOND). |
v2/registrar/claim-request-management/Mirror of the user claim API. Frontend reuses same claim pages by swapping prefix only.
+| Method | Route | What it does |
|---|---|---|
| POST | create-from-blame/:blameId | Create claim from a completed blame file. |
| GET | outer-parts-catalog / car-other-part | Parts catalogs (outer body parts + other parts JSON). |
| GET | branches/:insuranceId | Insurer branch list (for branch selection in claim sign step). |
| PATCH | select-outer-parts/:claimId | Select outer damaged parts. |
| PATCH | select-other-parts/:claimId | Select other damaged parts + bank info. |
| POST | upload-document/:claimId | Upload claim documents (licences, car card). |
| POST | capture-part/:claimId | Capture part photos + angles. |
| PATCH | car-capture/:claimId | Walk-around video (final step) → WAITING_FOR_DAMAGE_EXPERT. |
+ Handles V6 phone-initiated blame filing. The agent collects the guilty party's + data over the phone, runs the insurance inquiry, and sends the blame link via + SMS. The user then completes the rest of the form through the standard V2 flow + (with the initial-form/inquiry step skipped). The call-center agent's job ends + after send-link; they can monitor progress via the read endpoints. +
+ +v6/call-center-blame/| Method | Route | What it does |
|---|---|---|
| POST | create | Create a LINK blame file. Body: { type: "THIRD_PARTY" | "CAR_BODY" }. |
| POST | run-inquiry/:requestId | Run plate + national-code insurance inquiry for the guilty party. Stores result on blame document. |
| POST | run-inquiry-vin/:requestId | VIN/chassis alternative to run-inquiry. Uses ESG chassis lookup. |
| POST | send-link/:requestId | Register user if needed, store as first party, send blame invite link via SMS. Body: { phoneNumber }. |
| GET | my-files | List all blame files started by this agent. |
| GET | blame/:requestId | Current status and workflow step for one file (to check if user has opened the link and progressed). |
+ After send-link the user completes the form via
+ v2/blame-request-management/ (standard V2 flow).
+ The initial-form / inquiry step is automatically skipped
+ (skipInitialFormStep=true). Downstream claim flow is the
+ standard V2 claim flow.
+
+ All panel actors (every role except user) authenticate through the same
+ POST actor/login endpoint with captcha. Password reset is via email OTP.
+ Profile reads and edits are also shared.
+
actor/| Method | Route | What it does |
|---|---|---|
| GET | actor/captcha | Issue a new login captcha challenge (returns captchaId + SVG image). |
| POST | actor/login | Authenticate any actor role. Body: role, username/email/nationalCode, password, captchaId, captcha. Returns JWT access + refresh tokens. |
| POST | actor/forget-password | Send password-reset OTP to email. |
| POST | actor/forget-password-verify | Verify OTP and set new password. |
| GET | actor/profile | Get current actor's profile. |
| PATCH | actor/profile | Update current actor's profile. |