From ca71c494510f7fc0cafabda50c90bf69e274bfc2 Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Thu, 2 Jul 2026 15:10:15 +0330 Subject: [PATCH] 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 --- assets/admin/pages/AppointmentDetailPage.tsx | 22 ++++++--- assets/admin/pages/PaymentDetailPage.tsx | 11 ++++- assets/admin/types/index.ts | 3 ++ docs/api/admin.md | 51 ++++++++++++++++++-- src/Admin/Controller/AdminApiController.php | 48 ++++++++++++++++++ src/Payment/Gateway/MellatGateway.php | 37 +++++++++----- src/Payment/Gateway/SepGateway.php | 11 +++-- tests/Payment/MellatGatewayTest.php | 25 ++++++++++ 8 files changed, 181 insertions(+), 27 deletions(-) create mode 100644 tests/Payment/MellatGatewayTest.php diff --git a/assets/admin/pages/AppointmentDetailPage.tsx b/assets/admin/pages/AppointmentDetailPage.tsx index 9e3f42bf..73b7aefb 100644 --- a/assets/admin/pages/AppointmentDetailPage.tsx +++ b/assets/admin/pages/AppointmentDetailPage.tsx @@ -6,7 +6,7 @@ import { toast } from 'sonner'; import { api } from '../lib/api'; import type { ApiResponse } from '../lib/api'; import type { Appointment, AppointmentStatus } from '../types'; -import { formatDate, formatDateTime } from '../lib/utils'; +import { formatDate, formatDateTime, toDate } from '../lib/utils'; import PageHeader from '../components/ui/PageHeader'; import StatusBadge from '../components/ui/StatusBadge'; import ConfirmDialog from '../components/ui/ConfirmDialog'; @@ -22,6 +22,13 @@ const ALL_STATUSES: { value: AppointmentStatus; label: string }[] = [ { value: 'expired', label: 'منقضی' }, ]; +const timeOf = (ts?: number | null) => { + const d = toDate(ts ?? null); + return d + ? new Intl.DateTimeFormat('fa-IR-u-nu-latn', { hour: '2-digit', minute: '2-digit', hour12: false }).format(d) + : '—'; +}; + function InfoRow({ label, value }: { label: string; value: React.ReactNode }) { return (