"use client"; import { useQuery } from "@tanstack/react-query"; import Link from "next/link"; import { useTenantId } from "@/hooks/useTenantId"; import { paymentApi } from "@/modules/payment/services/payment-api"; import { PaymentPageLoader, PaymentPageError, PaymentEmptyState } from "@/modules/payment/pages/shared"; import { PageHeader, Card, CardContent } from "@/components/ds"; import { PaymentStatusChip } from "@/modules/payment/components/PaymentStatusChip"; export const PaymentCallbacks = function PaymentCallbacksPage() { const { tenantId } = useTenantId(); const q = useQuery({ queryKey: ["payment", tenantId, "callbacks"], queryFn: async () => { const [audit, requests] = await Promise.all([ paymentApi.audit.list(tenantId!), paymentApi.requests.list(tenantId!), ]); const callbackAudit = audit.filter( (a) => String(a.entity_type ?? "").includes("Callback") || String(a.action ?? "").toLowerCase().includes("callback") ); const awaiting = requests.filter((r) => r.status === "redirect_issued"); return { callbackAudit, awaiting }; }, enabled: !!tenantId, }); if (!tenantId || q.isLoading) return ; if (q.error) return q.refetch()} />; const { callbackAudit, awaiting } = q.data!; return (

در انتظار callback ({awaiting.length})

{awaiting.length === 0 ? ( ) : (
    {awaiting.map((r) => (
  • {String(r.amount_minor)} {String(r.currency)}
  • ))}
)}

لاگ حسابرسی callback

{callbackAudit.length === 0 ? (

رویداد callback در audit ثبت نشده.

) : (
    {callbackAudit.map((a) => (
  • {String(a.action)} — {String(a.entity_type)} —{" "} {a.created_at ? new Date(String(a.created_at)).toLocaleString("fa-IR") : "—"}
  • ))}
)}
); }; export default PaymentCallbacks;