order-management 0.0.57 → 0.0.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +862 -14
- package/.medusa/server/src/admin/index.mjs +864 -16
- package/.medusa/server/src/api/admin/payment-transactions/[id]/route.js +77 -0
- package/.medusa/server/src/api/admin/payment-transactions/route.js +115 -0
- package/.medusa/server/src/api/admin/payment-transactions/validators.js +22 -0
- package/.medusa/server/src/api/admin/refunds/[id]/route.js +159 -0
- package/.medusa/server/src/api/admin/refunds/route.js +187 -0
- package/.medusa/server/src/api/admin/refunds/validators.js +28 -0
- package/package.json +1 -1
|
@@ -370,6 +370,503 @@ const OrderRefundContextWidget = (props) => {
|
|
|
370
370
|
adminSdk.defineWidgetConfig({
|
|
371
371
|
zone: "order.details.after"
|
|
372
372
|
});
|
|
373
|
+
const useDebounce$3 = (value, delay) => {
|
|
374
|
+
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
375
|
+
react.useEffect(() => {
|
|
376
|
+
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
377
|
+
return () => clearTimeout(handler);
|
|
378
|
+
}, [value, delay]);
|
|
379
|
+
return debouncedValue;
|
|
380
|
+
};
|
|
381
|
+
const getStatusBadgeClass$7 = (status) => {
|
|
382
|
+
const s = status.toLowerCase();
|
|
383
|
+
if (s === "captured" || s === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
384
|
+
if (s === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
385
|
+
if (s === "error" || s === "canceled" || s === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
386
|
+
if (s === "pending" || s === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
387
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
388
|
+
};
|
|
389
|
+
const PaymentsPage = () => {
|
|
390
|
+
const navigate = reactRouterDom.useNavigate();
|
|
391
|
+
const [items, setItems] = react.useState([]);
|
|
392
|
+
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
393
|
+
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
394
|
+
const debouncedOrderId = useDebounce$3(orderIdSearch, 300);
|
|
395
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
396
|
+
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
397
|
+
const [error, setError] = react.useState(null);
|
|
398
|
+
const [offset, setOffset] = react.useState(0);
|
|
399
|
+
const [count, setCount] = react.useState(0);
|
|
400
|
+
const limit = 50;
|
|
401
|
+
const loadTransactions = react.useCallback(
|
|
402
|
+
async (nextOffset, replace) => {
|
|
403
|
+
try {
|
|
404
|
+
if (replace) setIsLoading(true);
|
|
405
|
+
else setIsFetchingMore(true);
|
|
406
|
+
setError(null);
|
|
407
|
+
const params = new URLSearchParams();
|
|
408
|
+
params.set("limit", String(limit));
|
|
409
|
+
params.set("offset", String(nextOffset));
|
|
410
|
+
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
411
|
+
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
412
|
+
const response = await fetch(
|
|
413
|
+
`/admin/payment-transactions?${params.toString()}`,
|
|
414
|
+
{ credentials: "include" }
|
|
415
|
+
);
|
|
416
|
+
if (!response.ok) {
|
|
417
|
+
const text = await response.text();
|
|
418
|
+
throw new Error(text || "Failed to load payment transactions");
|
|
419
|
+
}
|
|
420
|
+
const payload = await response.json();
|
|
421
|
+
const list = payload.transactions ?? [];
|
|
422
|
+
setCount(payload.count ?? 0);
|
|
423
|
+
setOffset(nextOffset + list.length);
|
|
424
|
+
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
425
|
+
} catch (e) {
|
|
426
|
+
setError(e instanceof Error ? e.message : "Failed to load");
|
|
427
|
+
} finally {
|
|
428
|
+
setIsLoading(false);
|
|
429
|
+
setIsFetchingMore(false);
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
[statusFilter, debouncedOrderId]
|
|
433
|
+
);
|
|
434
|
+
react.useEffect(() => {
|
|
435
|
+
void loadTransactions(0, true);
|
|
436
|
+
}, [loadTransactions]);
|
|
437
|
+
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
438
|
+
const displayStatus = (t) => {
|
|
439
|
+
const s = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
440
|
+
return s !== "" ? s : "—";
|
|
441
|
+
};
|
|
442
|
+
const displayAmount = (t) => {
|
|
443
|
+
const num = Number(t.amount) / 100;
|
|
444
|
+
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
445
|
+
return `${code} ${num.toFixed(2)}`;
|
|
446
|
+
};
|
|
447
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-6", children: [
|
|
448
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
449
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
450
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payments" }),
|
|
451
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
452
|
+
] }),
|
|
453
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
454
|
+
] }),
|
|
455
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
456
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
457
|
+
ui.Input,
|
|
458
|
+
{
|
|
459
|
+
placeholder: "Search by Order ID",
|
|
460
|
+
value: orderIdSearch,
|
|
461
|
+
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
462
|
+
className: "md:max-w-sm",
|
|
463
|
+
"aria-label": "Search by order ID"
|
|
464
|
+
}
|
|
465
|
+
),
|
|
466
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
467
|
+
"select",
|
|
468
|
+
{
|
|
469
|
+
value: statusFilter,
|
|
470
|
+
onChange: (e) => setStatusFilter(e.target.value),
|
|
471
|
+
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-xs",
|
|
472
|
+
"aria-label": "Filter by status",
|
|
473
|
+
children: [
|
|
474
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
475
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
476
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
477
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
478
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
479
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
480
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
481
|
+
]
|
|
482
|
+
}
|
|
483
|
+
) })
|
|
484
|
+
] }),
|
|
485
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
486
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
487
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => loadTransactions(0, true), children: "Try again" }) })
|
|
488
|
+
] }) : null,
|
|
489
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading payments…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
490
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
491
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
492
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
493
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
494
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
495
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
496
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
497
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
498
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
499
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
500
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
501
|
+
] }) }),
|
|
502
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
503
|
+
"tr",
|
|
504
|
+
{
|
|
505
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
506
|
+
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
507
|
+
children: [
|
|
508
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
509
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
510
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
511
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
512
|
+
ui.Badge,
|
|
513
|
+
{
|
|
514
|
+
size: "2xsmall",
|
|
515
|
+
className: `uppercase ${getStatusBadgeClass$7(displayStatus(t))}`,
|
|
516
|
+
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
517
|
+
}
|
|
518
|
+
) }),
|
|
519
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
520
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
521
|
+
year: "numeric",
|
|
522
|
+
month: "short",
|
|
523
|
+
day: "numeric",
|
|
524
|
+
hour: "numeric",
|
|
525
|
+
minute: "2-digit",
|
|
526
|
+
hour12: true
|
|
527
|
+
}) }),
|
|
528
|
+
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: "px-4 py-4", children: [
|
|
529
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
530
|
+
ui.Button,
|
|
531
|
+
{
|
|
532
|
+
variant: "transparent",
|
|
533
|
+
size: "small",
|
|
534
|
+
onClick: (e) => {
|
|
535
|
+
e.stopPropagation();
|
|
536
|
+
navigate(`/payments/${t.payment_session_id}`);
|
|
537
|
+
},
|
|
538
|
+
children: "View details"
|
|
539
|
+
}
|
|
540
|
+
),
|
|
541
|
+
t.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
542
|
+
ui.Button,
|
|
543
|
+
{
|
|
544
|
+
variant: "transparent",
|
|
545
|
+
size: "small",
|
|
546
|
+
onClick: (e) => {
|
|
547
|
+
e.stopPropagation();
|
|
548
|
+
navigate(`/orders/${t.order_id}`);
|
|
549
|
+
},
|
|
550
|
+
children: "Order"
|
|
551
|
+
}
|
|
552
|
+
) : null
|
|
553
|
+
] })
|
|
554
|
+
]
|
|
555
|
+
},
|
|
556
|
+
t.payment_session_id
|
|
557
|
+
)) })
|
|
558
|
+
] }) }),
|
|
559
|
+
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
560
|
+
ui.Button,
|
|
561
|
+
{
|
|
562
|
+
variant: "secondary",
|
|
563
|
+
isLoading: isFetchingMore,
|
|
564
|
+
onClick: () => loadTransactions(offset, false),
|
|
565
|
+
children: "Load more"
|
|
566
|
+
}
|
|
567
|
+
) }) : null
|
|
568
|
+
] }) });
|
|
569
|
+
};
|
|
570
|
+
const config$7 = adminSdk.defineRouteConfig({
|
|
571
|
+
label: "Payments",
|
|
572
|
+
icon: icons.CreditCard
|
|
573
|
+
});
|
|
574
|
+
const useDebounce$2 = (value, delay) => {
|
|
575
|
+
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
576
|
+
react.useEffect(() => {
|
|
577
|
+
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
578
|
+
return () => clearTimeout(handler);
|
|
579
|
+
}, [value, delay]);
|
|
580
|
+
return debouncedValue;
|
|
581
|
+
};
|
|
582
|
+
const getStatusBadgeClass$6 = (status) => {
|
|
583
|
+
const s = status.toLowerCase();
|
|
584
|
+
if (s === "captured" || s === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
585
|
+
if (s === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
586
|
+
if (s === "error" || s === "canceled" || s === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
587
|
+
if (s === "pending" || s === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
588
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
589
|
+
};
|
|
590
|
+
const RefundsPage = () => {
|
|
591
|
+
const navigate = reactRouterDom.useNavigate();
|
|
592
|
+
const [items, setItems] = react.useState([]);
|
|
593
|
+
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
594
|
+
const debouncedOrderId = useDebounce$2(orderIdSearch, 300);
|
|
595
|
+
const [paymentStatusFilter, setPaymentStatusFilter] = react.useState("all");
|
|
596
|
+
const [providerSearch, setProviderSearch] = react.useState("");
|
|
597
|
+
const debouncedProvider = useDebounce$2(providerSearch, 300);
|
|
598
|
+
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
599
|
+
const debouncedCurrency = useDebounce$2(currencySearch, 300);
|
|
600
|
+
const [dateFrom, setDateFrom] = react.useState("");
|
|
601
|
+
const [dateTo, setDateTo] = react.useState("");
|
|
602
|
+
const [amountMin, setAmountMin] = react.useState("");
|
|
603
|
+
const [amountMax, setAmountMax] = react.useState("");
|
|
604
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
605
|
+
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
606
|
+
const [error, setError] = react.useState(null);
|
|
607
|
+
const [offset, setOffset] = react.useState(0);
|
|
608
|
+
const [count, setCount] = react.useState(0);
|
|
609
|
+
const limit = 50;
|
|
610
|
+
const loadRefunds = react.useCallback(
|
|
611
|
+
async (nextOffset, replace) => {
|
|
612
|
+
try {
|
|
613
|
+
if (replace) setIsLoading(true);
|
|
614
|
+
else setIsFetchingMore(true);
|
|
615
|
+
setError(null);
|
|
616
|
+
const params = new URLSearchParams();
|
|
617
|
+
params.set("limit", String(limit));
|
|
618
|
+
params.set("offset", String(nextOffset));
|
|
619
|
+
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
620
|
+
if (paymentStatusFilter !== "all") params.set("payment_status", paymentStatusFilter);
|
|
621
|
+
if (debouncedProvider.trim()) params.set("provider_id", debouncedProvider.trim());
|
|
622
|
+
if (debouncedCurrency.trim()) params.set("currency_code", debouncedCurrency.trim());
|
|
623
|
+
if (dateFrom.trim()) params.set("date_from", dateFrom.trim());
|
|
624
|
+
if (dateTo.trim()) params.set("date_to", dateTo.trim());
|
|
625
|
+
const min = amountMin.trim() ? Number(amountMin) : void 0;
|
|
626
|
+
const max = amountMax.trim() ? Number(amountMax) : void 0;
|
|
627
|
+
if (min != null && !Number.isNaN(min)) params.set("amount_min", String(min));
|
|
628
|
+
if (max != null && !Number.isNaN(max)) params.set("amount_max", String(max));
|
|
629
|
+
const response = await fetch(`/admin/refunds?${params.toString()}`, {
|
|
630
|
+
credentials: "include"
|
|
631
|
+
});
|
|
632
|
+
if (!response.ok) {
|
|
633
|
+
const text = await response.text();
|
|
634
|
+
throw new Error(text || "Failed to load refunds");
|
|
635
|
+
}
|
|
636
|
+
const payload = await response.json();
|
|
637
|
+
const list = payload.refunds ?? [];
|
|
638
|
+
setCount(payload.count ?? 0);
|
|
639
|
+
setOffset(nextOffset + list.length);
|
|
640
|
+
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
641
|
+
} catch (e) {
|
|
642
|
+
setError(e instanceof Error ? e.message : "Failed to load");
|
|
643
|
+
} finally {
|
|
644
|
+
setIsLoading(false);
|
|
645
|
+
setIsFetchingMore(false);
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
[
|
|
649
|
+
debouncedOrderId,
|
|
650
|
+
paymentStatusFilter,
|
|
651
|
+
debouncedProvider,
|
|
652
|
+
debouncedCurrency,
|
|
653
|
+
dateFrom,
|
|
654
|
+
dateTo,
|
|
655
|
+
amountMin,
|
|
656
|
+
amountMax
|
|
657
|
+
]
|
|
658
|
+
);
|
|
659
|
+
react.useEffect(() => {
|
|
660
|
+
void loadRefunds(0, true);
|
|
661
|
+
}, [loadRefunds]);
|
|
662
|
+
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
663
|
+
const displayAmount = (r) => {
|
|
664
|
+
const num = Number(r.amount) / 100;
|
|
665
|
+
const code = (r.currency_code ?? "USD").toUpperCase();
|
|
666
|
+
return `${code} ${num.toFixed(2)}`;
|
|
667
|
+
};
|
|
668
|
+
const displayStatus = (r) => {
|
|
669
|
+
const s = r.payment_status ?? "";
|
|
670
|
+
return s !== "" ? s : "—";
|
|
671
|
+
};
|
|
672
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-6", children: [
|
|
673
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
674
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
675
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refunds" }),
|
|
676
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Refund records — amount, order, payment status" })
|
|
677
|
+
] }),
|
|
678
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadRefunds(0, true), children: "Refresh" })
|
|
679
|
+
] }),
|
|
680
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
681
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
682
|
+
ui.Input,
|
|
683
|
+
{
|
|
684
|
+
placeholder: "Order ID",
|
|
685
|
+
value: orderIdSearch,
|
|
686
|
+
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
687
|
+
className: "md:max-w-[180px]",
|
|
688
|
+
"aria-label": "Filter by order ID"
|
|
689
|
+
}
|
|
690
|
+
),
|
|
691
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
692
|
+
ui.Input,
|
|
693
|
+
{
|
|
694
|
+
placeholder: "Provider",
|
|
695
|
+
value: providerSearch,
|
|
696
|
+
onChange: (e) => setProviderSearch(e.target.value),
|
|
697
|
+
className: "md:max-w-[140px]",
|
|
698
|
+
"aria-label": "Filter by provider"
|
|
699
|
+
}
|
|
700
|
+
),
|
|
701
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
702
|
+
ui.Input,
|
|
703
|
+
{
|
|
704
|
+
placeholder: "Currency",
|
|
705
|
+
value: currencySearch,
|
|
706
|
+
onChange: (e) => setCurrencySearch(e.target.value),
|
|
707
|
+
className: "md:max-w-[100px]",
|
|
708
|
+
"aria-label": "Filter by currency"
|
|
709
|
+
}
|
|
710
|
+
),
|
|
711
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
712
|
+
"select",
|
|
713
|
+
{
|
|
714
|
+
value: paymentStatusFilter,
|
|
715
|
+
onChange: (e) => setPaymentStatusFilter(e.target.value),
|
|
716
|
+
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-[160px]",
|
|
717
|
+
"aria-label": "Filter by payment status",
|
|
718
|
+
children: [
|
|
719
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
720
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
721
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
722
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
723
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
724
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
725
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
726
|
+
]
|
|
727
|
+
}
|
|
728
|
+
),
|
|
729
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
730
|
+
ui.Input,
|
|
731
|
+
{
|
|
732
|
+
type: "date",
|
|
733
|
+
placeholder: "From",
|
|
734
|
+
value: dateFrom,
|
|
735
|
+
onChange: (e) => setDateFrom(e.target.value),
|
|
736
|
+
className: "md:max-w-[140px]",
|
|
737
|
+
"aria-label": "Date from"
|
|
738
|
+
}
|
|
739
|
+
),
|
|
740
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
741
|
+
ui.Input,
|
|
742
|
+
{
|
|
743
|
+
type: "date",
|
|
744
|
+
placeholder: "To",
|
|
745
|
+
value: dateTo,
|
|
746
|
+
onChange: (e) => setDateTo(e.target.value),
|
|
747
|
+
className: "md:max-w-[140px]",
|
|
748
|
+
"aria-label": "Date to"
|
|
749
|
+
}
|
|
750
|
+
),
|
|
751
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
752
|
+
ui.Input,
|
|
753
|
+
{
|
|
754
|
+
placeholder: "Amount min",
|
|
755
|
+
value: amountMin,
|
|
756
|
+
onChange: (e) => setAmountMin(e.target.value),
|
|
757
|
+
type: "number",
|
|
758
|
+
min: 0,
|
|
759
|
+
className: "md:max-w-[100px]",
|
|
760
|
+
"aria-label": "Refund amount minimum"
|
|
761
|
+
}
|
|
762
|
+
),
|
|
763
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
764
|
+
ui.Input,
|
|
765
|
+
{
|
|
766
|
+
placeholder: "Amount max",
|
|
767
|
+
value: amountMax,
|
|
768
|
+
onChange: (e) => setAmountMax(e.target.value),
|
|
769
|
+
type: "number",
|
|
770
|
+
min: 0,
|
|
771
|
+
className: "md:max-w-[100px]",
|
|
772
|
+
"aria-label": "Refund amount maximum"
|
|
773
|
+
}
|
|
774
|
+
)
|
|
775
|
+
] }) }),
|
|
776
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
777
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
778
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => loadRefunds(0, true), children: "Try again" }) })
|
|
779
|
+
] }) : null,
|
|
780
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading refunds…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
781
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No refunds yet" }),
|
|
782
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Refund records will appear here." })
|
|
783
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full overflow-x-auto rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full table-fixed divide-y divide-ui-border-base", style: { minWidth: 0 }, children: [
|
|
784
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
785
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Refund ID" }),
|
|
786
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
787
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Payment ID" }),
|
|
788
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[8%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
789
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[6%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Currency" }),
|
|
790
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[10%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
791
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[10%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Payment Status" }),
|
|
792
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[14%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Note" }),
|
|
793
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
794
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[8%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
795
|
+
] }) }),
|
|
796
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((r) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
797
|
+
"tr",
|
|
798
|
+
{
|
|
799
|
+
className: "cursor-pointer hover:bg-ui-bg-subtle/60",
|
|
800
|
+
onClick: () => navigate(`/refunds/${r.refund_id}`),
|
|
801
|
+
children: [
|
|
802
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-mono text-sm text-ui-fg-base", title: r.refund_id, children: r.refund_id }),
|
|
803
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-medium text-ui-fg-base", title: r.order_id ?? void 0, children: r.order_id ?? "—" }),
|
|
804
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-mono text-sm text-ui-fg-subtle", title: r.payment_id, children: r.payment_id }),
|
|
805
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", children: displayAmount(r) }),
|
|
806
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle uppercase", children: r.currency_code || "—" }),
|
|
807
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", title: r.provider_id || void 0, children: r.provider_id || "—" }),
|
|
808
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
809
|
+
ui.Badge,
|
|
810
|
+
{
|
|
811
|
+
size: "2xsmall",
|
|
812
|
+
className: `uppercase ${getStatusBadgeClass$6(displayStatus(r))}`,
|
|
813
|
+
children: displayStatus(r) !== "—" ? displayStatus(r).replace(/_/g, " ") : "—"
|
|
814
|
+
}
|
|
815
|
+
) }),
|
|
816
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", title: r.note ?? void 0, children: r.note ?? "—" }),
|
|
817
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle text-xs", children: new Date(r.created_at).toLocaleDateString("en-US", {
|
|
818
|
+
month: "short",
|
|
819
|
+
day: "numeric",
|
|
820
|
+
hour: "numeric",
|
|
821
|
+
minute: "2-digit",
|
|
822
|
+
hour12: true
|
|
823
|
+
}) }),
|
|
824
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-1", children: [
|
|
825
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
826
|
+
ui.Button,
|
|
827
|
+
{
|
|
828
|
+
variant: "transparent",
|
|
829
|
+
size: "small",
|
|
830
|
+
onClick: (e) => {
|
|
831
|
+
e.stopPropagation();
|
|
832
|
+
navigate(`/refunds/${r.refund_id}`);
|
|
833
|
+
},
|
|
834
|
+
children: "Details"
|
|
835
|
+
}
|
|
836
|
+
),
|
|
837
|
+
r.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
838
|
+
ui.Button,
|
|
839
|
+
{
|
|
840
|
+
variant: "transparent",
|
|
841
|
+
size: "small",
|
|
842
|
+
onClick: (e) => {
|
|
843
|
+
e.stopPropagation();
|
|
844
|
+
navigate(`/orders/${r.order_id}`);
|
|
845
|
+
},
|
|
846
|
+
children: "Order"
|
|
847
|
+
}
|
|
848
|
+
) : null
|
|
849
|
+
] }) })
|
|
850
|
+
]
|
|
851
|
+
},
|
|
852
|
+
r.refund_id
|
|
853
|
+
)) })
|
|
854
|
+
] }) }),
|
|
855
|
+
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
856
|
+
ui.Button,
|
|
857
|
+
{
|
|
858
|
+
variant: "secondary",
|
|
859
|
+
isLoading: isFetchingMore,
|
|
860
|
+
onClick: () => loadRefunds(offset, false),
|
|
861
|
+
children: "Load more"
|
|
862
|
+
}
|
|
863
|
+
) }) : null
|
|
864
|
+
] }) });
|
|
865
|
+
};
|
|
866
|
+
const config$6 = adminSdk.defineRouteConfig({
|
|
867
|
+
label: "Refunds",
|
|
868
|
+
icon: icons.Receipt
|
|
869
|
+
});
|
|
373
870
|
const useDebounce$1 = (value, delay) => {
|
|
374
871
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
375
872
|
react.useEffect(() => {
|
|
@@ -378,7 +875,7 @@ const useDebounce$1 = (value, delay) => {
|
|
|
378
875
|
}, [value, delay]);
|
|
379
876
|
return debouncedValue;
|
|
380
877
|
};
|
|
381
|
-
const getStatusBadgeClass$
|
|
878
|
+
const getStatusBadgeClass$5 = (status) => {
|
|
382
879
|
const statusLower = status.toLowerCase();
|
|
383
880
|
if (statusLower === "requested") {
|
|
384
881
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -549,7 +1046,7 @@ const ReturnsPage = () => {
|
|
|
549
1046
|
ui.Badge,
|
|
550
1047
|
{
|
|
551
1048
|
size: "2xsmall",
|
|
552
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1049
|
+
className: `uppercase ${getStatusBadgeClass$5(returnOrder.status)}`,
|
|
553
1050
|
children: returnOrder.status.replace(/_/g, " ")
|
|
554
1051
|
}
|
|
555
1052
|
) }),
|
|
@@ -598,7 +1095,7 @@ const ReturnsPage = () => {
|
|
|
598
1095
|
) }) : null
|
|
599
1096
|
] }) });
|
|
600
1097
|
};
|
|
601
|
-
const config$
|
|
1098
|
+
const config$5 = adminSdk.defineRouteConfig({
|
|
602
1099
|
label: "Return Orders",
|
|
603
1100
|
icon: icons.ArrowPath
|
|
604
1101
|
});
|
|
@@ -610,7 +1107,7 @@ const useDebounce = (value, delay) => {
|
|
|
610
1107
|
}, [value, delay]);
|
|
611
1108
|
return debouncedValue;
|
|
612
1109
|
};
|
|
613
|
-
const getStatusBadgeClass$
|
|
1110
|
+
const getStatusBadgeClass$4 = (status) => {
|
|
614
1111
|
const statusLower = status.toLowerCase();
|
|
615
1112
|
if (statusLower === "requested") {
|
|
616
1113
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -778,7 +1275,7 @@ const SwapsPage = () => {
|
|
|
778
1275
|
ui.Badge,
|
|
779
1276
|
{
|
|
780
1277
|
size: "2xsmall",
|
|
781
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1278
|
+
className: `uppercase ${getStatusBadgeClass$4(swap.status)}`,
|
|
782
1279
|
children: swap.status.replace(/_/g, " ")
|
|
783
1280
|
}
|
|
784
1281
|
) }),
|
|
@@ -828,10 +1325,321 @@ const SwapsPage = () => {
|
|
|
828
1325
|
) }) : null
|
|
829
1326
|
] }) });
|
|
830
1327
|
};
|
|
831
|
-
const config$
|
|
1328
|
+
const config$4 = adminSdk.defineRouteConfig({
|
|
832
1329
|
label: "Exchanges",
|
|
833
1330
|
icon: icons.ArrowPath
|
|
834
1331
|
});
|
|
1332
|
+
const getStatusBadgeClass$3 = (status) => {
|
|
1333
|
+
const s = status.toLowerCase();
|
|
1334
|
+
if (s === "captured" || s === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1335
|
+
if (s === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1336
|
+
if (s === "error" || s === "canceled" || s === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1337
|
+
if (s === "pending" || s === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1338
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1339
|
+
};
|
|
1340
|
+
const PaymentDetailPage = () => {
|
|
1341
|
+
var _a;
|
|
1342
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1343
|
+
const params = reactRouterDom.useParams();
|
|
1344
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
1345
|
+
const [detail, setDetail] = react.useState(null);
|
|
1346
|
+
const [loading, setLoading] = react.useState(!!id);
|
|
1347
|
+
const [error, setError] = react.useState(null);
|
|
1348
|
+
react.useEffect(() => {
|
|
1349
|
+
if (!id) {
|
|
1350
|
+
setLoading(false);
|
|
1351
|
+
return;
|
|
1352
|
+
}
|
|
1353
|
+
let cancelled = false;
|
|
1354
|
+
setLoading(true);
|
|
1355
|
+
setError(null);
|
|
1356
|
+
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
1357
|
+
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
1358
|
+
return res.json();
|
|
1359
|
+
}).then((data) => {
|
|
1360
|
+
if (!cancelled) setDetail(data);
|
|
1361
|
+
}).catch((e) => {
|
|
1362
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
1363
|
+
}).finally(() => {
|
|
1364
|
+
if (!cancelled) setLoading(false);
|
|
1365
|
+
});
|
|
1366
|
+
return () => {
|
|
1367
|
+
cancelled = true;
|
|
1368
|
+
};
|
|
1369
|
+
}, [id]);
|
|
1370
|
+
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
1371
|
+
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
1372
|
+
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
1373
|
+
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${(Number(detail.amount) / 100).toFixed(2)}` : "";
|
|
1374
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
|
|
1375
|
+
/* @__PURE__ */ jsxRuntime.jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1376
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
1377
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payment session" }),
|
|
1378
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
1379
|
+
] }) }),
|
|
1380
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1381
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1382
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
1383
|
+
] }) : loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading…" }) }) : detail ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1384
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-ui-border-base p-6 flex flex-col gap-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
1385
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1386
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
1387
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1388
|
+
ui.Button,
|
|
1389
|
+
{
|
|
1390
|
+
variant: "transparent",
|
|
1391
|
+
size: "small",
|
|
1392
|
+
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
1393
|
+
children: detail.order_id
|
|
1394
|
+
}
|
|
1395
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "—" }) })
|
|
1396
|
+
] }),
|
|
1397
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1398
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
1399
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: displayAmount })
|
|
1400
|
+
] }),
|
|
1401
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1402
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
1403
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.provider_id })
|
|
1404
|
+
] }),
|
|
1405
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1406
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
1407
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1408
|
+
ui.Badge,
|
|
1409
|
+
{
|
|
1410
|
+
size: "2xsmall",
|
|
1411
|
+
className: `uppercase ${getStatusBadgeClass$3(displayStatus)}`,
|
|
1412
|
+
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
1413
|
+
}
|
|
1414
|
+
) })
|
|
1415
|
+
] }),
|
|
1416
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1417
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
1418
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
1419
|
+
] }),
|
|
1420
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1421
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
1422
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
1423
|
+
] }),
|
|
1424
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1425
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
1426
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
1427
|
+
] }),
|
|
1428
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1429
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
1430
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
1431
|
+
year: "numeric",
|
|
1432
|
+
month: "short",
|
|
1433
|
+
day: "numeric",
|
|
1434
|
+
hour: "numeric",
|
|
1435
|
+
minute: "2-digit",
|
|
1436
|
+
hour12: true
|
|
1437
|
+
}) })
|
|
1438
|
+
] })
|
|
1439
|
+
] }) }),
|
|
1440
|
+
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1441
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
1442
|
+
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.data, null, 2) })
|
|
1443
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-ui-border-base p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No provider data for this session." }) })
|
|
1444
|
+
] }) : null
|
|
1445
|
+
] }) });
|
|
1446
|
+
};
|
|
1447
|
+
const config$3 = adminSdk.defineRouteConfig({
|
|
1448
|
+
label: "Payment details",
|
|
1449
|
+
icon: icons.CreditCard
|
|
1450
|
+
});
|
|
1451
|
+
const getStatusBadgeClass$2 = (status) => {
|
|
1452
|
+
const s = status.toLowerCase();
|
|
1453
|
+
if (s === "captured" || s === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1454
|
+
if (s === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1455
|
+
if (s === "error" || s === "canceled" || s === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1456
|
+
if (s === "pending" || s === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1457
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1458
|
+
};
|
|
1459
|
+
const formatAmount = (value) => {
|
|
1460
|
+
return (value / 100).toFixed(2);
|
|
1461
|
+
};
|
|
1462
|
+
const RefundDetailPage = () => {
|
|
1463
|
+
var _a, _b, _c;
|
|
1464
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1465
|
+
const params = reactRouterDom.useParams();
|
|
1466
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
1467
|
+
const [detail, setDetail] = react.useState(null);
|
|
1468
|
+
const [loading, setLoading] = react.useState(!!id);
|
|
1469
|
+
const [error, setError] = react.useState(null);
|
|
1470
|
+
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
1471
|
+
react.useEffect(() => {
|
|
1472
|
+
if (!id) {
|
|
1473
|
+
setLoading(false);
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
let cancelled = false;
|
|
1477
|
+
setLoading(true);
|
|
1478
|
+
setError(null);
|
|
1479
|
+
fetch(`/admin/refunds/${id}`, { credentials: "include" }).then((res) => {
|
|
1480
|
+
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
1481
|
+
return res.json();
|
|
1482
|
+
}).then((data) => {
|
|
1483
|
+
if (!cancelled) setDetail(data);
|
|
1484
|
+
}).catch((e) => {
|
|
1485
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
1486
|
+
}).finally(() => {
|
|
1487
|
+
if (!cancelled) setLoading(false);
|
|
1488
|
+
});
|
|
1489
|
+
return () => {
|
|
1490
|
+
cancelled = true;
|
|
1491
|
+
};
|
|
1492
|
+
}, [id]);
|
|
1493
|
+
const paymentStatus = ((_b = detail == null ? void 0 : detail.payment) == null ? void 0 : _b.status) ?? "—";
|
|
1494
|
+
const hasGatewayData = ((_c = detail == null ? void 0 : detail.payment) == null ? void 0 : _c.payment_data) && typeof detail.payment.payment_data === "object" && Object.keys(detail.payment.payment_data).length > 0;
|
|
1495
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
|
|
1496
|
+
/* @__PURE__ */ jsxRuntime.jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1497
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
|
|
1498
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refund details" }),
|
|
1499
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle font-mono", children: id ?? "—" })
|
|
1500
|
+
] }) }),
|
|
1501
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1502
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1503
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/refunds"), children: "Back to list" })
|
|
1504
|
+
] }) : loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading…" }) }) : detail ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1505
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1506
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Refund summary" }),
|
|
1507
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
1508
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1509
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund ID" }),
|
|
1510
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.id })
|
|
1511
|
+
] }),
|
|
1512
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1513
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
1514
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.refund.amount) })
|
|
1515
|
+
] }),
|
|
1516
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1517
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Note" }),
|
|
1518
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.refund.note ?? "—" })
|
|
1519
|
+
] }),
|
|
1520
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1521
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created at" }),
|
|
1522
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.refund.created_at).toLocaleDateString("en-US", {
|
|
1523
|
+
year: "numeric",
|
|
1524
|
+
month: "short",
|
|
1525
|
+
day: "numeric",
|
|
1526
|
+
hour: "numeric",
|
|
1527
|
+
minute: "2-digit",
|
|
1528
|
+
hour12: true
|
|
1529
|
+
}) })
|
|
1530
|
+
] }),
|
|
1531
|
+
detail.refund.created_by ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1532
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
|
|
1533
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
|
|
1534
|
+
] }) : null
|
|
1535
|
+
] })
|
|
1536
|
+
] }),
|
|
1537
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1538
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
|
|
1539
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
1540
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1541
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment amount" }),
|
|
1542
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.payment_amount) })
|
|
1543
|
+
] }),
|
|
1544
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1545
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Captured amount" }),
|
|
1546
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.captured_amount) })
|
|
1547
|
+
] }),
|
|
1548
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1549
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refunded amount" }),
|
|
1550
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.refunded_amount) })
|
|
1551
|
+
] }),
|
|
1552
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1553
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
1554
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment.provider_id || "—" })
|
|
1555
|
+
] }),
|
|
1556
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1557
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
1558
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1559
|
+
ui.Badge,
|
|
1560
|
+
{
|
|
1561
|
+
size: "2xsmall",
|
|
1562
|
+
className: `uppercase ${getStatusBadgeClass$2(paymentStatus)}`,
|
|
1563
|
+
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
1564
|
+
}
|
|
1565
|
+
) })
|
|
1566
|
+
] }),
|
|
1567
|
+
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1568
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1569
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
1570
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
1571
|
+
] }),
|
|
1572
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1573
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
1574
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
1575
|
+
] }),
|
|
1576
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1577
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
1578
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
1579
|
+
detail.computed.refund_percentage.toFixed(1),
|
|
1580
|
+
"%"
|
|
1581
|
+
] })
|
|
1582
|
+
] })
|
|
1583
|
+
] }) : null
|
|
1584
|
+
] })
|
|
1585
|
+
] }),
|
|
1586
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1587
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Order summary" }),
|
|
1588
|
+
detail.order ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
1589
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1590
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
1591
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1592
|
+
ui.Button,
|
|
1593
|
+
{
|
|
1594
|
+
variant: "transparent",
|
|
1595
|
+
size: "small",
|
|
1596
|
+
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
1597
|
+
children: detail.order.order_number ?? detail.order.order_id
|
|
1598
|
+
}
|
|
1599
|
+
) })
|
|
1600
|
+
] }),
|
|
1601
|
+
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1602
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
1603
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
1604
|
+
] }) : null,
|
|
1605
|
+
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1606
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
1607
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
1608
|
+
] }) : null,
|
|
1609
|
+
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1610
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
1611
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
1612
|
+
] }) : null,
|
|
1613
|
+
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1614
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
1615
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
1616
|
+
] }) : null
|
|
1617
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
1618
|
+
] }),
|
|
1619
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1620
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1621
|
+
"button",
|
|
1622
|
+
{
|
|
1623
|
+
type: "button",
|
|
1624
|
+
className: "flex w-full items-center justify-between text-left",
|
|
1625
|
+
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
1626
|
+
"aria-expanded": gatewayExpanded,
|
|
1627
|
+
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
1628
|
+
children: [
|
|
1629
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
1630
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
1631
|
+
]
|
|
1632
|
+
}
|
|
1633
|
+
),
|
|
1634
|
+
gatewayExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: hasGatewayData ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.payment.payment_data, null, 2) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No gateway payload for this payment." }) })
|
|
1635
|
+
] })
|
|
1636
|
+
] }) : null
|
|
1637
|
+
] }) });
|
|
1638
|
+
};
|
|
1639
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
1640
|
+
label: "Refund details",
|
|
1641
|
+
icon: icons.Receipt
|
|
1642
|
+
});
|
|
835
1643
|
const getStatusBadgeClass$1 = (status) => {
|
|
836
1644
|
const statusLower = status.toLowerCase();
|
|
837
1645
|
if (statusLower === "requested") {
|
|
@@ -1398,6 +2206,14 @@ const widgetModule = { widgets: [
|
|
|
1398
2206
|
] };
|
|
1399
2207
|
const routeModule = {
|
|
1400
2208
|
routes: [
|
|
2209
|
+
{
|
|
2210
|
+
Component: PaymentsPage,
|
|
2211
|
+
path: "/payments"
|
|
2212
|
+
},
|
|
2213
|
+
{
|
|
2214
|
+
Component: RefundsPage,
|
|
2215
|
+
path: "/refunds"
|
|
2216
|
+
},
|
|
1401
2217
|
{
|
|
1402
2218
|
Component: ReturnsPage,
|
|
1403
2219
|
path: "/returns"
|
|
@@ -1406,6 +2222,14 @@ const routeModule = {
|
|
|
1406
2222
|
Component: SwapsPage,
|
|
1407
2223
|
path: "/swaps"
|
|
1408
2224
|
},
|
|
2225
|
+
{
|
|
2226
|
+
Component: PaymentDetailPage,
|
|
2227
|
+
path: "/payments/:id"
|
|
2228
|
+
},
|
|
2229
|
+
{
|
|
2230
|
+
Component: RefundDetailPage,
|
|
2231
|
+
path: "/refunds/:id"
|
|
2232
|
+
},
|
|
1409
2233
|
{
|
|
1410
2234
|
Component: ReturnDetailPage,
|
|
1411
2235
|
path: "/returns/:id"
|
|
@@ -1419,21 +2243,39 @@ const routeModule = {
|
|
|
1419
2243
|
const menuItemModule = {
|
|
1420
2244
|
menuItems: [
|
|
1421
2245
|
{
|
|
1422
|
-
label: config$
|
|
1423
|
-
icon: config$
|
|
1424
|
-
path: "/
|
|
2246
|
+
label: config$7.label,
|
|
2247
|
+
icon: config$7.icon,
|
|
2248
|
+
path: "/payments",
|
|
1425
2249
|
nested: void 0
|
|
1426
2250
|
},
|
|
1427
2251
|
{
|
|
1428
|
-
label: config$
|
|
1429
|
-
icon: config$
|
|
2252
|
+
label: config$6.label,
|
|
2253
|
+
icon: config$6.icon,
|
|
2254
|
+
path: "/refunds",
|
|
2255
|
+
nested: void 0
|
|
2256
|
+
},
|
|
2257
|
+
{
|
|
2258
|
+
label: config$4.label,
|
|
2259
|
+
icon: config$4.icon,
|
|
1430
2260
|
path: "/swaps",
|
|
1431
2261
|
nested: void 0
|
|
1432
2262
|
},
|
|
1433
2263
|
{
|
|
1434
|
-
label: config$
|
|
1435
|
-
icon: config$
|
|
1436
|
-
path: "/returns
|
|
2264
|
+
label: config$5.label,
|
|
2265
|
+
icon: config$5.icon,
|
|
2266
|
+
path: "/returns",
|
|
2267
|
+
nested: void 0
|
|
2268
|
+
},
|
|
2269
|
+
{
|
|
2270
|
+
label: config$3.label,
|
|
2271
|
+
icon: config$3.icon,
|
|
2272
|
+
path: "/payments/:id",
|
|
2273
|
+
nested: void 0
|
|
2274
|
+
},
|
|
2275
|
+
{
|
|
2276
|
+
label: config$2.label,
|
|
2277
|
+
icon: config$2.icon,
|
|
2278
|
+
path: "/refunds/:id",
|
|
1437
2279
|
nested: void 0
|
|
1438
2280
|
},
|
|
1439
2281
|
{
|
|
@@ -1441,6 +2283,12 @@ const menuItemModule = {
|
|
|
1441
2283
|
icon: config.icon,
|
|
1442
2284
|
path: "/swaps/:id",
|
|
1443
2285
|
nested: void 0
|
|
2286
|
+
},
|
|
2287
|
+
{
|
|
2288
|
+
label: config$1.label,
|
|
2289
|
+
icon: config$1.icon,
|
|
2290
|
+
path: "/returns/:id",
|
|
2291
|
+
nested: void 0
|
|
1444
2292
|
}
|
|
1445
2293
|
]
|
|
1446
2294
|
};
|