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:
@@ -9,6 +9,12 @@ import { formatDate, formatDateTime, formatRial } from '../lib/utils';
|
||||
import PageHeader from '../components/ui/PageHeader';
|
||||
import StatusBadge from '../components/ui/StatusBadge';
|
||||
|
||||
const PAYMENT_TYPE_LABELS: Record<string, string> = {
|
||||
appointment: 'نوبت',
|
||||
subscription: 'اشتراک',
|
||||
sms_wallet: 'کیف پول پیامک',
|
||||
};
|
||||
|
||||
function InfoRow({ label, value }: { label: string; value: React.ReactNode }) {
|
||||
return (
|
||||
<div className="cp-info-row">
|
||||
@@ -24,7 +30,7 @@ export default function PaymentDetailPage() {
|
||||
|
||||
const { data, isLoading } = useQuery({
|
||||
queryKey: ['payment', uuid],
|
||||
queryFn: () => api.get<ApiResponse<Payment>>(`/api/v1/payment/${uuid}`),
|
||||
queryFn: () => api.get<ApiResponse<Payment>>(`/api/v1/admin/payments/${uuid}`),
|
||||
enabled: !!uuid,
|
||||
});
|
||||
|
||||
@@ -58,7 +64,10 @@ export default function PaymentDetailPage() {
|
||||
<div className="max-w-lg">
|
||||
<div className="bg-white rounded-2xl border border-gray-100 shadow-sm p-6">
|
||||
<InfoRow label="شناسه" value={<span dir="ltr" className="font-mono text-xs">{payment.uuid}</span>} />
|
||||
<InfoRow label="شماره سفارش" value={payment.order_id ? <span dir="ltr" className="font-mono text-xs">{payment.order_id}</span> : null} />
|
||||
<InfoRow label="بیمار" value={payment.patient_name} />
|
||||
<InfoRow label="موبایل" value={<span dir="ltr">{payment.patient_mobile}</span>} />
|
||||
<InfoRow label="نوع" value={PAYMENT_TYPE_LABELS[payment.type ?? ''] ?? payment.type} />
|
||||
<InfoRow label="مبلغ" value={formatRial(payment.amount)} />
|
||||
<InfoRow label="وضعیت" value={<StatusBadge type="payment" value={payment.status} />} />
|
||||
<InfoRow label="درگاه" value={<span className="uppercase">{payment.gateway}</span>} />
|
||||
|
||||
Reference in New Issue
Block a user