@easypayment/medusa-paypal 0.1.8 → 0.2.0

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.
Files changed (21) hide show
  1. package/.medusa/server/src/admin/index.js +206 -206
  2. package/.medusa/server/src/admin/index.mjs +207 -207
  3. package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts +1 -1
  4. package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -1
  5. package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js +0 -6
  6. package/.medusa/server/src/api/admin/payment-collections/[id]/payment-sessions/route.js.map +1 -1
  7. package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts +1 -1
  8. package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -1
  9. package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js +0 -8
  10. package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js.map +1 -1
  11. package/.medusa/server/src/jobs/paypal-reconcile.js +1 -1
  12. package/.medusa/server/src/jobs/paypal-reconcile.js.map +1 -1
  13. package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts +3 -4
  14. package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts.map +1 -1
  15. package/.medusa/server/src/modules/paypal/utils/provider-ids.js +7 -21
  16. package/.medusa/server/src/modules/paypal/utils/provider-ids.js.map +1 -1
  17. package/package.json +1 -1
  18. package/src/api/admin/payment-collections/[id]/payment-sessions/route.ts +0 -7
  19. package/src/api/store/payment-collections/[id]/payment-sessions/route.ts +0 -9
  20. package/src/jobs/paypal-reconcile.ts +1 -1
  21. package/src/modules/paypal/utils/provider-ids.ts +6 -18
@@ -336,88 +336,6 @@ function AdditionalSettingsTab() {
336
336
  )
337
337
  ] }) });
338
338
  }
339
- function PayPalApplePayPage() {
340
- return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
341
- }
342
- function formatDate$2(value) {
343
- if (!value) {
344
- return "";
345
- }
346
- const parsed = new Date(value);
347
- if (Number.isNaN(parsed.getTime())) {
348
- return value;
349
- }
350
- return parsed.toLocaleString();
351
- }
352
- function PayPalAuditLogsPage() {
353
- const [logs, setLogs] = react.useState([]);
354
- const [loading, setLoading] = react.useState(false);
355
- const [error, setError] = react.useState(null);
356
- const fetchLogs = react.useCallback(async () => {
357
- try {
358
- setLoading(true);
359
- setError(null);
360
- const response = await fetch("/admin/paypal/audit-logs?limit=50", {
361
- credentials: "include",
362
- headers: {
363
- Accept: "application/json"
364
- }
365
- });
366
- if (!response.ok) {
367
- const message = await response.text().catch(() => "");
368
- throw new Error(message || "Failed to load audit logs.");
369
- }
370
- const data = await response.json().catch(() => ({}));
371
- setLogs((data == null ? void 0 : data.logs) || []);
372
- } catch (fetchError) {
373
- setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
374
- setLogs([]);
375
- } finally {
376
- setLoading(false);
377
- }
378
- }, []);
379
- react.useEffect(() => {
380
- fetchLogs();
381
- }, [fetchLogs]);
382
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
383
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
384
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
385
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
386
- ] }),
387
- /* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
388
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
389
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
390
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
391
- /* @__PURE__ */ jsxRuntime.jsx(
392
- "button",
393
- {
394
- type: "button",
395
- onClick: fetchLogs,
396
- className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
397
- disabled: loading,
398
- children: loading ? "Refreshing..." : "Refresh"
399
- }
400
- )
401
- ] }) }),
402
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
403
- error ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
404
- !error && logs.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading audit logs..." : "No audit log entries found yet." }) : null,
405
- logs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full text-left text-sm", children: [
406
- /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
407
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
408
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
409
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 font-medium", children: "Details" })
410
- ] }) }),
411
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-t border-ui-border-base", children: [
412
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$2(entry.created_at) || "—" }),
413
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
414
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 text-ui-fg-subtle", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap rounded-md bg-ui-bg-subtle p-2 text-xs text-ui-fg-subtle", children: JSON.stringify(entry.metadata || {}, null, 2) }) })
415
- ] }, entry.id)) })
416
- ] }) }) : null
417
- ] })
418
- ] })
419
- ] }) });
420
- }
421
339
  const DEFAULT_FORM = {
422
340
  enabled: true,
423
341
  title: "Credit or Debit Card",
@@ -712,6 +630,9 @@ function AdvancedCardPaymentsTab() {
712
630
  )
713
631
  ] }) });
714
632
  }
633
+ function PayPalApplePayPage() {
634
+ return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
635
+ }
715
636
  const config = adminSdk.defineRouteConfig({
716
637
  label: "PayPal Connection",
717
638
  hide: true
@@ -1302,7 +1223,7 @@ const EMPTY_FILTERS = {
1302
1223
  order_id: "",
1303
1224
  cart_id: ""
1304
1225
  };
1305
- function formatDate$1(value) {
1226
+ function formatDate$2(value) {
1306
1227
  if (!value) {
1307
1228
  return "";
1308
1229
  }
@@ -1481,19 +1402,208 @@ function PayPalDisputesPage() {
1481
1402
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3", children: dispute.amount ? `${dispute.amount} ${dispute.currency_code || ""}` : "-" }),
1482
1403
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3", children: dispute.order_id || "-" }),
1483
1404
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3", children: dispute.cart_id || "-" }),
1484
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 text-ui-fg-subtle", children: formatDate$1(dispute.updated_at || dispute.created_at) })
1405
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 text-ui-fg-subtle", children: formatDate$2(dispute.updated_at || dispute.created_at) })
1485
1406
  ] }, dispute.id)) })
1486
1407
  ] }) }),
1487
1408
  error ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-ui-border-base px-4 py-3 text-sm text-ui-fg-error", children: error }) : null
1488
1409
  ] })
1489
1410
  ] }) });
1490
1411
  }
1412
+ function formatDate$1(value) {
1413
+ if (!value) {
1414
+ return "";
1415
+ }
1416
+ const parsed = new Date(value);
1417
+ if (Number.isNaN(parsed.getTime())) {
1418
+ return value;
1419
+ }
1420
+ return parsed.toLocaleString();
1421
+ }
1422
+ function PayPalAuditLogsPage() {
1423
+ const [logs, setLogs] = react.useState([]);
1424
+ const [loading, setLoading] = react.useState(false);
1425
+ const [error, setError] = react.useState(null);
1426
+ const fetchLogs = react.useCallback(async () => {
1427
+ try {
1428
+ setLoading(true);
1429
+ setError(null);
1430
+ const response = await fetch("/admin/paypal/audit-logs?limit=50", {
1431
+ credentials: "include",
1432
+ headers: {
1433
+ Accept: "application/json"
1434
+ }
1435
+ });
1436
+ if (!response.ok) {
1437
+ const message = await response.text().catch(() => "");
1438
+ throw new Error(message || "Failed to load audit logs.");
1439
+ }
1440
+ const data = await response.json().catch(() => ({}));
1441
+ setLogs((data == null ? void 0 : data.logs) || []);
1442
+ } catch (fetchError) {
1443
+ setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
1444
+ setLogs([]);
1445
+ } finally {
1446
+ setLoading(false);
1447
+ }
1448
+ }, []);
1449
+ react.useEffect(() => {
1450
+ fetchLogs();
1451
+ }, [fetchLogs]);
1452
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
1453
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1454
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
1455
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
1456
+ ] }),
1457
+ /* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
1458
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
1459
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
1460
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
1461
+ /* @__PURE__ */ jsxRuntime.jsx(
1462
+ "button",
1463
+ {
1464
+ type: "button",
1465
+ onClick: fetchLogs,
1466
+ className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
1467
+ disabled: loading,
1468
+ children: loading ? "Refreshing..." : "Refresh"
1469
+ }
1470
+ )
1471
+ ] }) }),
1472
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
1473
+ error ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
1474
+ !error && logs.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading audit logs..." : "No audit log entries found yet." }) : null,
1475
+ logs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full text-left text-sm", children: [
1476
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1477
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
1478
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
1479
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 font-medium", children: "Details" })
1480
+ ] }) }),
1481
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-t border-ui-border-base", children: [
1482
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$1(entry.created_at) || "—" }),
1483
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
1484
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 text-ui-fg-subtle", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "whitespace-pre-wrap rounded-md bg-ui-bg-subtle p-2 text-xs text-ui-fg-subtle", children: JSON.stringify(entry.metadata || {}, null, 2) }) })
1485
+ ] }, entry.id)) })
1486
+ ] }) }) : null
1487
+ ] })
1488
+ ] })
1489
+ ] }) });
1490
+ }
1491
1491
  function PayPalGooglePayPage() {
1492
1492
  return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
1493
1493
  }
