order-management 0.0.76 → 0.0.77
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.
|
@@ -873,16 +873,216 @@ const getStatusBadgeClass$7 = (status) => {
|
|
|
873
873
|
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
874
874
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
875
875
|
};
|
|
876
|
-
const
|
|
876
|
+
const PaymentsPage = () => {
|
|
877
877
|
const navigate = reactRouterDom.useNavigate();
|
|
878
878
|
const [items, setItems] = react.useState([]);
|
|
879
|
+
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
879
880
|
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
880
881
|
const debouncedOrderId = useDebounce$3(orderIdSearch, 300);
|
|
882
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
883
|
+
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
884
|
+
const [error, setError] = react.useState(null);
|
|
885
|
+
const [offset, setOffset] = react.useState(0);
|
|
886
|
+
const [count, setCount] = react.useState(0);
|
|
887
|
+
const limit = 50;
|
|
888
|
+
const loadTransactions = react.useCallback(
|
|
889
|
+
async (nextOffset, replace) => {
|
|
890
|
+
try {
|
|
891
|
+
if (replace) setIsLoading(true);
|
|
892
|
+
else setIsFetchingMore(true);
|
|
893
|
+
setError(null);
|
|
894
|
+
const params = new URLSearchParams();
|
|
895
|
+
params.set("limit", String(limit));
|
|
896
|
+
params.set("offset", String(nextOffset));
|
|
897
|
+
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
898
|
+
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
899
|
+
const response = await fetch(
|
|
900
|
+
`/admin/payment-transactions?${params.toString()}`,
|
|
901
|
+
{ credentials: "include" }
|
|
902
|
+
);
|
|
903
|
+
if (!response.ok) {
|
|
904
|
+
const text = await response.text();
|
|
905
|
+
throw new Error(text || "Failed to load payment transactions");
|
|
906
|
+
}
|
|
907
|
+
const payload = await response.json();
|
|
908
|
+
const list = payload.transactions ?? [];
|
|
909
|
+
setCount(payload.count ?? 0);
|
|
910
|
+
setOffset(nextOffset + list.length);
|
|
911
|
+
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
912
|
+
} catch (e) {
|
|
913
|
+
setError(e instanceof Error ? e.message : "Failed to load");
|
|
914
|
+
} finally {
|
|
915
|
+
setIsLoading(false);
|
|
916
|
+
setIsFetchingMore(false);
|
|
917
|
+
}
|
|
918
|
+
},
|
|
919
|
+
[statusFilter, debouncedOrderId]
|
|
920
|
+
);
|
|
921
|
+
react.useEffect(() => {
|
|
922
|
+
void loadTransactions(0, true);
|
|
923
|
+
}, [loadTransactions]);
|
|
924
|
+
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
925
|
+
const displayStatus = (t) => {
|
|
926
|
+
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
927
|
+
return s2 !== "" ? s2 : "—";
|
|
928
|
+
};
|
|
929
|
+
const displayAmount = (t) => {
|
|
930
|
+
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
931
|
+
return `${code} ${Number(t.amount)}`;
|
|
932
|
+
};
|
|
933
|
+
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: [
|
|
934
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
935
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
936
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payments" }),
|
|
937
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
938
|
+
] }),
|
|
939
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
940
|
+
] }),
|
|
941
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
942
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
943
|
+
ui.Input,
|
|
944
|
+
{
|
|
945
|
+
placeholder: "Search by Order ID",
|
|
946
|
+
value: orderIdSearch,
|
|
947
|
+
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
948
|
+
className: "md:max-w-sm",
|
|
949
|
+
"aria-label": "Search by order ID"
|
|
950
|
+
}
|
|
951
|
+
),
|
|
952
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
953
|
+
"select",
|
|
954
|
+
{
|
|
955
|
+
value: statusFilter,
|
|
956
|
+
onChange: (e) => setStatusFilter(e.target.value),
|
|
957
|
+
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",
|
|
958
|
+
"aria-label": "Filter by status",
|
|
959
|
+
children: [
|
|
960
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
961
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
962
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
963
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
964
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
965
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
966
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
967
|
+
]
|
|
968
|
+
}
|
|
969
|
+
) })
|
|
970
|
+
] }),
|
|
971
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
972
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
973
|
+
/* @__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" }) })
|
|
974
|
+
] }) : null,
|
|
975
|
+
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: [
|
|
976
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
977
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
978
|
+
] }) : /* @__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: [
|
|
979
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
980
|
+
/* @__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" }),
|
|
981
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
982
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
983
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
984
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
985
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
986
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
987
|
+
] }) }),
|
|
988
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
989
|
+
"tr",
|
|
990
|
+
{
|
|
991
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
992
|
+
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
993
|
+
children: [
|
|
994
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
995
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
996
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
997
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
998
|
+
ui.Badge,
|
|
999
|
+
{
|
|
1000
|
+
size: "2xsmall",
|
|
1001
|
+
className: `uppercase ${getStatusBadgeClass$7(displayStatus(t))}`,
|
|
1002
|
+
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
1003
|
+
}
|
|
1004
|
+
) }),
|
|
1005
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
1006
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
1007
|
+
year: "numeric",
|
|
1008
|
+
month: "short",
|
|
1009
|
+
day: "numeric",
|
|
1010
|
+
hour: "numeric",
|
|
1011
|
+
minute: "2-digit",
|
|
1012
|
+
hour12: true
|
|
1013
|
+
}) }),
|
|
1014
|
+
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: "px-4 py-4", children: [
|
|
1015
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1016
|
+
ui.Button,
|
|
1017
|
+
{
|
|
1018
|
+
variant: "transparent",
|
|
1019
|
+
size: "small",
|
|
1020
|
+
onClick: (e) => {
|
|
1021
|
+
e.stopPropagation();
|
|
1022
|
+
navigate(`/payments/${t.payment_session_id}`);
|
|
1023
|
+
},
|
|
1024
|
+
children: "View details"
|
|
1025
|
+
}
|
|
1026
|
+
),
|
|
1027
|
+
t.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1028
|
+
ui.Button,
|
|
1029
|
+
{
|
|
1030
|
+
variant: "transparent",
|
|
1031
|
+
size: "small",
|
|
1032
|
+
onClick: (e) => {
|
|
1033
|
+
e.stopPropagation();
|
|
1034
|
+
navigate(`/orders/${t.order_id}`);
|
|
1035
|
+
},
|
|
1036
|
+
children: "Order"
|
|
1037
|
+
}
|
|
1038
|
+
) : null
|
|
1039
|
+
] })
|
|
1040
|
+
]
|
|
1041
|
+
},
|
|
1042
|
+
t.payment_session_id
|
|
1043
|
+
)) })
|
|
1044
|
+
] }) }),
|
|
1045
|
+
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1046
|
+
ui.Button,
|
|
1047
|
+
{
|
|
1048
|
+
variant: "secondary",
|
|
1049
|
+
isLoading: isFetchingMore,
|
|
1050
|
+
onClick: () => loadTransactions(offset, false),
|
|
1051
|
+
children: "Load more"
|
|
1052
|
+
}
|
|
1053
|
+
) }) : null
|
|
1054
|
+
] }) });
|
|
1055
|
+
};
|
|
1056
|
+
const config$7 = adminSdk.defineRouteConfig({
|
|
1057
|
+
label: "Payments",
|
|
1058
|
+
icon: icons.CreditCard
|
|
1059
|
+
});
|
|
1060
|
+
const useDebounce$2 = (value, delay) => {
|
|
1061
|
+
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1062
|
+
react.useEffect(() => {
|
|
1063
|
+
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
1064
|
+
return () => clearTimeout(handler);
|
|
1065
|
+
}, [value, delay]);
|
|
1066
|
+
return debouncedValue;
|
|
1067
|
+
};
|
|
1068
|
+
const getStatusBadgeClass$6 = (status) => {
|
|
1069
|
+
const s2 = status.toLowerCase();
|
|
1070
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1071
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1072
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1073
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1074
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1075
|
+
};
|
|
1076
|
+
const RefundsPage = () => {
|
|
1077
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1078
|
+
const [items, setItems] = react.useState([]);
|
|
1079
|
+
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
1080
|
+
const debouncedOrderId = useDebounce$2(orderIdSearch, 300);
|
|
881
1081
|
const [paymentStatusFilter, setPaymentStatusFilter] = react.useState("all");
|
|
882
1082
|
const [providerSearch, setProviderSearch] = react.useState("");
|
|
883
|
-
const debouncedProvider = useDebounce$
|
|
1083
|
+
const debouncedProvider = useDebounce$2(providerSearch, 300);
|
|
884
1084
|
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
885
|
-
const debouncedCurrency = useDebounce$
|
|
1085
|
+
const debouncedCurrency = useDebounce$2(currencySearch, 300);
|
|
886
1086
|
const [dateFrom, setDateFrom] = react.useState("");
|
|
887
1087
|
const [dateTo, setDateTo] = react.useState("");
|
|
888
1088
|
const [amountMin, setAmountMin] = react.useState("");
|
|
@@ -1094,7 +1294,7 @@ const RefundsPage = () => {
|
|
|
1094
1294
|
ui.Badge,
|
|
1095
1295
|
{
|
|
1096
1296
|
size: "2xsmall",
|
|
1097
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1297
|
+
className: `uppercase ${getStatusBadgeClass$6(displayStatus(r))}`,
|
|
1098
1298
|
children: displayStatus(r) !== "—" ? displayStatus(r).replace(/_/g, " ") : "—"
|
|
1099
1299
|
}
|
|
1100
1300
|
) }),
|
|
@@ -1148,210 +1348,10 @@ const RefundsPage = () => {
|
|
|
1148
1348
|
) }) : null
|
|
1149
1349
|
] }) });
|
|
1150
1350
|
};
|
|
1151
|
-
const config$
|
|
1351
|
+
const config$6 = adminSdk.defineRouteConfig({
|
|
1152
1352
|
label: "Refunds",
|
|
1153
1353
|
icon: icons.Receipt
|
|
1154
1354
|
});
|
|
1155
|
-
const useDebounce$2 = (value, delay) => {
|
|
1156
|
-
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1157
|
-
react.useEffect(() => {
|
|
1158
|
-
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
1159
|
-
return () => clearTimeout(handler);
|
|
1160
|
-
}, [value, delay]);
|
|
1161
|
-
return debouncedValue;
|
|
1162
|
-
};
|
|
1163
|
-
const getStatusBadgeClass$6 = (status) => {
|
|
1164
|
-
const s2 = status.toLowerCase();
|
|
1165
|
-
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1166
|
-
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1167
|
-
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1168
|
-
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1169
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1170
|
-
};
|
|
1171
|
-
const PaymentsPage = () => {
|
|
1172
|
-
const navigate = reactRouterDom.useNavigate();
|
|
1173
|
-
const [items, setItems] = react.useState([]);
|
|
1174
|
-
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
1175
|
-
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
1176
|
-
const debouncedOrderId = useDebounce$2(orderIdSearch, 300);
|
|
1177
|
-
const [isLoading, setIsLoading] = react.useState(true);
|
|
1178
|
-
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
1179
|
-
const [error, setError] = react.useState(null);
|
|
1180
|
-
const [offset, setOffset] = react.useState(0);
|
|
1181
|
-
const [count, setCount] = react.useState(0);
|
|
1182
|
-
const limit = 50;
|
|
1183
|
-
const loadTransactions = react.useCallback(
|
|
1184
|
-
async (nextOffset, replace) => {
|
|
1185
|
-
try {
|
|
1186
|
-
if (replace) setIsLoading(true);
|
|
1187
|
-
else setIsFetchingMore(true);
|
|
1188
|
-
setError(null);
|
|
1189
|
-
const params = new URLSearchParams();
|
|
1190
|
-
params.set("limit", String(limit));
|
|
1191
|
-
params.set("offset", String(nextOffset));
|
|
1192
|
-
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
1193
|
-
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
1194
|
-
const response = await fetch(
|
|
1195
|
-
`/admin/payment-transactions?${params.toString()}`,
|
|
1196
|
-
{ credentials: "include" }
|
|
1197
|
-
);
|
|
1198
|
-
if (!response.ok) {
|
|
1199
|
-
const text = await response.text();
|
|
1200
|
-
throw new Error(text || "Failed to load payment transactions");
|
|
1201
|
-
}
|
|
1202
|
-
const payload = await response.json();
|
|
1203
|
-
const list = payload.transactions ?? [];
|
|
1204
|
-
setCount(payload.count ?? 0);
|
|
1205
|
-
setOffset(nextOffset + list.length);
|
|
1206
|
-
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
1207
|
-
} catch (e) {
|
|
1208
|
-
setError(e instanceof Error ? e.message : "Failed to load");
|
|
1209
|
-
} finally {
|
|
1210
|
-
setIsLoading(false);
|
|
1211
|
-
setIsFetchingMore(false);
|
|
1212
|
-
}
|
|
1213
|
-
},
|
|
1214
|
-
[statusFilter, debouncedOrderId]
|
|
1215
|
-
);
|
|
1216
|
-
react.useEffect(() => {
|
|
1217
|
-
void loadTransactions(0, true);
|
|
1218
|
-
}, [loadTransactions]);
|
|
1219
|
-
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
1220
|
-
const displayStatus = (t) => {
|
|
1221
|
-
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
1222
|
-
return s2 !== "" ? s2 : "—";
|
|
1223
|
-
};
|
|
1224
|
-
const displayAmount = (t) => {
|
|
1225
|
-
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
1226
|
-
return `${code} ${Number(t.amount)}`;
|
|
1227
|
-
};
|
|
1228
|
-
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: [
|
|
1229
|
-
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1230
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1231
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payments" }),
|
|
1232
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
1233
|
-
] }),
|
|
1234
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
1235
|
-
] }),
|
|
1236
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1237
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1238
|
-
ui.Input,
|
|
1239
|
-
{
|
|
1240
|
-
placeholder: "Search by Order ID",
|
|
1241
|
-
value: orderIdSearch,
|
|
1242
|
-
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
1243
|
-
className: "md:max-w-sm",
|
|
1244
|
-
"aria-label": "Search by order ID"
|
|
1245
|
-
}
|
|
1246
|
-
),
|
|
1247
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1248
|
-
"select",
|
|
1249
|
-
{
|
|
1250
|
-
value: statusFilter,
|
|
1251
|
-
onChange: (e) => setStatusFilter(e.target.value),
|
|
1252
|
-
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",
|
|
1253
|
-
"aria-label": "Filter by status",
|
|
1254
|
-
children: [
|
|
1255
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
1256
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
1257
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
1258
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
1259
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
1260
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
1261
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
1262
|
-
]
|
|
1263
|
-
}
|
|
1264
|
-
) })
|
|
1265
|
-
] }),
|
|
1266
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1267
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1268
|
-
/* @__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" }) })
|
|
1269
|
-
] }) : null,
|
|
1270
|
-
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: [
|
|
1271
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
1272
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
1273
|
-
] }) : /* @__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: [
|
|
1274
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1275
|
-
/* @__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" }),
|
|
1276
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
1277
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
1278
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
1279
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
1280
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1281
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1282
|
-
] }) }),
|
|
1283
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1284
|
-
"tr",
|
|
1285
|
-
{
|
|
1286
|
-
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1287
|
-
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
1288
|
-
children: [
|
|
1289
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
1290
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
1291
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
1292
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1293
|
-
ui.Badge,
|
|
1294
|
-
{
|
|
1295
|
-
size: "2xsmall",
|
|
1296
|
-
className: `uppercase ${getStatusBadgeClass$6(displayStatus(t))}`,
|
|
1297
|
-
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
1298
|
-
}
|
|
1299
|
-
) }),
|
|
1300
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
1301
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
1302
|
-
year: "numeric",
|
|
1303
|
-
month: "short",
|
|
1304
|
-
day: "numeric",
|
|
1305
|
-
hour: "numeric",
|
|
1306
|
-
minute: "2-digit",
|
|
1307
|
-
hour12: true
|
|
1308
|
-
}) }),
|
|
1309
|
-
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: "px-4 py-4", children: [
|
|
1310
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1311
|
-
ui.Button,
|
|
1312
|
-
{
|
|
1313
|
-
variant: "transparent",
|
|
1314
|
-
size: "small",
|
|
1315
|
-
onClick: (e) => {
|
|
1316
|
-
e.stopPropagation();
|
|
1317
|
-
navigate(`/payments/${t.payment_session_id}`);
|
|
1318
|
-
},
|
|
1319
|
-
children: "View details"
|
|
1320
|
-
}
|
|
1321
|
-
),
|
|
1322
|
-
t.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1323
|
-
ui.Button,
|
|
1324
|
-
{
|
|
1325
|
-
variant: "transparent",
|
|
1326
|
-
size: "small",
|
|
1327
|
-
onClick: (e) => {
|
|
1328
|
-
e.stopPropagation();
|
|
1329
|
-
navigate(`/orders/${t.order_id}`);
|
|
1330
|
-
},
|
|
1331
|
-
children: "Order"
|
|
1332
|
-
}
|
|
1333
|
-
) : null
|
|
1334
|
-
] })
|
|
1335
|
-
]
|
|
1336
|
-
},
|
|
1337
|
-
t.payment_session_id
|
|
1338
|
-
)) })
|
|
1339
|
-
] }) }),
|
|
1340
|
-
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1341
|
-
ui.Button,
|
|
1342
|
-
{
|
|
1343
|
-
variant: "secondary",
|
|
1344
|
-
isLoading: isFetchingMore,
|
|
1345
|
-
onClick: () => loadTransactions(offset, false),
|
|
1346
|
-
children: "Load more"
|
|
1347
|
-
}
|
|
1348
|
-
) }) : null
|
|
1349
|
-
] }) });
|
|
1350
|
-
};
|
|
1351
|
-
const config$6 = adminSdk.defineRouteConfig({
|
|
1352
|
-
label: "Payments",
|
|
1353
|
-
icon: icons.CreditCard
|
|
1354
|
-
});
|
|
1355
1355
|
const useDebounce$1 = (value, delay) => {
|
|
1356
1356
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1357
1357
|
react.useEffect(() => {
|
|
@@ -1799,22 +1799,141 @@ const SwapsPage = () => {
|
|
|
1799
1799
|
swap.id
|
|
1800
1800
|
)) })
|
|
1801
1801
|
] }) }),
|
|
1802
|
-
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1803
|
-
ui.Button,
|
|
1804
|
-
{
|
|
1805
|
-
variant: "secondary",
|
|
1806
|
-
isLoading: isFetchingMore,
|
|
1807
|
-
onClick: () => loadSwaps(offset, false),
|
|
1808
|
-
children: "Load more"
|
|
1809
|
-
}
|
|
1810
|
-
) }) : null
|
|
1802
|
+
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1803
|
+
ui.Button,
|
|
1804
|
+
{
|
|
1805
|
+
variant: "secondary",
|
|
1806
|
+
isLoading: isFetchingMore,
|
|
1807
|
+
onClick: () => loadSwaps(offset, false),
|
|
1808
|
+
children: "Load more"
|
|
1809
|
+
}
|
|
1810
|
+
) }) : null
|
|
1811
|
+
] }) });
|
|
1812
|
+
};
|
|
1813
|
+
const config$4 = adminSdk.defineRouteConfig({
|
|
1814
|
+
label: "Exchanges",
|
|
1815
|
+
icon: icons.ArrowPath
|
|
1816
|
+
});
|
|
1817
|
+
const getStatusBadgeClass$3 = (status) => {
|
|
1818
|
+
const s2 = status.toLowerCase();
|
|
1819
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1820
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1821
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1822
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1823
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1824
|
+
};
|
|
1825
|
+
const PaymentDetailPage = () => {
|
|
1826
|
+
var _a;
|
|
1827
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1828
|
+
const params = reactRouterDom.useParams();
|
|
1829
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
1830
|
+
const [detail, setDetail] = react.useState(null);
|
|
1831
|
+
const [loading, setLoading] = react.useState(!!id);
|
|
1832
|
+
const [error, setError] = react.useState(null);
|
|
1833
|
+
react.useEffect(() => {
|
|
1834
|
+
if (!id) {
|
|
1835
|
+
setLoading(false);
|
|
1836
|
+
return;
|
|
1837
|
+
}
|
|
1838
|
+
let cancelled = false;
|
|
1839
|
+
setLoading(true);
|
|
1840
|
+
setError(null);
|
|
1841
|
+
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
1842
|
+
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
1843
|
+
return res.json();
|
|
1844
|
+
}).then((data) => {
|
|
1845
|
+
if (!cancelled) setDetail(data);
|
|
1846
|
+
}).catch((e) => {
|
|
1847
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
1848
|
+
}).finally(() => {
|
|
1849
|
+
if (!cancelled) setLoading(false);
|
|
1850
|
+
});
|
|
1851
|
+
return () => {
|
|
1852
|
+
cancelled = true;
|
|
1853
|
+
};
|
|
1854
|
+
}, [id]);
|
|
1855
|
+
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
1856
|
+
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
1857
|
+
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
1858
|
+
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
1859
|
+
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: [
|
|
1860
|
+
/* @__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: [
|
|
1861
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
1862
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payment session" }),
|
|
1863
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
1864
|
+
] }) }),
|
|
1865
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1866
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1867
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
1868
|
+
] }) : 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: [
|
|
1869
|
+
/* @__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: [
|
|
1870
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1871
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
1872
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1873
|
+
ui.Button,
|
|
1874
|
+
{
|
|
1875
|
+
variant: "transparent",
|
|
1876
|
+
size: "small",
|
|
1877
|
+
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
1878
|
+
children: detail.order_id
|
|
1879
|
+
}
|
|
1880
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "—" }) })
|
|
1881
|
+
] }),
|
|
1882
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1883
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
1884
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: displayAmount })
|
|
1885
|
+
] }),
|
|
1886
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1887
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
1888
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.provider_id })
|
|
1889
|
+
] }),
|
|
1890
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1891
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
1892
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1893
|
+
ui.Badge,
|
|
1894
|
+
{
|
|
1895
|
+
size: "2xsmall",
|
|
1896
|
+
className: `uppercase ${getStatusBadgeClass$3(displayStatus)}`,
|
|
1897
|
+
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
1898
|
+
}
|
|
1899
|
+
) })
|
|
1900
|
+
] }),
|
|
1901
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1902
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
1903
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
1904
|
+
] }),
|
|
1905
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1906
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
1907
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
1908
|
+
] }),
|
|
1909
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1910
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
1911
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
1912
|
+
] }),
|
|
1913
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1914
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
1915
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
1916
|
+
year: "numeric",
|
|
1917
|
+
month: "short",
|
|
1918
|
+
day: "numeric",
|
|
1919
|
+
hour: "numeric",
|
|
1920
|
+
minute: "2-digit",
|
|
1921
|
+
hour12: true
|
|
1922
|
+
}) })
|
|
1923
|
+
] })
|
|
1924
|
+
] }) }),
|
|
1925
|
+
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1926
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
1927
|
+
/* @__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) })
|
|
1928
|
+
] }) : /* @__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." }) })
|
|
1929
|
+
] }) : null
|
|
1811
1930
|
] }) });
|
|
1812
1931
|
};
|
|
1813
|
-
const config$
|
|
1814
|
-
label: "
|
|
1815
|
-
icon: icons.
|
|
1932
|
+
const config$3 = adminSdk.defineRouteConfig({
|
|
1933
|
+
label: "Payment details",
|
|
1934
|
+
icon: icons.CreditCard
|
|
1816
1935
|
});
|
|
1817
|
-
const getStatusBadgeClass$
|
|
1936
|
+
const getStatusBadgeClass$2 = (status) => {
|
|
1818
1937
|
const s2 = status.toLowerCase();
|
|
1819
1938
|
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1820
1939
|
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
@@ -1925,7 +2044,7 @@ const RefundDetailPage = () => {
|
|
|
1925
2044
|
ui.Badge,
|
|
1926
2045
|
{
|
|
1927
2046
|
size: "2xsmall",
|
|
1928
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2047
|
+
className: `uppercase ${getStatusBadgeClass$2(paymentStatus)}`,
|
|
1929
2048
|
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
1930
2049
|
}
|
|
1931
2050
|
) })
|
|
@@ -2002,129 +2121,10 @@ const RefundDetailPage = () => {
|
|
|
2002
2121
|
] }) : null
|
|
2003
2122
|
] }) });
|
|
2004
2123
|
};
|
|
2005
|
-
const config$
|
|
2124
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
2006
2125
|
label: "Refund details",
|
|
2007
2126
|
icon: icons.Receipt
|
|
2008
2127
|
});
|
|
2009
|
-
const getStatusBadgeClass$2 = (status) => {
|
|
2010
|
-
const s2 = status.toLowerCase();
|
|
2011
|
-
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2012
|
-
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2013
|
-
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2014
|
-
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2015
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2016
|
-
};
|
|
2017
|
-
const PaymentDetailPage = () => {
|
|
2018
|
-
var _a;
|
|
2019
|
-
const navigate = reactRouterDom.useNavigate();
|
|
2020
|
-
const params = reactRouterDom.useParams();
|
|
2021
|
-
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
2022
|
-
const [detail, setDetail] = react.useState(null);
|
|
2023
|
-
const [loading, setLoading] = react.useState(!!id);
|
|
2024
|
-
const [error, setError] = react.useState(null);
|
|
2025
|
-
react.useEffect(() => {
|
|
2026
|
-
if (!id) {
|
|
2027
|
-
setLoading(false);
|
|
2028
|
-
return;
|
|
2029
|
-
}
|
|
2030
|
-
let cancelled = false;
|
|
2031
|
-
setLoading(true);
|
|
2032
|
-
setError(null);
|
|
2033
|
-
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
2034
|
-
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
2035
|
-
return res.json();
|
|
2036
|
-
}).then((data) => {
|
|
2037
|
-
if (!cancelled) setDetail(data);
|
|
2038
|
-
}).catch((e) => {
|
|
2039
|
-
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
2040
|
-
}).finally(() => {
|
|
2041
|
-
if (!cancelled) setLoading(false);
|
|
2042
|
-
});
|
|
2043
|
-
return () => {
|
|
2044
|
-
cancelled = true;
|
|
2045
|
-
};
|
|
2046
|
-
}, [id]);
|
|
2047
|
-
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
2048
|
-
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
2049
|
-
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
2050
|
-
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
2051
|
-
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: [
|
|
2052
|
-
/* @__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: [
|
|
2053
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
2054
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payment session" }),
|
|
2055
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
2056
|
-
] }) }),
|
|
2057
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2058
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2059
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
2060
|
-
] }) : 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: [
|
|
2061
|
-
/* @__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: [
|
|
2062
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2063
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
2064
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2065
|
-
ui.Button,
|
|
2066
|
-
{
|
|
2067
|
-
variant: "transparent",
|
|
2068
|
-
size: "small",
|
|
2069
|
-
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
2070
|
-
children: detail.order_id
|
|
2071
|
-
}
|
|
2072
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "—" }) })
|
|
2073
|
-
] }),
|
|
2074
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2075
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
2076
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: displayAmount })
|
|
2077
|
-
] }),
|
|
2078
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2079
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
2080
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.provider_id })
|
|
2081
|
-
] }),
|
|
2082
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2083
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
2084
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2085
|
-
ui.Badge,
|
|
2086
|
-
{
|
|
2087
|
-
size: "2xsmall",
|
|
2088
|
-
className: `uppercase ${getStatusBadgeClass$2(displayStatus)}`,
|
|
2089
|
-
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
2090
|
-
}
|
|
2091
|
-
) })
|
|
2092
|
-
] }),
|
|
2093
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2094
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
2095
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
2096
|
-
] }),
|
|
2097
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2098
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
2099
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
2100
|
-
] }),
|
|
2101
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2102
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
2103
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
2104
|
-
] }),
|
|
2105
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2106
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
2107
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
2108
|
-
year: "numeric",
|
|
2109
|
-
month: "short",
|
|
2110
|
-
day: "numeric",
|
|
2111
|
-
hour: "numeric",
|
|
2112
|
-
minute: "2-digit",
|
|
2113
|
-
hour12: true
|
|
2114
|
-
}) })
|
|
2115
|
-
] })
|
|
2116
|
-
] }) }),
|
|
2117
|
-
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2118
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
2119
|
-
/* @__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) })
|
|
2120
|
-
] }) : /* @__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." }) })
|
|
2121
|
-
] }) : null
|
|
2122
|
-
] }) });
|
|
2123
|
-
};
|
|
2124
|
-
const config$2 = adminSdk.defineRouteConfig({
|
|
2125
|
-
label: "Payment details",
|
|
2126
|
-
icon: icons.CreditCard
|
|
2127
|
-
});
|
|
2128
2128
|
const getStatusBadgeClass$1 = (status) => {
|
|
2129
2129
|
const statusLower = status.toLowerCase();
|
|
2130
2130
|
if (statusLower === "requested") {
|
|
@@ -2695,14 +2695,14 @@ const widgetModule = { widgets: [
|
|
|
2695
2695
|
] };
|
|
2696
2696
|
const routeModule = {
|
|
2697
2697
|
routes: [
|
|
2698
|
-
{
|
|
2699
|
-
Component: RefundsPage,
|
|
2700
|
-
path: "/refunds"
|
|
2701
|
-
},
|
|
2702
2698
|
{
|
|
2703
2699
|
Component: PaymentsPage,
|
|
2704
2700
|
path: "/payments"
|
|
2705
2701
|
},
|
|
2702
|
+
{
|
|
2703
|
+
Component: RefundsPage,
|
|
2704
|
+
path: "/refunds"
|
|
2705
|
+
},
|
|
2706
2706
|
{
|
|
2707
2707
|
Component: ReturnsPage,
|
|
2708
2708
|
path: "/returns"
|
|
@@ -2711,14 +2711,14 @@ const routeModule = {
|
|
|
2711
2711
|
Component: SwapsPage,
|
|
2712
2712
|
path: "/swaps"
|
|
2713
2713
|
},
|
|
2714
|
-
{
|
|
2715
|
-
Component: RefundDetailPage,
|
|
2716
|
-
path: "/refunds/:id"
|
|
2717
|
-
},
|
|
2718
2714
|
{
|
|
2719
2715
|
Component: PaymentDetailPage,
|
|
2720
2716
|
path: "/payments/:id"
|
|
2721
2717
|
},
|
|
2718
|
+
{
|
|
2719
|
+
Component: RefundDetailPage,
|
|
2720
|
+
path: "/refunds/:id"
|
|
2721
|
+
},
|
|
2722
2722
|
{
|
|
2723
2723
|
Component: ReturnDetailPage,
|
|
2724
2724
|
path: "/returns/:id"
|
|
@@ -2731,16 +2731,10 @@ const routeModule = {
|
|
|
2731
2731
|
};
|
|
2732
2732
|
const menuItemModule = {
|
|
2733
2733
|
menuItems: [
|
|
2734
|
-
{
|
|
2735
|
-
label: config$6.label,
|
|
2736
|
-
icon: config$6.icon,
|
|
2737
|
-
path: "/payments",
|
|
2738
|
-
nested: void 0
|
|
2739
|
-
},
|
|
2740
2734
|
{
|
|
2741
2735
|
label: config$7.label,
|
|
2742
2736
|
icon: config$7.icon,
|
|
2743
|
-
path: "/
|
|
2737
|
+
path: "/payments",
|
|
2744
2738
|
nested: void 0
|
|
2745
2739
|
},
|
|
2746
2740
|
{
|
|
@@ -2749,6 +2743,12 @@ const menuItemModule = {
|
|
|
2749
2743
|
path: "/returns",
|
|
2750
2744
|
nested: void 0
|
|
2751
2745
|
},
|
|
2746
|
+
{
|
|
2747
|
+
label: config$6.label,
|
|
2748
|
+
icon: config$6.icon,
|
|
2749
|
+
path: "/refunds",
|
|
2750
|
+
nested: void 0
|
|
2751
|
+
},
|
|
2752
2752
|
{
|
|
2753
2753
|
label: config$4.label,
|
|
2754
2754
|
icon: config$4.icon,
|
|
@@ -2758,13 +2758,19 @@ const menuItemModule = {
|
|
|
2758
2758
|
{
|
|
2759
2759
|
label: config$3.label,
|
|
2760
2760
|
icon: config$3.icon,
|
|
2761
|
-
path: "/
|
|
2761
|
+
path: "/payments/:id",
|
|
2762
|
+
nested: void 0
|
|
2763
|
+
},
|
|
2764
|
+
{
|
|
2765
|
+
label: config$1.label,
|
|
2766
|
+
icon: config$1.icon,
|
|
2767
|
+
path: "/returns/:id",
|
|
2762
2768
|
nested: void 0
|
|
2763
2769
|
},
|
|
2764
2770
|
{
|
|
2765
2771
|
label: config$2.label,
|
|
2766
2772
|
icon: config$2.icon,
|
|
2767
|
-
path: "/
|
|
2773
|
+
path: "/refunds/:id",
|
|
2768
2774
|
nested: void 0
|
|
2769
2775
|
},
|
|
2770
2776
|
{
|
|
@@ -2772,12 +2778,6 @@ const menuItemModule = {
|
|
|
2772
2778
|
icon: config.icon,
|
|
2773
2779
|
path: "/swaps/:id",
|
|
2774
2780
|
nested: void 0
|
|
2775
|
-
},
|
|
2776
|
-
{
|
|
2777
|
-
label: config$1.label,
|
|
2778
|
-
icon: config$1.icon,
|
|
2779
|
-
path: "/returns/:id",
|
|
2780
|
-
nested: void 0
|
|
2781
2781
|
}
|
|
2782
2782
|
]
|
|
2783
2783
|
};
|