"use client"; import { useQuery } from "@tanstack/react-query"; import { useTenantId } from "@/hooks/useTenantId"; import { paymentApi } from "@/modules/payment/services/payment-api"; import { usePaymentHealth } from "@/modules/payment/hooks/usePaymentCapabilities"; import { PaymentPageLoader, PaymentPageError } from "@/modules/payment/pages/shared"; import { PageHeader, Card, CardContent, Badge } from "@/components/ds"; import { PaymentStatusChip } from "@/modules/payment/components/PaymentStatusChip"; export const PaymentGatewayHealth = function PaymentGatewayHealthPage() { const { tenantId } = useTenantId(); const health = usePaymentHealth(); const connectionsQ = useQuery({ queryKey: ["payment", tenantId, "psp-health"], queryFn: () => paymentApi.pspConnections.list(tenantId!), enabled: !!tenantId, }); if (!tenantId || connectionsQ.isLoading || health.isLoading) return ; if (connectionsQ.error) return connectionsQ.refetch()} />; return (
{health.data?.status ?? "—"} } />

سرویس: {health.data?.service}

نسخه: {health.data?.version}

وضعیت: {health.data?.status}

{(connectionsQ.data ?? []).map((c) => (

{String(c.name ?? c.provider_code)}

{String(c.provider_code)}

))} {(connectionsQ.data ?? []).length === 0 ? (

اتصال PSP ثبت نشده — از بخش مدیریت درگاه اضافه کنید.

) : null}
); }; export default PaymentGatewayHealth;