1494
1494
  function PayPalPayLaterMessagingPage() {
1495
1495
  return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
1496
1496
  }
1497
+ function formatDate(value) {
1498
+ if (!value) {
1499
+ return "—";
1500
+ }
1501
+ const parsed = new Date(value);
1502
+ if (Number.isNaN(parsed.getTime())) {
1503
+ return value;
1504
+ }
1505
+ return parsed.toLocaleString();
1506
+ }
1507
+ function PayPalReconciliationStatusPage() {
1508
+ const [status, setStatus] = react.useState({});
1509
+ const [loading, setLoading] = react.useState(false);
1510
+ const [error, setError] = react.useState(null);
1511
+ const fetchStatus = react.useCallback(async () => {
1512
+ try {
1513
+ setLoading(true);
1514
+ setError(null);
1515
+ const response = await fetch("/admin/paypal/reconciliation-status", {
1516
+ credentials: "include",
1517
+ headers: {
1518
+ Accept: "application/json"
1519
+ }
1520
+ });
1521
+ if (!response.ok) {
1522
+ const message = await response.text().catch(() => "");
1523
+ throw new Error(message || "Failed to load reconciliation status.");
1524
+ }
1525
+ const data = await response.json().catch(() => ({}));
1526
+ setStatus((data == null ? void 0 : data.status) || {});
1527
+ } catch (fetchError) {
1528
+ setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load reconciliation status.");
1529
+ setStatus({});
1530
+ } finally {
1531
+ setLoading(false);
1532
+ }
1533
+ }, []);
1534
+ react.useEffect(() => {
1535
+ fetchStatus();
1536
+ }, [fetchStatus]);
1537
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
1538
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1539
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Reconciliation Status" }),
1540
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Monitor reconciliation health and drift detection for PayPal payment sessions." })
1541
+ ] }),
1542
+ /* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
1543
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
1544
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
1545
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest reconciliation run" }),
1546
+ /* @__PURE__ */ jsxRuntime.jsx(
1547
+ "button",
1548
+ {
1549
+ type: "button",
1550
+ onClick: fetchStatus,
1551
+ className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
1552
+ disabled: loading,
1553
+ children: loading ? "Refreshing..." : "Refresh"
1554
+ }
1555
+ )
1556
+ ] }) }),
1557
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
1558
+ error ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
1559
+ !error && Object.keys(status).length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading reconciliation status..." : "No reconciliation data yet." }) : null,
1560
+ Object.keys(status).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 text-sm text-ui-fg-base md:grid-cols-2", children: [
1561
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1562
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last run" }),
1563
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_run_at) })
1564
+ ] }),
1565
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1566
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last run status" }),
1567
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium capitalize", children: status.last_run_status || "—" })
1568
+ ] }),
1569
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1570
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last success" }),
1571
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_success_at) })
1572
+ ] }),
1573
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1574
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last failure" }),
1575
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_failure_at) })
1576
+ ] }),
1577
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1578
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Sessions checked" }),
1579
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.sessions_checked ?? 0 })
1580
+ ] }),
1581
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1582
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Sessions updated" }),
1583
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.sessions_updated ?? 0 })
1584
+ ] }),
1585
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1586
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Drift detections" }),
1587
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.drift_count ?? 0 })
1588
+ ] }),
1589
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1590
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last drift order" }),
1591
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.last_drift_order_id || "—" }),
1592
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: formatDate(status.last_drift_at) })
1593
+ ] }),
1594
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
1595
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last error" }),
1596
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.last_error || "No errors recorded." })
1597
+ ] }),
1598
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
1599
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Total runs" }),
1600
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.runs ?? 0 })
1601
+ ] })
1602
+ ] }) : null
1603
+ ] })
1604
+ ] })
1605
+ ] }) });
1606
+ }
1497
1607
  const DISPLAY_LOCATION_OPTIONS = [
1498
1608
  { value: "product", label: "Product Page" },
1499
1609
  { value: "cart", label: "Cart Page" },
@@ -1931,116 +2041,6 @@ function PayPalSettingsTab() {
1931
2041
  )
1932
2042
  ] }) });
1933
2043
  }
1934
- function formatDate(value) {
1935
- if (!value) {
1936
- return "—";
1937
- }
1938
- const parsed = new Date(value);
1939
- if (Number.isNaN(parsed.getTime())) {
1940
- return value;
1941
- }
1942
- return parsed.toLocaleString();
1943
- }
1944
- function PayPalReconciliationStatusPage() {
1945
- const [status, setStatus] = react.useState({});
1946
- const [loading, setLoading] = react.useState(false);
1947
- const [error, setError] = react.useState(null);
1948
- const fetchStatus = react.useCallback(async () => {
1949
- try {
1950
- setLoading(true);
1951
- setError(null);
1952
- const response = await fetch("/admin/paypal/reconciliation-status", {
1953
- credentials: "include",
1954
- headers: {
1955
- Accept: "application/json"
1956
- }
1957
- });
1958
- if (!response.ok) {
1959
- const message = await response.text().catch(() => "");
1960
- throw new Error(message || "Failed to load reconciliation status.");
1961
- }
1962
- const data = await response.json().catch(() => ({}));
1963
- setStatus((data == null ? void 0 : data.status) || {});
1964
- } catch (fetchError) {
1965
- setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load reconciliation status.");
1966
- setStatus({});
1967
- } finally {
1968
- setLoading(false);
1969
- }
1970
- }, []);
1971
- react.useEffect(() => {
1972
- fetchStatus();
1973
- }, [fetchStatus]);
1974
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
1975
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1976
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Reconciliation Status" }),
1977
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Monitor reconciliation health and drift detection for PayPal payment sessions." })
1978
- ] }),
1979
- /* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
1980
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
1981
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
1982
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest reconciliation run" }),
1983
- /* @__PURE__ */ jsxRuntime.jsx(
1984
- "button",
1985
- {
1986
- type: "button",
1987
- onClick: fetchStatus,
1988
- className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
1989
- disabled: loading,
1990
- children: loading ? "Refreshing..." : "Refresh"
1991
- }
1992
- )
1993
- ] }) }),
1994
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
1995
- error ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
1996
- !error && Object.keys(status).length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading reconciliation status..." : "No reconciliation data yet." }) : null,
1997
- Object.keys(status).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 text-sm text-ui-fg-base md:grid-cols-2", children: [
1998
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1999
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last run" }),
2000
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_run_at) })
2001
- ] }),
2002
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2003
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last run status" }),
2004
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium capitalize", children: status.last_run_status || "—" })
2005
- ] }),
2006
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2007
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last success" }),
2008
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_success_at) })
2009
- ] }),
2010
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2011
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last failure" }),
2012
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_failure_at) })
2013
- ] }),
2014
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2015
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Sessions checked" }),
2016
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.sessions_checked ?? 0 })
2017
- ] }),
2018
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2019
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Sessions updated" }),
2020
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.sessions_updated ?? 0 })
2021
- ] }),
2022
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2023
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Drift detections" }),
2024
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.drift_count ?? 0 })
2025
- ] }),
2026
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2027
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last drift order" }),
2028
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.last_drift_order_id || "—" }),
2029
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: formatDate(status.last_drift_at) })
2030
- ] }),
2031
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
2032
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Last error" }),
2033
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.last_error || "No errors recorded." })
2034
- ] }),
2035
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
2036
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle", children: "Total runs" }),
2037
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 font-medium", children: status.runs ?? 0 })
2038
- ] })
2039
- ] }) : null
2040
- ] })
2041
- ] })
2042
- ] }) });
2043
- }
2044
2044
  const widgetModule = { widgets: [] };
