fix(inquiries): route all tenants through ESG and Fanavaran

This commit is contained in:
SepehrYahyaee
2026-11-21 15:27:06 +03:30
parent 61ef4faaf4
commit 1a38b98829
15 changed files with 675 additions and 860 deletions
+18 -120
View File
@@ -319,81 +319,21 @@ curl -X POST "$FANAVARAN_BIME_URL/car/third-party-car-financial-claims" \
--data @fanavaran-claim-submit.json
```
## Tejarat Inquiry Provider
Default base URL:
```sh
TEJARAT_INQUIRY_BASE_URL="${TEJARAT_INQUIRY_BASE_URL:-http://82.99.202.245:3027}"
TEJARAT_INQUIRY_EMAIL='xxx@example.com'
TEJARAT_INQUIRY_PASSWORD='123321'
```
Used by `src/sand-hub/sand-hub.service.ts` for third-party plate and car-body plate inquiries when ESG is not selected.
### Sequence
1. Login to `/user/login`.
2. Use returned `accessToken` as `Authorization: Bearer ...`.
3. Call inquiry endpoint.
### Login
```sh
curl -X POST "$TEJARAT_INQUIRY_BASE_URL/user/login" \
-H "Accept: */*" \
-H "Content-Type: application/json" \
--data '{
"email": "'"$TEJARAT_INQUIRY_EMAIL"'",
"password": "'"$TEJARAT_INQUIRY_PASSWORD"'"
}'
```
```sh
TEJARAT_ACCESS_TOKEN="<response accessToken>"
```
### Third-Party Plate / Policy Block Inquiry
```sh
curl -X POST "$TEJARAT_INQUIRY_BASE_URL/block-inquiry-tejarat" \
-H "Authorization: Bearer $TEJARAT_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
--data '{
"leftTwoDigits": "12",
"serialLetter": "ب",
"threeDigits": "345",
"rightTwoDigits": "67",
"nationalCode": "0012345678"
}'
```
### Car-Body Plate Inquiry
```sh
curl -X POST "$TEJARAT_INQUIRY_BASE_URL/block-inquiry-tejarat/badane" \
-H "Authorization: Bearer $TEJARAT_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
--data '{
"part1": 12,
"part2": "ب",
"part3": 345,
"part4": 67,
"nationalCode": "0012345678"
}'
```
## ESG Inquiry Provider
Default/fallback base URL in some call sites:
Used by `src/sand-hub/sand-hub.service.ts` for third-party plate/VIN, identity
and Sheba inquiries in **every tenant**, including Moalem (`CLIENT_ID=7`).
```sh
ESG_URL="${ESG_URL:-http://192.168.20.22:8085}"
ESG_URL="https://<gateway-host>/<optional-prefix>"
ESG_USERNAME="<gateway-username>"
ESG_PASSWORD="<gateway-password>"
```
Used by `src/sand-hub/sand-hub.service.ts` for selected tenants, for example when `CLIENT_ID=8`.
There is no fallback URL or fallback to the deprecated Tejarat provider.
Car-body plate and VIN inquiries use the tenant’s Fanavaran profile through
`LookupsService.findLastProcessedCarPolicy("car-body", query)`, not ESG.
See [inquiry provider routing](inquiry-provider-routing.md) for deployment notes.
### Sequence
@@ -417,7 +357,7 @@ curl -X POST "$ESG_URL/auth/login" \
ESG_ACCESS_TOKEN="<response accessToken>"
```
### Car By Plate (canonical Parsian third-party plate inquiry)
### Car By Plate (third-party inquiry for all tenants)
```sh
curl -X POST "$ESG_URL/inquiry/carByPlate" \
@@ -483,15 +423,18 @@ curl -X POST "$ESG_URL/inquiry/sheba" \
## SandHub Provider
Used by `src/sand-hub/sand-hub.service.ts` for legacy inquiry flows.
Used only for the optional driving-licence and legal vehicle-ownership checks.
The current ESG API has no equivalent contract for these checks. Plate/VIN,
personal identity and Sheba inquiries do not use this adapter. Configure these
settings only when the optional checks are enabled.
Environment:
```sh
SANHUB_BASE_URL='http://82.99.202.245:3027'
SANHUB_URL_LOGIN='http://82.99.202.245:3027/user/login'
SANHUB_USERNAME='default@admin.com'
SANHUB_PASSWORD='123321'
SANHUB_BASE_URL='https://<optional-check-provider>'
SANHUB_URL_LOGIN='https://<optional-check-provider>/<login-path>'
SANHUB_USERNAME='<optional-check-username>'
SANHUB_PASSWORD='<optional-check-password>'
```
### Sequence
@@ -515,37 +458,6 @@ curl -X POST "$SANHUB_URL_LOGIN" \
SANHUB_ACCESS_TOKEN="<response accessToken>"
```
### Third-Party Plate / Policy Block Inquiry
```sh
curl -X POST "$SANHUB_BASE_URL/block-inquiry-tejarat" \
-H "Authorization: Bearer $SANHUB_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
--data '{
"leftTwoDigits": "12",
"serialLetter": "ب",
"threeDigits": "345",
"rightTwoDigits": "67",
"nationalCode": "0012345678"
}'
```
### Personal Inquiry
The app converts Jalali birth dates to Gregorian before sending to SandHub.
```sh
curl -X POST "$SANHUB_BASE_URL/personal-inquiry/tejarat-no" \
-H "Authorization: Bearer $SANHUB_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
--data '{
"nationalCode": "0012345678",
"birthdate": "1999-02-13"
}'
```
### Driving License Check
```sh
@@ -575,20 +487,6 @@ curl -X POST "$SANHUB_BASE_URL/ownership" \
}'
```
### Sheba Validation
```sh
curl -X POST "$SANHUB_BASE_URL/sheba/sheba-tejaratno" \
-H "Authorization: Bearer $SANHUB_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
--data '{
"AccountOwnerType": "1",
"NationalId": "0012345678",
"ShebaId": "IR000000000000000000000000"
}'
```
## Map.ir Reverse Geocoding
Used by `src/claim-request-management/claim-request-management.service.ts`.