order-management 0.0.103 → 0.0.104
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 +462 -462
- package/.medusa/server/src/admin/index.mjs +463 -463
- package/.medusa/server/src/api/middlewares/inject-return-shipping.js +54 -0
- package/.medusa/server/src/api/middlewares.js +7 -1
- package/.medusa/server/src/helpers/ensure-return-to-store-option.js +255 -0
- package/.medusa/server/src/helpers/index.js +2 -1
- package/.medusa/server/src/utils/order-fulfillment-metadata.js +3 -2
- package/package.json +2 -1
|
@@ -2229,27 +2229,19 @@ const getStatusBadgeClass$7 = (status) => {
|
|
|
2229
2229
|
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2230
2230
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2231
2231
|
};
|
|
2232
|
-
const
|
|
2232
|
+
const PaymentsPage = () => {
|
|
2233
2233
|
const navigate = reactRouterDom.useNavigate();
|
|
2234
2234
|
const [items, setItems] = react.useState([]);
|
|
2235
|
+
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
2235
2236
|
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
2236
2237
|
const debouncedOrderId = useDebounce$3(orderIdSearch, 300);
|
|
2237
|
-
const [paymentStatusFilter, setPaymentStatusFilter] = react.useState("all");
|
|
2238
|
-
const [providerSearch, setProviderSearch] = react.useState("");
|
|
2239
|
-
const debouncedProvider = useDebounce$3(providerSearch, 300);
|
|
2240
|
-
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
2241
|
-
const debouncedCurrency = useDebounce$3(currencySearch, 300);
|
|
2242
|
-
const [dateFrom, setDateFrom] = react.useState("");
|
|
2243
|
-
const [dateTo, setDateTo] = react.useState("");
|
|
2244
|
-
const [amountMin, setAmountMin] = react.useState("");
|
|
2245
|
-
const [amountMax, setAmountMax] = react.useState("");
|
|
2246
2238
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
2247
2239
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
2248
2240
|
const [error, setError] = react.useState(null);
|
|
2249
2241
|
const [offset, setOffset] = react.useState(0);
|
|
2250
2242
|
const [count, setCount] = react.useState(0);
|
|
2251
2243
|
const limit = 50;
|
|
2252
|
-
const
|
|
2244
|
+
const loadTransactions = react.useCallback(
|
|
2253
2245
|
async (nextOffset, replace) => {
|
|
2254
2246
|
try {
|
|
2255
2247
|
if (replace) setIsLoading(true);
|
|
@@ -2258,25 +2250,18 @@ const RefundsPage = () => {
|
|
|
2258
2250
|
const params = new URLSearchParams();
|
|
2259
2251
|
params.set("limit", String(limit));
|
|
2260
2252
|
params.set("offset", String(nextOffset));
|
|
2253
|
+
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
2261
2254
|
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
if (dateTo.trim()) params.set("date_to", dateTo.trim());
|
|
2267
|
-
const min = amountMin.trim() ? Number(amountMin) : void 0;
|
|
2268
|
-
const max = amountMax.trim() ? Number(amountMax) : void 0;
|
|
2269
|
-
if (min != null && !Number.isNaN(min)) params.set("amount_min", String(min));
|
|
2270
|
-
if (max != null && !Number.isNaN(max)) params.set("amount_max", String(max));
|
|
2271
|
-
const response = await fetch(`/admin/refunds?${params.toString()}`, {
|
|
2272
|
-
credentials: "include"
|
|
2273
|
-
});
|
|
2255
|
+
const response = await fetch(
|
|
2256
|
+
`/admin/payment-transactions?${params.toString()}`,
|
|
2257
|
+
{ credentials: "include" }
|
|
2258
|
+
);
|
|
2274
2259
|
if (!response.ok) {
|
|
2275
2260
|
const text = await response.text();
|
|
2276
|
-
throw new Error(text || "Failed to load
|
|
2261
|
+
throw new Error(text || "Failed to load payment transactions");
|
|
2277
2262
|
}
|
|
2278
2263
|
const payload = await response.json();
|
|
2279
|
-
const list = payload.
|
|
2264
|
+
const list = payload.transactions ?? [];
|
|
2280
2265
|
setCount(payload.count ?? 0);
|
|
2281
2266
|
setOffset(nextOffset + list.length);
|
|
2282
2267
|
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
@@ -2287,75 +2272,46 @@ const RefundsPage = () => {
|
|
|
2287
2272
|
setIsFetchingMore(false);
|
|
2288
2273
|
}
|
|
2289
2274
|
},
|
|
2290
|
-
[
|
|
2291
|
-
debouncedOrderId,
|
|
2292
|
-
paymentStatusFilter,
|
|
2293
|
-
debouncedProvider,
|
|
2294
|
-
debouncedCurrency,
|
|
2295
|
-
dateFrom,
|
|
2296
|
-
dateTo,
|
|
2297
|
-
amountMin,
|
|
2298
|
-
amountMax
|
|
2299
|
-
]
|
|
2275
|
+
[statusFilter, debouncedOrderId]
|
|
2300
2276
|
);
|
|
2301
2277
|
react.useEffect(() => {
|
|
2302
|
-
void
|
|
2303
|
-
}, [
|
|
2278
|
+
void loadTransactions(0, true);
|
|
2279
|
+
}, [loadTransactions]);
|
|
2304
2280
|
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
2305
|
-
const
|
|
2306
|
-
const
|
|
2307
|
-
return `${code} ${Number(r.amount)}`;
|
|
2308
|
-
};
|
|
2309
|
-
const displayStatus = (r) => {
|
|
2310
|
-
const s2 = r.payment_status ?? "";
|
|
2281
|
+
const displayStatus = (t) => {
|
|
2282
|
+
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
2311
2283
|
return s2 !== "" ? s2 : "—";
|
|
2312
2284
|
};
|
|
2285
|
+
const displayAmount = (t) => {
|
|
2286
|
+
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
2287
|
+
return `${code} ${Number(t.amount)}`;
|
|
2288
|
+
};
|
|
2313
2289
|
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: [
|
|
2314
2290
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
2315
2291
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2316
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
2317
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
2292
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payments" }),
|
|
2293
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
2318
2294
|
] }),
|
|
2319
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () =>
|
|
2295
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
2320
2296
|
] }),
|
|
2321
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2297
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
2322
2298
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2323
2299
|
ui.Input,
|
|
2324
2300
|
{
|
|
2325
|
-
placeholder: "Order ID",
|
|
2301
|
+
placeholder: "Search by Order ID",
|
|
2326
2302
|
value: orderIdSearch,
|
|
2327
2303
|
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
2328
|
-
className: "md:max-w-
|
|
2329
|
-
"aria-label": "
|
|
2330
|
-
}
|
|
2331
|
-
),
|
|
2332
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2333
|
-
ui.Input,
|
|
2334
|
-
{
|
|
2335
|
-
placeholder: "Provider",
|
|
2336
|
-
value: providerSearch,
|
|
2337
|
-
onChange: (e) => setProviderSearch(e.target.value),
|
|
2338
|
-
className: "md:max-w-[140px]",
|
|
2339
|
-
"aria-label": "Filter by provider"
|
|
2340
|
-
}
|
|
2341
|
-
),
|
|
2342
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2343
|
-
ui.Input,
|
|
2344
|
-
{
|
|
2345
|
-
placeholder: "Currency",
|
|
2346
|
-
value: currencySearch,
|
|
2347
|
-
onChange: (e) => setCurrencySearch(e.target.value),
|
|
2348
|
-
className: "md:max-w-[100px]",
|
|
2349
|
-
"aria-label": "Filter by currency"
|
|
2304
|
+
className: "md:max-w-sm",
|
|
2305
|
+
"aria-label": "Search by order ID"
|
|
2350
2306
|
}
|
|
2351
2307
|
),
|
|
2352
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2308
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2353
2309
|
"select",
|
|
2354
2310
|
{
|
|
2355
|
-
value:
|
|
2356
|
-
onChange: (e) =>
|
|
2357
|
-
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-
|
|
2358
|
-
"aria-label": "Filter by
|
|
2311
|
+
value: statusFilter,
|
|
2312
|
+
onChange: (e) => setStatusFilter(e.target.value),
|
|
2313
|
+
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",
|
|
2314
|
+
"aria-label": "Filter by status",
|
|
2359
2315
|
children: [
|
|
2360
2316
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
2361
2317
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
@@ -2366,103 +2322,52 @@ const RefundsPage = () => {
|
|
|
2366
2322
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
2367
2323
|
]
|
|
2368
2324
|
}
|
|
2369
|
-
)
|
|
2370
|
-
|
|
2371
|
-
ui.Input,
|
|
2372
|
-
{
|
|
2373
|
-
type: "date",
|
|
2374
|
-
placeholder: "From",
|
|
2375
|
-
value: dateFrom,
|
|
2376
|
-
onChange: (e) => setDateFrom(e.target.value),
|
|
2377
|
-
className: "md:max-w-[140px]",
|
|
2378
|
-
"aria-label": "Date from"
|
|
2379
|
-
}
|
|
2380
|
-
),
|
|
2381
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2382
|
-
ui.Input,
|
|
2383
|
-
{
|
|
2384
|
-
type: "date",
|
|
2385
|
-
placeholder: "To",
|
|
2386
|
-
value: dateTo,
|
|
2387
|
-
onChange: (e) => setDateTo(e.target.value),
|
|
2388
|
-
className: "md:max-w-[140px]",
|
|
2389
|
-
"aria-label": "Date to"
|
|
2390
|
-
}
|
|
2391
|
-
),
|
|
2392
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2393
|
-
ui.Input,
|
|
2394
|
-
{
|
|
2395
|
-
placeholder: "Amount min",
|
|
2396
|
-
value: amountMin,
|
|
2397
|
-
onChange: (e) => setAmountMin(e.target.value),
|
|
2398
|
-
type: "number",
|
|
2399
|
-
min: 0,
|
|
2400
|
-
className: "md:max-w-[100px]",
|
|
2401
|
-
"aria-label": "Refund amount minimum"
|
|
2402
|
-
}
|
|
2403
|
-
),
|
|
2404
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2405
|
-
ui.Input,
|
|
2406
|
-
{
|
|
2407
|
-
placeholder: "Amount max",
|
|
2408
|
-
value: amountMax,
|
|
2409
|
-
onChange: (e) => setAmountMax(e.target.value),
|
|
2410
|
-
type: "number",
|
|
2411
|
-
min: 0,
|
|
2412
|
-
className: "md:max-w-[100px]",
|
|
2413
|
-
"aria-label": "Refund amount maximum"
|
|
2414
|
-
}
|
|
2415
|
-
)
|
|
2416
|
-
] }) }),
|
|
2325
|
+
) })
|
|
2326
|
+
] }),
|
|
2417
2327
|
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2418
2328
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2419
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () =>
|
|
2329
|
+
/* @__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" }) })
|
|
2420
2330
|
] }) : null,
|
|
2421
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading
|
|
2422
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No
|
|
2423
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "
|
|
2424
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
2331
|
+
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: [
|
|
2332
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
2333
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
2334
|
+
] }) : /* @__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: [
|
|
2425
2335
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2426
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
2427
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
2428
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
2429
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
2430
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
2431
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
2432
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
2433
|
-
/* @__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" }),
|
|
2434
|
-
/* @__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" }),
|
|
2435
|
-
/* @__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" })
|
|
2336
|
+
/* @__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" }),
|
|
2337
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
2338
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
2339
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
2340
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
2341
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
2342
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
2436
2343
|
] }) }),
|
|
2437
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((
|
|
2344
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2438
2345
|
"tr",
|
|
2439
2346
|
{
|
|
2440
|
-
className: "
|
|
2441
|
-
onClick: () => navigate(`/
|
|
2347
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
2348
|
+
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
2442
2349
|
children: [
|
|
2443
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
2444
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
2445
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
2446
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
2447
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle uppercase", children: r.currency_code || "—" }),
|
|
2448
|
-
/* @__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 || "—" }),
|
|
2449
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2350
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
2351
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
2352
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
2353
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2450
2354
|
ui.Badge,
|
|
2451
2355
|
{
|
|
2452
2356
|
size: "2xsmall",
|
|
2453
|
-
className: `uppercase ${getStatusBadgeClass$7(displayStatus(
|
|
2454
|
-
children: displayStatus(
|
|
2357
|
+
className: `uppercase ${getStatusBadgeClass$7(displayStatus(t))}`,
|
|
2358
|
+
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
2455
2359
|
}
|
|
2456
2360
|
) }),
|
|
2457
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
2458
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
2361
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
2362
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
2363
|
+
year: "numeric",
|
|
2459
2364
|
month: "short",
|
|
2460
2365
|
day: "numeric",
|
|
2461
2366
|
hour: "numeric",
|
|
2462
2367
|
minute: "2-digit",
|
|
2463
2368
|
hour12: true
|
|
2464
2369
|
}) }),
|
|
2465
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2370
|
+
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: "px-4 py-4", children: [
|
|
2466
2371
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2467
2372
|
ui.Button,
|
|
2468
2373
|
{
|
|
@@ -2470,27 +2375,27 @@ const RefundsPage = () => {
|
|
|
2470
2375
|
size: "small",
|
|
2471
2376
|
onClick: (e) => {
|
|
2472
2377
|
e.stopPropagation();
|
|
2473
|
-
navigate(`/
|
|
2378
|
+
navigate(`/payments/${t.payment_session_id}`);
|
|
2474
2379
|
},
|
|
2475
|
-
children: "
|
|
2380
|
+
children: "View details"
|
|
2476
2381
|
}
|
|
2477
2382
|
),
|
|
2478
|
-
|
|
2383
|
+
t.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2479
2384
|
ui.Button,
|
|
2480
2385
|
{
|
|
2481
2386
|
variant: "transparent",
|
|
2482
2387
|
size: "small",
|
|
2483
2388
|
onClick: (e) => {
|
|
2484
2389
|
e.stopPropagation();
|
|
2485
|
-
navigate(`/orders/${
|
|
2390
|
+
navigate(`/orders/${t.order_id}`);
|
|
2486
2391
|
},
|
|
2487
2392
|
children: "Order"
|
|
2488
2393
|
}
|
|
2489
2394
|
) : null
|
|
2490
|
-
] })
|
|
2395
|
+
] })
|
|
2491
2396
|
]
|
|
2492
2397
|
},
|
|
2493
|
-
|
|
2398
|
+
t.payment_session_id
|
|
2494
2399
|
)) })
|
|
2495
2400
|
] }) }),
|
|
2496
2401
|
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2498,15 +2403,15 @@ const RefundsPage = () => {
|
|
|
2498
2403
|
{
|
|
2499
2404
|
variant: "secondary",
|
|
2500
2405
|
isLoading: isFetchingMore,
|
|
2501
|
-
onClick: () =>
|
|
2406
|
+
onClick: () => loadTransactions(offset, false),
|
|
2502
2407
|
children: "Load more"
|
|
2503
2408
|
}
|
|
2504
2409
|
) }) : null
|
|
2505
2410
|
] }) });
|
|
2506
2411
|
};
|
|
2507
2412
|
const config$8 = adminSdk.defineRouteConfig({
|
|
2508
|
-
label: "
|
|
2509
|
-
icon: icons.
|
|
2413
|
+
label: "Payments",
|
|
2414
|
+
icon: icons.CreditCard
|
|
2510
2415
|
});
|
|
2511
2416
|
const useDebounce$2 = (value, delay) => {
|
|
2512
2417
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
@@ -2524,19 +2429,27 @@ const getStatusBadgeClass$6 = (status) => {
|
|
|
2524
2429
|
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2525
2430
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2526
2431
|
};
|
|
2527
|
-
const
|
|
2432
|
+
const RefundsPage = () => {
|
|
2528
2433
|
const navigate = reactRouterDom.useNavigate();
|
|
2529
2434
|
const [items, setItems] = react.useState([]);
|
|
2530
|
-
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
2531
2435
|
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
2532
2436
|
const debouncedOrderId = useDebounce$2(orderIdSearch, 300);
|
|
2437
|
+
const [paymentStatusFilter, setPaymentStatusFilter] = react.useState("all");
|
|
2438
|
+
const [providerSearch, setProviderSearch] = react.useState("");
|
|
2439
|
+
const debouncedProvider = useDebounce$2(providerSearch, 300);
|
|
2440
|
+
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
2441
|
+
const debouncedCurrency = useDebounce$2(currencySearch, 300);
|
|
2442
|
+
const [dateFrom, setDateFrom] = react.useState("");
|
|
2443
|
+
const [dateTo, setDateTo] = react.useState("");
|
|
2444
|
+
const [amountMin, setAmountMin] = react.useState("");
|
|
2445
|
+
const [amountMax, setAmountMax] = react.useState("");
|
|
2533
2446
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
2534
2447
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
2535
2448
|
const [error, setError] = react.useState(null);
|
|
2536
2449
|
const [offset, setOffset] = react.useState(0);
|
|
2537
2450
|
const [count, setCount] = react.useState(0);
|
|
2538
2451
|
const limit = 50;
|
|
2539
|
-
const
|
|
2452
|
+
const loadRefunds = react.useCallback(
|
|
2540
2453
|
async (nextOffset, replace) => {
|
|
2541
2454
|
try {
|
|
2542
2455
|
if (replace) setIsLoading(true);
|
|
@@ -2545,18 +2458,25 @@ const PaymentsPage = () => {
|
|
|
2545
2458
|
const params = new URLSearchParams();
|
|
2546
2459
|
params.set("limit", String(limit));
|
|
2547
2460
|
params.set("offset", String(nextOffset));
|
|
2548
|
-
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
2549
2461
|
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
);
|
|
2462
|
+
if (paymentStatusFilter !== "all") params.set("payment_status", paymentStatusFilter);
|
|
2463
|
+
if (debouncedProvider.trim()) params.set("provider_id", debouncedProvider.trim());
|
|
2464
|
+
if (debouncedCurrency.trim()) params.set("currency_code", debouncedCurrency.trim());
|
|
2465
|
+
if (dateFrom.trim()) params.set("date_from", dateFrom.trim());
|
|
2466
|
+
if (dateTo.trim()) params.set("date_to", dateTo.trim());
|
|
2467
|
+
const min = amountMin.trim() ? Number(amountMin) : void 0;
|
|
2468
|
+
const max = amountMax.trim() ? Number(amountMax) : void 0;
|
|
2469
|
+
if (min != null && !Number.isNaN(min)) params.set("amount_min", String(min));
|
|
2470
|
+
if (max != null && !Number.isNaN(max)) params.set("amount_max", String(max));
|
|
2471
|
+
const response = await fetch(`/admin/refunds?${params.toString()}`, {
|
|
2472
|
+
credentials: "include"
|
|
2473
|
+
});
|
|
2554
2474
|
if (!response.ok) {
|
|
2555
2475
|
const text = await response.text();
|
|
2556
|
-
throw new Error(text || "Failed to load
|
|
2476
|
+
throw new Error(text || "Failed to load refunds");
|
|
2557
2477
|
}
|
|
2558
2478
|
const payload = await response.json();
|
|
2559
|
-
const list = payload.
|
|
2479
|
+
const list = payload.refunds ?? [];
|
|
2560
2480
|
setCount(payload.count ?? 0);
|
|
2561
2481
|
setOffset(nextOffset + list.length);
|
|
2562
2482
|
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
@@ -2567,46 +2487,75 @@ const PaymentsPage = () => {
|
|
|
2567
2487
|
setIsFetchingMore(false);
|
|
2568
2488
|
}
|
|
2569
2489
|
},
|
|
2570
|
-
[
|
|
2490
|
+
[
|
|
2491
|
+
debouncedOrderId,
|
|
2492
|
+
paymentStatusFilter,
|
|
2493
|
+
debouncedProvider,
|
|
2494
|
+
debouncedCurrency,
|
|
2495
|
+
dateFrom,
|
|
2496
|
+
dateTo,
|
|
2497
|
+
amountMin,
|
|
2498
|
+
amountMax
|
|
2499
|
+
]
|
|
2571
2500
|
);
|
|
2572
2501
|
react.useEffect(() => {
|
|
2573
|
-
void
|
|
2574
|
-
}, [
|
|
2502
|
+
void loadRefunds(0, true);
|
|
2503
|
+
}, [loadRefunds]);
|
|
2575
2504
|
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
2576
|
-
const
|
|
2577
|
-
const
|
|
2578
|
-
return
|
|
2505
|
+
const displayAmount = (r) => {
|
|
2506
|
+
const code = (r.currency_code ?? "USD").toUpperCase();
|
|
2507
|
+
return `${code} ${Number(r.amount)}`;
|
|
2579
2508
|
};
|
|
2580
|
-
const
|
|
2581
|
-
const
|
|
2582
|
-
return
|
|
2509
|
+
const displayStatus = (r) => {
|
|
2510
|
+
const s2 = r.payment_status ?? "";
|
|
2511
|
+
return s2 !== "" ? s2 : "—";
|
|
2583
2512
|
};
|
|
2584
2513
|
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: [
|
|
2585
2514
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
2586
2515
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2587
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
2588
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
2516
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refunds" }),
|
|
2517
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Refund records — amount, order, payment status" })
|
|
2589
2518
|
] }),
|
|
2590
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () =>
|
|
2519
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadRefunds(0, true), children: "Refresh" })
|
|
2591
2520
|
] }),
|
|
2592
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2521
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
2593
2522
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2594
2523
|
ui.Input,
|
|
2595
2524
|
{
|
|
2596
|
-
placeholder: "
|
|
2525
|
+
placeholder: "Order ID",
|
|
2597
2526
|
value: orderIdSearch,
|
|
2598
2527
|
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
2599
|
-
className: "md:max-w-
|
|
2600
|
-
"aria-label": "
|
|
2528
|
+
className: "md:max-w-[180px]",
|
|
2529
|
+
"aria-label": "Filter by order ID"
|
|
2601
2530
|
}
|
|
2602
2531
|
),
|
|
2603
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2532
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2533
|
+
ui.Input,
|
|
2534
|
+
{
|
|
2535
|
+
placeholder: "Provider",
|
|
2536
|
+
value: providerSearch,
|
|
2537
|
+
onChange: (e) => setProviderSearch(e.target.value),
|
|
2538
|
+
className: "md:max-w-[140px]",
|
|
2539
|
+
"aria-label": "Filter by provider"
|
|
2540
|
+
}
|
|
2541
|
+
),
|
|
2542
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2543
|
+
ui.Input,
|
|
2544
|
+
{
|
|
2545
|
+
placeholder: "Currency",
|
|
2546
|
+
value: currencySearch,
|
|
2547
|
+
onChange: (e) => setCurrencySearch(e.target.value),
|
|
2548
|
+
className: "md:max-w-[100px]",
|
|
2549
|
+
"aria-label": "Filter by currency"
|
|
2550
|
+
}
|
|
2551
|
+
),
|
|
2552
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2604
2553
|
"select",
|
|
2605
2554
|
{
|
|
2606
|
-
value:
|
|
2607
|
-
onChange: (e) =>
|
|
2608
|
-
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-
|
|
2609
|
-
"aria-label": "Filter by status",
|
|
2555
|
+
value: paymentStatusFilter,
|
|
2556
|
+
onChange: (e) => setPaymentStatusFilter(e.target.value),
|
|
2557
|
+
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]",
|
|
2558
|
+
"aria-label": "Filter by payment status",
|
|
2610
2559
|
children: [
|
|
2611
2560
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
2612
2561
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
@@ -2617,52 +2566,103 @@ const PaymentsPage = () => {
|
|
|
2617
2566
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
2618
2567
|
]
|
|
2619
2568
|
}
|
|
2620
|
-
)
|
|
2621
|
-
|
|
2569
|
+
),
|
|
2570
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2571
|
+
ui.Input,
|
|
2572
|
+
{
|
|
2573
|
+
type: "date",
|
|
2574
|
+
placeholder: "From",
|
|
2575
|
+
value: dateFrom,
|
|
2576
|
+
onChange: (e) => setDateFrom(e.target.value),
|
|
2577
|
+
className: "md:max-w-[140px]",
|
|
2578
|
+
"aria-label": "Date from"
|
|
2579
|
+
}
|
|
2580
|
+
),
|
|
2581
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2582
|
+
ui.Input,
|
|
2583
|
+
{
|
|
2584
|
+
type: "date",
|
|
2585
|
+
placeholder: "To",
|
|
2586
|
+
value: dateTo,
|
|
2587
|
+
onChange: (e) => setDateTo(e.target.value),
|
|
2588
|
+
className: "md:max-w-[140px]",
|
|
2589
|
+
"aria-label": "Date to"
|
|
2590
|
+
}
|
|
2591
|
+
),
|
|
2592
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2593
|
+
ui.Input,
|
|
2594
|
+
{
|
|
2595
|
+
placeholder: "Amount min",
|
|
2596
|
+
value: amountMin,
|
|
2597
|
+
onChange: (e) => setAmountMin(e.target.value),
|
|
2598
|
+
type: "number",
|
|
2599
|
+
min: 0,
|
|
2600
|
+
className: "md:max-w-[100px]",
|
|
2601
|
+
"aria-label": "Refund amount minimum"
|
|
2602
|
+
}
|
|
2603
|
+
),
|
|
2604
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2605
|
+
ui.Input,
|
|
2606
|
+
{
|
|
2607
|
+
placeholder: "Amount max",
|
|
2608
|
+
value: amountMax,
|
|
2609
|
+
onChange: (e) => setAmountMax(e.target.value),
|
|
2610
|
+
type: "number",
|
|
2611
|
+
min: 0,
|
|
2612
|
+
className: "md:max-w-[100px]",
|
|
2613
|
+
"aria-label": "Refund amount maximum"
|
|
2614
|
+
}
|
|
2615
|
+
)
|
|
2616
|
+
] }) }),
|
|
2622
2617
|
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2623
2618
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2624
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () =>
|
|
2619
|
+
/* @__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" }) })
|
|
2625
2620
|
] }) : null,
|
|
2626
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading
|
|
2627
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No
|
|
2628
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "
|
|
2629
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-
|
|
2630
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2631
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
2632
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
2633
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
2634
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
2635
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
2636
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
2637
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
2621
|
+
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: [
|
|
2622
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No refunds yet" }),
|
|
2623
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Refund records will appear here." })
|
|
2624
|
+
] }) : /* @__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: [
|
|
2625
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2626
|
+
/* @__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" }),
|
|
2627
|
+
/* @__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" }),
|
|
2628
|
+
/* @__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" }),
|
|
2629
|
+
/* @__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" }),
|
|
2630
|
+
/* @__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" }),
|
|
2631
|
+
/* @__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" }),
|
|
2632
|
+
/* @__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" }),
|
|
2633
|
+
/* @__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" }),
|
|
2634
|
+
/* @__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" }),
|
|
2635
|
+
/* @__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" })
|
|
2638
2636
|
] }) }),
|
|
2639
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((
|
|
2637
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((r) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2640
2638
|
"tr",
|
|
2641
2639
|
{
|
|
2642
|
-
className: "hover:bg-ui-bg-subtle/60
|
|
2643
|
-
onClick: () => navigate(`/
|
|
2640
|
+
className: "cursor-pointer hover:bg-ui-bg-subtle/60",
|
|
2641
|
+
onClick: () => navigate(`/refunds/${r.refund_id}`),
|
|
2644
2642
|
children: [
|
|
2645
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
2646
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
2647
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
2648
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
2643
|
+
/* @__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 }),
|
|
2644
|
+
/* @__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 ?? "—" }),
|
|
2645
|
+
/* @__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 }),
|
|
2646
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", children: displayAmount(r) }),
|
|
2647
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle uppercase", children: r.currency_code || "—" }),
|
|
2648
|
+
/* @__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 || "—" }),
|
|
2649
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2649
2650
|
ui.Badge,
|
|
2650
2651
|
{
|
|
2651
2652
|
size: "2xsmall",
|
|
2652
|
-
className: `uppercase ${getStatusBadgeClass$6(displayStatus(
|
|
2653
|
-
children: displayStatus(
|
|
2653
|
+
className: `uppercase ${getStatusBadgeClass$6(displayStatus(r))}`,
|
|
2654
|
+
children: displayStatus(r) !== "—" ? displayStatus(r).replace(/_/g, " ") : "—"
|
|
2654
2655
|
}
|
|
2655
2656
|
) }),
|
|
2656
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
2657
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
2658
|
-
year: "numeric",
|
|
2657
|
+
/* @__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 ?? "—" }),
|
|
2658
|
+
/* @__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", {
|
|
2659
2659
|
month: "short",
|
|
2660
2660
|
day: "numeric",
|
|
2661
2661
|
hour: "numeric",
|
|
2662
2662
|
minute: "2-digit",
|
|
2663
2663
|
hour12: true
|
|
2664
2664
|
}) }),
|
|
2665
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2665
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-1", children: [
|
|
2666
2666
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2667
2667
|
ui.Button,
|
|
2668
2668
|
{
|
|
@@ -2670,27 +2670,27 @@ const PaymentsPage = () => {
|
|
|
2670
2670
|
size: "small",
|
|
2671
2671
|
onClick: (e) => {
|
|
2672
2672
|
e.stopPropagation();
|
|
2673
|
-
navigate(`/
|
|
2673
|
+
navigate(`/refunds/${r.refund_id}`);
|
|
2674
2674
|
},
|
|
2675
|
-
children: "
|
|
2675
|
+
children: "Details"
|
|
2676
2676
|
}
|
|
2677
2677
|
),
|
|
2678
|
-
|
|
2678
|
+
r.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2679
2679
|
ui.Button,
|
|
2680
2680
|
{
|
|
2681
2681
|
variant: "transparent",
|
|
2682
2682
|
size: "small",
|
|
2683
2683
|
onClick: (e) => {
|
|
2684
2684
|
e.stopPropagation();
|
|
2685
|
-
navigate(`/orders/${
|
|
2685
|
+
navigate(`/orders/${r.order_id}`);
|
|
2686
2686
|
},
|
|
2687
2687
|
children: "Order"
|
|
2688
2688
|
}
|
|
2689
2689
|
) : null
|
|
2690
|
-
] })
|
|
2690
|
+
] }) })
|
|
2691
2691
|
]
|
|
2692
2692
|
},
|
|
2693
|
-
|
|
2693
|
+
r.refund_id
|
|
2694
2694
|
)) })
|
|
2695
2695
|
] }) }),
|
|
2696
2696
|
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2698,15 +2698,15 @@ const PaymentsPage = () => {
|
|
|
2698
2698
|
{
|
|
2699
2699
|
variant: "secondary",
|
|
2700
2700
|
isLoading: isFetchingMore,
|
|
2701
|
-
onClick: () =>
|
|
2701
|
+
onClick: () => loadRefunds(offset, false),
|
|
2702
2702
|
children: "Load more"
|
|
2703
2703
|
}
|
|
2704
2704
|
) }) : null
|
|
2705
2705
|
] }) });
|
|
2706
2706
|
};
|
|
2707
2707
|
const config$7 = adminSdk.defineRouteConfig({
|
|
2708
|
-
label: "
|
|
2709
|
-
icon: icons.
|
|
2708
|
+
label: "Refunds",
|
|
2709
|
+
icon: icons.Receipt
|
|
2710
2710
|
});
|
|
2711
2711
|
const useDebounce$1 = (value, delay) => {
|
|
2712
2712
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
@@ -3913,205 +3913,14 @@ const DetailError = ({
|
|
|
3913
3913
|
/* @__PURE__ */ jsxRuntime.jsx(icons.ExclamationCircle, { className: ui.clx(notFound ? "text-ui-fg-muted" : "text-ui-fg-error") }),
|
|
3914
3914
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", children: notFound ? "Audit entry not found" : "Unable to load this deleted record" }),
|
|
3915
3915
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "max-w-md text-ui-fg-subtle", children: notFound ? "This audit entry doesn’t exist. The link may be incorrect." : "We couldn’t retrieve the audit entry right now. Check your connection and try again." }),
|
|
3916
|
-
!notFound ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", className: "max-w-md font-mono text-ui-fg-muted", children: message }) : null,
|
|
3917
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 flex gap-2", children: [
|
|
3918
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", size: "small", onClick: onBack, children: "Back to Deleted Records" }),
|
|
3919
|
-
!notFound ? /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", size: "small", onClick: onRetry, children: "Try again" }) : null
|
|
3920
|
-
] })
|
|
3921
|
-
] });
|
|
3922
|
-
const config$4 = adminSdk.defineRouteConfig({});
|
|
3923
|
-
const getStatusBadgeClass$3 = (status) => {
|
|
3924
|
-
const s2 = status.toLowerCase();
|
|
3925
|
-
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
3926
|
-
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
3927
|
-
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
3928
|
-
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
3929
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
3930
|
-
};
|
|
3931
|
-
const formatAmount = (value) => {
|
|
3932
|
-
return String(value);
|
|
3933
|
-
};
|
|
3934
|
-
const RefundDetailPage = () => {
|
|
3935
|
-
const navigate = reactRouterDom.useNavigate();
|
|
3936
|
-
const params = reactRouterDom.useParams();
|
|
3937
|
-
const id = params?.id?.trim();
|
|
3938
|
-
const [detail, setDetail] = react.useState(null);
|
|
3939
|
-
const [loading, setLoading] = react.useState(!!id);
|
|
3940
|
-
const [error, setError] = react.useState(null);
|
|
3941
|
-
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
3942
|
-
react.useEffect(() => {
|
|
3943
|
-
if (!id) {
|
|
3944
|
-
setLoading(false);
|
|
3945
|
-
return;
|
|
3946
|
-
}
|
|
3947
|
-
let cancelled = false;
|
|
3948
|
-
setLoading(true);
|
|
3949
|
-
setError(null);
|
|
3950
|
-
fetch(`/admin/refunds/${id}`, { credentials: "include" }).then((res) => {
|
|
3951
|
-
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
3952
|
-
return res.json();
|
|
3953
|
-
}).then((data) => {
|
|
3954
|
-
if (!cancelled) setDetail(data);
|
|
3955
|
-
}).catch((e) => {
|
|
3956
|
-
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
3957
|
-
}).finally(() => {
|
|
3958
|
-
if (!cancelled) setLoading(false);
|
|
3959
|
-
});
|
|
3960
|
-
return () => {
|
|
3961
|
-
cancelled = true;
|
|
3962
|
-
};
|
|
3963
|
-
}, [id]);
|
|
3964
|
-
const paymentStatus = detail?.payment?.status ?? "—";
|
|
3965
|
-
const hasGatewayData = detail?.payment?.payment_data && typeof detail.payment.payment_data === "object" && Object.keys(detail.payment.payment_data).length > 0;
|
|
3966
|
-
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: [
|
|
3967
|
-
/* @__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: [
|
|
3968
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
|
|
3969
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refund details" }),
|
|
3970
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle font-mono", children: id ?? "—" })
|
|
3971
|
-
] }) }),
|
|
3972
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
3973
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
3974
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/refunds"), children: "Back to list" })
|
|
3975
|
-
] }) : 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: [
|
|
3976
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
3977
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Refund summary" }),
|
|
3978
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
3979
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3980
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund ID" }),
|
|
3981
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.id })
|
|
3982
|
-
] }),
|
|
3983
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3984
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
3985
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.refund.amount) })
|
|
3986
|
-
] }),
|
|
3987
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3988
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Note" }),
|
|
3989
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.refund.note ?? "—" })
|
|
3990
|
-
] }),
|
|
3991
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3992
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created at" }),
|
|
3993
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.refund.created_at).toLocaleDateString("en-US", {
|
|
3994
|
-
year: "numeric",
|
|
3995
|
-
month: "short",
|
|
3996
|
-
day: "numeric",
|
|
3997
|
-
hour: "numeric",
|
|
3998
|
-
minute: "2-digit",
|
|
3999
|
-
hour12: true
|
|
4000
|
-
}) })
|
|
4001
|
-
] }),
|
|
4002
|
-
detail.refund.created_by ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4003
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
|
|
4004
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
|
|
4005
|
-
] }) : null
|
|
4006
|
-
] })
|
|
4007
|
-
] }),
|
|
4008
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4009
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
|
|
4010
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4011
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4012
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment amount" }),
|
|
4013
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.payment_amount) })
|
|
4014
|
-
] }),
|
|
4015
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4016
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Captured amount" }),
|
|
4017
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.captured_amount) })
|
|
4018
|
-
] }),
|
|
4019
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4020
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refunded amount" }),
|
|
4021
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.refunded_amount) })
|
|
4022
|
-
] }),
|
|
4023
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4024
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
4025
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment.provider_id || "—" })
|
|
4026
|
-
] }),
|
|
4027
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4028
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
4029
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4030
|
-
ui.Badge,
|
|
4031
|
-
{
|
|
4032
|
-
size: "2xsmall",
|
|
4033
|
-
className: `uppercase ${getStatusBadgeClass$3(paymentStatus)}`,
|
|
4034
|
-
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
4035
|
-
}
|
|
4036
|
-
) })
|
|
4037
|
-
] }),
|
|
4038
|
-
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4039
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4040
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
4041
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
4042
|
-
] }),
|
|
4043
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4044
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
4045
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
4046
|
-
] }),
|
|
4047
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4048
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
4049
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
4050
|
-
detail.computed.refund_percentage.toFixed(1),
|
|
4051
|
-
"%"
|
|
4052
|
-
] })
|
|
4053
|
-
] })
|
|
4054
|
-
] }) : null
|
|
4055
|
-
] })
|
|
4056
|
-
] }),
|
|
4057
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4058
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Order summary" }),
|
|
4059
|
-
detail.order ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4060
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4061
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
4062
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4063
|
-
ui.Button,
|
|
4064
|
-
{
|
|
4065
|
-
variant: "transparent",
|
|
4066
|
-
size: "small",
|
|
4067
|
-
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
4068
|
-
children: detail.order.order_number ?? detail.order.order_id
|
|
4069
|
-
}
|
|
4070
|
-
) })
|
|
4071
|
-
] }),
|
|
4072
|
-
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4073
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
4074
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
4075
|
-
] }) : null,
|
|
4076
|
-
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4077
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
4078
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
4079
|
-
] }) : null,
|
|
4080
|
-
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4081
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
4082
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
4083
|
-
] }) : null,
|
|
4084
|
-
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4085
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
4086
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
4087
|
-
] }) : null
|
|
4088
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
4089
|
-
] }),
|
|
4090
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4091
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4092
|
-
"button",
|
|
4093
|
-
{
|
|
4094
|
-
type: "button",
|
|
4095
|
-
className: "flex w-full items-center justify-between text-left",
|
|
4096
|
-
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
4097
|
-
"aria-expanded": gatewayExpanded,
|
|
4098
|
-
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
4099
|
-
children: [
|
|
4100
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
4101
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
4102
|
-
]
|
|
4103
|
-
}
|
|
4104
|
-
),
|
|
4105
|
-
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." }) })
|
|
4106
|
-
] })
|
|
4107
|
-
] }) : null
|
|
4108
|
-
] }) });
|
|
4109
|
-
};
|
|
4110
|
-
const config$3 = adminSdk.defineRouteConfig({
|
|
4111
|
-
label: "Refund details",
|
|
4112
|
-
icon: icons.Receipt
|
|
4113
|
-
});
|
|
4114
|
-
const getStatusBadgeClass$2 = (status) => {
|
|
3916
|
+
!notFound ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", className: "max-w-md font-mono text-ui-fg-muted", children: message }) : null,
|
|
3917
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 flex gap-2", children: [
|
|
3918
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", size: "small", onClick: onBack, children: "Back to Deleted Records" }),
|
|
3919
|
+
!notFound ? /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", size: "small", onClick: onRetry, children: "Try again" }) : null
|
|
3920
|
+
] })
|
|
3921
|
+
] });
|
|
3922
|
+
const config$4 = adminSdk.defineRouteConfig({});
|
|
3923
|
+
const getStatusBadgeClass$3 = (status) => {
|
|
4115
3924
|
const s2 = status.toLowerCase();
|
|
4116
3925
|
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
4117
3926
|
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
@@ -4189,7 +3998,7 @@ const PaymentDetailPage = () => {
|
|
|
4189
3998
|
ui.Badge,
|
|
4190
3999
|
{
|
|
4191
4000
|
size: "2xsmall",
|
|
4192
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
4001
|
+
className: `uppercase ${getStatusBadgeClass$3(displayStatus)}`,
|
|
4193
4002
|
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
4194
4003
|
}
|
|
4195
4004
|
) })
|
|
@@ -4225,11 +4034,11 @@ const PaymentDetailPage = () => {
|
|
|
4225
4034
|
] }) : null
|
|
4226
4035
|
] }) });
|
|
4227
4036
|
};
|
|
4228
|
-
const config$
|
|
4037
|
+
const config$3 = adminSdk.defineRouteConfig({
|
|
4229
4038
|
label: "Payment details",
|
|
4230
4039
|
icon: icons.CreditCard
|
|
4231
4040
|
});
|
|
4232
|
-
const getStatusBadgeClass$
|
|
4041
|
+
const getStatusBadgeClass$2 = (status) => {
|
|
4233
4042
|
const statusLower = status.toLowerCase();
|
|
4234
4043
|
if (statusLower === "requested") {
|
|
4235
4044
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -4362,7 +4171,7 @@ const ReturnDetailPage = () => {
|
|
|
4362
4171
|
ui.Badge,
|
|
4363
4172
|
{
|
|
4364
4173
|
size: "small",
|
|
4365
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
4174
|
+
className: `uppercase ${getStatusBadgeClass$2(returnOrder.status)}`,
|
|
4366
4175
|
children: returnOrder.status.replace(/_/g, " ")
|
|
4367
4176
|
}
|
|
4368
4177
|
)
|
|
@@ -4445,7 +4254,7 @@ const ReturnDetailPage = () => {
|
|
|
4445
4254
|
ui.Badge,
|
|
4446
4255
|
{
|
|
4447
4256
|
size: "2xsmall",
|
|
4448
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
4257
|
+
className: `uppercase ${getStatusBadgeClass$2(entry.status)}`,
|
|
4449
4258
|
children: entry.status.replace(/_/g, " ")
|
|
4450
4259
|
}
|
|
4451
4260
|
) }),
|
|
@@ -4507,11 +4316,11 @@ const ReturnDetailPage = () => {
|
|
|
4507
4316
|
updateSuccess && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-ui-border-success bg-ui-bg-success-subtle p-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-success", children: "Action completed successfully" }) })
|
|
4508
4317
|
] }) });
|
|
4509
4318
|
};
|
|
4510
|
-
const config$
|
|
4319
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
4511
4320
|
label: "Return Order Details",
|
|
4512
4321
|
icon: icons.CheckCircle
|
|
4513
4322
|
});
|
|
4514
|
-
const getStatusBadgeClass = (status) => {
|
|
4323
|
+
const getStatusBadgeClass$1 = (status) => {
|
|
4515
4324
|
const statusLower = status.toLowerCase();
|
|
4516
4325
|
if (statusLower === "requested") {
|
|
4517
4326
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -4648,7 +4457,7 @@ const SwapDetailPage = () => {
|
|
|
4648
4457
|
ui.Badge,
|
|
4649
4458
|
{
|
|
4650
4459
|
size: "small",
|
|
4651
|
-
className: `uppercase ${getStatusBadgeClass(swap.status)}`,
|
|
4460
|
+
className: `uppercase ${getStatusBadgeClass$1(swap.status)}`,
|
|
4652
4461
|
children: swap.status.replace(/_/g, " ")
|
|
4653
4462
|
}
|
|
4654
4463
|
)
|
|
@@ -4716,7 +4525,7 @@ const SwapDetailPage = () => {
|
|
|
4716
4525
|
ui.Badge,
|
|
4717
4526
|
{
|
|
4718
4527
|
size: "2xsmall",
|
|
4719
|
-
className: `uppercase ${getStatusBadgeClass(entry.status)}`,
|
|
4528
|
+
className: `uppercase ${getStatusBadgeClass$1(entry.status)}`,
|
|
4720
4529
|
children: entry.status.replace(/_/g, " ")
|
|
4721
4530
|
}
|
|
4722
4531
|
) }),
|
|
@@ -4785,10 +4594,201 @@ const SwapDetailPage = () => {
|
|
|
4785
4594
|
] })
|
|
4786
4595
|
] }) });
|
|
4787
4596
|
};
|
|
4788
|
-
const config = adminSdk.defineRouteConfig({
|
|
4597
|
+
const config$1 = adminSdk.defineRouteConfig({
|
|
4789
4598
|
label: "Swap Details",
|
|
4790
4599
|
icon: icons.ArrowPath
|
|
4791
4600
|
});
|
|
4601
|
+
const getStatusBadgeClass = (status) => {
|
|
4602
|
+
const s2 = status.toLowerCase();
|
|
4603
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
4604
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
4605
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
4606
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
4607
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
4608
|
+
};
|
|
4609
|
+
const formatAmount = (value) => {
|
|
4610
|
+
return String(value);
|
|
4611
|
+
};
|
|
4612
|
+
const RefundDetailPage = () => {
|
|
4613
|
+
const navigate = reactRouterDom.useNavigate();
|
|
4614
|
+
const params = reactRouterDom.useParams();
|
|
4615
|
+
const id = params?.id?.trim();
|
|
4616
|
+
const [detail, setDetail] = react.useState(null);
|
|
4617
|
+
const [loading, setLoading] = react.useState(!!id);
|
|
4618
|
+
const [error, setError] = react.useState(null);
|
|
4619
|
+
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
4620
|
+
react.useEffect(() => {
|
|
4621
|
+
if (!id) {
|
|
4622
|
+
setLoading(false);
|
|
4623
|
+
return;
|
|
4624
|
+
}
|
|
4625
|
+
let cancelled = false;
|
|
4626
|
+
setLoading(true);
|
|
4627
|
+
setError(null);
|
|
4628
|
+
fetch(`/admin/refunds/${id}`, { credentials: "include" }).then((res) => {
|
|
4629
|
+
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
4630
|
+
return res.json();
|
|
4631
|
+
}).then((data) => {
|
|
4632
|
+
if (!cancelled) setDetail(data);
|
|
4633
|
+
}).catch((e) => {
|
|
4634
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
4635
|
+
}).finally(() => {
|
|
4636
|
+
if (!cancelled) setLoading(false);
|
|
4637
|
+
});
|
|
4638
|
+
return () => {
|
|
4639
|
+
cancelled = true;
|
|
4640
|
+
};
|
|
4641
|
+
}, [id]);
|
|
4642
|
+
const paymentStatus = detail?.payment?.status ?? "—";
|
|
4643
|
+
const hasGatewayData = detail?.payment?.payment_data && typeof detail.payment.payment_data === "object" && Object.keys(detail.payment.payment_data).length > 0;
|
|
4644
|
+
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: [
|
|
4645
|
+
/* @__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: [
|
|
4646
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
|
|
4647
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refund details" }),
|
|
4648
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle font-mono", children: id ?? "—" })
|
|
4649
|
+
] }) }),
|
|
4650
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
4651
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
4652
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/refunds"), children: "Back to list" })
|
|
4653
|
+
] }) : 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: [
|
|
4654
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4655
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Refund summary" }),
|
|
4656
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4657
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4658
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund ID" }),
|
|
4659
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.id })
|
|
4660
|
+
] }),
|
|
4661
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4662
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
4663
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.refund.amount) })
|
|
4664
|
+
] }),
|
|
4665
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4666
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Note" }),
|
|
4667
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.refund.note ?? "—" })
|
|
4668
|
+
] }),
|
|
4669
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4670
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created at" }),
|
|
4671
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.refund.created_at).toLocaleDateString("en-US", {
|
|
4672
|
+
year: "numeric",
|
|
4673
|
+
month: "short",
|
|
4674
|
+
day: "numeric",
|
|
4675
|
+
hour: "numeric",
|
|
4676
|
+
minute: "2-digit",
|
|
4677
|
+
hour12: true
|
|
4678
|
+
}) })
|
|
4679
|
+
] }),
|
|
4680
|
+
detail.refund.created_by ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4681
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
|
|
4682
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
|
|
4683
|
+
] }) : null
|
|
4684
|
+
] })
|
|
4685
|
+
] }),
|
|
4686
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4687
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
|
|
4688
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4689
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4690
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment amount" }),
|
|
4691
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.payment_amount) })
|
|
4692
|
+
] }),
|
|
4693
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4694
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Captured amount" }),
|
|
4695
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.captured_amount) })
|
|
4696
|
+
] }),
|
|
4697
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4698
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refunded amount" }),
|
|
4699
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.refunded_amount) })
|
|
4700
|
+
] }),
|
|
4701
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4702
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
4703
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment.provider_id || "—" })
|
|
4704
|
+
] }),
|
|
4705
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4706
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
4707
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4708
|
+
ui.Badge,
|
|
4709
|
+
{
|
|
4710
|
+
size: "2xsmall",
|
|
4711
|
+
className: `uppercase ${getStatusBadgeClass(paymentStatus)}`,
|
|
4712
|
+
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
4713
|
+
}
|
|
4714
|
+
) })
|
|
4715
|
+
] }),
|
|
4716
|
+
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4717
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4718
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
4719
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
4720
|
+
] }),
|
|
4721
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4722
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
4723
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
4724
|
+
] }),
|
|
4725
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4726
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
4727
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
4728
|
+
detail.computed.refund_percentage.toFixed(1),
|
|
4729
|
+
"%"
|
|
4730
|
+
] })
|
|
4731
|
+
] })
|
|
4732
|
+
] }) : null
|
|
4733
|
+
] })
|
|
4734
|
+
] }),
|
|
4735
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4736
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Order summary" }),
|
|
4737
|
+
detail.order ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4738
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4739
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
4740
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4741
|
+
ui.Button,
|
|
4742
|
+
{
|
|
4743
|
+
variant: "transparent",
|
|
4744
|
+
size: "small",
|
|
4745
|
+
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
4746
|
+
children: detail.order.order_number ?? detail.order.order_id
|
|
4747
|
+
}
|
|
4748
|
+
) })
|
|
4749
|
+
] }),
|
|
4750
|
+
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4751
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
4752
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
4753
|
+
] }) : null,
|
|
4754
|
+
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4755
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
4756
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
4757
|
+
] }) : null,
|
|
4758
|
+
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4759
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
4760
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
4761
|
+
] }) : null,
|
|
4762
|
+
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4763
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
4764
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
4765
|
+
] }) : null
|
|
4766
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
4767
|
+
] }),
|
|
4768
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4769
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4770
|
+
"button",
|
|
4771
|
+
{
|
|
4772
|
+
type: "button",
|
|
4773
|
+
className: "flex w-full items-center justify-between text-left",
|
|
4774
|
+
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
4775
|
+
"aria-expanded": gatewayExpanded,
|
|
4776
|
+
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
4777
|
+
children: [
|
|
4778
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
4779
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
4780
|
+
]
|
|
4781
|
+
}
|
|
4782
|
+
),
|
|
4783
|
+
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." }) })
|
|
4784
|
+
] })
|
|
4785
|
+
] }) : null
|
|
4786
|
+
] }) });
|
|
4787
|
+
};
|
|
4788
|
+
const config = adminSdk.defineRouteConfig({
|
|
4789
|
+
label: "Refund details",
|
|
4790
|
+
icon: icons.Receipt
|
|
4791
|
+
});
|
|
4792
4792
|
const i18nTranslations0 = {};
|
|
4793
4793
|
const widgetModule = { widgets: [
|
|
4794
4794
|
{
|
|
@@ -4810,13 +4810,13 @@ const routeModule = {
|
|
|
4810
4810
|
handle: { label: config$9.label, translationNs: config$9.translationNs }
|
|
4811
4811
|
},
|
|
4812
4812
|
{
|
|
4813
|
-
Component:
|
|
4814
|
-
path: "/
|
|
4813
|
+
Component: PaymentsPage,
|
|
4814
|
+
path: "/payments",
|
|
4815
4815
|
handle: { label: config$8.label, translationNs: config$8.translationNs }
|
|
4816
4816
|
},
|
|
4817
4817
|
{
|
|
4818
|
-
Component:
|
|
4819
|
-
path: "/
|
|
4818
|
+
Component: RefundsPage,
|
|
4819
|
+
path: "/refunds",
|
|
4820
4820
|
handle: { label: config$7.label, translationNs: config$7.translationNs }
|
|
4821
4821
|
},
|
|
4822
4822
|
{
|
|
@@ -4834,24 +4834,24 @@ const routeModule = {
|
|
|
4834
4834
|
path: "/deleted-records-audit/:id",
|
|
4835
4835
|
handle: { label: config$4.label, translationNs: config$4.translationNs }
|
|
4836
4836
|
},
|
|
4837
|
-
{
|
|
4838
|
-
Component: RefundDetailPage,
|
|
4839
|
-
path: "/refunds/:id",
|
|
4840
|
-
handle: { label: config$3.label, translationNs: config$3.translationNs }
|
|
4841
|
-
},
|
|
4842
4837
|
{
|
|
4843
4838
|
Component: PaymentDetailPage,
|
|
4844
4839
|
path: "/payments/:id",
|
|
4845
|
-
handle: { label: config$
|
|
4840
|
+
handle: { label: config$3.label, translationNs: config$3.translationNs }
|
|
4846
4841
|
},
|
|
4847
4842
|
{
|
|
4848
4843
|
Component: ReturnDetailPage,
|
|
4849
4844
|
path: "/returns/:id",
|
|
4850
|
-
handle: { label: config$
|
|
4845
|
+
handle: { label: config$2.label, translationNs: config$2.translationNs }
|
|
4851
4846
|
},
|
|
4852
4847
|
{
|
|
4853
4848
|
Component: SwapDetailPage,
|
|
4854
4849
|
path: "/swaps/:id",
|
|
4850
|
+
handle: { label: config$1.label, translationNs: config$1.translationNs }
|
|
4851
|
+
},
|
|
4852
|
+
{
|
|
4853
|
+
Component: RefundDetailPage,
|
|
4854
|
+
path: "/refunds/:id",
|
|
4855
4855
|
handle: { label: config.label, translationNs: config.translationNs }
|
|
4856
4856
|
}
|
|
4857
4857
|
]
|
|
@@ -4867,16 +4867,16 @@ const menuItemModule = {
|
|
|
4867
4867
|
translationNs: void 0
|
|
4868
4868
|
},
|
|
4869
4869
|
{
|
|
4870
|
-
label: config$
|
|
4871
|
-
icon: config$
|
|
4870
|
+
label: config$8.label,
|
|
4871
|
+
icon: config$8.icon,
|
|
4872
4872
|
path: "/payments",
|
|
4873
4873
|
nested: void 0,
|
|
4874
4874
|
rank: void 0,
|
|
4875
4875
|
translationNs: void 0
|
|
4876
4876
|
},
|
|
4877
4877
|
{
|
|
4878
|
-
label: config$
|
|
4879
|
-
icon: config$
|
|
4878
|
+
label: config$7.label,
|
|
4879
|
+
icon: config$7.icon,
|
|
4880
4880
|
path: "/refunds",
|
|
4881
4881
|
nested: void 0,
|
|
4882
4882
|
rank: void 0,
|
|
@@ -4899,32 +4899,32 @@ const menuItemModule = {
|
|
|
4899
4899
|
translationNs: void 0
|
|
4900
4900
|
},
|
|
4901
4901
|
{
|
|
4902
|
-
label: config$
|
|
4903
|
-
icon: config$
|
|
4902
|
+
label: config$3.label,
|
|
4903
|
+
icon: config$3.icon,
|
|
4904
4904
|
path: "/payments/:id",
|
|
4905
4905
|
nested: void 0,
|
|
4906
4906
|
rank: void 0,
|
|
4907
4907
|
translationNs: void 0
|
|
4908
4908
|
},
|
|
4909
4909
|
{
|
|
4910
|
-
label: config
|
|
4911
|
-
icon: config
|
|
4910
|
+
label: config.label,
|
|
4911
|
+
icon: config.icon,
|
|
4912
4912
|
path: "/refunds/:id",
|
|
4913
4913
|
nested: void 0,
|
|
4914
4914
|
rank: void 0,
|
|
4915
4915
|
translationNs: void 0
|
|
4916
4916
|
},
|
|
4917
4917
|
{
|
|
4918
|
-
label: config$
|
|
4919
|
-
icon: config$
|
|
4918
|
+
label: config$2.label,
|
|
4919
|
+
icon: config$2.icon,
|
|
4920
4920
|
path: "/returns/:id",
|
|
4921
4921
|
nested: void 0,
|
|
4922
4922
|
rank: void 0,
|
|
4923
4923
|
translationNs: void 0
|
|
4924
4924
|
},
|
|
4925
4925
|
{
|
|
4926
|
-
label: config.label,
|
|
4927
|
-
icon: config.icon,
|
|
4926
|
+
label: config$1.label,
|
|
4927
|
+
icon: config$1.icon,
|
|
4928
4928
|
path: "/swaps/:id",
|
|
4929
4929
|
nested: void 0,
|
|
4930
4930
|
rank: void 0,
|