2045
2045
  const routeModule = {
2046
2046
  routes: [
@@ -2052,18 +2052,14 @@ const routeModule = {
2052
2052
  Component: AdditionalSettingsTab,
2053
2053
  path: "/settings/paypal/additional-settings"
2054
2054
  },
2055
- {
2056
- Component: PayPalApplePayPage,
2057
- path: "/settings/paypal/apple-pay"
2058
- },
2059
- {
2060
- Component: PayPalAuditLogsPage,
2061
- path: "/settings/paypal/audit-logs"
2062
- },
2063
2055
  {
2064
2056
  Component: AdvancedCardPaymentsTab,
2065
2057
  path: "/settings/paypal/advanced-card-payments"
2066
2058
  },
2059
+ {
2060
+ Component: PayPalApplePayPage,
2061
+ path: "/settings/paypal/apple-pay"
2062
+ },
2067
2063
  {
2068
2064
  Component: PayPalConnectionPage,
2069
2065
  path: "/settings/paypal/connection"
@@ -2072,6 +2068,10 @@ const routeModule = {
2072
2068
  Component: PayPalDisputesPage,
2073
2069
  path: "/settings/paypal/disputes"
2074
2070
  },
2071
+ {
2072
+ Component: PayPalAuditLogsPage,
2073
+ path: "/settings/paypal/audit-logs"
2074
+ },
2075
2075
  {
2076
2076
  Component: PayPalGooglePayPage,
2077
2077
  path: "/settings/paypal/google-pay"
@@ -2080,13 +2080,13 @@ const routeModule = {
2080
2080
  Component: PayPalPayLaterMessagingPage,
2081
2081
  path: "/settings/paypal/pay-later-messaging"
2082
2082
  },
2083
- {
2084
- Component: PayPalSettingsTab,
2085
- path: "/settings/paypal/paypal-settings"
2086
- },
2087
2083
  {
2088
2084
  Component: PayPalReconciliationStatusPage,
2089
2085
  path: "/settings/paypal/reconciliation-status"
2086
+ },
2087
+ {
2088
+ Component: PayPalSettingsTab,
2089
+ path: "/settings/paypal/paypal-settings"
2090
2090
  }
2091
2091
  ]
2092
2092
  };
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { defineRouteConfig } from "@medusajs/admin-sdk";
3
3
  import { Navigate, useLocation, Link } from "react-router-dom";
4
- import { useState, useRef, useEffect, useCallback, useMemo, useLayoutEffect } from "react";
4
+ import { useState, useRef, useEffect, useMemo, useCallback, useLayoutEffect } from "react";
5
5
  const config$1 = defineRouteConfig({
6
6
  label: "PayPal"
7
7
  });
@@ -335,88 +335,6 @@ function AdditionalSettingsTab() {
335
335
  )
336
336
  ] }) });
337
337
  }
338
- function PayPalApplePayPage() {
339
- return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
340
- }
341
- function formatDate$2(value) {
342
- if (!value) {
343
- return "";
344
- }
345
- const parsed = new Date(value);
346
- if (Number.isNaN(parsed.getTime())) {
347
- return value;
348
- }
349
- return parsed.toLocaleString();
350
- }
351
- function PayPalAuditLogsPage() {
352
- const [logs, setLogs] = useState([]);
353
- const [loading, setLoading] = useState(false);
354
- const [error, setError] = useState(null);
355
- const fetchLogs = useCallback(async () => {
356
- try {
357
- setLoading(true);
358
- setError(null);
359
- const response = await fetch("/admin/paypal/audit-logs?limit=50", {
360
- credentials: "include",
361
- headers: {
362
- Accept: "application/json"
363
- }
364
- });
365
- if (!response.ok) {
366
- const message = await response.text().catch(() => "");
367
- throw new Error(message || "Failed to load audit logs.");
368
- }
369
- const data = await response.json().catch(() => ({}));
370
- setLogs((data == null ? void 0 : data.logs) || []);
371
- } catch (fetchError) {
372
- setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
373
- setLogs([]);
374
- } finally {
375
- setLoading(false);
376
- }
377
- }, []);
378
- useEffect(() => {
379
- fetchLogs();
380
- }, [fetchLogs]);
381
- return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
382
- /* @__PURE__ */ jsxs("div", { children: [
383
- /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
384
- /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
385
- ] }),
386
- /* @__PURE__ */ jsx(PayPalTabs, {}),
387
- /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
388
- /* @__PURE__ */ jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
389
- /* @__PURE__ */ jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
390
- /* @__PURE__ */ jsx(
391
- "button",
392
- {
393
- type: "button",
394
- onClick: fetchLogs,
395
- className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
396
- disabled: loading,
397
- children: loading ? "Refreshing..." : "Refresh"
398
- }
399
- )
400
- ] }) }),
401
- /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
402
- error ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
403
- !error && logs.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading audit logs..." : "No audit log entries found yet." }) : null,
404
- logs.length > 0 ? /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full text-left text-sm", children: [
405
- /* @__PURE__ */ jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxs("tr", { children: [
406
- /* @__PURE__ */ jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
407
- /* @__PURE__ */ jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
408
- /* @__PURE__ */ jsx("th", { className: "pb-2 font-medium", children: "Details" })
409
- ] }) }),
410
- /* @__PURE__ */ jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxs("tr", { className: "border-t border-ui-border-base", children: [
411
- /* @__PURE__ */ jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$2(entry.created_at) || "—" }),
412
- /* @__PURE__ */ jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
413
- /* @__PURE__ */ jsx("td", { className: "py-3 text-ui-fg-subtle", children: /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap rounded-md bg-ui-bg-subtle p-2 text-xs text-ui-fg-subtle", children: JSON.stringify(entry.metadata || {}, null, 2) }) })
414
- ] }, entry.id)) })
415
- ] }) }) : null
416
- ] })
417
- ] })
418
- ] }) });
419
- }
420
338
  const DEFAULT_FORM = {
421
339
  enabled: true,
422
340
  title: "Credit or Debit Card",
@@ -711,6 +629,9 @@ function AdvancedCardPaymentsTab() {
711
629
  )
712
630
  ] }) });
