@easypayment/medusa-payment-paypal 1.3.8 → 1.3.10
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 +261 -94
- package/.medusa/server/src/admin/index.mjs +196 -31
- package/.medusa/server/src/api/admin/paypal/merchant-status/route.d.ts +11 -0
- package/.medusa/server/src/api/admin/paypal/merchant-status/route.d.ts.map +1 -0
- package/.medusa/server/src/api/admin/paypal/merchant-status/route.js +32 -0
- package/.medusa/server/src/api/admin/paypal/merchant-status/route.js.map +1 -0
- package/.medusa/server/src/api/store/paypal/create-order/route.d.ts +4 -1
- package/.medusa/server/src/api/store/paypal/create-order/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/create-order/route.js +113 -108
- package/.medusa/server/src/api/store/paypal/create-order/route.js.map +1 -1
- package/.medusa/server/src/api/utils/request-logger.d.ts.map +1 -1
- package/.medusa/server/src/api/utils/request-logger.js +4 -2
- package/.medusa/server/src/api/utils/request-logger.js.map +1 -1
- package/.medusa/server/src/modules/paypal/service.d.ts +33 -0
- package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/service.js +138 -34
- package/.medusa/server/src/modules/paypal/service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/types/config.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/types/config.js +2 -1
- package/.medusa/server/src/modules/paypal/types/config.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/merchant-status.d.ts +48 -0
- package/.medusa/server/src/modules/paypal/utils/merchant-status.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/merchant-status.js +106 -0
- package/.medusa/server/src/modules/paypal/utils/merchant-status.js.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/order-context.d.ts +61 -0
- package/.medusa/server/src/modules/paypal/utils/order-context.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/order-context.js +127 -0
- package/.medusa/server/src/modules/paypal/utils/order-context.js.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/request-logger.d.ts +12 -0
- package/.medusa/server/src/modules/paypal/utils/request-logger.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/request-logger.js +26 -2
- package/.medusa/server/src/modules/paypal/utils/request-logger.js.map +1 -1
- package/CHANGELOG.md +102 -0
- package/README.md +4 -4
- package/package.json +1 -1
- package/src/admin/routes/settings/paypal/_components/MerchantStatusNotices.tsx +116 -0
- package/src/admin/routes/settings/paypal/additional-settings/page.tsx +54 -12
- package/src/admin/routes/settings/paypal/advanced-card-payments/page.tsx +2 -0
- package/src/admin/routes/settings/paypal/connection/page.tsx +73 -6
- package/src/api/admin/paypal/merchant-status/route.ts +36 -0
- package/src/api/store/paypal/create-order/route.ts +191 -165
- package/src/api/utils/request-logger.ts +7 -3
- package/src/modules/paypal/service.ts +192 -43
- package/src/modules/paypal/types/config.ts +3 -2
- package/src/modules/paypal/utils/merchant-status.ts +187 -0
- package/src/modules/paypal/utils/order-context.ts +163 -0
- package/src/modules/paypal/utils/request-logger.ts +30 -2
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Turn PayPal's seller onboarding status
|
|
4
|
+
* (`GET /v1/customer/partners/{partner-id}/merchant-integrations/{merchant-id}`)
|
|
5
|
+
* into what the admin needs to know: can this seller receive payments, are
|
|
6
|
+
* PayPal payments and Advanced Card payments enabled, and what should the
|
|
7
|
+
* merchant be told when they are not.
|
|
8
|
+
*
|
|
9
|
+
* The checks and the two "Attention" messages are the ones PayPal's partner
|
|
10
|
+
* integration review asks for (2026-11-17).
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.PAYMENTS_NOT_RECEIVABLE_MESSAGE = exports.EMAIL_NOT_CONFIRMED_MESSAGE = void 0;
|
|
14
|
+
exports.evaluateMerchantStatus = evaluateMerchantStatus;
|
|
15
|
+
exports.EMAIL_NOT_CONFIRMED_MESSAGE = "Attention: Please confirm your email address on https://www.paypal.com/businessprofile/settings in order to receive payments! You currently cannot receive payments.";
|
|
16
|
+
exports.PAYMENTS_NOT_RECEIVABLE_MESSAGE = "Attention: You currently cannot receive payments due to restriction on your PayPal account. Please reach out to PayPal Customer Support or connect to https://www.paypal.com for more information.";
|
|
17
|
+
function upper(value) {
|
|
18
|
+
const text = String(value ?? "")
|
|
19
|
+
.trim()
|
|
20
|
+
.toUpperCase();
|
|
21
|
+
return text || null;
|
|
22
|
+
}
|
|
23
|
+
function findByName(list, name) {
|
|
24
|
+
if (!Array.isArray(list))
|
|
25
|
+
return null;
|
|
26
|
+
const match = list.find((entry) => entry && typeof entry === "object" && upper(entry.name) === name);
|
|
27
|
+
return match || null;
|
|
28
|
+
}
|
|
29
|
+
function featureStatus(details, productName, capabilityName) {
|
|
30
|
+
const vetting = upper(findByName(details.products, productName)?.vetting_status);
|
|
31
|
+
const capability = upper(findByName(details.capabilities, capabilityName)?.status);
|
|
32
|
+
return {
|
|
33
|
+
enabled: vetting === "SUBSCRIBED" && capability === "ACTIVE",
|
|
34
|
+
vetting_status: vetting,
|
|
35
|
+
capability_status: capability,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Merchant-facing explanation for a feature that is not enabled. */
|
|
39
|
+
function notEnabledMessage(label, status) {
|
|
40
|
+
switch (status.vetting_status) {
|
|
41
|
+
case null:
|
|
42
|
+
return `${label} are not enabled on your PayPal account. Please connect your PayPal account again to apply, or contact PayPal Customer Support.`;
|
|
43
|
+
case "NEED_MORE_DATA":
|
|
44
|
+
return `${label} are not enabled yet: PayPal needs more information from you. Please log in to your PayPal account and provide the requested details.`;
|
|
45
|
+
case "IN_REVIEW":
|
|
46
|
+
case "PENDING":
|
|
47
|
+
return `${label} are not enabled yet: PayPal is still reviewing your application. This can take a few days; you do not need to do anything for now.`;
|
|
48
|
+
case "DENIED":
|
|
49
|
+
return `${label} are not available: PayPal declined your application. Please contact PayPal Customer Support for more information.`;
|
|
50
|
+
case "SUBSCRIBED":
|
|
51
|
+
return `${label} are approved on your PayPal account but not active yet (status: ${status.capability_status || "not available"}). Please check your PayPal account for pending actions, or contact PayPal Customer Support.`;
|
|
52
|
+
default:
|
|
53
|
+
return `${label} are not enabled on your PayPal account (status: ${status.vetting_status}). Please check your PayPal account, or contact PayPal Customer Support.`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Evaluate a merchant-integrations response. Never throws. */
|
|
57
|
+
function evaluateMerchantStatus(input) {
|
|
58
|
+
const details = input && typeof input === "object" ? input : {};
|
|
59
|
+
const paymentsReceivable = typeof details.payments_receivable === "boolean"
|
|
60
|
+
? details.payments_receivable
|
|
61
|
+
: null;
|
|
62
|
+
const emailConfirmed = typeof details.primary_email_confirmed === "boolean"
|
|
63
|
+
? details.primary_email_confirmed
|
|
64
|
+
: null;
|
|
65
|
+
const paypalPayments = featureStatus(details, "PPCP_STANDARD", "PAY_WITH_PAYPAL");
|
|
66
|
+
const cardPayments = featureStatus(details, "PPCP_CUSTOM", "CUSTOM_CARD_PROCESSING");
|
|
67
|
+
const notices = [];
|
|
68
|
+
if (emailConfirmed === false) {
|
|
69
|
+
notices.push({
|
|
70
|
+
code: "email_not_confirmed",
|
|
71
|
+
level: "error",
|
|
72
|
+
message: exports.EMAIL_NOT_CONFIRMED_MESSAGE,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (paymentsReceivable === false) {
|
|
76
|
+
notices.push({
|
|
77
|
+
code: "payments_not_receivable",
|
|
78
|
+
level: "error",
|
|
79
|
+
message: exports.PAYMENTS_NOT_RECEIVABLE_MESSAGE,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (!paypalPayments.enabled) {
|
|
83
|
+
notices.push({
|
|
84
|
+
code: "paypal_payments_not_enabled",
|
|
85
|
+
level: "error",
|
|
86
|
+
message: notEnabledMessage("PayPal payments", paypalPayments),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (!cardPayments.enabled) {
|
|
90
|
+
notices.push({
|
|
91
|
+
code: "card_payments_not_enabled",
|
|
92
|
+
// Cards are an optional extra on top of PayPal payments.
|
|
93
|
+
level: "warning",
|
|
94
|
+
message: notEnabledMessage("Advanced Credit and Debit Card payments", cardPayments),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
merchant_id: String(details.merchant_id || "").trim() || null,
|
|
99
|
+
payments_receivable: paymentsReceivable,
|
|
100
|
+
primary_email_confirmed: emailConfirmed,
|
|
101
|
+
paypal_payments: paypalPayments,
|
|
102
|
+
card_payments: cardPayments,
|
|
103
|
+
notices,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=merchant-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merchant-status.js","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/merchant-status.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AA+GH,wDAkEC;AA/HY,QAAA,2BAA2B,GACtC,sKAAsK,CAAA;AAE3J,QAAA,+BAA+B,GAC1C,oMAAoM,CAAA;AAEtM,SAAS,KAAK,CAAC,KAAc;IAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;SAC7B,IAAI,EAAE;SACN,WAAW,EAAE,CAAA;IAChB,OAAO,IAAI,IAAI,IAAI,CAAA;AACrB,CAAC;AAED,SAAS,UAAU,CAAC,IAAa,EAAE,IAAY;IAC7C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CACrB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAC5E,CAAA;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AW,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI;QAC7D,mBAAmB,EAAE,kBAAkB;QACvC,uBAAuB,EAAE,cAAc;QACvC,eAAe,EAAE,cAAc;QAC/B,aAAa,EAAE,YAAY;QAC3B,OAAO;KACR,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pieces of the Create Order payload (`POST /v2/checkout/orders`) that are
|
|
3
|
+
* worth testing on their own: the PayPal landing page and the shipping
|
|
4
|
+
* address sent with `shipping_preference: SET_PROVIDED_ADDRESS`.
|
|
5
|
+
*/
|
|
6
|
+
export type PayPalLandingPage = "LOGIN" | "GUEST_CHECKOUT";
|
|
7
|
+
/**
|
|
8
|
+
* `payment_source.paypal.experience_context.landing_page` for the admin
|
|
9
|
+
* "Landing Page" setting.
|
|
10
|
+
*
|
|
11
|
+
* `LOGIN` is the default PayPal's partner review asks for. A stored
|
|
12
|
+
* "no_preference" (the admin default before 1.3.9) is treated as `LOGIN` too.
|
|
13
|
+
* "billing" selects PayPal's guest (card) checkout page, which
|
|
14
|
+
* `experience_context` calls `GUEST_CHECKOUT` — `BILLING` was its name in the
|
|
15
|
+
* deprecated `application_context`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveLandingPage(setting: unknown): PayPalLandingPage;
|
|
18
|
+
export type CartShippingAddress = {
|
|
19
|
+
first_name?: string | null;
|
|
20
|
+
last_name?: string | null;
|
|
21
|
+
address_1?: string | null;
|
|
22
|
+
address_2?: string | null;
|
|
23
|
+
city?: string | null;
|
|
24
|
+
province?: string | null;
|
|
25
|
+
postal_code?: string | null;
|
|
26
|
+
country_code?: string | null;
|
|
27
|
+
};
|
|
28
|
+
export type PayPalShipping = {
|
|
29
|
+
name?: {
|
|
30
|
+
full_name: string;
|
|
31
|
+
};
|
|
32
|
+
address: {
|
|
33
|
+
address_line_1: string;
|
|
34
|
+
address_line_2?: string;
|
|
35
|
+
admin_area_2?: string;
|
|
36
|
+
admin_area_1?: string;
|
|
37
|
+
postal_code: string;
|
|
38
|
+
country_code: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The cart's shipping address as a PayPal `purchase_units[].shipping` object,
|
|
43
|
+
* or null when the cart has no address PayPal would accept (it rejects an
|
|
44
|
+
* address without a street line, postal code or two-letter country).
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildPayPalShipping(addr: CartShippingAddress | null | undefined): PayPalShipping | null;
|
|
47
|
+
/** True when two PayPal shipping objects describe the same recipient/address. */
|
|
48
|
+
export declare function sameShipping(a: unknown, b: unknown): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Short stable fingerprint of a shipping object, for the PayPal-Request-Id:
|
|
51
|
+
* PayPal replays the stored response for a repeated request id, so an order
|
|
52
|
+
* for the same cart and amount but a different address needs a different id.
|
|
53
|
+
*/
|
|
54
|
+
export declare function shippingFingerprint(shipping: unknown): string;
|
|
55
|
+
/**
|
|
56
|
+
* Whether PayPal rejected a Create Order request because of the shipping
|
|
57
|
+
* address we sent (so the order can be retried without it instead of failing
|
|
58
|
+
* the checkout).
|
|
59
|
+
*/
|
|
60
|
+
export declare function isShippingAddressRejection(status: number, responseText: string): boolean;
|
|
61
|
+
//# sourceMappingURL=order-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-context.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/order-context.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,gBAAgB,CAAA;AAE1D;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAOtE;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5B,OAAO,EAAE;QACP,cAAc,EAAE,MAAM,CAAA;QACtB,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,WAAW,EAAE,MAAM,CAAA;QACnB,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;CACF,CAAA;AAmBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GAC3C,cAAc,GAAG,IAAI,CA0BvB;AAkBD,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAK7D;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GACnB,OAAO,CAiBT"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveLandingPage = resolveLandingPage;
|
|
4
|
+
exports.buildPayPalShipping = buildPayPalShipping;
|
|
5
|
+
exports.sameShipping = sameShipping;
|
|
6
|
+
exports.shippingFingerprint = shippingFingerprint;
|
|
7
|
+
exports.isShippingAddressRejection = isShippingAddressRejection;
|
|
8
|
+
const crypto_1 = require("crypto");
|
|
9
|
+
/**
|
|
10
|
+
* `payment_source.paypal.experience_context.landing_page` for the admin
|
|
11
|
+
* "Landing Page" setting.
|
|
12
|
+
*
|
|
13
|
+
* `LOGIN` is the default PayPal's partner review asks for. A stored
|
|
14
|
+
* "no_preference" (the admin default before 1.3.9) is treated as `LOGIN` too.
|
|
15
|
+
* "billing" selects PayPal's guest (card) checkout page, which
|
|
16
|
+
* `experience_context` calls `GUEST_CHECKOUT` — `BILLING` was its name in the
|
|
17
|
+
* deprecated `application_context`.
|
|
18
|
+
*/
|
|
19
|
+
function resolveLandingPage(setting) {
|
|
20
|
+
const value = String(setting ?? "")
|
|
21
|
+
.trim()
|
|
22
|
+
.toLowerCase();
|
|
23
|
+
return value === "billing" || value === "guest_checkout"
|
|
24
|
+
? "GUEST_CHECKOUT"
|
|
25
|
+
: "LOGIN";
|
|
26
|
+
}
|
|
27
|
+
function text(value) {
|
|
28
|
+
return String(value ?? "").trim();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Medusa stores a province either as the buyer typed it or as an ISO 3166-2
|
|
32
|
+
* code ("us-ca"). PayPal wants the subdivision without the country prefix
|
|
33
|
+
* ("CA").
|
|
34
|
+
*/
|
|
35
|
+
function normalizeProvince(province, country) {
|
|
36
|
+
const match = province.match(/^([a-z]{2})-([a-z0-9]{1,3})$/i);
|
|
37
|
+
if (match && match[1].toUpperCase() === country) {
|
|
38
|
+
return match[2].toUpperCase();
|
|
39
|
+
}
|
|
40
|
+
return province;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The cart's shipping address as a PayPal `purchase_units[].shipping` object,
|
|
44
|
+
* or null when the cart has no address PayPal would accept (it rejects an
|
|
45
|
+
* address without a street line, postal code or two-letter country).
|
|
46
|
+
*/
|
|
47
|
+
function buildPayPalShipping(addr) {
|
|
48
|
+
if (!addr)
|
|
49
|
+
return null;
|
|
50
|
+
const line1 = text(addr.address_1);
|
|
51
|
+
const postal = text(addr.postal_code);
|
|
52
|
+
const country = text(addr.country_code).toUpperCase();
|
|
53
|
+
if (!line1 || !postal || country.length !== 2)
|
|
54
|
+
return null;
|
|
55
|
+
const fullName = [addr.first_name, addr.last_name]
|
|
56
|
+
.map(text)
|
|
57
|
+
.filter(Boolean)
|
|
58
|
+
.join(" ");
|
|
59
|
+
const line2 = text(addr.address_2);
|
|
60
|
+
const city = text(addr.city);
|
|
61
|
+
const province = normalizeProvince(text(addr.province), country);
|
|
62
|
+
return {
|
|
63
|
+
...(fullName ? { name: { full_name: fullName.slice(0, 300) } } : {}),
|
|
64
|
+
address: {
|
|
65
|
+
address_line_1: line1.slice(0, 300),
|
|
66
|
+
...(line2 ? { address_line_2: line2.slice(0, 300) } : {}),
|
|
67
|
+
...(city ? { admin_area_2: city.slice(0, 120) } : {}),
|
|
68
|
+
...(province ? { admin_area_1: province.slice(0, 300) } : {}),
|
|
69
|
+
postal_code: postal.slice(0, 60),
|
|
70
|
+
country_code: country,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function comparable(shipping) {
|
|
75
|
+
const s = (shipping && typeof shipping === "object" ? shipping : {});
|
|
76
|
+
const a = (s.address && typeof s.address === "object" ? s.address : {});
|
|
77
|
+
return [
|
|
78
|
+
s.name?.full_name,
|
|
79
|
+
a.address_line_1,
|
|
80
|
+
a.address_line_2,
|
|
81
|
+
a.admin_area_2,
|
|
82
|
+
a.admin_area_1,
|
|
83
|
+
a.postal_code,
|
|
84
|
+
a.country_code,
|
|
85
|
+
]
|
|
86
|
+
.map((part) => text(part).toLowerCase().replace(/\s+/g, " "))
|
|
87
|
+
.join("|");
|
|
88
|
+
}
|
|
89
|
+
/** True when two PayPal shipping objects describe the same recipient/address. */
|
|
90
|
+
function sameShipping(a, b) {
|
|
91
|
+
return comparable(a) === comparable(b);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Short stable fingerprint of a shipping object, for the PayPal-Request-Id:
|
|
95
|
+
* PayPal replays the stored response for a repeated request id, so an order
|
|
96
|
+
* for the same cart and amount but a different address needs a different id.
|
|
97
|
+
*/
|
|
98
|
+
function shippingFingerprint(shipping) {
|
|
99
|
+
return (0, crypto_1.createHash)("sha256")
|
|
100
|
+
.update(comparable(shipping))
|
|
101
|
+
.digest("hex")
|
|
102
|
+
.slice(0, 8);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Whether PayPal rejected a Create Order request because of the shipping
|
|
106
|
+
* address we sent (so the order can be retried without it instead of failing
|
|
107
|
+
* the checkout).
|
|
108
|
+
*/
|
|
109
|
+
function isShippingAddressRejection(status, responseText) {
|
|
110
|
+
if (status !== 400 && status !== 422)
|
|
111
|
+
return false;
|
|
112
|
+
let json;
|
|
113
|
+
try {
|
|
114
|
+
json = JSON.parse(responseText);
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
const details = Array.isArray(json?.details) ? json.details : [];
|
|
120
|
+
return details.some((detail) => {
|
|
121
|
+
const field = String(detail?.field || "");
|
|
122
|
+
const issue = String(detail?.issue || "");
|
|
123
|
+
return (/\/shipping(\/|$)/i.test(field) ||
|
|
124
|
+
/SHIPPING_ADDRESS|MISSING_SHIPPING/i.test(issue));
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=order-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-context.js","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/order-context.ts"],"names":[],"mappings":";;AAoBA,gDAOC;AA+CD,kDA4BC;AAmBD,oCAEC;AAOD,kDAKC;AAOD,gEAoBC;AAlKD,mCAAmC;AAUnC;;;;;;;;;GASG;AACH,SAA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P,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAA;IAChE,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAW,EAAE,EAAE;QAClC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,CAAA;QACzC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,CAAA;QACzC,OAAO,CACL,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC;YAC/B,oCAAoC,CAAC,IAAI,CAAC,KAAK,CAAC,CACjD,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -21,6 +21,18 @@ export declare function setRequestLoggingEnabled(enabled: boolean): void;
|
|
|
21
21
|
export declare function isRequestLoggingEnabled(): boolean;
|
|
22
22
|
/** Deep-copy `value` with the values of sensitive keys replaced. */
|
|
23
23
|
export declare function redactBody(value: unknown, depth?: number): unknown;
|
|
24
|
+
/**
|
|
25
|
+
* Where the request log is written: `PAYPAL_LOG_DIR` when set, otherwise
|
|
26
|
+
* `<project>/.medusa/paypal-logs`.
|
|
27
|
+
*
|
|
28
|
+
* The default used to be `<cwd>/logs`. `medusa develop` restarts the server
|
|
29
|
+
* whenever a file changes inside the project, so every logged request
|
|
30
|
+
* restarted it — and with in-memory sessions each restart logged the admin
|
|
31
|
+
* out. `.medusa` is ignored by that watcher (and by git in Medusa projects).
|
|
32
|
+
* The built server runs from `<project>/.medusa/server`, which each build
|
|
33
|
+
* wipes, so the project root is used there too and the logs survive rebuilds.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveLogDir(envDir?: string | undefined, cwd?: string): string;
|
|
24
36
|
/** Absolute path of the log file for the current day. */
|
|
25
37
|
export declare function getCurrentLogFilePath(): string;
|
|
26
38
|
export type OutboundLog = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-logger.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/request-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAoBH,mFAAmF;AACnF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAE/D;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,IAAI,OAAO,CAEjD;AAyBD,oEAAoE;AACpE,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,OAAO,CAY7D;
|
|
1
|
+
{"version":3,"file":"request-logger.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/request-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAoBH,mFAAmF;AACnF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAE/D;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,IAAI,OAAO,CAEjD;AAyBD,oEAAoE;AACpE,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,OAAO,CAY7D;AAgFD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,MAAM,GAAE,MAAM,GAAG,SAAsC,EACvD,GAAG,GAAE,MAAsB,GAC1B,MAAM,CAaR;AAYD,yDAAyD;AACzD,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AA0CD,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CA+BpD;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,8DAA8D;AAC9D,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CA6BlD;AAMD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,wDAAwD;AACxD,wBAAgB,YAAY,IAAI,WAAW,EAAE,CAmB5C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAa3D"}
|
|
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
23
|
exports.setRequestLoggingEnabled = setRequestLoggingEnabled;
|
|
24
24
|
exports.isRequestLoggingEnabled = isRequestLoggingEnabled;
|
|
25
25
|
exports.redactBody = redactBody;
|
|
26
|
+
exports.resolveLogDir = resolveLogDir;
|
|
26
27
|
exports.getCurrentLogFilePath = getCurrentLogFilePath;
|
|
27
28
|
exports.logOutbound = logOutbound;
|
|
28
29
|
exports.logInbound = logInbound;
|
|
@@ -160,9 +161,32 @@ function normalizeHeaders(headers) {
|
|
|
160
161
|
// ---------------------------------------------------------------------------
|
|
161
162
|
// File sink
|
|
162
163
|
// ---------------------------------------------------------------------------
|
|
164
|
+
/**
|
|
165
|
+
* Where the request log is written: `PAYPAL_LOG_DIR` when set, otherwise
|
|
166
|
+
* `<project>/.medusa/paypal-logs`.
|
|
167
|
+
*
|
|
168
|
+
* The default used to be `<cwd>/logs`. `medusa develop` restarts the server
|
|
169
|
+
* whenever a file changes inside the project, so every logged request
|
|
170
|
+
* restarted it — and with in-memory sessions each restart logged the admin
|
|
171
|
+
* out. `.medusa` is ignored by that watcher (and by git in Medusa projects).
|
|
172
|
+
* The built server runs from `<project>/.medusa/server`, which each build
|
|
173
|
+
* wipes, so the project root is used there too and the logs survive rebuilds.
|
|
174
|
+
*/
|
|
175
|
+
function resolveLogDir(envDir = process.env.PAYPAL_LOG_DIR, cwd = process.cwd()) {
|
|
176
|
+
const dir = (envDir || "").trim();
|
|
177
|
+
if (dir)
|
|
178
|
+
return path_1.default.resolve(dir);
|
|
179
|
+
const parts = path_1.default.resolve(cwd).split(path_1.default.sep);
|
|
180
|
+
const inBuiltServer = parts.length >= 2 &&
|
|
181
|
+
parts[parts.length - 2] === ".medusa" &&
|
|
182
|
+
parts[parts.length - 1] === "server";
|
|
183
|
+
const projectRoot = inBuiltServer
|
|
184
|
+
? path_1.default.resolve(cwd, "..", "..")
|
|
185
|
+
: path_1.default.resolve(cwd);
|
|
186
|
+
return path_1.default.join(projectRoot, ".medusa", "paypal-logs");
|
|
187
|
+
}
|
|
163
188
|
function getLogDir() {
|
|
164
|
-
|
|
165
|
-
return dir ? path_1.default.resolve(dir) : path_1.default.join(process.cwd(), "logs");
|
|
189
|
+
return resolveLogDir();
|
|
166
190
|
}
|
|
167
191
|
const LOG_PREFIX = "paypal-requests-";
|
|
168
192
|
function dateStamp(d = new Date()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-logger.js","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/request-logger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;AAqBH,4DAEC;AAGD,0DAEC;AA0BD,gCAYC;
|
|
1
|
+
{"version":3,"file":"request-logger.js","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/request-logger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;AAqBH,4DAEC;AAGD,0DAEC;AA0BD,gCAYC;AA2FD,sCAgBC;AAaD,sDAEC;AAwDD,kCA+BC;AAcD,gCA6BC;AAaD,oCAmBC;AAMD,wCAaC;AA/WD,4CAAmB;AACnB,gDAAuB;AAEvB,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,YAAY,GAAG,oBAAoB,CAAC,IAAI,CAC5C,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAC9C,CAAA;AAED,IAAI,cAAc,GAAG,KAAK,CAAA;AAE1B,mFAAmF;AACnF,SAAgB,wBAAwB,CAAC,OAAgB;IACvD,cAAc,GAAG,CAAC,CAAC,OAAO,CAAA;AAC5B,CAAC;AAED,4EAA4E;AAC5E,SAAgB,uBAAuB;IACrC,OAAO,YAAY,IAAI,cAAc,CAAA;AACvC,CAAC;AAED,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,2EAA2E;AAC3E,+EAA+E;AAC/E,0EAA0E;AAC1E,EAAE;AACF,6EAA6E;AAC7E,qEAAqE;AACrE,6EAA6E;AAC7E,6EAA6E;AAC7E,SAAS;AACT,MAAM,qBAAqB,GACzB,6NAA6N,CAAA;AAE/N,8EAA8E;AAC9E,gDAAgD;AAChD,MAAM,mBAAmB,GACvB,oEAAoE,CAAA;AAEtE,MAAM,QAAQ,GAAG,YAAY,CAAA;AAE7B,oEAAoE;AACpE,SAAgB,UAAU,CAAC,KAAc,EAAE,KAAK,GAAG,CAAC;IAClD,IAAI,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AAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACvC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;YACjB,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YACxC,CAAC,CAAC,IAAI,CAAA;IACV,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IACxB,yEAAyE;IACzE,IAAI,cAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAA;IAC3D,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAA;IACvC,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,108 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@easypayment/medusa-payment-paypal` are documented here.
|
|
4
4
|
|
|
5
|
+
## 1.3.10 — 2026-11-18
|
|
6
|
+
|
|
7
|
+
Found by running the plugin end to end in a store (onboarding, wallet and card
|
|
8
|
+
checkout with Capture and Authorize).
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **Request logging no longer restarts the dev server and logs the admin
|
|
13
|
+
out.** The log was written to `logs/` inside the project. `medusa develop`
|
|
14
|
+
restarts the server whenever a file changes there, so with logging on every
|
|
15
|
+
logged request restarted it, and because admin sessions are kept in memory
|
|
16
|
+
(without Redis) each restart ended the admin's session: the PayPal pages
|
|
17
|
+
then failed with `{"message":"Unauthorized"}` moments after logging in. The
|
|
18
|
+
default folder is now `.medusa/paypal-logs` in the project, which that
|
|
19
|
+
watcher ignores and which Medusa projects already keep out of git. It is
|
|
20
|
+
resolved from the project root when the built server runs from
|
|
21
|
+
`.medusa/server`, so logs also survive rebuilds. `PAYPAL_LOG_DIR` still
|
|
22
|
+
overrides it; existing files in `logs/` are left where they are.
|
|
23
|
+
- **Seller status is read with the seller's own credentials again.** 1.3.9
|
|
24
|
+
asked the partner service to read it with the partner account's credentials
|
|
25
|
+
first. Onboarding is `integration_type: FIRST_PARTY`, and for a first-party
|
|
26
|
+
integration PayPal only accepts this call from the seller: with the
|
|
27
|
+
partner's token it answers `401 AUTHORIZATION_ERROR` ("If it's a first party
|
|
28
|
+
integration this request shouldn't come with the partner scope"). The
|
|
29
|
+
attempt could never succeed, added a failed request to every status check,
|
|
30
|
+
and is removed, together with `PAYPAL_PARTNER_STATUS_URL`. The checks and
|
|
31
|
+
merchant warnings added in 1.3.9 are unchanged. The status is read for the
|
|
32
|
+
active environment only.
|
|
33
|
+
- **One seller status call per onboarding instead of five.** The Connection
|
|
34
|
+
page and the onboarding exchange each asked PayPal for the seller's status,
|
|
35
|
+
some of them at the same moment. Requests that arrive together now share one
|
|
36
|
+
call, and the answer is reused for five minutes (until the credentials
|
|
37
|
+
change or a refresh is asked for).
|
|
38
|
+
- **`brand_name` and `soft_descriptor` no longer say "PayPal".** The Additional
|
|
39
|
+
Settings form pre-filled "PayPal" for Brand Name and Credit Card Statement
|
|
40
|
+
Name, so stores that saved the form sent PayPal's name as their own. Both
|
|
41
|
+
fields now start empty, and a stored "PayPal" is treated as unset: the brand
|
|
42
|
+
name falls back to the store's name and no statement descriptor is sent.
|
|
43
|
+
- **Readable errors on the PayPal Connection page.** A failed call showed the
|
|
44
|
+
raw response body. An expired session now reads "Your admin session has
|
|
45
|
+
expired. Reload this page and log in again.", and a failed Disconnect keeps
|
|
46
|
+
showing the connected account instead of switching to the "not connected"
|
|
47
|
+
view although nothing was disconnected.
|
|
48
|
+
- **Request log entries no longer repeat the query string** (for example
|
|
49
|
+
`/store/paypal/config?cart_id=…?cart_id=…`).
|
|
50
|
+
|
|
51
|
+
## 1.3.9 — 2026-11-17
|
|
52
|
+
|
|
53
|
+
Changes requested by PayPal's partner integration review of 2026-11-17.
|
|
54
|
+
|
|
55
|
+
### Changed
|
|
56
|
+
|
|
57
|
+
- **Seller status is read with the partner's credentials.** The seller
|
|
58
|
+
onboarding status
|
|
59
|
+
(`GET /v1/customer/partners/{partner-id}/merchant-integrations/{merchant-id}`)
|
|
60
|
+
is now requested through the partner service, which calls PayPal with the
|
|
61
|
+
partner account's credentials. If the partner service cannot be reached, or
|
|
62
|
+
PayPal refuses the partner token for a seller, the plugin falls back to the
|
|
63
|
+
seller's own credentials as before. `PAYPAL_PARTNER_STATUS_URL` overrides the
|
|
64
|
+
endpoint; it is derived automatically from `PAYPAL_PARTNER_SERVICE_URL`.
|
|
65
|
+
- **Create Order: `landing_page` is `LOGIN`.** The admin "Landing Page" setting
|
|
66
|
+
defaulted to "No Preference", so stores that saved the Additional Settings
|
|
67
|
+
form sent `NO_PREFERENCE`. That option is removed and a stored
|
|
68
|
+
"no_preference" is sent as `LOGIN`. The "Billing" option is now "Guest
|
|
69
|
+
checkout (card form)" and sends `GUEST_CHECKOUT`, the value
|
|
70
|
+
`experience_context` accepts (`BILLING` belonged to the deprecated
|
|
71
|
+
`application_context`).
|
|
72
|
+
- **Create Order: the checkout shipping address is sent by default** with
|
|
73
|
+
`shipping_preference: SET_PROVIDED_ADDRESS`, so PayPal shows the address the
|
|
74
|
+
buyer entered in the storefront. Card orders carry the address too. This was
|
|
75
|
+
opt-in; turn it off with the new "Send Shipping Address" setting or
|
|
76
|
+
`PAYPAL_SEND_SHIPPING_ADDRESS=false`. Carts without a complete address (for
|
|
77
|
+
example digital goods) send none. If PayPal rejects the address, the order
|
|
78
|
+
is created without it rather than failing the checkout, and a stored order
|
|
79
|
+
is replaced when the buyer changes the address.
|
|
80
|
+
- **Create Order: `custom_id` is no longer sent at the top level of the
|
|
81
|
+
request.** It stays on the purchase unit, which is where PayPal reads it.
|
|
82
|
+
|
|
83
|
+
### Added
|
|
84
|
+
|
|
85
|
+
- **Account warnings in the admin.** The PayPal Connection page now checks the
|
|
86
|
+
seller's status and tells the merchant when their PayPal email is not
|
|
87
|
+
confirmed (`primary_email_confirmed`), when the account cannot receive
|
|
88
|
+
payments (`payments_receivable`), when PayPal payments are not enabled
|
|
89
|
+
(`PPCP_STANDARD` not `SUBSCRIBED` or `PAY_WITH_PAYPAL` not `ACTIVE`), and
|
|
90
|
+
when Advanced Card payments are not enabled (`PPCP_CUSTOM` not `SUBSCRIBED`
|
|
91
|
+
or `CUSTOM_CARD_PROCESSING` not `ACTIVE`), with wording that follows the
|
|
92
|
+
vetting status. The card warning also shows on the Advanced Card Payments
|
|
93
|
+
page. New route: `GET /admin/paypal/merchant-status`.
|
|
94
|
+
|
|
95
|
+
### Fixed
|
|
96
|
+
|
|
97
|
+
- **The app access token is no longer minted twice while connecting.** Saving
|
|
98
|
+
the same credentials again (to add the seller's email once it was known)
|
|
99
|
+
discarded the cached token, so a second `/v1/oauth2/token` call followed
|
|
100
|
+
within seconds. The token is now kept until it expires unless the
|
|
101
|
+
credentials actually change. Saving credentials manually no longer mints a
|
|
102
|
+
separate, uncached token for the profile lookup either.
|
|
103
|
+
- **Onboarding no longer makes a status call that always failed.** The seller
|
|
104
|
+
status was first requested with the token from the authorization-code
|
|
105
|
+
exchange, which PayPal answers with `401 AUTHORIZATION_ERROR`.
|
|
106
|
+
|
|
5
107
|
## 1.3.8 — 2026-11-17
|
|
6
108
|
|
|
7
109
|
### Changed
|
package/README.md
CHANGED
|
@@ -144,7 +144,7 @@ Everything is managed in **Medusa Admin → Settings → PayPal**. Changes apply
|
|
|
144
144
|
| --- | --- |
|
|
145
145
|
| **PayPal Settings** | Turn PayPal on or off, checkout title, button color, shape, width, height and label |
|
|
146
146
|
| **Advanced Card Payments** | Turn card payments on or off, checkout title, 3D Secure mode |
|
|
147
|
-
| **Additional Settings** | Payment action (capture or authorize), brand name shown at PayPal, landing page, instant payments, item details, invoice prefix, card statement name |
|
|
147
|
+
| **Additional Settings** | Payment action (capture or authorize), brand name shown at PayPal, landing page, instant payments, item details, shipping address, invoice prefix, card statement name |
|
|
148
148
|
|
|
149
149
|
## 🔐 Going live
|
|
150
150
|
|
|
@@ -171,7 +171,7 @@ Everything works without these. They are for developers who need to tune the plu
|
|
|
171
171
|
| `STOREFRONT_URL` (or `STORE_URL`) | Request origin, if listed in `STORE_CORS` | Storefront address used for PayPal return and cancel pages. Can also be set in Admin |
|
|
172
172
|
| `PAYPAL_ENCRYPTION_STRICT` | `false` | `true` refuses to save credentials unencrypted |
|
|
173
173
|
| `PAYPAL_ADMIN_ORIGIN` | First `ADMIN_CORS` entry | Restricts the onboarding popup to your admin URL |
|
|
174
|
-
| `PAYPAL_SEND_SHIPPING_ADDRESS` | `
|
|
174
|
+
| `PAYPAL_SEND_SHIPPING_ADDRESS` | `true` | The shipping address the buyer entered at checkout is sent on PayPal orders (`SET_PROVIDED_ADDRESS`), which PayPal Seller Protection needs. Set `false` to let buyers pick an address in PayPal instead. Also an admin setting |
|
|
175
175
|
| `PAYPAL_CURRENCY` | `EUR` | Fallback currency if none is configured |
|
|
176
176
|
| `PAYPAL_HTTP_TIMEOUT_MS` | `30000` | Timeout for calls to PayPal |
|
|
177
177
|
| `PAYPAL_SETTINGS_CACHE_MS` | `15000` | In-process cache for plugin settings reads. `0` disables it |
|
|
@@ -183,7 +183,7 @@ Everything works without these. They are for developers who need to tune the plu
|
|
|
183
183
|
| `PAYPAL_WEBHOOK_RATE_LIMIT_MAX` / `PAYPAL_WEBHOOK_RATE_LIMIT_WINDOW_MS` | Off / `60000` | Optional request limit for the webhook endpoint, separate from the one above |
|
|
184
184
|
| `PAYPAL_ALERT_WEBHOOK_URLS` | Unset | Comma-separated URLs that receive operational alerts, including dead-lettered webhook events |
|
|
185
185
|
| `PAYPAL_REQUEST_LOG` | Off | `1` or `true` forces the request/response log on, regardless of the admin toggle |
|
|
186
|
-
| `PAYPAL_LOG_DIR` |
|
|
186
|
+
| `PAYPAL_LOG_DIR` | `.medusa/paypal-logs` in the project | Directory for the `paypal-requests-YYYY-MM-DD.log` file written when logging is on. Keep it outside the folders `medusa develop` watches, or every logged request restarts the dev server |
|
|
187
187
|
| `PAYPAL_PARTNER_SERVICE_URL` | Built-in | Overrides the partner onboarding service used by the connect flow |
|
|
188
188
|
| `PAYPAL_SELLER_NONCE` | Partner service nonce | Only change this if you also run your own `PAYPAL_PARTNER_SERVICE_URL`. It must match the nonce that service puts in its onboarding links |
|
|
189
189
|
| `PAYPAL_PARTNER_MERCHANT_ID_SANDBOX` / `PAYPAL_PARTNER_MERCHANT_ID_LIVE` | Built-in | Overrides the partner merchant IDs used for onboarding |
|
|
@@ -221,7 +221,7 @@ Storefronts can use it to show a message such as "insufficient funds, try anothe
|
|
|
221
221
|
|
|
222
222
|
<br>
|
|
223
223
|
|
|
224
|
-
Turn on **Settings → PayPal → Additional Settings → Request/response logging** (off by default) to append every PayPal API call, and every plugin API request and response, to
|
|
224
|
+
Turn on **Settings → PayPal → Additional Settings → Request/response logging** (off by default) to append every PayPal API call, and every plugin API request and response, to `.medusa/paypal-logs/paypal-requests-YYYY-MM-DD.log`.
|
|
225
225
|
|
|
226
226
|
- Credentials are redacted. The `PayPal-Partner-Attribution-Id` (BN code) is kept, so the file is safe to hand to PayPal's go-live review.
|
|
227
227
|
- Download it from the same settings page with **Download log**, or at `GET /admin/paypal/logs?download=1`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easypayment/medusa-payment-paypal",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.10",
|
|
4
4
|
"description": "PayPal & credit card payments for Medusa v2 — PayPal Buttons, hosted card fields, 3D Secure, and an admin dashboard. Built by a PayPal Partner.",
|
|
5
5
|
"author": "EasyPayment Plugins",
|
|
6
6
|
"license": "MIT",
|