Add payment module, BFF proxy, hub/dashboard/ops/PSP/merchant screens wired to real APIs, and mark payment-frontend complete in project status. Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
863 B
TypeScript
32 lines
863 B
TypeScript
"use client";
|
|
|
|
import { useQuery } from "@tanstack/react-query";
|
|
import { useTenantId } from "@/hooks/useTenantId";
|
|
import { paymentApi } from "@/modules/payment/services/payment-api";
|
|
|
|
export function usePaymentCapabilities() {
|
|
const { tenantId } = useTenantId();
|
|
return useQuery({
|
|
queryKey: ["payment", tenantId, "capabilities"],
|
|
queryFn: () => paymentApi.capabilities(tenantId!),
|
|
enabled: !!tenantId,
|
|
staleTime: 60_000,
|
|
});
|
|
}
|
|
|
|
export function usePaymentHealth() {
|
|
return useQuery({
|
|
queryKey: ["payment", "health"],
|
|
queryFn: () => paymentApi.health(),
|
|
});
|
|
}
|
|
|
|
export function usePaymentMetrics() {
|
|
const { tenantId } = useTenantId();
|
|
return useQuery({
|
|
queryKey: ["payment", tenantId, "metrics"],
|
|
queryFn: () => paymentApi.metrics(tenantId ?? undefined),
|
|
staleTime: 30_000,
|
|
});
|
|
}
|