@easypayment/medusa-payment-paypal 1.3.7 → 1.3.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 +172 -76
- package/.medusa/server/src/admin/index.mjs +107 -13
- package/.medusa/server/src/api/admin/paypal/logs/route.d.ts.map +1 -1
- package/.medusa/server/src/api/admin/paypal/logs/route.js.map +1 -1
- 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 +101 -102
- package/.medusa/server/src/api/store/paypal/create-order/route.js.map +1 -1
- package/.medusa/server/src/modules/paypal/service.d.ts +34 -0
- package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/service.js +161 -34
- package/.medusa/server/src/modules/paypal/service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/types/config.d.ts +12 -0
- package/.medusa/server/src/modules/paypal/types/config.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/types/config.js +25 -1
- package/.medusa/server/src/modules/paypal/types/config.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/merchant-status.d.ts +50 -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/CHANGELOG.md +78 -0
- package/README.md +108 -61
- package/package.json +2 -2
- package/src/admin/routes/settings/paypal/_components/MerchantStatusNotices.tsx +116 -0
- package/src/admin/routes/settings/paypal/additional-settings/page.tsx +32 -6
- package/src/admin/routes/settings/paypal/advanced-card-payments/page.tsx +2 -0
- package/src/admin/routes/settings/paypal/connection/page.tsx +7 -0
- package/src/api/admin/paypal/logs/route.ts +1 -4
- package/src/api/admin/paypal/merchant-status/route.ts +36 -0
- package/src/api/store/paypal/create-order/route.ts +176 -157
- package/src/modules/paypal/service.ts +222 -43
- package/src/modules/paypal/types/config.ts +35 -2
- package/src/modules/paypal/utils/merchant-status.ts +185 -0
- package/src/modules/paypal/utils/order-context.ts +163 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn PayPal's seller onboarding status
|
|
3
|
+
* (`GET /v1/customer/partners/{partner-id}/merchant-integrations/{merchant-id}`)
|
|
4
|
+
* into what the admin needs to know: can this seller receive payments, are
|
|
5
|
+
* PayPal payments and Advanced Card payments enabled, and what should the
|
|
6
|
+
* merchant be told when they are not.
|
|
7
|
+
*
|
|
8
|
+
* The checks and the two "Attention" messages are the ones PayPal's partner
|
|
9
|
+
* integration review asks for (2026-11-17).
|
|
10
|
+
*/
|
|
11
|
+
export type MerchantNoticeLevel = "error" | "warning";
|
|
12
|
+
export type MerchantNotice = {
|
|
13
|
+
code: "email_not_confirmed" | "payments_not_receivable" | "paypal_payments_not_enabled" | "card_payments_not_enabled";
|
|
14
|
+
level: MerchantNoticeLevel;
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
export type MerchantFeatureStatus = {
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
/** `products[name].vetting_status`, or null when the product is absent. */
|
|
20
|
+
vetting_status: string | null;
|
|
21
|
+
/** `capabilities[name].status`, or null when the capability is absent. */
|
|
22
|
+
capability_status: string | null;
|
|
23
|
+
};
|
|
24
|
+
export type MerchantStatus = {
|
|
25
|
+
merchant_id: string | null;
|
|
26
|
+
payments_receivable: boolean | null;
|
|
27
|
+
primary_email_confirmed: boolean | null;
|
|
28
|
+
paypal_payments: MerchantFeatureStatus;
|
|
29
|
+
card_payments: MerchantFeatureStatus;
|
|
30
|
+
notices: MerchantNotice[];
|
|
31
|
+
};
|
|
32
|
+
/** What `PayPalModuleService.getMerchantStatus()` reports to the admin. */
|
|
33
|
+
export type MerchantStatusReport = ({
|
|
34
|
+
environment: string;
|
|
35
|
+
available: true;
|
|
36
|
+
/** Whose credentials read the status: the partner's or the seller's. */
|
|
37
|
+
source: "partner" | "seller";
|
|
38
|
+
checked_at: string;
|
|
39
|
+
} & MerchantStatus) | {
|
|
40
|
+
environment: string;
|
|
41
|
+
available: false;
|
|
42
|
+
reason: "not_connected" | "merchant_id_unknown" | "lookup_failed";
|
|
43
|
+
message?: string;
|
|
44
|
+
notices: MerchantNotice[];
|
|
45
|
+
};
|
|
46
|
+
export declare const 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.";
|
|
47
|
+
export declare const 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.";
|
|
48
|
+
/** Evaluate a merchant-integrations response. Never throws. */
|
|
49
|
+
export declare function evaluateMerchantStatus(input: unknown): MerchantStatus;
|
|
50
|
+
//# sourceMappingURL=merchant-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merchant-status.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/merchant-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,SAAS,CAAA;AAErD,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI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@
|
|
|
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;;;AA6GH,wDAkEC;AA/HY,QAAA,2BAA2B,GACtC,sKAAsK,CAAA;AAE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,OAAO;YACd,OAAO,EAAE,uCAA+B;SACzC,CAAC,CAAA;IACJ,CAAC;IACD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC5B,OAAO,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,6BAA6B;YACnC,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,EAAE,cAAc,CAAC;SAC9D,CAAC,CAAA;IACJ,CAAC;IACD,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAC1B,OAAO,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,2BAA2B;YACjC,yDAAyD;YACzD,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,iBAAiB,CACxB,yCAAyC,EACzC,YAAY,CACb;SACF,CAAC,CAAA;IACJ,CAAC;IAED,OAAO;QACL,WAAW,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,SAAgB,kBAAkB,CAAC,OAAgB;IACjD,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;SAChC,IAAI,EAAE;SACN,WAAW,EAAE,CAAA;IAChB,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,gBAAgB;QACtD,CAAC,CAAC,gBAAgB;QAClB,CAAC,CAAC,OAAO,CAAA;AACb,CAAC;AAyBD,SAAS,IAAI,CAAC,KAAc;IAC1B,OAAO,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;AACnC,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,QAAgB,EAAE,OAAe;IAC1D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAA;IAC7D,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,OAAO,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;IAC/B,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED;;;;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
|
+
Changes requested by PayPal's partner integration review of 2026-11-17.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **Seller status is read with the partner's credentials.** The seller
|
|
12
|
+
onboarding status
|
|
13
|
+
(`GET /v1/customer/partners/{partner-id}/merchant-integrations/{merchant-id}`)
|
|
14
|
+
is now requested through the partner service, which calls PayPal with the
|
|
15
|
+
partner account's credentials. If the partner service cannot be reached, or
|
|
16
|
+
PayPal refuses the partner token for a seller, the plugin falls back to the
|
|
17
|
+
seller's own credentials as before. `PAYPAL_PARTNER_STATUS_URL` overrides the
|
|
18
|
+
endpoint; it is derived automatically from `PAYPAL_PARTNER_SERVICE_URL`.
|
|
19
|
+
- **Create Order: `landing_page` is `LOGIN`.** The admin "Landing Page" setting
|
|
20
|
+
defaulted to "No Preference", so stores that saved the Additional Settings
|
|
21
|
+
form sent `NO_PREFERENCE`. That option is removed and a stored
|
|
22
|
+
"no_preference" is sent as `LOGIN`. The "Billing" option is now "Guest
|
|
23
|
+
checkout (card form)" and sends `GUEST_CHECKOUT`, the value
|
|
24
|
+
`experience_context` accepts (`BILLING` belonged to the deprecated
|
|
25
|
+
`application_context`).
|
|
26
|
+
- **Create Order: the checkout shipping address is sent by default** with
|
|
27
|
+
`shipping_preference: SET_PROVIDED_ADDRESS`, so PayPal shows the address the
|
|
28
|
+
buyer entered in the storefront. Card orders carry the address too. This was
|
|
29
|
+
opt-in; turn it off with the new "Send Shipping Address" setting or
|
|
30
|
+
`PAYPAL_SEND_SHIPPING_ADDRESS=false`. Carts without a complete address (for
|
|
31
|
+
example digital goods) send none. If PayPal rejects the address, the order
|
|
32
|
+
is created without it rather than failing the checkout, and a stored order
|
|
33
|
+
is replaced when the buyer changes the address.
|
|
34
|
+
- **Create Order: `custom_id` is no longer sent at the top level of the
|
|
35
|
+
request.** It stays on the purchase unit, which is where PayPal reads it.
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- **Account warnings in the admin.** The PayPal Connection page now checks the
|
|
40
|
+
seller's status and tells the merchant when their PayPal email is not
|
|
41
|
+
confirmed (`primary_email_confirmed`), when the account cannot receive
|
|
42
|
+
payments (`payments_receivable`), when PayPal payments are not enabled
|
|
43
|
+
(`PPCP_STANDARD` not `SUBSCRIBED` or `PAY_WITH_PAYPAL` not `ACTIVE`), and
|
|
44
|
+
when Advanced Card payments are not enabled (`PPCP_CUSTOM` not `SUBSCRIBED`
|
|
45
|
+
or `CUSTOM_CARD_PROCESSING` not `ACTIVE`), with wording that follows the
|
|
46
|
+
vetting status. The card warning also shows on the Advanced Card Payments
|
|
47
|
+
page. New route: `GET /admin/paypal/merchant-status`.
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- **The app access token is no longer minted twice while connecting.** Saving
|
|
52
|
+
the same credentials again (to add the seller's email once it was known)
|
|
53
|
+
discarded the cached token, so a second `/v1/oauth2/token` call followed
|
|
54
|
+
within seconds. The token is now kept until it expires unless the
|
|
55
|
+
credentials actually change. Saving credentials manually no longer mints a
|
|
56
|
+
separate, uncached token for the profile lookup either.
|
|
57
|
+
- **Onboarding no longer makes a status call that always failed.** The seller
|
|
58
|
+
status was first requested with the token from the authorization-code
|
|
59
|
+
exchange, which PayPal answers with `401 AUTHORIZATION_ERROR`.
|
|
60
|
+
|
|
61
|
+
## 1.3.8 — 2026-11-17
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
|
|
65
|
+
- **README rewritten for faster setup.** Added a contents list, a "Customize"
|
|
66
|
+
table that matches the admin tabs, a "Going live" table, and split the
|
|
67
|
+
advanced material into collapsible sections (environment variables, declined
|
|
68
|
+
cards, monitoring, integration log). The connect step now names the admin
|
|
69
|
+
page and the manual-credentials link as they appear in Medusa Admin, and
|
|
70
|
+
`STORE_URL` is documented as an alias of `STOREFRONT_URL`.
|
|
71
|
+
- No runtime changes.
|
|
72
|
+
|
|
73
|
+
### Fixed
|
|
74
|
+
|
|
75
|
+
- **README:** removed the "Start a discussion" link, which returned 404, and
|
|
76
|
+
replaced emoji that render as plain glyphs or break heading anchors on npm
|
|
77
|
+
and GitHub.
|
|
78
|
+
- **package.json:** `repository.url` is now in the normalized `git+https://`
|
|
79
|
+
form, so `npm publish` no longer auto-corrects it with a warning.
|
|
80
|
+
- **Formatting:** `src/api/admin/paypal/logs/route.ts` now passes
|
|
81
|
+
`prettier --check`.
|
|
82
|
+
|
|
5
83
|
## 1.3.7 — 2026-11-16
|
|
6
84
|
|
|
7
85
|
### Fixed
|