@easypayment/medusa-payment-paypal 1.3.3 → 1.3.4
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 +91 -7
- package/.medusa/server/src/admin/index.mjs +91 -7
- package/.medusa/server/src/api/admin/paypal/logs/route.d.ts +10 -0
- package/.medusa/server/src/api/admin/paypal/logs/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/logs/route.js +43 -0
- package/.medusa/server/src/api/admin/paypal/logs/route.js.map +1 -0
- package/.medusa/server/src/api/middlewares.d.ts.map +1 -1
- package/.medusa/server/src/api/middlewares.js +22 -4
- package/.medusa/server/src/api/middlewares.js.map +1 -1
- package/.medusa/server/src/api/utils/request-logger.d.ts +11 -0
- package/.medusa/server/src/api/utils/request-logger.d.ts.map +1 -0
- package/.medusa/server/src/api/utils/request-logger.js +69 -0
- package/.medusa/server/src/api/utils/request-logger.js.map +1 -0
- package/.medusa/server/src/modules/paypal/payment-provider/base-provider.d.ts +3 -3
- package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/service.js +9 -0
- package/.medusa/server/src/modules/paypal/service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/types/config.js +1 -1
- package/.medusa/server/src/modules/paypal/types/config.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.js +10 -0
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.js +39 -0
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/request-logger.d.ts +62 -0
- package/.medusa/server/src/modules/paypal/utils/request-logger.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/request-logger.js +297 -0
- package/.medusa/server/src/modules/paypal/utils/request-logger.js.map +1 -0
- package/CHANGELOG.md +7 -0
- package/README.md +4 -0
- package/package.json +1 -1
- package/src/admin/routes/settings/paypal/additional-settings/page.tsx +87 -0
- package/src/api/admin/paypal/logs/route.ts +50 -0
- package/src/api/middlewares.ts +22 -4
- package/src/api/utils/request-logger.ts +84 -0
- package/src/modules/paypal/service.ts +11 -0
- package/src/modules/paypal/types/config.ts +1 -1
- package/src/modules/paypal/utils/credential-resolver.ts +9 -0
- package/src/modules/paypal/utils/paypal-fetch.ts +42 -0
- package/src/modules/paypal/utils/request-logger.ts +358 -0
|
@@ -161,7 +161,8 @@ const DEFAULT_FORM$1 = {
|
|
|
161
161
|
requireInstantPayment: false,
|
|
162
162
|
sendItemDetails: true,
|
|
163
163
|
invoicePrefix: "PP-",
|
|
164
|
-
creditCardStatementName: "PayPal"
|
|
164
|
+
creditCardStatementName: "PayPal",
|
|
165
|
+
debugLogging: false
|
|
165
166
|
};
|
|
166
167
|
function mergeWithDefaults$1(saved) {
|
|
167
168
|
if (!saved) return { ...DEFAULT_FORM$1 };
|
|
@@ -179,9 +180,53 @@ function AdditionalSettingsTab() {
|
|
|
179
180
|
}));
|
|
180
181
|
const [loading, setLoading] = react.useState(false);
|
|
181
182
|
const [saving, setSaving] = react.useState(false);
|
|
183
|
+
const [downloading, setDownloading] = react.useState(false);
|
|
182
184
|
const [toast, setToast] = react.useState(null);
|
|
183
185
|
const didInit = react.useRef(false);
|
|
184
186
|
const dismissToast = react.useCallback(() => setToast(null), []);
|
|
187
|
+
async function onDownloadLog() {
|
|
188
|
+
var _a;
|
|
189
|
+
try {
|
|
190
|
+
setDownloading(true);
|
|
191
|
+
setToast(null);
|
|
192
|
+
const headers = { Accept: "text/plain" };
|
|
193
|
+
if (typeof window !== "undefined") {
|
|
194
|
+
const token = (_a = window.__medusa__) == null ? void 0 : _a.token;
|
|
195
|
+
if (token) headers["Authorization"] = `Bearer ${token}`;
|
|
196
|
+
}
|
|
197
|
+
const res = await fetch("/admin/paypal/logs?download=1", {
|
|
198
|
+
headers,
|
|
199
|
+
credentials: "include"
|
|
200
|
+
});
|
|
201
|
+
if (!res.ok) {
|
|
202
|
+
if (res.status === 404) {
|
|
203
|
+
throw new Error(
|
|
204
|
+
"No log file yet. Enable logging, run a test transaction, then download."
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
throw new Error(`Download failed (${res.status})`);
|
|
208
|
+
}
|
|
209
|
+
const blob = await res.blob();
|
|
210
|
+
const dispo = res.headers.get("Content-Disposition") || "";
|
|
211
|
+
const match = dispo.match(/filename="?([^"]+)"?/);
|
|
212
|
+
const filename = (match == null ? void 0 : match[1]) || "paypal-requests.log";
|
|
213
|
+
const url = URL.createObjectURL(blob);
|
|
214
|
+
const a = document.createElement("a");
|
|
215
|
+
a.href = url;
|
|
216
|
+
a.download = filename;
|
|
217
|
+
document.body.appendChild(a);
|
|
218
|
+
a.click();
|
|
219
|
+
a.remove();
|
|
220
|
+
URL.revokeObjectURL(url);
|
|
221
|
+
} catch (e) {
|
|
222
|
+
setToast({
|
|
223
|
+
kind: "error",
|
|
224
|
+
message: e instanceof Error ? e.message : "Failed to download log"
|
|
225
|
+
});
|
|
226
|
+
} finally {
|
|
227
|
+
setDownloading(false);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
185
230
|
react.useEffect(() => {
|
|
186
231
|
if (didInit.current) return;
|
|
187
232
|
didInit.current = true;
|
|
@@ -357,6 +402,45 @@ function AdditionalSettingsTab() {
|
|
|
357
402
|
)
|
|
358
403
|
] })
|
|
359
404
|
}
|
|
405
|
+
),
|
|
406
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
407
|
+
SectionCard,
|
|
408
|
+
{
|
|
409
|
+
title: "Integration logging (PayPal review)",
|
|
410
|
+
description: "Write every PayPal API request/response and plugin API request/response to a log file you can download and send to PayPal for integration approval. Credentials (auth tokens, client secrets, card fields) are redacted; the BN code is kept. Keep this OFF in normal production use.",
|
|
411
|
+
right: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
412
|
+
"button",
|
|
413
|
+
{
|
|
414
|
+
type: "button",
|
|
415
|
+
onClick: onDownloadLog,
|
|
416
|
+
disabled: downloading,
|
|
417
|
+
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5",
|
|
418
|
+
children: downloading ? "Preparing…" : "Download log"
|
|
419
|
+
}
|
|
420
|
+
) }),
|
|
421
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "divide-y divide-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
422
|
+
FieldRow,
|
|
423
|
+
{
|
|
424
|
+
label: "Request/response logging",
|
|
425
|
+
hint: "When enabled, the plugin appends each request and response to logs/paypal-requests-YYYY-MM-DD.log (path configurable via PAYPAL_LOG_DIR). Remember to save after toggling.",
|
|
426
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
427
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
428
|
+
"input",
|
|
429
|
+
{
|
|
430
|
+
type: "checkbox",
|
|
431
|
+
checked: form.debugLogging,
|
|
432
|
+
onChange: (e) => setForm((p) => ({
|
|
433
|
+
...p,
|
|
434
|
+
debugLogging: e.target.checked
|
|
435
|
+
})),
|
|
436
|
+
className: "h-4 w-4 rounded border-ui-border-base"
|
|
437
|
+
}
|
|
438
|
+
),
|
|
439
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable request/response log file" })
|
|
440
|
+
] })
|
|
441
|
+
}
|
|
442
|
+
) })
|
|
443
|
+
}
|
|
360
444
|
)
|
|
361
445
|
] }) });
|
|
362
446
|
}
|
|
@@ -515,10 +599,10 @@ function AdvancedCardPaymentsTab() {
|
|
|
515
599
|
)
|
|
516
600
|
] }) });
|
|
517
601
|
}
|
|
518
|
-
function
|
|
602
|
+
function PayPalGooglePayPage() {
|
|
519
603
|
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
520
604
|
}
|
|
521
|
-
function
|
|
605
|
+
function PayPalApplePayPage() {
|
|
522
606
|
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
523
607
|
}
|
|
524
608
|
const config = adminSdk.defineRouteConfig({
|
|
@@ -1510,14 +1594,14 @@ const routeModule = {
|
|
|
1510
1594
|
Component: AdvancedCardPaymentsTab,
|
|
1511
1595
|
path: "/settings/paypal/advanced-card-payments"
|
|
1512
1596
|
},
|
|
1513
|
-
{
|
|
1514
|
-
Component: PayPalApplePayPage,
|
|
1515
|
-
path: "/settings/paypal/apple-pay"
|
|
1516
|
-
},
|
|
1517
1597
|
{
|
|
1518
1598
|
Component: PayPalGooglePayPage,
|
|
1519
1599
|
path: "/settings/paypal/google-pay"
|
|
1520
1600
|
},
|
|
1601
|
+
{
|
|
1602
|
+
Component: PayPalApplePayPage,
|
|
1603
|
+
path: "/settings/paypal/apple-pay"
|
|
1604
|
+
},
|
|
1521
1605
|
{
|
|
1522
1606
|
Component: PayPalConnectionPage,
|
|
1523
1607
|
path: "/settings/paypal/connection"
|
|
@@ -160,7 +160,8 @@ const DEFAULT_FORM$1 = {
|
|
|
160
160
|
requireInstantPayment: false,
|
|
161
161
|
sendItemDetails: true,
|
|
162
162
|
invoicePrefix: "PP-",
|
|
163
|
-
creditCardStatementName: "PayPal"
|
|
163
|
+
creditCardStatementName: "PayPal",
|
|
164
|
+
debugLogging: false
|
|
164
165
|
};
|
|
165
166
|
function mergeWithDefaults$1(saved) {
|
|
166
167
|
if (!saved) return { ...DEFAULT_FORM$1 };
|
|
@@ -178,9 +179,53 @@ function AdditionalSettingsTab() {
|
|
|
178
179
|
}));
|
|
179
180
|
const [loading, setLoading] = useState(false);
|
|
180
181
|
const [saving, setSaving] = useState(false);
|
|
182
|
+
const [downloading, setDownloading] = useState(false);
|
|
181
183
|
const [toast, setToast] = useState(null);
|
|
182
184
|
const didInit = useRef(false);
|
|
183
185
|
const dismissToast = useCallback(() => setToast(null), []);
|
|
186
|
+
async function onDownloadLog() {
|
|
187
|
+
var _a;
|
|
188
|
+
try {
|
|
189
|
+
setDownloading(true);
|
|
190
|
+
setToast(null);
|
|
191
|
+
const headers = { Accept: "text/plain" };
|
|
192
|
+
if (typeof window !== "undefined") {
|
|
193
|
+
const token = (_a = window.__medusa__) == null ? void 0 : _a.token;
|
|
194
|
+
if (token) headers["Authorization"] = `Bearer ${token}`;
|
|
195
|
+
}
|
|
196
|
+
const res = await fetch("/admin/paypal/logs?download=1", {
|
|
197
|
+
headers,
|
|
198
|
+
credentials: "include"
|
|
199
|
+
});
|
|
200
|
+
if (!res.ok) {
|
|
201
|
+
if (res.status === 404) {
|
|
202
|
+
throw new Error(
|
|
203
|
+
"No log file yet. Enable logging, run a test transaction, then download."
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
throw new Error(`Download failed (${res.status})`);
|
|
207
|
+
}
|
|
208
|
+
const blob = await res.blob();
|
|
209
|
+
const dispo = res.headers.get("Content-Disposition") || "";
|
|
210
|
+
const match = dispo.match(/filename="?([^"]+)"?/);
|
|
211
|
+
const filename = (match == null ? void 0 : match[1]) || "paypal-requests.log";
|
|
212
|
+
const url = URL.createObjectURL(blob);
|
|
213
|
+
const a = document.createElement("a");
|
|
214
|
+
a.href = url;
|
|
215
|
+
a.download = filename;
|
|
216
|
+
document.body.appendChild(a);
|
|
217
|
+
a.click();
|
|
218
|
+
a.remove();
|
|
219
|
+
URL.revokeObjectURL(url);
|
|
220
|
+
} catch (e) {
|
|
221
|
+
setToast({
|
|
222
|
+
kind: "error",
|
|
223
|
+
message: e instanceof Error ? e.message : "Failed to download log"
|
|
224
|
+
});
|
|
225
|
+
} finally {
|
|
226
|
+
setDownloading(false);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
184
229
|
useEffect(() => {
|
|
185
230
|
if (didInit.current) return;
|
|
186
231
|
didInit.current = true;
|
|
@@ -356,6 +401,45 @@ function AdditionalSettingsTab() {
|
|
|
356
401
|
)
|
|
357
402
|
] })
|
|
358
403
|
}
|
|
404
|
+
),
|
|
405
|
+
/* @__PURE__ */ jsx(
|
|
406
|
+
SectionCard,
|
|
407
|
+
{
|
|
408
|
+
title: "Integration logging (PayPal review)",
|
|
409
|
+
description: "Write every PayPal API request/response and plugin API request/response to a log file you can download and send to PayPal for integration approval. Credentials (auth tokens, client secrets, card fields) are redacted; the BN code is kept. Keep this OFF in normal production use.",
|
|
410
|
+
right: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsx(
|
|
411
|
+
"button",
|
|
412
|
+
{
|
|
413
|
+
type: "button",
|
|
414
|
+
onClick: onDownloadLog,
|
|
415
|
+
disabled: downloading,
|
|
416
|
+
className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5",
|
|
417
|
+
children: downloading ? "Preparing…" : "Download log"
|
|
418
|
+
}
|
|
419
|
+
) }),
|
|
420
|
+
children: /* @__PURE__ */ jsx("div", { className: "divide-y divide-ui-border-base", children: /* @__PURE__ */ jsx(
|
|
421
|
+
FieldRow,
|
|
422
|
+
{
|
|
423
|
+
label: "Request/response logging",
|
|
424
|
+
hint: "When enabled, the plugin appends each request and response to logs/paypal-requests-YYYY-MM-DD.log (path configurable via PAYPAL_LOG_DIR). Remember to save after toggling.",
|
|
425
|
+
children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
426
|
+
/* @__PURE__ */ jsx(
|
|
427
|
+
"input",
|
|
428
|
+
{
|
|
429
|
+
type: "checkbox",
|
|
430
|
+
checked: form.debugLogging,
|
|
431
|
+
onChange: (e) => setForm((p) => ({
|
|
432
|
+
...p,
|
|
433
|
+
debugLogging: e.target.checked
|
|
434
|
+
})),
|
|
435
|
+
className: "h-4 w-4 rounded border-ui-border-base"
|
|
436
|
+
}
|
|
437
|
+
),
|
|
438
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable request/response log file" })
|
|
439
|
+
] })
|
|
440
|
+
}
|
|
441
|
+
) })
|
|
442
|
+
}
|
|
359
443
|
)
|
|
360
444
|
] }) });
|
|
361
445
|
}
|
|
@@ -514,10 +598,10 @@ function AdvancedCardPaymentsTab() {
|
|
|
514
598
|
)
|
|
515
599
|
] }) });
|
|
516
600
|
}
|
|
517
|
-
function
|
|
601
|
+
function PayPalGooglePayPage() {
|
|
518
602
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
519
603
|
}
|
|
520
|
-
function
|
|
604
|
+
function PayPalApplePayPage() {
|
|
521
605
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
522
606
|
}
|
|
523
607
|
const config = defineRouteConfig({
|
|
@@ -1509,14 +1593,14 @@ const routeModule = {
|
|
|
1509
1593
|
Component: AdvancedCardPaymentsTab,
|
|
1510
1594
|
path: "/settings/paypal/advanced-card-payments"
|
|
1511
1595
|
},
|
|
1512
|
-
{
|
|
1513
|
-
Component: PayPalApplePayPage,
|
|
1514
|
-
path: "/settings/paypal/apple-pay"
|
|
1515
|
-
},
|
|
1516
1596
|
{
|
|
1517
1597
|
Component: PayPalGooglePayPage,
|
|
1518
1598
|
path: "/settings/paypal/google-pay"
|
|
1519
1599
|
},
|
|
1600
|
+
{
|
|
1601
|
+
Component: PayPalApplePayPage,
|
|
1602
|
+
path: "/settings/paypal/apple-pay"
|
|
1603
|
+
},
|
|
1520
1604
|
{
|
|
1521
1605
|
Component: PayPalConnectionPage,
|
|
1522
1606
|
path: "/settings/paypal/connection"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
|
|
2
|
+
/**
|
|
3
|
+
* GET /admin/paypal/logs
|
|
4
|
+
* → { enabled, files: [{ name, size, modified }] }
|
|
5
|
+
*
|
|
6
|
+
* GET /admin/paypal/logs?file=<name>&download=1 (file optional → newest)
|
|
7
|
+
* → the raw log file as a text/plain attachment, for sending to PayPal.
|
|
8
|
+
*/
|
|
9
|
+
export declare function GET(req: MedusaRequest, res: MedusaResponse): Promise<MedusaResponse>;
|
|
10
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/admin/paypal/logs/route.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAO7E;;;;;;GAMG;AACH,wBAAsB,GAAG,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,2BAiChE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GET = GET;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const request_logger_1 = require("../../../../modules/paypal/utils/request-logger");
|
|
10
|
+
/**
|
|
11
|
+
* GET /admin/paypal/logs
|
|
12
|
+
* → { enabled, files: [{ name, size, modified }] }
|
|
13
|
+
*
|
|
14
|
+
* GET /admin/paypal/logs?file=<name>&download=1 (file optional → newest)
|
|
15
|
+
* → the raw log file as a text/plain attachment, for sending to PayPal.
|
|
16
|
+
*/
|
|
17
|
+
async function GET(req, res) {
|
|
18
|
+
try {
|
|
19
|
+
const query = req.query;
|
|
20
|
+
const wantsDownload = query.download === "1" ||
|
|
21
|
+
query.download === "true" ||
|
|
22
|
+
typeof query.file === "string";
|
|
23
|
+
if (wantsDownload) {
|
|
24
|
+
const filePath = (0, request_logger_1.resolveLogFile)(query.file);
|
|
25
|
+
if (!filePath) {
|
|
26
|
+
return res.status(404).json({ message: "Log file not found" });
|
|
27
|
+
}
|
|
28
|
+
const name = path_1.default.basename(filePath);
|
|
29
|
+
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
|
30
|
+
res.setHeader("Content-Disposition", `attachment; filename="${name}"`);
|
|
31
|
+
return res.send(fs_1.default.readFileSync(filePath, "utf8"));
|
|
32
|
+
}
|
|
33
|
+
return res.json({
|
|
34
|
+
enabled: (0, request_logger_1.isRequestLoggingEnabled)(),
|
|
35
|
+
files: (0, request_logger_1.listLogFiles)(),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
console.error("[PayPal] logs GET failed:", e instanceof Error ? e.message : e);
|
|
40
|
+
return res.status(500).json({ message: "Failed to read PayPal logs" });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMapp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O,CAAC,KAAK,CACX,2BAA2B,EAC3B,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CACnC,CAAA;QACD,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC,CAAA;IACxE,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middlewares.d.ts","sourceRoot":"","sources":["../../../../src/api/middlewares.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"middlewares.d.ts","sourceRoot":"","sources":["../../../../src/api/middlewares.ts"],"names":[],"mappings":";AAIA,wBAkFE"}
|
|
@@ -2,8 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const http_1 = require("@medusajs/framework/http");
|
|
4
4
|
const rate_limit_1 = require("./utils/rate-limit");
|
|
5
|
+
const request_logger_1 = require("./utils/request-logger");
|
|
5
6
|
exports.default = (0, http_1.defineMiddlewares)({
|
|
6
7
|
routes: [
|
|
8
|
+
// Opt-in request/response logging for the plugin's API routes. One catch-all
|
|
9
|
+
// per namespace is enough — every /store/paypal/*, /admin/paypal/* and
|
|
10
|
+
// /hooks/paypal/* request matches its namespace entry, and the logger
|
|
11
|
+
// de-dupes per request so overlapping matchers can't double-log. It is a
|
|
12
|
+
// pass-through unless logging is enabled in settings.
|
|
13
|
+
{
|
|
14
|
+
matcher: "/store/paypal/:path*",
|
|
15
|
+
middlewares: [(0, request_logger_1.createInboundLogger)()],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
matcher: "/store/paypal-complete",
|
|
19
|
+
middlewares: [(0, request_logger_1.createInboundLogger)()],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
matcher: "/admin/paypal/:path*",
|
|
23
|
+
middlewares: [(0, request_logger_1.createInboundLogger)()],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
matcher: "/hooks/paypal/:path*",
|
|
27
|
+
middlewares: [(0, request_logger_1.createInboundLogger)()],
|
|
28
|
+
},
|
|
7
29
|
{
|
|
8
30
|
// Keep the exact bytes PayPal signed (`req.rawBody`) so webhook signature
|
|
9
31
|
// verification hashes the original payload, not a re-serialized copy. This
|
|
@@ -62,10 +84,6 @@ exports.default = (0, http_1.defineMiddlewares)({
|
|
|
62
84
|
method: ["GET"],
|
|
63
85
|
middlewares: [(0, rate_limit_1.createRateLimiter)("config")],
|
|
64
86
|
},
|
|
65
|
-
{
|
|
66
|
-
matcher: "/store/paypal/:path*",
|
|
67
|
-
middlewares: [],
|
|
68
|
-
},
|
|
69
87
|
],
|
|
70
88
|
});
|
|
71
89
|
//# sourceMappingURL=middlewares.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middlewares.js","sourceRoot":"","sources":["../../../../src/api/middlewares.ts"],"names":[],"mappings":";;AAAA,mDAA4D;AAC5D,mDAAsD;
|
|
1
|
+
{"version":3,"file":"middlewares.js","sourceRoot":"","sources":["../../../../src/api/middlewares.ts"],"names":[],"mappings":";;AAAA,mDAA4D;AAC5D,mDAAsD;AACtD,2DAA4D;AAE5D,kBAAe,IAAA,wBAAiB,EAAC;IAC/B,MAAM,EAAE;QACN,6EAA6E;QAC7E,uEAAuE;QACvE,sEAAsE;QACtE,yEAAyE;QACzE,sDAAsD;QACtD;YACE,OAAO,EAAE,sBAAsB;YAC/B,WAAW,EAAE,CAAC,IAAA,oCAAmB,GAAE,CAAC;SACrC;QACD;YACE,OAAO,EAAE,wBAAwB;YACjC,WAAW,EAAE,CAAC,IAAA,oCAAmB,GAAE,CAAC;SACrC;QACD;YACE,OAAO,EAAE,sBAAsB;YAC/B,WAAW,EAAE,CAAC,IAAA,oCAAmB,GAAE,CAAC;SACrC;QACD;YACE,OAAO,EAAE,sBAAsB;YAC/B,WAAW,EAAE,CAAC,IAAA,oCAAmB,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,WAAW,EAAE,CAAC,IAAA,8BAAiB,EAAC,QAAQ,CAAC,CAAC;SAC3C;KACF;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MedusaNextFunction, MedusaRequest, MedusaResponse } from "@medusajs/framework/http";
|
|
2
|
+
/**
|
|
3
|
+
* Inbound request/response logger for the plugin's own API routes.
|
|
4
|
+
*
|
|
5
|
+
* Opt-in: a pass-through unless logging is enabled (admin setting or the
|
|
6
|
+
* `PAYPAL_REQUEST_LOG` env var). Captures the request body and the response
|
|
7
|
+
* payload by wrapping `res.json` / `res.send`, then appends one entry to the
|
|
8
|
+
* shared PayPal request log. Redaction of secrets happens in the logger.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createInboundLogger(): (req: MedusaRequest, res: MedusaResponse, next: MedusaNextFunction) => void;
|
|
11
|
+
//# sourceMappingURL=request-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-logger.d.ts","sourceRoot":"","sources":["../../../../../src/api/utils/request-logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACb,cAAc,EACf,MAAM,0BAA0B,CAAA;AAMjC;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,KAE/B,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,MAAM,kBAAkB,UA6D3B"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createInboundLogger = createInboundLogger;
|
|
4
|
+
const request_logger_1 = require("../../modules/paypal/utils/request-logger");
|
|
5
|
+
/**
|
|
6
|
+
* Inbound request/response logger for the plugin's own API routes.
|
|
7
|
+
*
|
|
8
|
+
* Opt-in: a pass-through unless logging is enabled (admin setting or the
|
|
9
|
+
* `PAYPAL_REQUEST_LOG` env var). Captures the request body and the response
|
|
10
|
+
* payload by wrapping `res.json` / `res.send`, then appends one entry to the
|
|
11
|
+
* shared PayPal request log. Redaction of secrets happens in the logger.
|
|
12
|
+
*/
|
|
13
|
+
function createInboundLogger() {
|
|
14
|
+
return function inboundLogger(req, res, next) {
|
|
15
|
+
if (!(0, request_logger_1.isRequestLoggingEnabled)()) {
|
|
16
|
+
return next();
|
|
17
|
+
}
|
|
18
|
+
// Several route entries can match one request (e.g. the webhook raw-body
|
|
19
|
+
// entry AND the /store/paypal catch-all). Guard so we log it only once.
|
|
20
|
+
const reqAny = req;
|
|
21
|
+
if (reqAny.__paypalLogged) {
|
|
22
|
+
return next();
|
|
23
|
+
}
|
|
24
|
+
reqAny.__paypalLogged = true;
|
|
25
|
+
const startedAt = Date.now();
|
|
26
|
+
let responseBody;
|
|
27
|
+
let captured = false;
|
|
28
|
+
const origJson = res.json.bind(res);
|
|
29
|
+
const origSend = res.send.bind(res);
|
|
30
|
+
res.json = ((body) => {
|
|
31
|
+
if (!captured) {
|
|
32
|
+
responseBody = body;
|
|
33
|
+
captured = true;
|
|
34
|
+
}
|
|
35
|
+
return origJson(body);
|
|
36
|
+
});
|
|
37
|
+
res.send = ((body) => {
|
|
38
|
+
if (!captured) {
|
|
39
|
+
responseBody = body;
|
|
40
|
+
captured = true;
|
|
41
|
+
}
|
|
42
|
+
return origSend(body);
|
|
43
|
+
});
|
|
44
|
+
const flush = () => {
|
|
45
|
+
try {
|
|
46
|
+
(0, request_logger_1.logInbound)({
|
|
47
|
+
method: req.method,
|
|
48
|
+
path: req.baseUrl
|
|
49
|
+
? `${req.baseUrl}${req.path || ""}`
|
|
50
|
+
: req.originalUrl || req.path || req.url || "",
|
|
51
|
+
query: req.query,
|
|
52
|
+
requestHeaders: req.headers,
|
|
53
|
+
requestBody: req.body,
|
|
54
|
+
status: res.statusCode,
|
|
55
|
+
responseBody,
|
|
56
|
+
durationMs: Date.now() - startedAt,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// logging must never break the request
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
// `finish` fires once the response is fully flushed, for every response
|
|
64
|
+
// path (json, send, raw end, errors) — a single reliable hook.
|
|
65
|
+
res.once("finish", flush);
|
|
66
|
+
return next();
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=request-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-logger.js","sourceRoot":"","sources":["../../../../../src/api/utils/request-logger.ts"],"names":[],"mappings":";;AAkBA,kDAiEC;AA9ED,8EAGkD;AAElD;;;;;;;GAOG;AACH,SAAgB,mBAAmB;IACjC,OAAO,SAAS,aAAa,CAC3B,GAAkB,EAClB,GAAmB,EACnB,IAAwB;QAExB,IAAI,CAAC,IAAA,wCAAuB,GAAE,EAAE,CAAC;YAC/B,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;QACD,yEAAyE;QACzE,wEAAwE;QACxE,MAAM,MAAM,GAAG,GAAU,CAAA;QACzB,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;YAC1B,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;QACD,MAAM,CAAC,cAAc,GAAG,IAAI,CAAA;QAE5B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAC5B,IAAI,YAAqB,CAAA;QACzB,IAAI,QAAQ,GAAG,KAAK,CAAA;QAEpB,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACnC,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAEnC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,IAAa,EAAE,EAAE;YAC5B,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,YAAY,GAAG,IAAI,CAAA;gBACnB,QAAQ,GAAG,IAAI,CAAA;YACjB,CAAC;YACD,OAAO,QAAQ,CAAC,IAAW,CAAC,CAAA;QAC9B,CAAC,CAAoB,CAAA;QAErB,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,IAAa,EAAE,EAAE;YAC5B,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,YAAY,GAAG,IAAI,CAAA;gBACnB,QAAQ,GAAG,IAAI,CAAA;YACjB,CAAC;YACD,OAAO,QAAQ,CAAC,IAAW,CAAC,CAAA;QAC9B,CAAC,CAAoB,CAAA;QAErB,MAAM,KAAK,GAAG,GAAG,EAAE;YACjB,IAAI,CAAC;gBACH,IAAA,2BAAU,EAAC;oBACT,MAAM,EAAE,GAAG,CAAC,MAAM;oBAClB,IAAI,EAAG,GAAW,CAAC,OAAO;wBACxB,CAAC,CAAC,GAAI,GAAW,CAAC,OAAO,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,EAAE;wBAC5C,CAAC,CAAE,GAAW,CAAC,WAAW,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,IAAI,EAAE;oBACzD,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,cAAc,EAAE,GAAG,CAAC,OAAO;oBAC3B,WAAW,EAAG,GAAW,CAAC,IAAI;oBAC9B,MAAM,EAAE,GAAG,CAAC,UAAU;oBACtB,YAAY;oBACZ,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;iBACnC,CAAC,CAAA;YACJ,CAAC;YAAC,MAAM,CAAC;gBACP,uCAAuC;YACzC,CAAC;QACH,CAAC,CAAA;QAED,wEAAwE;QACxE,+DAA+D;QAC/D,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;QAEzB,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -94,9 +94,9 @@ export declare abstract class PayPalProviderBase extends AbstractPaymentProvider
|
|
|
94
94
|
data?: Record<string, unknown>;
|
|
95
95
|
amount?: unknown;
|
|
96
96
|
}, nextCurrencyCode: string): Record<string, unknown>;
|
|
97
|
-
protected mapCaptureStatus(status?: string): "pending" | "
|
|
98
|
-
protected mapAuthorizationStatus(status?: string): "
|
|
99
|
-
protected mapOrderStatus(status?: string): "pending" | "
|
|
97
|
+
protected mapCaptureStatus(status?: string): "pending" | "error" | "captured" | "canceled" | null;
|
|
98
|
+
protected mapAuthorizationStatus(status?: string): "error" | "authorized" | "canceled" | null;
|
|
99
|
+
protected mapOrderStatus(status?: string): "pending" | "error" | "authorized" | "captured" | "canceled";
|
|
100
100
|
/**
|
|
101
101
|
* Capture funds for a session — one PayPal capture per Medusa capture row.
|
|
102
102
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../src/modules/paypal/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../../src/modules/paypal/service.ts"],"names":[],"mappings":"AAmBA,KAAK,WAAW,GAAG,SAAS,GAAG,MAAM,CAAA;AAErC,KAAK,MAAM,GACP,cAAc,GACd,SAAS,GACT,qBAAqB,GACrB,WAAW,GACX,SAAS,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0Bb;;;;;;;;GAQG;AACH,cAAM,mBAAoB,SAAQ,wBAKhC;IACA,SAAS,CAAC,GAAG,8CAAoB;IACjC,OAAO,CAAC,mBAAmB,CAA+B;IAG1D,OAAO,CAAC,YAAY,CAEL;IAGf,OAAO,CAAC,0BAA0B,CAA8B;IAChE,OAAO,CAAC,oBAAoB,CAA8B;gBAE9C,GAAG,IAAI,EAAE,GAAG,EAAE;IAa1B,OAAO,KAAK,MAAM,GAEjB;YAEa,eAAe;YAKf,sBAAsB;IA+DpC;;;OAGG;IACG,aAAa;;;;IAQnB,OAAO,CAAC,mBAAmB;YAMb,oBAAoB;YAOpB,aAAa;YAQb,qBAAqB;IAUnC,OAAO,CAAC,WAAW;IA6BnB,OAAO,CAAC,kBAAkB;YA6DZ,+BAA+B;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,CAAC,EAAE,MAAM,CAAA;KACvB;;;;;;;;;;;;;;;;;;;;;IAkCD,sDAAsD;IAChD,wBAAwB,CAAC,KAAK,EAAE;QACpC,EAAE,EAAE,MAAM,CAAA;QACV,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,aAAa,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;QAC3B,YAAY,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;QAC1B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAC5B;;;;;;;;;;;;;;;;;;IAYD;;;;;;;;OAQG;IACG,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAiBpC;;;OAGG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;IAsDnE,6DAA6D;IACvD,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAKpC;;;OAGG;IACG,SAAS,CAAC,KAAK,EAAE;QACrB,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KACnC;CA2CF;AAED,eAAe,mBAAmB,CAAA"}
|
|
@@ -16,6 +16,7 @@ const paypal_auth_1 = require("./utils/paypal-auth");
|
|
|
16
16
|
const currencies_1 = require("./utils/currencies");
|
|
17
17
|
const partner_1 = require("./utils/partner");
|
|
18
18
|
const settings_cache_1 = require("./utils/settings-cache");
|
|
19
|
+
const request_logger_1 = require("./utils/request-logger");
|
|
19
20
|
const SENSITIVE_KEY_RE = /secret|password|client_secret|access_token|refresh_token|authorization|auth_code|api[_-]?key/i;
|
|
20
21
|
/**
|
|
21
22
|
* Defensive redaction for audit logs: replace values of keys that look
|
|
@@ -1295,6 +1296,14 @@ class PayPalModuleService extends (0, utils_1.MedusaService)({
|
|
|
1295
1296
|
const row = rows?.[0];
|
|
1296
1297
|
const result = { data: (row?.data || {}) };
|
|
1297
1298
|
(0, settings_cache_1.setCachedSettings)("module-settings", result);
|
|
1299
|
+
// Keep the process-local request-logging flag in step with the admin toggle.
|
|
1300
|
+
try {
|
|
1301
|
+
const addl = (result.data?.additional_settings || {});
|
|
1302
|
+
(0, request_logger_1.setRequestLoggingEnabled)(!!(addl.debugLogging ?? addl.debug_logging));
|
|
1303
|
+
}
|
|
1304
|
+
catch {
|
|
1305
|
+
// never let a logging-flag sync break settings reads
|
|
1306
|
+
}
|
|
1298
1307
|
return result;
|
|
1299
1308
|
}
|
|
1300
1309
|
deepMerge(target, source) {
|