713
631
  }
632
+ function PayPalApplePayPage() {
633
+ return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
634
+ }
714
635
  const config = defineRouteConfig({
715
636
  label: "PayPal Connection",
716
637
  hide: true
@@ -1301,7 +1222,7 @@ const EMPTY_FILTERS = {
1301
1222
  order_id: "",
1302
1223
  cart_id: ""
1303
1224
  };
1304
- function formatDate$1(value) {
1225
+ function formatDate$2(value) {
1305
1226
  if (!value) {
1306
1227
  return "";
1307
1228
  }
@@ -1480,19 +1401,208 @@ function PayPalDisputesPage() {
1480
1401
  /* @__PURE__ */ jsx("td", { className: "px-4 py-3", children: dispute.amount ? `${dispute.amount} ${dispute.currency_code || ""}` : "-" }),
1481
1402
  /* @__PURE__ */ jsx("td", { className: "px-4 py-3", children: dispute.order_id || "-" }),
1482
1403
  /* @__PURE__ */ jsx("td", { className: "px-4 py-3", children: dispute.cart_id || "-" }),
1483
- /* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-ui-fg-subtle", children: formatDate$1(dispute.updated_at || dispute.created_at) })
1404
+ /* @__PURE__ */ jsx("td", { className: "px-4 py-3 text-ui-fg-subtle", children: formatDate$2(dispute.updated_at || dispute.created_at) })
1484
1405
  ] }, dispute.id)) })
1485
1406
  ] }) }),
1486
1407
  error ? /* @__PURE__ */ jsx("div", { className: "border-t border-ui-border-base px-4 py-3 text-sm text-ui-fg-error", children: error }) : null
1487
1408
  ] })
1488
1409
  ] }) });
1489
1410
  }
1411
+ function formatDate$1(value) {
1412
+ if (!value) {
1413
+ return "";
1414
+ }
1415
+ const parsed = new Date(value);
1416
+ if (Number.isNaN(parsed.getTime())) {
1417
+ return value;
1418
+ }
1419
+ return parsed.toLocaleString();
1420
+ }
1421
+ function PayPalAuditLogsPage() {
1422
+ const [logs, setLogs] = useState([]);
1423
+ const [loading, setLoading] = useState(false);
1424
+ const [error, setError] = useState(null);
1425
+ const fetchLogs = useCallback(async () => {
1426
+ try {
1427
+ setLoading(true);
1428
+ setError(null);
1429
+ const response = await fetch("/admin/paypal/audit-logs?limit=50", {
1430
+ credentials: "include",
1431
+ headers: {
1432
+ Accept: "application/json"
1433
+ }
1434
+ });
1435
+ if (!response.ok) {
1436
+ const message = await response.text().catch(() => "");
1437
+ throw new Error(message || "Failed to load audit logs.");
1438
+ }
1439
+ const data = await response.json().catch(() => ({}));
1440
+ setLogs((data == null ? void 0 : data.logs) || []);
1441
+ } catch (fetchError) {
1442
+ setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
1443
+ setLogs([]);
1444
+ } finally {
1445
+ setLoading(false);
1446
+ }
1447
+ }, []);
1448
+ useEffect(() => {
1449
+ fetchLogs();
1450
+ }, [fetchLogs]);
1451
+ return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
1452
+ /* @__PURE__ */ jsxs("div", { children: [
1453
+ /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
1454
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
1455
+ ] }),
1456
+ /* @__PURE__ */ jsx(PayPalTabs, {}),
1457
+ /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
1458
+ /* @__PURE__ */ jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
1459
+ /* @__PURE__ */ jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
1460
+ /* @__PURE__ */ jsx(
1461
+ "button",
1462
+ {
1463
+ type: "button",
1464
+ onClick: fetchLogs,
1465
+ className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
1466
+ disabled: loading,
1467
+ children: loading ? "Refreshing..." : "Refresh"
1468
+ }
1469
+ )
1470
+ ] }) }),
1471
+ /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
1472
+ error ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
1473
+ !error && logs.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading audit logs..." : "No audit log entries found yet." }) : null,
1474
+ logs.length > 0 ? /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full text-left text-sm", children: [
1475
+ /* @__PURE__ */ jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxs("tr", { children: [
1476
+ /* @__PURE__ */ jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
1477
+ /* @__PURE__ */ jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
1478
+ /* @__PURE__ */ jsx("th", { className: "pb-2 font-medium", children: "Details" })
1479
+ ] }) }),
1480
+ /* @__PURE__ */ jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxs("tr", { className: "border-t border-ui-border-base", children: [
1481
+ /* @__PURE__ */ jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$1(entry.created_at) || "—" }),
1482
+ /* @__PURE__ */ jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
1483
+ /* @__PURE__ */ jsx("td", { className: "py-3 text-ui-fg-subtle", children: /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap rounded-md bg-ui-bg-subtle p-2 text-xs text-ui-fg-subtle", children: JSON.stringify(entry.metadata || {}, null, 2) }) })
1484
+ ] }, entry.id)) })
1485
+ ] }) }) : null
1486
+ ] })
1487
+ ] })
1488
+ ] }) });
1489
+ }
1490
1490
  function PayPalGooglePayPage() {
1491
1491
  return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
1492
1492
  }
1493
1493
  function PayPalPayLaterMessagingPage() {
1494
1494
  return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
1495
1495
  }
