--- last_updated: 2026-08-08 tags: [fanavaran, constants, config] source: fanavaran-module-docs --- # 03 — Constants Legend for **Varies by company?** ✅ = different per insurer tenant · ❌ = shared across tenants in current code Secrets are **not** printed here — read from Mongo `fanavaranClientConfigs` or seed profiles. --- ## Auth (tenant) | Name | Example (Parsian) | Where used | Why | Varies? | |------|-------------------|------------|-----|---------| | `appName` | `ParsianService` | GetAppToken | App identity | ✅ | | `secret` | *(config)* | GetAppToken | App secret | ✅ | | `username` | `ParsianServiceUser` | Login | User | ✅ | | `password` | *(config)* | Login | Password | ✅ | | `corpId` | `543` | All business calls | Corp scope | ✅ | | `contractId` | `28` | All business calls | Contract | ✅ | | `location` | `210050` | General calls without claim context | Tenant default OpBUId | ✅ (claim submissions require a staff location or branch code) | Seed: `SEED_FANAVARAN_CLIENT_PROFILES` · Runtime: `getFanavaranClientProfile(key)`. Claim submissions resolve `Location` from staff profiles in the `file-maker`, `file-reviewer`, `expert`, `damage-expert`, and `field-expert` collections. Each profile stores `locations: [{ id, name }]`; the first non-empty `id` is its primary Fanavaran OpBUId. When staff locations are missing, null, or empty, resolve that staff member's `branchId` in the `branches` collection and use the branch's `code` as the OpBUId. This branch fallback is checked before moving to another staff candidate. The branch document's `_id` is never sent as the HTTP Location. Resolution priority: claim initiator → blame initiator → active damage reply actor → assigned damage reviewer → assigned FileReviewer → assigned blame expert → blame decision actor. The first candidate with a location wins. A missing blame record does not discard the claim's own staff. When none has a location, claim submission fails with `FANAVARAN_STAFF_LOCATION_MISSING` instead of sending the tenant default. Base claim, damage, attachment, expertise, hull update, and GEN.44 create calls use the same claim header resolver. Authentication requests do not send Location; the cached login token can be reused across staff locations. --- ## Payload defaults (tenant profile.defaults) Hull submissions validate selected codebook IDs against fresh Fanavaran API responses before every create, base update, attachment upload, and expertise write. These checks bypass lookup-file and database caches. Missing or inactive IDs block the remote write with `FANAVARAN_HULL_LOOKUP_INVALID`; they are never accepted merely because they appear in the defaults below. Hull collision type, culprit type, authority, damage kind, and cost kind select matching captions from API responses without numeric fallbacks. Policy accessories are read for the current PolicyId; ActualPremium is refreshed from that policy's TotalPremium. Expert-entered amounts and durations remain expert data. `IsLicenseReplaced` stays explicitly 0. | Name | Shared seed | Parsian override | Tejaratno | Moallem | Varies? | |------|-------------|------------------|-----------|---------|---------| | `AccidentCityId` | 701 | same | same | same | usually ❌ | | `AccidentReportTypeId` | 155 | same | same | same | usually ❌ | | `AccidentVehicleUsedId` | 1 | same | same | same | usually ❌ | | `ClaimExpertId` (GEN.03) | 4543092 | **154** | 4543092 | shared TBD | ✅ | | `ExpertiseClaimExpertId` (GEN.08) | 2709 | **29** | **2709** | shared TBD | ✅ | | `CompensationReferenceId` | 167 | same | same | same | usually ❌ | | `CulpritLicenceTypeId` | 2 | same | same | same | usually ❌ | | `CulpritTypeId` | 337 | same | same | same | usually ❌ | | `DmgCaseTypeId` | 175 | same | same | same | may ✅ | | `DmgHistoryStatus` | 5214 | same | same | same | may ✅ | | `PlaqueKindId` | 8 | same | same | same | may ✅ | | `PlaqueSampleId` | 10 | same | same | same | may ✅ | | `DriverIsOwner` | 0 | same | same | same | ❌ | | `FaultPercent` | 100 | same | same | same | ❌ | | `ClaimFileTypeId` (GEN.07) | 23 | **63** | 23 | **17** | ✅ | **Never swap** GEN.03 `ClaimExpertId` with GEN.08 `ExpertiseClaimExpertId` — different Fanavaran roles. --- ## Code-level shared constants File: `claim-request-management.service.ts` | Name | Value | Where | Why | Varies? | |------|-------|-------|-----|---------| | `FANAVARAN_SUBMIT_URL` | `.../third-party-car-financial-claims` | All stage posts | API root | ❌ (same host) | | `FANAVARAN_ACCIDENT_LOCATION_ADDRESS` | `استان تهران شهر تهران` | GEN.03 | Provisional address | currently ❌ | | `FANAVARAN_DEFAULT_ACCIDENT_CAUSE_ID` | `6` | GEN.03 | Default cause | may ✅ later | | `FANAVARAN_DEFAULT_ACCIDENT_LEVEL` | `5456` | GEN.08 sections | Default severity | may ✅ | | `FANAVARAN_PROVISIONAL_ESTIMATE_AMOUNT` | `1000` | GEN.03/12 early | Positive estimate | ❌ | | `FANAVARAN_DUMMY_LICENCE_NO` | env or `9705463515` | Licence fields | Never empty | env override | | `InspectionPlaceId` (expertise) | `282` | GEN.08 | Hardcoded today | should verify ✅ | | `DropAmountStatus` (expertise) | `5458` | GEN.08 | Hardcoded today | should verify ✅ | | Auth URLs | apimanager.iraneit.com | Auth service | Host | ❌ | | Lookup base | same host `/BimeApi/v2.0` | Lookups | Host | ❌ | --- ## Env / activation | Name | Example | Where | Why | Varies? | |------|---------|-------|-----|---------| | `FANAVARAN_CLIENT` | `parsian` | `resolveFanavaranClientKey` | Active tenant | ✅ per deploy | | `CLIENT_ID` | `8` → parsian | Fallback hint | Legacy deploy map | ✅ | | `INSURANCE_CORP_ID` | Persian caption | Damage `InsuranceCorpId` | Match lookup Caption | ✅ | | `FANAVARAN_DUMMY_LICENCE_NO` | digits | Licence fallback | Test/prod dummy | optional | --- ## Enums / claim types (YARA) | Name | Relevant values | Fanavaran use | |------|-----------------|---------------| | Claim type | `THIRD_PARTY` | `third-party-car-financial-claims` (base → dmg-cases → files → expertise) | | | `CAR_BODY` | `vehicle-hull-claims` (base → files → expertise; **no dmg-cases**) | | `ClaimCaseStatus` | local workflow | Triggers stages indirectly | | History event types | `FANAVARAN_*_SUCCEEDED/FAILED` | Audit trail on claim | --- ## Retry / backoff constants | Name | Value | Where | |------|-------|-------| | `FANAVARAN_RETRY_DELAY_MS` | 5 min | Stage retry | | `FANAVARAN_TRANSIENT_RETRY_DELAY_MS` | 10 min | “Try again later” stage retry | | `FANAVARAN_MAX_RETRIES` | 2 | Per stage | | `TRANSIENT_BACKOFF_MS` | 5 min | Tenant-wide auth backoff | | Token TTL | Until Tehran midnight | Auth cache | --- ## Plate letter codes `FANAVARAN_PLATE_LETTER_CODE` maps Persian plate letters → Fanavaran middle codes (shared mapping table in claim service).