([]);
- // ─── Query: /payment-history/payments/:id/gateway ──────────────────────────
- const effectiveId = paymentId || orderId;
- const { data: rawData, isLoading } = useGetPaymentGateway(effectiveId);
+ // ─── Query: /payment-history/:id?lang=tm ───────────────────────────────────
+ const { data: historyData, isLoading } = useGetOrderPaymentHistory(orderId, { lang: "tm" });
const items = useMemo(() => {
- let list: any[] = [];
- if (Array.isArray(rawData)) {
- list = rawData;
- } else if (rawData && typeof rawData === "object" && (rawData as any).id) {
- list = [rawData];
- } else if (rawData && Array.isArray((rawData as any).items)) {
- list = (rawData as any).items;
- }
+ const list = historyData?.items ?? [];
if (!search.trim()) return list;
const q = search.trim().toLowerCase();
@@ -137,13 +118,11 @@ export function PaymentHistoryTable({ orderId, paymentId }: PaymentHistoryTableP
const haystack = [r.id, getPayerFullName(r), getMaskedCard(r), getReference(r), r.orderId].join(" ").toLowerCase();
return haystack.includes(q);
});
- }, [rawData, search]);
+ }, [historyData, search]);
const totalCount = useMemo(() => {
- if (Array.isArray(rawData)) return rawData.length;
- if (rawData && typeof (rawData as any).count === "number") return (rawData as any).count;
- return items.length;
- }, [rawData, items]);
+ return historyData?.count ?? items.length;
+ }, [historyData, items]);
const totalPages = Math.ceil(totalCount / perPage) || 1;
@@ -234,21 +213,14 @@ export function PaymentHistoryTable({ orderId, paymentId }: PaymentHistoryTableP
{
id: "isPaid",
header: t("intlPayment.historyColumns.isPaid", "Tölenen"),
- cell: ({ row }) => (
-
- ),
+ cell: ({ row }) => ,
size: 110,
},
{
- id: "isSynced",
- header: t("intlPayment.historyColumns.isSynced", "Ulgam bn birikdirilen"),
- cell: ({ row }) => (
-
- ),
+ id: "gatewayStatus",
+ accessorKey: "gatewayStatus",
+ header: t("onlinePayments.columns.gatewayStatus", "Gateway statusy"),
+ cell: ({ row }) => ,
size: 130,
},
{
@@ -257,7 +229,7 @@ export function PaymentHistoryTable({ orderId, paymentId }: PaymentHistoryTableP
cell: ({ row }) => (
{/* Storage (Database) icon: opens payment detail dialog */}
- {/* */}
+
+
{/* Eye icon: opens last-step dialog */}
{/* Single history table */}
-
+