1496
+ function formatDate(value) {
1497
+ if (!value) {
1498
+ return "—";
1499
+ }
1500
+ const parsed = new Date(value);
1501
+ if (Number.isNaN(parsed.getTime())) {
1502
+ return value;
1503
+ }
1504
+ return parsed.toLocaleString();
1505
+ }
1506
+ function PayPalReconciliationStatusPage() {
1507
+ const [status, setStatus] = useState({});
1508
+ const [loading, setLoading] = useState(false);
1509
+ const [error, setError] = useState(null);
1510
+ const fetchStatus = useCallback(async () => {
1511
+ try {
1512
+ setLoading(true);
1513
+ setError(null);
1514
+ const response = await fetch("/admin/paypal/reconciliation-status", {
1515
+ credentials: "include",
1516
+ headers: {
1517
+ Accept: "application/json"
1518
+ }
1519
+ });
1520
+ if (!response.ok) {
1521
+ const message = await response.text().catch(() => "");
1522
+ throw new Error(message || "Failed to load reconciliation status.");
1523
+ }
1524
+ const data = await response.json().catch(() => ({}));
1525
+ setStatus((data == null ? void 0 : data.status) || {});
1526
+ } catch (fetchError) {
1527
+ setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load reconciliation status.");
1528
+ setStatus({});
1529
+ } finally {
1530
+ setLoading(false);
1531
+ }
1532
+ }, []);
1533
+ useEffect(() => {
1534
+ fetchStatus();
1535
+ }, [fetchStatus]);
1536
+ return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
1537
+ /* @__PURE__ */ jsxs("div", { children: [
1538
+ /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Reconciliation Status" }),
1539
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Monitor reconciliation health and drift detection for PayPal payment sessions." })
1540
+ ] }),
1541
+ /* @__PURE__ */ jsx(PayPalTabs, {}),
1542
+ /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
1543
+ /* @__PURE__ */ jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
1544
+ /* @__PURE__ */ jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest reconciliation run" }),
1545
+ /* @__PURE__ */ jsx(
1546
+ "button",
1547
+ {
1548
+ type: "button",
1549
+ onClick: fetchStatus,
1550
+ className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
1551
+ disabled: loading,
1552
+ children: loading ? "Refreshing..." : "Refresh"
1553
+ }
1554
+ )
1555
+ ] }) }),
1556
+ /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
1557
+ error ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
1558
+ !error && Object.keys(status).length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading reconciliation status..." : "No reconciliation data yet." }) : null,
1559
+ Object.keys(status).length > 0 ? /* @__PURE__ */ jsxs("div", { className: "grid gap-4 text-sm text-ui-fg-base md:grid-cols-2", children: [
1560
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1561
+ /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last run" }),
1562
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_run_at) })
1563
+ ] }),
1564
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1565
+ /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last run status" }),
1566
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium capitalize", children: status.last_run_status || "—" })
1567
+ ] }),
1568
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1569
+ /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last success" }),
1570
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_success_at) })
1571
+ ] }),
1572
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1573
+ /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last failure" }),
1574
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_failure_at) })
1575
+ ] }),
1576
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1577
+ /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Sessions checked" }),
1578
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.sessions_checked ?? 0 })
1579
+ ] }),
1580
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1581
+ /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Sessions updated" }),
1582
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.sessions_updated ?? 0 })
1583
+ ] }),
1584
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1585
+ /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Drift detections" }),
1586
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.drift_count ?? 0 })
1587
+ ] }),
1588
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1589
+ /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last drift order" }),
1590
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.last_drift_order_id || "—" }),
1591
+ /* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: formatDate(status.last_drift_at) })
1592
+ ] }),
1593
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
1594
+ /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last error" }),
1595
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.last_error || "No errors recorded." })
1596
+ ] }),
1597
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
1598
+ /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Total runs" }),
1599
+ /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.runs ?? 0 })
1600
+ ] })
1601
+ ] }) : null
1602
+ ] })
1603
+ ] })
1604
+ ] }) });
1605
+ }
1496
1606
  const DISPLAY_LOCATION_OPTIONS = [
1497
1607
  { value: "product", label: "Product Page" },
1498
1608
  { value: "cart", label: "Cart Page" },
@@ -1930,116 +2040,6 @@ function PayPalSettingsTab() {
1930
2040
  )
1931
2041
  ] }) });
1932
2042
  }
1933
- function formatDate(value) {
1934
- if (!value) {
1935
- return "—";
1936
- }
1937
- const parsed = new Date(value);
1938
- if (Number.isNaN(parsed.getTime())) {
1939
- return value;
1940
- }
1941
- return parsed.toLocaleString();
1942
- }
1943
- function PayPalReconciliationStatusPage() {
1944
- const [status, setStatus] = useState({});
1945
- const [loading, setLoading] = useState(false);
1946
- const [error, setError] = useState(null);
1947
- const fetchStatus = useCallback(async () => {
1948
- try {
1949
- setLoading(true);
1950
- setError(null);
1951
- const response = await fetch("/admin/paypal/reconciliation-status", {
1952
- credentials: "include",
1953
- headers: {
1954
- Accept: "application/json"
1955
- }
1956
- });
1957
- if (!response.ok) {
1958
- const message = await response.text().catch(() => "");
1959
- throw new Error(message || "Failed to load reconciliation status.");
1960
- }
1961
- const data = await response.json().catch(() => ({}));
1962
- setStatus((data == null ? void 0 : data.status) || {});
1963
- } catch (fetchError) {
1964
- setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load reconciliation status.");
1965
- setStatus({});
1966
- } finally {
1967
- setLoading(false);
1968
- }
1969
- }, []);
1970
- useEffect(() => {
1971
- fetchStatus();
1972
- }, [fetchStatus]);
1973
- return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
1974
- /* @__PURE__ */ jsxs("div", { children: [
1975
- /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Reconciliation Status" }),
1976
- /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Monitor reconciliation health and drift detection for PayPal payment sessions." })
1977
- ] }),
1978
- /* @__PURE__ */ jsx(PayPalTabs, {}),
1979
- /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
1980
- /* @__PURE__ */ jsx("div", { className: "border-b border-ui-border-base p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
1981
- /* @__PURE__ */ jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest reconciliation run" }),
1982
- /* @__PURE__ */ jsx(
1983
- "button",
1984
- {
1985
- type: "button",
1986
- onClick: fetchStatus,
1987
- className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
1988
- disabled: loading,
1989
- children: loading ? "Refreshing..." : "Refresh"
1990
- }
1991
- )
1992
- ] }) }),
1993
- /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
1994
- error ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
1995
- !error && Object.keys(status).length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-sm text-ui-fg-subtle", children: loading ? "Loading reconciliation status..." : "No reconciliation data yet." }) : null,
1996
- Object.keys(status).length > 0 ? /* @__PURE__ */ jsxs("div", { className: "grid gap-4 text-sm text-ui-fg-base md:grid-cols-2", children: [
1997
- /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
1998
- /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last run" }),
1999
- /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_run_at) })
2000
- ] }),
2001
- /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2002
- /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last run status" }),
2003
- /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium capitalize", children: status.last_run_status || "—" })
2004
- ] }),
2005
- /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2006
- /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last success" }),
2007
- /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_success_at) })
2008
- ] }),
2009
- /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2010
- /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last failure" }),
2011
- /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: formatDate(status.last_failure_at) })
2012
- ] }),
2013
- /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2014
- /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Sessions checked" }),
2015
- /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.sessions_checked ?? 0 })
2016
- ] }),
2017
- /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2018
- /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Sessions updated" }),
2019
- /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.sessions_updated ?? 0 })
2020
- ] }),
2021
- /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2022
- /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Drift detections" }),
2023
- /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.drift_count ?? 0 })
2024
- ] }),
2025
- /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3", children: [
2026
- /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last drift order" }),
2027
- /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.last_drift_order_id || "—" }),
2028
- /* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-ui-fg-subtle", children: formatDate(status.last_drift_at) })
2029
- ] }),
2030
- /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
2031
- /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Last error" }),
2032
- /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.last_error || "No errors recorded." })
2033
- ] }),
2034
- /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-3 md:col-span-2", children: [
2035
- /* @__PURE__ */ jsx("div", { className: "text-ui-fg-subtle", children: "Total runs" }),
2036
- /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: status.runs ?? 0 })
2037
- ] })
2038
- ] }) : null
2039
- ] })
2040
- ] })
2041
- ] }) });
2042
- }
2043
2043
  const widgetModule = { widgets: [] };
