feat(payment): add payment detail endpoint and update payment model with order_id and patient_name

feat(appointment): enhance appointment detail page with time formatting and additional info
fix(payment): update payment query to fetch from the correct endpoint and adjust response structure
docs(api): add search parameter to payments API documentation and detail response structure
test(payment): add unit test for MellatGateway to verify null credentials handling
This commit is contained in:
hamed
2026-07-02 15:10:15 +03:30
parent 1e342a695f
commit ca71c49451
8 changed files with 181 additions and 27 deletions
+47 -4
View File
@@ -600,6 +600,11 @@ List all payments.
| `limit` | integer | ❌ | Default: 20 |
| `status` | string | ❌ | `"pending"`, `"paid"`, `"failed"`, `"cancelled"` |
### Query Parameters (تکمیل)
| Param | Type | Required | Description |
|-------|------|----------|-------------|
| `search` | string | ❌ | جستجو در موبایل کاربر، `reference_id` یا `order_id` |
### Response `200`
```json
{
@@ -607,17 +612,55 @@ List all payments.
"data": [
{
"uuid": "...",
"order_id": "CLINICPRO-...",
"amount_rials": 500000,
"status": "paid",
"amount": 500000,
"status": "success",
"gateway": "mellat",
"created_at": 1717000000
"ref_id": "1234567",
"patient_mobile": "0912...",
"paid_at": "2026-07-02T09:00:00+03:30",
"created_at": "2026-07-02T08:55:00+03:30"
}
],
"meta": { "totalRecords": 7800, "totalPages": 390, "currentPage": 1 }
}
```
> `amount` بر حسب ریال، `ref_id` همان `reference_id` درگاه، `paid_at` فقط برای پرداخت `success` (بر اساس `updated_at`) و در غیر این‌صورت `null`. تاریخ‌ها ISO-8601.
---
### GET `/api/v1/admin/payments/{uuid}`
جزئیات یک پرداخت. **پاسخ تخت است** (`data` مستقیم آبجکت پرداخت، نه nested).
**Permission:** `ROLE_ADMIN`
### Response `200`
```json
{
"success": true,
"data": {
"uuid": "...",
"order_id": "ORD-XXXX",
"amount": 500000,
"status": "success",
"gateway": "mellat",
"type": "appointment",
"ref_id": "1234567",
"patient_mobile": "0912...",
"patient_name": "علی احمدی",
"appointment_uuid": "...",
"paid_at": "2026-07-02T09:00:00+03:30",
"created_at": "2026-07-02T08:55:00+03:30"
}
}
```
### Errors
| Code | HTTP | Description |
|------|------|-------------|
| `ERR_NOT_FOUND_001` | 404 | پرداخت یافت نشد |
---
## Settlement Management