@easypayment/medusa-paypal 0.1.8 → 0.1.9
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 +90 -90
- package/.medusa/server/src/admin/index.mjs +91 -91
- package/.medusa/server/src/jobs/paypal-reconcile.js +1 -1
- package/.medusa/server/src/jobs/paypal-reconcile.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts +3 -4
- package/.medusa/server/src/modules/paypal/utils/provider-ids.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/provider-ids.js +7 -21
- package/.medusa/server/src/modules/paypal/utils/provider-ids.js.map +1 -1
- package/package.json +1 -1
- package/src/jobs/paypal-reconcile.ts +1 -1
- 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
|
|
@@ -1296,6 +1217,85 @@ function PayPalConnectionPage() {
|
|
|
1296
1217
|
` })
|
|
1297
1218
|
] });
|
|
1298
1219
|
}
|
|
1220
|
+
function formatDate$2(value) {
|
|
1221
|
+
if (!value) {
|
|
1222
|
+
return "";
|
|
1223
|
+
}
|
|
1224
|
+
const parsed = new Date(value);
|
|
1225
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
1226
|
+
return value;
|
|
1227
|
+
}
|
|
1228
|
+
return parsed.toLocaleString();
|
|
1229
|
+
}
|
|
1230
|
+
function PayPalAuditLogsPage() {
|
|
1231
|
+
const [logs, setLogs] = react.useState([]);
|
|
1232
|
+
const [loading, setLoading] = react.useState(false);
|
|
1233
|
+
const [error, setError] = react.useState(null);
|
|
1234
|
+
const fetchLogs = react.useCallback(async () => {
|
|
1235
|
+
try {
|
|
1236
|
+
setLoading(true);
|
|
1237
|
+
setError(null);
|
|
1238
|
+
const response = await fetch("/admin/paypal/audit-logs?limit=50", {
|
|
1239
|
+
credentials: "include",
|
|
1240
|
+
headers: {
|
|
1241
|
+
Accept: "application/json"
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
if (!response.ok) {
|
|
1245
|
+
const message = await response.text().catch(() => "");
|
|
1246
|
+
throw new Error(message || "Failed to load audit logs.");
|
|
1247
|
+
}
|
|
1248
|
+
const data = await response.json().catch(() => ({}));
|
|
1249
|
+
setLogs((data == null ? void 0 : data.logs) || []);
|
|
1250
|
+
} catch (fetchError) {
|
|
1251
|
+
setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
|
|
1252
|
+
setLogs([]);
|
|
1253
|
+
} finally {
|
|
1254
|
+
setLoading(false);
|
|
1255
|
+
}
|
|
1256
|
+
}, []);
|
|
1257
|
+
react.useEffect(() => {
|
|
1258
|
+
fetchLogs();
|
|
1259
|
+
}, [fetchLogs]);
|
|
1260
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1261
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1262
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
|
|
1263
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
|
|
1264
|
+
] }),
|
|
1265
|
+
/* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
|
|
1266
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
1267
|
+
/* @__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: [
|
|
1268
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
|
|
1269
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1270
|
+
"button",
|
|
1271
|
+
{
|
|
1272
|
+
type: "button",
|
|
1273
|
+
onClick: fetchLogs,
|
|
1274
|
+
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
|
|
1275
|
+
disabled: loading,
|
|
1276
|
+
children: loading ? "Refreshing..." : "Refresh"
|
|
1277
|
+
}
|
|
1278
|
+
)
|
|
1279
|
+
] }) }),
|
|
1280
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
|
|
1281
|
+
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,
|
|
1282
|
+
!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,
|
|
1283
|
+
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: [
|
|
1284
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1285
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
|
|
1286
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
|
|
1287
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "pb-2 font-medium", children: "Details" })
|
|
1288
|
+
] }) }),
|
|
1289
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-t border-ui-border-base", children: [
|
|
1290
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$2(entry.created_at) || "—" }),
|
|
1291
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
|
|
1292
|
+
/* @__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) }) })
|
|
1293
|
+
] }, entry.id)) })
|
|
1294
|
+
] }) }) : null
|
|
1295
|
+
] })
|
|
1296
|
+
] })
|
|
1297
|
+
] }) });
|
|
1298
|
+
}
|
|
1299
1299
|
const EMPTY_FILTERS = {
|
|
1300
1300
|
dispute_id: "",
|
|
1301
1301
|
status: "",
|
|
@@ -2052,22 +2052,22 @@ 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"
|
|
2070
2066
|
},
|
|
2067
|
+
{
|
|
2068
|
+
Component: PayPalAuditLogsPage,
|
|
2069
|
+
path: "/settings/paypal/audit-logs"
|
|
2070
|
+
},
|
|
2071
2071
|
{
|
|
2072
2072
|
Component: PayPalDisputesPage,
|
|
2073
2073
|
path: "/settings/paypal/disputes"
|
|
@@ -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,
|
|
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
|
|
@@ -1295,6 +1216,85 @@ function PayPalConnectionPage() {
|
|
|
1295
1216
|
` })
|
|
1296
1217
|
] });
|
|
1297
1218
|
}
|
|
1219
|
+
function formatDate$2(value) {
|
|
1220
|
+
if (!value) {
|
|
1221
|
+
return "";
|
|
1222
|
+
}
|
|
1223
|
+
const parsed = new Date(value);
|
|
1224
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
1225
|
+
return value;
|
|
1226
|
+
}
|
|
1227
|
+
return parsed.toLocaleString();
|
|
1228
|
+
}
|
|
1229
|
+
function PayPalAuditLogsPage() {
|
|
1230
|
+
const [logs, setLogs] = useState([]);
|
|
1231
|
+
const [loading, setLoading] = useState(false);
|
|
1232
|
+
const [error, setError] = useState(null);
|
|
1233
|
+
const fetchLogs = useCallback(async () => {
|
|
1234
|
+
try {
|
|
1235
|
+
setLoading(true);
|
|
1236
|
+
setError(null);
|
|
1237
|
+
const response = await fetch("/admin/paypal/audit-logs?limit=50", {
|
|
1238
|
+
credentials: "include",
|
|
1239
|
+
headers: {
|
|
1240
|
+
Accept: "application/json"
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1243
|
+
if (!response.ok) {
|
|
1244
|
+
const message = await response.text().catch(() => "");
|
|
1245
|
+
throw new Error(message || "Failed to load audit logs.");
|
|
1246
|
+
}
|
|
1247
|
+
const data = await response.json().catch(() => ({}));
|
|
1248
|
+
setLogs((data == null ? void 0 : data.logs) || []);
|
|
1249
|
+
} catch (fetchError) {
|
|
1250
|
+
setError((fetchError == null ? void 0 : fetchError.message) || "Failed to load audit logs.");
|
|
1251
|
+
setLogs([]);
|
|
1252
|
+
} finally {
|
|
1253
|
+
setLoading(false);
|
|
1254
|
+
}
|
|
1255
|
+
}, []);
|
|
1256
|
+
useEffect(() => {
|
|
1257
|
+
fetchLogs();
|
|
1258
|
+
}, [fetchLogs]);
|
|
1259
|
+
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1260
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1261
|
+
/* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Audit Logs" }),
|
|
1262
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-ui-fg-subtle", children: "Track administrative changes and credential events for PayPal configuration." })
|
|
1263
|
+
] }),
|
|
1264
|
+
/* @__PURE__ */ jsx(PayPalTabs, {}),
|
|
1265
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base bg-ui-bg-base shadow-sm", children: [
|
|
1266
|
+
/* @__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: [
|
|
1267
|
+
/* @__PURE__ */ jsx("div", { className: "text-base font-semibold text-ui-fg-base", children: "Latest events" }),
|
|
1268
|
+
/* @__PURE__ */ jsx(
|
|
1269
|
+
"button",
|
|
1270
|
+
{
|
|
1271
|
+
type: "button",
|
|
1272
|
+
onClick: fetchLogs,
|
|
1273
|
+
className: "rounded-md border border-ui-border-base px-3 py-2 text-sm text-ui-fg-base",
|
|
1274
|
+
disabled: loading,
|
|
1275
|
+
children: loading ? "Refreshing..." : "Refresh"
|
|
1276
|
+
}
|
|
1277
|
+
)
|
|
1278
|
+
] }) }),
|
|
1279
|
+
/* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
1280
|
+
error ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600", children: error }) : null,
|
|
1281
|
+
!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,
|
|
1282
|
+
logs.length > 0 ? /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full text-left text-sm", children: [
|
|
1283
|
+
/* @__PURE__ */ jsx("thead", { className: "text-ui-fg-muted", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
1284
|
+
/* @__PURE__ */ jsx("th", { className: "pb-2 pr-4 font-medium", children: "Timestamp" }),
|
|
1285
|
+
/* @__PURE__ */ jsx("th", { className: "pb-2 pr-4 font-medium", children: "Event" }),
|
|
1286
|
+
/* @__PURE__ */ jsx("th", { className: "pb-2 font-medium", children: "Details" })
|
|
1287
|
+
] }) }),
|
|
1288
|
+
/* @__PURE__ */ jsx("tbody", { children: logs.map((entry) => /* @__PURE__ */ jsxs("tr", { className: "border-t border-ui-border-base", children: [
|
|
1289
|
+
/* @__PURE__ */ jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: formatDate$2(entry.created_at) || "—" }),
|
|
1290
|
+
/* @__PURE__ */ jsx("td", { className: "py-3 pr-4 text-ui-fg-base", children: entry.event_type || "—" }),
|
|
1291
|
+
/* @__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) }) })
|
|
1292
|
+
] }, entry.id)) })
|
|
1293
|
+
] }) }) : null
|
|
1294
|
+
] })
|
|
1295
|
+
] })
|
|
1296
|
+
] }) });
|
|
1297
|
+
}
|
|
1298
1298
|
const EMPTY_FILTERS = {
|
|
1299
1299
|
dispute_id: "",
|
|
1300
1300
|
status: "",
|
|
@@ -2051,22 +2051,22 @@ 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"
|
|
2069
2065
|
},
|
|
2066
|
+
{
|
|
2067
|
+
Component: PayPalAuditLogsPage,
|
|
2068
|
+
path: "/settings/paypal/audit-logs"
|
|
2069
|
+
},
|
|
2070
2070
|
{
|
|
2071
2071
|
Component: PayPalDisputesPage,
|
|
2072
2072
|
path: "/settings/paypal/disputes"
|
|
@@ -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: ["
|
|
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,
|
|
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,CAA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,EAAE,kBAAkB;IACxB,QAAQ,EAAE,cAAc;CACzB,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const PAYPAL_PROVIDER_IDS: readonly ["
|
|
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,
|
|
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.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
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
|
-
|
|
8
|
-
|
|
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
|
-
|
|
25
|
-
if (!normalizedProviderId)
|
|
11
|
+
if (!providerId)
|
|
26
12
|
return false;
|
|
27
|
-
return exports.PAYPAL_PROVIDER_IDS.includes(
|
|
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,
|
|
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
|
@@ -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: ["
|
|
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
|
|
2
|
-
export 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
|
-
|
|
6
|
-
|
|
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
|
-
|
|
22
|
-
if (!normalizedProviderId) return false
|
|
10
|
+
if (!providerId) return false
|
|
23
11
|
|
|
24
12
|
return PAYPAL_PROVIDER_IDS.includes(
|
|
25
|
-
|
|
13
|
+
providerId as (typeof PAYPAL_PROVIDER_IDS)[number]
|
|
26
14
|
)
|
|
27
15
|
}
|