(null);
+ const [showRawLogs, setShowRawLogs] = useState(false);
const fetchStats = async () => {
try {
@@ -101,6 +122,22 @@ export default function Transactions() {
}
};
+ const fetchHealth = async (silent = false) => {
+ try {
+ if (!silent) setHealthLoading(true);
+ const res = await api.get('/payment/admin/health');
+ if (res.data) {
+ setHealth(res.data);
+ if (!silent) toast.success(`وضعیت درگاه زیبال: ${res.data.status} (${res.data.latencyMs}ms)`);
+ }
+ } catch (e) {
+ console.error('Failed to fetch gateway health', e);
+ if (!silent) toast.error('عدم دسترسی به سرویس Health Check درگاه');
+ } finally {
+ if (!silent) setHealthLoading(false);
+ }
+ };
+
const fetchTransactions = useCallback(async () => {
try {
setIsLoading(true);
@@ -131,6 +168,7 @@ export default function Transactions() {
useEffect(() => {
fetchTransactions();
fetchStats();
+ fetchHealth(true);
}, [fetchTransactions]);
const handleCopy = (text: string, title: string) => {
@@ -143,7 +181,7 @@ export default function Transactions() {
setIsReconciling(true);
const res = await api.post('/payment/admin/reconcile');
toast.success(
- `انطباق تراکنشها انجام شد: ${res.data.verified} تایید شده، ${res.data.failed} ناموفق`,
+ `انطباق انجام شد: ${res.data.verified} تایید شده، ${res.data.failed} ناموفق`,
);
fetchTransactions();
fetchStats();
@@ -181,20 +219,63 @@ export default function Transactions() {
لاگها و مدیریت تراکنشهای مالی
- رهگیری لحظهای پرداختهای آنلاین زیبال، کارت به کارت، کیف پول و عیبیابی تراکنشها
+ رهگیری لحظهای پرداختهای آنلاین زیبال، بررسی لاگهای خام و عیبیابی تراکنشها
-
+
+
+
+
+
+ {/* Gateway Health Monitor Banner */}
+ {health && (
+
+
+
+
+
+
+
+
+ {health.gatewayName}
+
+ {health.status}
+
+
+
{health.message}
+
+
+
+
+
+
+ تاخیر: {health.latencyMs} ms
+
+
+
+ مرچنت: {health.activeMerchant}
+
+
+
+ )}
+
{/* Summary Stat Cards */}
{stats && (
@@ -488,6 +569,7 @@ export default function Transactions() {
onClick={() => {
setSelectedTx(tx);
setLiveInquiryData(null);
+ setShowRawLogs(false);
}}
className="p-2 bg-gray-100 hover:bg-purple-50 text-gray-600 hover:text-purple-600 rounded-xl transition-all"
title="مشاهده جزئیات و عیبیابی"
@@ -598,6 +680,24 @@ export default function Transactions() {
{selectedTx.cardNumber || 'ثبت نشده'}
+
+ {selectedTx.ipAddress && (
+
+ IP کلاینت:
+
+ {selectedTx.ipAddress}
+
+
+ )}
+
+ {selectedTx.userAgent && (
+
+ User-Agent دستگاه:
+
+ {selectedTx.userAgent}
+
+
+ )}
{/* Error Message / Reason */}
@@ -661,12 +761,48 @@ export default function Transactions() {
)}
+ {/* Raw Request & Response Inspector Toggle */}
+
+
+
+ {showRawLogs && (
+
+ {selectedTx.rawRequest && (
+
+
// Raw Request:
+
{JSON.stringify(selectedTx.rawRequest, null, 2)}
+
+ )}
+ {selectedTx.rawResponse && (
+
+
// Raw Response:
+
{JSON.stringify(selectedTx.rawResponse, null, 2)}
+
+ )}
+ {!selectedTx.rawRequest && !selectedTx.rawResponse && (
+
// لاگ خامی برای این تراکنش ثبت نشده است.
+ )}
+
+ )}
+
+
{/* Close Button */}
- 3234 nodes · 5269 edges · 285 communities
+ 3257 nodes · 5318 edges · 291 communities