2044
2044
  const routeModule = {
2045
2045
  routes: [
@@ -2051,18 +2051,14 @@ const routeModule = {
2051
2051
  Component: AdditionalSettingsTab,
2052
2052
  path: "/settings/paypal/additional-settings"
2053
2053
  },
2054
- {
2055
- Component: PayPalApplePayPage,
2056
- path: "/settings/paypal/apple-pay"
2057
- },
2058
- {
2059
- Component: PayPalAuditLogsPage,
2060
- path: "/settings/paypal/audit-logs"
2061
- },
2062
2054
  {
2063
2055
  Component: AdvancedCardPaymentsTab,
2064
2056
  path: "/settings/paypal/advanced-card-payments"
2065
2057
  },
2058
+ {
2059
+ Component: PayPalApplePayPage,
2060
+ path: "/settings/paypal/apple-pay"
2061
+ },
2066
2062
  {
2067
2063
  Component: PayPalConnectionPage,
2068
2064
  path: "/settings/paypal/connection"
@@ -2071,6 +2067,10 @@ const routeModule = {
2071
2067
  Component: PayPalDisputesPage,
2072
2068
  path: "/settings/paypal/disputes"
2073
2069
  },
2070
+ {
2071
+ Component: PayPalAuditLogsPage,
2072
+ path: "/settings/paypal/audit-logs"
2073
+ },
2074
2074
  {
2075
2075
  Component: PayPalGooglePayPage,
2076
2076
  path: "/settings/paypal/google-pay"
@@ -2079,13 +2079,13 @@ const routeModule = {
2079
2079
  Component: PayPalPayLaterMessagingPage,
2080
2080
  path: "/settings/paypal/pay-later-messaging"
2081
2081
  },
2082
- {
2083
- Component: PayPalSettingsTab,
2084
- path: "/settings/paypal/paypal-settings"
2085
- },
2086
2082
  {
2087
2083
  Component: PayPalReconciliationStatusPage,
2088
2084
  path: "/settings/paypal/reconciliation-status"
2085
+ },
2086
+ {
2087
+ Component: PayPalSettingsTab,
2088
+ path: "/settings/paypal/paypal-settings"
2089
2089
  }
2090
2090
  ]
2091
2091
  };
@@ -1,3 +1,3 @@
1
1
  import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
2
- export declare function POST(req: MedusaRequest, res: MedusaResponse): Promise<MedusaResponse>;
2
+ export declare function POST(req: MedusaRequest, res: MedusaResponse): Promise<void>;
3
3
  //# sourceMappingURL=route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../../src/api/admin/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AASxE,wBAAsB,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,2BAoBjE"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../../src/api/admin/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAQxE,wBAAsB,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,iBAcjE"}
@@ -2,15 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.POST = POST;
4
4
  const core_flows_1 = require("@medusajs/core-flows");
5
- const provider_ids_1 = require("../../../../../modules/paypal/utils/provider-ids");
6
5
  async function POST(req, res) {
7
6
  const collectionId = req.params.id;
8
7
  const { provider_id, data, customer_id } = req.body;
9
- if (!(0, provider_ids_1.isPayPalProviderId)(provider_id)) {
10
- return res.status(400).json({
11
- message: `Provider ${provider_id} is not a valid PayPal provider`,
12
- });
13
- }
14
8
  const { result } = await (0, core_flows_1.createPaymentSessionsWorkflow)(req.scope).run({
15
9
  input: {
16
10
  payment_collection_id: collectionId,
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../../src/api/admin/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":";;AAUA,oBAoBC;AA9BD,qDAAoE;AAEpE,mFAAqF;AAQ9E,KAAK,UAAU,IAAI,CAAC,GAAkB,EAAE,GAAmB;IAChE,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;IAClC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC,IAAgC,CAAA;IAE/E,IAAI,CAAC,IAAA,iCAAkB,EAAC,WAAW,CAAC,EAAE,CAAC;QACrC,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YAC1B,OAAO,EAAE,YAAY,WAAW,iCAAiC;SAClE,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,0CAA6B,EAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;QACpE,KAAK,EAAE;YACL,qBAAqB,EAAE,YAAY;YACnC,WAAW;YACX,WAAW;YACX,IAAI;SACL;KACF,CAAC,CAAA;IAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,CAAA;AACnD,CAAC"}
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../../src/api/admin/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":";;AASA,oBAcC;AAvBD,qDAAoE;AAS7D,KAAK,UAAU,IAAI,CAAC,GAAkB,EAAE,GAAmB;IAChE,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;IAClC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC,IAAgC,CAAA;IAE/E,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,0CAA6B,EAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;QACpE,KAAK,EAAE;YACL,qBAAqB,EAAE,YAAY;YACnC,WAAW;YACX,WAAW;YACX,IAAI;SACL;KACF,CAAC,CAAA;IAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,CAAA;AACnD,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { MedusaResponse, MedusaStoreRequest } from "@medusajs/framework/http";
2
- export declare function POST(req: MedusaStoreRequest, res: MedusaResponse): Promise<MedusaResponse>;
2
+ export declare function POST(req: MedusaStoreRequest, res: MedusaResponse): Promise<void>;
3
3
  //# sourceMappingURL=route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../../src/api/store/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAiB,MAAM,0BAA0B,CAAA;AAQ5F,wBAAsB,IAAI,CAAC,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,cAAc,2BA+BtE"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../../src/api/store/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAiB,MAAM,0BAA0B,CAAA;AAO5F,wBAAsB,IAAI,CAAC,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,cAAc,iBAuBtE"}
@@ -3,17 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.POST = POST;
4
4
  const core_flows_1 = require("@medusajs/core-flows");
5
5
  const http_1 = require("@medusajs/framework/http");
6
- const provider_ids_1 = require("../../../../../modules/paypal/utils/provider-ids");
7
6
  async function POST(req, res) {
8
7
  const collectionId = req.params.id;
9
8
  const { provider_id, data } = req.body;
10
- if (!(0, provider_ids_1.isPayPalProviderId)(provider_id)) {
11
- return res.status(400).json({
12
- code: "paypal_payment_session_error",
13
- type: "paypal_payment_session_error",
14
- message: `Provider ${provider_id} is not a valid PayPal provider`,
15
- });
16
- }
17
9
  await (0, core_flows_1.createPaymentSessionsWorkflow)(req.scope).run({
18
10
  input: {
19
11
  payment_collection_id: collectionId,
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../../src/api/store/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":";;AASA,oBA+BC;AAxCD,qDAAoE;AACpE,mDAA4F;AAC5F,mFAAqF;AAO9E,KAAK,UAAU,IAAI,CAAC,GAAuB,EAAE,GAAmB;IACrE,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;IAClC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,IAAgC,CAAA;IAElE,IAAI,CAAC,IAAA,iCAAkB,EAAC,WAAW,CAAC,EAAE,CAAC;QACrC,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YAC1B,IAAI,EAAE,8BAA8B;YACpC,IAAI,EAAE,8BAA8B;YACpC,OAAO,EAAE,YAAY,WAAW,iCAAiC;SAClE,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,IAAA,0CAA6B,EAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;QACjD,KAAK,EAAE;YACL,qBAAqB,EAAE,YAAY;YACnC,WAAW;YACX,WAAW,EAAE,GAAG,CAAC,YAAY,EAAE,QAAQ;YACvC,IAAI;SACL;KACF,CAAC,CAAA;IAEF,MAAM,iBAAiB,GAAG,MAAM,IAAA,oBAAa,EAAC;QAC5C,MAAM,EAAE,oBAAoB;QAC5B,UAAU,EAAE,YAAY;QACxB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,MAAM;KAC/B,CAAC,CAAA;IAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnB,kBAAkB,EAAE,iBAAiB;KACtC,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../../src/api/store/payment-collections/[id]/payment-sessions/route.ts"],"names":[],"mappings":";;AAQA,oBAuBC;AA/BD,qDAAoE;AACpE,mDAA4F;AAOrF,KAAK,UAAU,IAAI,CAAC,GAAuB,EAAE,GAAmB;IACrE,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;IAClC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,IAAgC,CAAA;IAElE,MAAM,IAAA,0CAA6B,EAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;QACjD,KAAK,EAAE;YACL,qBAAqB,EAAE,YAAY;YACnC,WAAW;YACX,WAAW,EAAE,GAAG,CAAC,YAAY,EAAE,QAAQ;YACvC,IAAI;SACL;KACF,CAAC,CAAA;IAEF,MAAM,iBAAiB,GAAG,MAAM,IAAA,oBAAa,EAAC;QAC5C,MAAM,EAAE,oBAAoB;QAC5B,UAAU,EAAE,YAAY;QACxB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,MAAM;KAC/B,CAAC,CAAA;IAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnB,kBAAkB,EAAE,iBAAiB;KACtC,CAAC,CAAA;AACJ,CAAC"}
@@ -13,7 +13,7 @@ async function paypalReconcile(container) {
13
13
  const paymentSessionService = container.resolve("payment_session");
14
14
  const paypal = container.resolve("paypal_onboarding");
15
15
  const sessions = await paymentSessionService.list({
16
- provider_id: ["paypal", "paypal_card"],
16
+ provider_id: ["pp_paypal_paypal", "pp_paypal_card_paypal_card"],
17
17
  status: ["pending", "authorized"],
18
18
  });
19
19
  let sessionsChecked = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"paypal-reconcile.js","sourceRoot":"","sources":["../../../../src/jobs/paypal-reconcile.ts"],"names":[],"mappings":";;;AAWA,kCAsHC;AA9HD,MAAM,UAAU,GAAuE;IACrF,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,YAAY;IACtB,SAAS,EAAE,UAAU;IACrB,MAAM,EAAE,UAAU;IAClB,SAAS,EAAE,UAAU;CACtB,CAAA;AAEc,KAAK,UAAU,eAAe,CAAC,SAA0B;IACtE,MAAM,qBAAqB,GAAG,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAQ,CAAA;IACzE,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAsB,mBAAmB,CAAC,CAAA;IAE1E,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,IAAI,CAAC;QAChD,WAAW,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC;QACtC,MAAM,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC;KAClC,CAAC,CAAA;IAEF,IAAI,eAAe,GAAG,CAAC,CAAA;IACvB,IAAI,eAAe,GAAG,CAAC,CAAA;IACvB,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,IAAI,WAAW,GAAkB,IAAI,CAAA;IACrC,IAAI,gBAAgB,GAAkB,IAAI,CAAA;IAC1C,IAAI,UAAU,GAAG,KAAK,CAAA;IACtB,IAAI,gBAAgB,GAAkB,IAAI,CAAA;IAE1C,KAAK,MAAM,OAAO,IAAI,QAAQ,IAAI,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,IAAI,IAAI,EAA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A,MAAM,GAAG;IACpB,IAAI,EAAE,kBAAkB;IACxB,QAAQ,EAAE,cAAc;CACzB,CAAA"}
@@ -1,6 +1,5 @@
1
- export declare const PAYPAL_WALLET_PROVIDER_IDS: readonly ["paypal"];
2
- export declare const PAYPAL_CARD_PROVIDER_IDS: readonly ["paypal_card"];
3
- export declare const PAYPAL_PROVIDER_IDS: readonly ["paypal", "paypal_card"];
4
- export declare const normalizePayPalProviderId: (providerId?: string | null) => string;
1
+ export declare const PAYPAL_WALLET_PROVIDER_ID: "pp_paypal_paypal";
2
+ export declare const PAYPAL_CARD_PROVIDER_ID: "pp_paypal_card_paypal_card";
3
+ export declare const PAYPAL_PROVIDER_IDS: readonly ["pp_paypal_paypal", "pp_paypal_card_paypal_card"];
5
4
  export declare const isPayPalProviderId: (providerId?: string | null) => boolean;
6
5
  //# sourceMappingURL=provider-ids.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider-ids.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/provider-ids.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,qBAAsB,CAAA;AAC7D,eAAO,MAAM,wBAAwB,0BAA2B,CAAA;AAEhE,eAAO,MAAM,mBAAmB,oCAGtB,CAAA;AAEV,eAAO,MAAM,yBAAyB,GAAI,aAAa,MAAM,GAAG,IAAI,WASnE,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,aAAa,MAAM,GAAG,IAAI,YAO5D,CAAA"}
1
+ {"version":3,"file":"provider-ids.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/provider-ids.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,EAAG,kBAA2B,CAAA;AACpE,eAAO,MAAM,uBAAuB,EAAG,4BAAqC,CAAA;AAE5E,eAAO,MAAM,mBAAmB,6DAGtB,CAAA;AAEV,eAAO,MAAM,kBAAkB,GAAI,aAAa,MAAM,GAAG,IAAI,YAM5D,CAAA"}
@@ -1,30 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPayPalProviderId = exports.normalizePayPalProviderId = exports.PAYPAL_PROVIDER_IDS = exports.PAYPAL_CARD_PROVIDER_IDS = exports.PAYPAL_WALLET_PROVIDER_IDS = void 0;
4
- exports.PAYPAL_WALLET_PROVIDER_IDS = ["paypal"];
5
- exports.PAYPAL_CARD_PROVIDER_IDS = ["paypal_card"];
3
+ exports.isPayPalProviderId = exports.PAYPAL_PROVIDER_IDS = exports.PAYPAL_CARD_PROVIDER_ID = exports.PAYPAL_WALLET_PROVIDER_ID = void 0;
4
+ exports.PAYPAL_WALLET_PROVIDER_ID = "pp_paypal_paypal";
5
+ exports.PAYPAL_CARD_PROVIDER_ID = "pp_paypal_card_paypal_card";
6
6
  exports.PAYPAL_PROVIDER_IDS = [
7
- ...exports.PAYPAL_WALLET_PROVIDER_IDS,
8
- ...exports.PAYPAL_CARD_PROVIDER_IDS,
7
+ exports.PAYPAL_WALLET_PROVIDER_ID,
8
+ exports.PAYPAL_CARD_PROVIDER_ID,
9
9
  ];
10
- const normalizePayPalProviderId = (providerId) => {
11
- if (!providerId)
12
- return providerId;
13
- if (!providerId.startsWith("pp_"))
14
- return providerId;
15
- if (providerId === "pp_paypal_paypal")
16
- return "paypal";
17
- if (providerId === "pp_paypal_card_paypal_card")
18
- return "paypal_card";
19
- const parts = providerId.split("_");
20
- return parts.length >= 3 ? parts.slice(2).join("_") : providerId;
21
- };
22
- exports.normalizePayPalProviderId = normalizePayPalProviderId;
23
10
  const isPayPalProviderId = (providerId) => {
24
- const normalizedProviderId = (0, exports.normalizePayPalProviderId)(providerId);
25
- if (!normalizedProviderId)
11
+ if (!providerId)
26
12
  return false;
27
- return exports.PAYPAL_PROVIDER_IDS.includes(normalizedProviderId);
13
+ return exports.PAYPAL_PROVIDER_IDS.includes(providerId);
28
14
  };
29
15
  exports.isPayPalProviderId = isPayPalProviderId;
30
16
  //# sourceMappingURL=provider-ids.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider-ids.js","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/provider-ids.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,CAAC,QAAQ,CAAU,CAAA;AAChD,QAAA,wBAAwB,GAAG,CAAC,aAAa,CAAU,CAAA;AAEnD,QAAA,mBAAmB,GAAG;IACjC,GAAG,kCAA0B;IAC7B,GAAG,gCAAwB;CACnB,CAAA;AAEH,MAAM,yBAAyB,GAAG,CAAC,UAA0B,EAAE,EAAE;IACtE,IAAI,CAAC,UAAU;QAAE,OAAO,UAAU,CAAA;IAClC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,UAAU,CAAA;IAEpD,IAAI,UAAU,KAAK,kBAAkB;QAAE,OAAO,QAAQ,CAAA;IACtD,IAAI,UAAU,KAAK,4BAA4B;QAAE,OAAO,aAAa,CAAA;IAErE,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACnC,OAAO,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAA;AAClE,CAAC,CAAA;AATY,QAAA,yBAAyB,6BASrC;AAEM,MAAM,kBAAkB,GAAG,CAAC,UAA0B,EAAE,EAAE;IAC/D,MAAM,oBAAoB,GAAG,IAAA,iCAAyB,EAAC,UAAU,CAAC,CAAA;IAClE,IAAI,CAAC,oBAAoB;QAAE,OAAO,KAAK,CAAA;IAEvC,OAAO,2BAAmB,CAAC,QAAQ,CACjC,oBAA4D,CAC7D,CAAA;AACH,CAAC,CAAA;AAPY,QAAA,kBAAkB,sBAO9B"}
1
+ {"version":3,"file":"provider-ids.js","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/provider-ids.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG,kBAA2B,CAAA;AACvD,QAAA,uBAAuB,GAAG,4BAAqC,CAAA;AAE/D,QAAA,mBAAmB,GAAG;IACjC,iCAAyB;IACzB,+BAAuB;CACf,CAAA;AAEH,MAAM,kBAAkB,GAAG,CAAC,UAA0B,EAAE,EAAE;IAC/D,IAAI,CAAC,UAAU;QAAE,OAAO,KAAK,CAAA;IAE7B,OAAO,2BAAmB,CAAC,QAAQ,CACjC,UAAkD,CACnD,CAAA;AACH,CAAC,CAAA;AANY,QAAA,kBAAkB,sBAM9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easypayment/medusa-paypal",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "description": "Industry-standard PayPal integration for Medusa v2",
5
5
  "license": "MIT",
6
6
  "main": "./.medusa/server/src/index.js",
@@ -1,6 +1,5 @@
1
1
  import { createPaymentSessionsWorkflow } from "@medusajs/core-flows"
2
2
  import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
3
- import { isPayPalProviderId } from "../../../../../modules/paypal/utils/provider-ids"
4
3
 
5
4
  type CreatePaymentSessionBody = {
6
5
  provider_id: string
@@ -12,12 +11,6 @@ export async function POST(req: MedusaRequest, res: MedusaResponse) {
12
11
  const collectionId = req.params.id
13
12
  const { provider_id, data, customer_id } = req.body as CreatePaymentSessionBody
14
13
 
15
- if (!isPayPalProviderId(provider_id)) {
16
- return res.status(400).json({
17
- message: `Provider ${provider_id} is not a valid PayPal provider`,
18
- })
19
- }
20
-
21
14
  const { result } = await createPaymentSessionsWorkflow(req.scope).run({
22
15
  input: {
23
16
  payment_collection_id: collectionId,
@@ -1,6 +1,5 @@
1
1
  import { createPaymentSessionsWorkflow } from "@medusajs/core-flows"
2
2
  import { MedusaResponse, MedusaStoreRequest, refetchEntity } from "@medusajs/framework/http"
3
- import { isPayPalProviderId } from "../../../../../modules/paypal/utils/provider-ids"
4
3
 
5
4
  type CreatePaymentSessionBody = {
6
5
  provider_id: string
@@ -11,14 +10,6 @@ export async function POST(req: MedusaStoreRequest, res: MedusaResponse) {
11
10
  const collectionId = req.params.id
12
11
  const { provider_id, data } = req.body as CreatePaymentSessionBody
13
12
 
14
- if (!isPayPalProviderId(provider_id)) {
15
- return res.status(400).json({
16
- code: "paypal_payment_session_error",
17
- type: "paypal_payment_session_error",
18
- message: `Provider ${provider_id} is not a valid PayPal provider`,
19
- })
20
- }
21
-
22
13
  await createPaymentSessionsWorkflow(req.scope).run({
23
14
  input: {
24
15
  payment_collection_id: collectionId,
@@ -14,7 +14,7 @@ export default async function paypalReconcile(container: MedusaContainer) {
14
14
  const paypal = container.resolve<PayPalModuleService>("paypal_onboarding")
15
15
 
16
16
  const sessions = await paymentSessionService.list({
17
- provider_id: ["paypal", "paypal_card"],
17
+ provider_id: ["pp_paypal_paypal", "pp_paypal_card_paypal_card"],
18
18
  status: ["pending", "authorized"],
19
19
  })
20
20
 
@@ -1,27 +1,15 @@
1
- export const PAYPAL_WALLET_PROVIDER_IDS = ["paypal"] as const
2
- export const PAYPAL_CARD_PROVIDER_IDS = ["paypal_card"] as const
1
+ export const PAYPAL_WALLET_PROVIDER_ID = "pp_paypal_paypal" as const
2
+ export const PAYPAL_CARD_PROVIDER_ID = "pp_paypal_card_paypal_card" as const
3
3
 
4
4
  export const PAYPAL_PROVIDER_IDS = [
5
- ...PAYPAL_WALLET_PROVIDER_IDS,
6
- ...PAYPAL_CARD_PROVIDER_IDS,
5
+ PAYPAL_WALLET_PROVIDER_ID,
6
+ PAYPAL_CARD_PROVIDER_ID,
7
7
  ] as const
8
8
 
9
- export const normalizePayPalProviderId = (providerId?: string | null) => {
10
- if (!providerId) return providerId
11
- if (!providerId.startsWith("pp_")) return providerId
12
-
13
- if (providerId === "pp_paypal_paypal") return "paypal"
14
- if (providerId === "pp_paypal_card_paypal_card") return "paypal_card"
15
-
16
- const parts = providerId.split("_")
17
- return parts.length >= 3 ? parts.slice(2).join("_") : providerId
18
- }
19
-
20
9
  export const isPayPalProviderId = (providerId?: string | null) => {
21
- const normalizedProviderId = normalizePayPalProviderId(providerId)
22
- if (!normalizedProviderId) return false
10
+ if (!providerId) return false
23
11
 
24
12
  return PAYPAL_PROVIDER_IDS.includes(
25
- normalizedProviderId as (typeof PAYPAL_PROVIDER_IDS)[number]
13
+ providerId as (typeof PAYPAL_PROVIDER_IDS)[number]
26
14
  )
27
15
  }