feat(migrations): add national_code_verified flag to users and normalize bank_account representation
- Added a new column `national_code_verified` to the `users` table. - Normalized the `bank_account` field in the `representations` table from a single object to an array of IBANs with a default `verified` status of false. feat(ApiIrService): implement identity verification client for api.ir - Created `ApiIrService` to handle identity verification via api.ir. - Implemented methods for matching national code with mobile and IBAN with national code and birth date. - Added error handling and logging for external API requests.
This commit is contained in:
+29
-13
@@ -91,23 +91,16 @@ Request a settlement (withdrawal from wallet to bank account).
|
||||
```json
|
||||
{
|
||||
"amount_rials": 1000000,
|
||||
"bank_account": {
|
||||
"iban": "IR...",
|
||||
"account_number": "1234567890",
|
||||
"bank_name": "بانک ملت",
|
||||
"owner_name": "علی احمدی"
|
||||
}
|
||||
"iban_id": "iban-uuid-..."
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `amount_rials` | integer | ✅ | Amount to withdraw (must be ≤ wallet balance) |
|
||||
| `bank_account` | object | ❌ | Bank account details (saved if not previously set) |
|
||||
| `bank_account.iban` | string | ❌ | IBAN (شبا) |
|
||||
| `bank_account.account_number` | string | ❌ | Account number |
|
||||
| `bank_account.bank_name` | string | ❌ | Bank name |
|
||||
| `bank_account.owner_name` | string | ❌ | Account owner name |
|
||||
| `iban_id` | string | ✅ | شناسهی یکی از شباهای **تأییدشدهی** نماینده (از `GET /api/v1/representation/me` → `bank_account[].id`) |
|
||||
|
||||
> شبای انتخابی بهصورت snapshot (`iban`, `bank_name`, `owner_name`) داخل خود رکورد تسویه ذخیره میشود؛ حذف بعدی شبا در پروفایل، این رکورد را تغییر نمیدهد. مبلغ همان لحظهی ثبت از کیفپول کسر (debit) میشود.
|
||||
|
||||
### Response `201`
|
||||
```json
|
||||
@@ -131,7 +124,9 @@ Request a settlement (withdrawal from wallet to bank account).
|
||||
| Code | HTTP | Description |
|
||||
|------|------|-------------|
|
||||
| `ERR_AUTH_001` | 401 | Missing token |
|
||||
| `ERR_VALIDATION_001` | 422 | Amount exceeds balance or invalid amount |
|
||||
| `ERR_VALIDATION_001` | 422 | مبلغ نامعتبر/بیش از موجودی، یا شبا تأییدنشده/نامعتبر (`field: iban_id`) |
|
||||
| `ERR_VALIDATION_002` | 422 | `iban_id` ارسال نشده (`field: iban_id`) |
|
||||
| `ERR_CONFLICT_001` | 422 | موجودی کافی نیست |
|
||||
|
||||
---
|
||||
|
||||
@@ -274,9 +269,30 @@ Updated settlement object with `status: "rejected"`.
|
||||
{ "success": true, "data": { "uuid": "...", "url": "/uploads/settlements/receipts/2026-06/...", "filename": "...", "filemime": "image/jpeg" } }
|
||||
```
|
||||
|
||||
### POST `/api/v1/settlement/{uuid}/receipt`
|
||||
|
||||
ذخیرهی رسید پرداخت **بدون** نهاییسازی. فقط روی تسویهی **approved**؛ وضعیت تغییر نمیکند (همچنان `approved`). پس از این مرحله دکمهی «تکمیل» در پنل فعال میشود. **Permission:** `ROLE_ADMIN`
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{ "receipt": "/uploads/settlements/receipts/2026-06/..." }
|
||||
```
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `receipt` | string | ✅ | URL رسیدِ آپلودشده |
|
||||
|
||||
**Response `200`:** آبجکت تسویه (با `receipt` ذخیرهشده، `status: "approved"`).
|
||||
|
||||
**Errors:**
|
||||
| Code | HTTP | Description |
|
||||
|------|------|-------------|
|
||||
| `ERR_NOT_FOUND_001` | 404 | درخواست یافت نشد |
|
||||
| `ERR_VALIDATION_001` | 422 | تسویه approved نیست |
|
||||
| `ERR_VALIDATION_002` | 422 | `receipt` خالی (`field: receipt`) |
|
||||
|
||||
### POST `/api/v1/settlement/{uuid}/paid`
|
||||
|
||||
ثبت پرداخت نهایی با رسید. فقط روی تسویهی **approved**. وضعیت → `paid` و `receipt` ذخیره میشود. کیفپول تغییر نمیکند. **Permission:** `ROLE_ADMIN`
|
||||
**«تکمیل»** — ثبت پرداخت نهایی. فقط روی تسویهی **approved**. وضعیت → `paid` و `receipt` ذخیره میشود. کیفپول تغییر نمیکند (مبلغ هنگام ثبت درخواست کسر شده). پس از تکمیل، آن مبلغ دیگر قابل درخواست تسویه نیست. **Permission:** `ROLE_ADMIN`
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
|
||||
Reference in New Issue
Block a user