@easypayment/medusa-payment-paypal 1.2.4 → 1.2.6
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 +10 -10
- package/.medusa/server/src/admin/index.mjs +10 -10
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js +6 -1
- package/.medusa/server/src/api/store/payment-collections/[id]/payment-sessions/route.js.map +1 -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 +26 -6
- package/.medusa/server/src/api/store/paypal/create-order/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal-complete/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal-complete/route.js +22 -2
- package/.medusa/server/src/api/store/paypal-complete/route.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/base-provider.d.ts +24 -1
- package/.medusa/server/src/modules/paypal/payment-provider/base-provider.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/base-provider.js +296 -0
- package/.medusa/server/src/modules/paypal/payment-provider/base-provider.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.d.ts +1 -2
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.js +3 -184
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts +1 -2
- package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/service.js +3 -182
- package/.medusa/server/src/modules/paypal/payment-provider/service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/status-utils.d.ts +21 -0
- package/.medusa/server/src/modules/paypal/payment-provider/status-utils.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/status-utils.js +54 -0
- package/.medusa/server/src/modules/paypal/payment-provider/status-utils.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.d.ts +10 -0
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.js +42 -0
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.js.map +1 -1
- package/CHANGELOG.md +60 -0
- package/package.json +1 -1
- package/src/api/store/payment-collections/[id]/payment-sessions/route.ts +7 -1
- package/src/api/store/paypal/create-order/route.ts +31 -6
- package/src/api/store/paypal-complete/route.ts +30 -3
- package/src/modules/paypal/payment-provider/base-provider.ts +417 -4
- package/src/modules/paypal/payment-provider/card-service.ts +4 -238
- package/src/modules/paypal/payment-provider/service.ts +4 -237
- package/src/modules/paypal/payment-provider/status-utils.ts +57 -0
- package/src/modules/paypal/utils/credential-resolver.ts +40 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-resolver.js","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/credential-resolver.ts"],"names":[],"mappings":";;;AAAA,uCAA8C;AAC9C,uCAAoE;AACpE,iDAA4C;AAC5C,mDAA8D;AAE9D,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;AAqBrC;;;;;;;;;;;GAWG;AACH,MAAa,wBAAwB;IAC3B,EAAE,CAAK;IACP,mBAAmB,GAA2B,IAAI,CAAA;IAE1D,YAAY,YAAiB;QAC3B,IAAI,CAAC,EAAE,GAAG,YAAY,CAAA;IACxB,CAAC;IAEO,KAAK,CAAC,gBAAgB;QAC5B,uEAAuE;QACvE,0EAA0E;QAC1E,oEAAoE;QACpE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,mBAAmB,CAAC;aAC5C,MAAM,CAAC,GAAG,CAAC;aACX,SAAS,CAAC,YAAY,CAAC;aACvB,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E,CAAC,CAAC,CAAC,EAAE,CAAC;aAClC,CAAC,CACH,CAAA;QACH,CAAC;QAAC,MAAM,CAAC;YACP,kDAAkD;QACpD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,QAAkC;QACjE,wEAAwE;QACxE,2EAA2E;QAC3E,MAAM,IAAA,4BAAkB,EAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;IACnD,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"credential-resolver.js","sourceRoot":"","sources":["../../../../../../src/modules/paypal/utils/credential-resolver.ts"],"names":[],"mappings":";;;AAAA,uCAA8C;AAC9C,uCAAoE;AACpE,iDAA4C;AAC5C,mDAA8D;AAE9D,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;AAqBrC;;;;;;;;;;;GAWG;AACH,MAAa,wBAAwB;IAC3B,EAAE,CAAK;IACP,mBAAmB,GAA2B,IAAI,CAAA;IAE1D,YAAY,YAAiB;QAC3B,IAAI,CAAC,EAAE,GAAG,YAAY,CAAA;IACxB,CAAC;IAEO,KAAK,CAAC,gBAAgB;QAC5B,uEAAuE;QACvE,0EAA0E;QAC1E,oEAAoE;QACpE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,mBAAmB,CAAC;aAC5C,MAAM,CAAC,GAAG,CAAC;aACX,SAAS,CAAC,YAAY,CAAC;aACvB,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC;aAC7B,KAAK,CAAC,CAAC,CAAC,CAAA;QAEX,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAA;IAC1B,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,yBAAyB,CAC7B,YAAoB;QAEpB,IAAI,CAAC;YACH,IAAI,CAAC,YAAY,IAAI,OAAO,YAAY,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAA;YAClE,MAAM,IAAI,GA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YAAY,CAAC,IAAY,EAAE,QAAkC;QACjE,wEAAwE;QACxE,2EAA2E;QAC3E,MAAM,IAAA,4BAAkB,EAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;IACnD,CAAC;CACF;AApRD,4DAoRC"}
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,66 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@easypayment/medusa-payment-paypal` are documented here.
|
|
4
4
|
|
|
5
|
+
## 1.2.6 — 2026-09-21
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Maintenance release, no code changes. Published alongside
|
|
9
|
+
`@easypayment/medusa-paypal-ui` 1.2.3 (formatting-only).
|
|
10
|
+
|
|
11
|
+
## 1.2.5 — 2026-09-14
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
- **Partial captures after the first one were never sent to PayPal.** Both
|
|
15
|
+
providers' `capturePayment` short-circuited whenever the session already
|
|
16
|
+
carried a `capture_id` — which is always the case after a first partial
|
|
17
|
+
capture — and reported success without calling PayPal. Medusa then showed
|
|
18
|
+
the full amount as captured while PayPal had only taken the first slice
|
|
19
|
+
(reproduced: 20 + 30 on a 50 EUR authorization → Medusa 50 captured, PayPal
|
|
20
|
+
20). Capture decisions are now driven by what PayPal actually holds for the
|
|
21
|
+
order, reconciled against Medusa's own capture ledger: the remaining amount
|
|
22
|
+
is captured, a request above what remains is refused (not silently
|
|
23
|
+
clamped), a fully-captured order is an idempotent success, and funds that
|
|
24
|
+
are still PENDING are never booked as captured. Money PayPal holds that
|
|
25
|
+
Medusa has not booked — a capture whose Medusa write failed and is being
|
|
26
|
+
retried with a fresh capture row (fresh `PayPal-Request-Id`), or a
|
|
27
|
+
storefront capture the session never recorded — is treated as the capture
|
|
28
|
+
being booked instead of being taken from the buyer a second time. The
|
|
29
|
+
capture that exhausts the session amount now closes the authorization
|
|
30
|
+
(`final_capture`). The logic lives once in the shared base provider instead
|
|
31
|
+
of two diverging copies.
|
|
32
|
+
|
|
33
|
+
> **Upgrade note:** if you used partial captures on 1.2.4 or earlier, Medusa
|
|
34
|
+
> may show more captured than PayPal actually took. Check PayPal for
|
|
35
|
+
> authorizations still in `PARTIALLY_CAPTURED` state and capture the
|
|
36
|
+
> remainder from the PayPal dashboard; the plugin cannot repair those
|
|
37
|
+
> retroactively because Medusa already considers them fully captured.
|
|
38
|
+
- **Line items sent to PayPal no longer include a bogus "Line Item Amount
|
|
39
|
+
Offset" or a fabricated `shipping_discount`.** Medusa v2's `cart.subtotal`
|
|
40
|
+
includes shipping and `shipping_total` includes the tax on shipping (which
|
|
41
|
+
`tax_total` also carries), so with **Send Item Details** on every cart with
|
|
42
|
+
a shipping charge got an offset item worth the shipping fee plus a fake
|
|
43
|
+
discount to make the totals balance. The breakdown now uses `item_subtotal`,
|
|
44
|
+
the pre-tax `shipping_subtotal` and `discount_subtotal` — the figures
|
|
45
|
+
Medusa's own total is built from — so `item_total + shipping + tax_total −
|
|
46
|
+
discount` equals the order total exactly (verified with tax, promotion and
|
|
47
|
+
shipping combined). The previous drift reconciliation is kept as a safety
|
|
48
|
+
net.
|
|
49
|
+
- **`POST /store/paypal-complete` no longer claims "Payment was processed"
|
|
50
|
+
for a payment that was never approved.** When the provider rejects the
|
|
51
|
+
session (buyer never approved, capture declined) the route now answers
|
|
52
|
+
`402` with the real reason and `payment_authorized: false`, so a storefront
|
|
53
|
+
does not tell the buyer "do not pay again" for money that was never taken.
|
|
54
|
+
Transient errors keep the retryable 5xx. The check uses
|
|
55
|
+
`MedusaError.isMedusaError` rather than `instanceof`, which is false across
|
|
56
|
+
the payment-module boundary.
|
|
57
|
+
- `POST /store/payment-collections/:id/payment-sessions` surfaces the core
|
|
58
|
+
workflow's real error message instead of `[object Object]`.
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
- Capture and refund calls send `Prefer: return=representation`, so the
|
|
62
|
+
capture/refund entries stored on the session carry amount, status and
|
|
63
|
+
`final_capture` instead of the id/status/links stub.
|
|
64
|
+
|
|
5
65
|
## 1.2.4 — 2026-09-11
|
|
6
66
|
|
|
7
67
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easypayment/medusa-payment-paypal",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
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",
|
|
@@ -43,7 +43,13 @@ export async function POST(req: MedusaStoreRequest, res: MedusaResponse) {
|
|
|
43
43
|
data,
|
|
44
44
|
})
|
|
45
45
|
} catch (error) {
|
|
46
|
-
|
|
46
|
+
// A failed core workflow rejects with the step's error, which is not
|
|
47
|
+
// always an `Error` instance (a plain `{ message }` object surfaces as
|
|
48
|
+
// "[object Object]" otherwise).
|
|
49
|
+
const message =
|
|
50
|
+
(error as { message?: unknown } | null)?.message != null
|
|
51
|
+
? String((error as { message?: unknown }).message)
|
|
52
|
+
: String(error)
|
|
47
53
|
throw new MedusaError(
|
|
48
54
|
MedusaError.Types.UNEXPECTED_STATE,
|
|
49
55
|
`Failed to create payment session for provider '${provider_id}': ${message}`
|
|
@@ -127,16 +127,24 @@ export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|
|
127
127
|
|
|
128
128
|
const query = req.scope.resolve("query")
|
|
129
129
|
|
|
130
|
+
// NOTE: do not add `shipping_methods.*` here. Medusa's totals decorator
|
|
131
|
+
// computes shipping from whatever shipping-method rows are loaded, so a
|
|
132
|
+
// partial selection (e.g. `shipping_methods.id`, without `amount`) makes
|
|
133
|
+
// `total`/`shipping_subtotal` come back WITHOUT shipping and the buyer is
|
|
134
|
+
// under-charged. Left unrequested, the query computes every total below
|
|
135
|
+
// (including `shipping_subtotal`) from the full cart.
|
|
130
136
|
const { data } = await query.graph({
|
|
131
137
|
entity: "cart",
|
|
132
138
|
fields: [
|
|
133
139
|
"id",
|
|
134
140
|
"total",
|
|
135
141
|
"subtotal",
|
|
142
|
+
"item_subtotal",
|
|
143
|
+
"shipping_subtotal",
|
|
136
144
|
"shipping_total",
|
|
137
145
|
"tax_total",
|
|
138
146
|
"discount_total",
|
|
139
|
-
"
|
|
147
|
+
"discount_subtotal",
|
|
140
148
|
"currency_code",
|
|
141
149
|
"region.currency_code",
|
|
142
150
|
"items.title",
|
|
@@ -314,11 +322,28 @@ export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|
|
314
322
|
...(cancelUrl ? { cancel_url: cancelUrl } : {}),
|
|
315
323
|
}
|
|
316
324
|
|
|
317
|
-
|
|
318
|
-
|
|
325
|
+
// Medusa v2's `cart.subtotal` is items PLUS shipping (pre-tax, pre-discount)
|
|
326
|
+
// and its `total` is `subtotal + tax_total - discount_subtotal`. The PayPal
|
|
327
|
+
// breakdown needs the item-only subtotal for `item_total` — using
|
|
328
|
+
// `cart.subtotal` here made every cart with a shipping charge grow a bogus
|
|
329
|
+
// "Line Item Amount Offset" item worth the shipping fee plus a matching
|
|
330
|
+
// fake `shipping_discount` to make the numbers balance.
|
|
331
|
+
// Likewise `shipping_total` includes the tax on shipping, which
|
|
332
|
+
// `tax_total` already carries — PayPal's `shipping` must be the pre-tax
|
|
333
|
+
// `shipping_subtotal` or the breakdown is short by the shipping tax.
|
|
334
|
+
const shippingMajor = Number(
|
|
335
|
+
cart.shipping_subtotal ?? cart.shipping_total ?? 0
|
|
336
|
+
)
|
|
337
|
+
const subtotalMajor =
|
|
338
|
+
cart.item_subtotal !== undefined && cart.item_subtotal !== null
|
|
339
|
+
? Number(cart.item_subtotal || 0)
|
|
340
|
+
: Number(cart.subtotal || 0) - shippingMajor
|
|
319
341
|
const taxMajor = Number(cart.tax_total || 0)
|
|
320
|
-
|
|
321
|
-
|
|
342
|
+
// `discount_subtotal` is the pre-tax discount actually subtracted from the
|
|
343
|
+
// total; `discount_total` also carries the discount's tax share.
|
|
344
|
+
const discountMajor = Number(
|
|
345
|
+
cart.discount_subtotal ?? cart.discount_total ?? 0
|
|
346
|
+
)
|
|
322
347
|
const lineItems = Array.isArray((cart as any).items)
|
|
323
348
|
? (cart as any).items
|
|
324
349
|
: []
|
|
@@ -403,7 +428,7 @@ export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|
|
403
428
|
)
|
|
404
429
|
: 0
|
|
405
430
|
|
|
406
|
-
const discountValue = discountMajor
|
|
431
|
+
const discountValue = discountMajor
|
|
407
432
|
|
|
408
433
|
// Build a breakdown only when we send line items. A breakdown whose
|
|
409
434
|
// item_total has no matching items (or items with no item_total) is
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
|
2
2
|
import type { IPaymentModuleService, Logger } from "@medusajs/framework/types"
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ContainerRegistrationKeys,
|
|
5
|
+
MedusaError,
|
|
6
|
+
Modules,
|
|
7
|
+
} from "@medusajs/framework/utils"
|
|
4
8
|
import { randomUUID } from "crypto"
|
|
5
9
|
import { isPayPalProviderId } from "../../../modules/paypal/utils/provider-ids"
|
|
6
10
|
import { runCoreWorkflow } from "../../../modules/paypal/utils/core-workflow"
|
|
@@ -82,13 +86,36 @@ export async function POST(req: MedusaRequest, res: MedusaResponse) {
|
|
|
82
86
|
`[paypal] paypal-complete authorizePaymentSession succeeded (request_id=${requestId}, session_id=${session.id})`
|
|
83
87
|
)
|
|
84
88
|
} catch (e: any) {
|
|
85
|
-
// Authorization is the gate for completion; if it fails, the
|
|
86
|
-
// completeCartWorkflow below fails too and we report that honestly.
|
|
87
89
|
logger.warn(
|
|
88
90
|
`[paypal] paypal-complete authorizePaymentSession failed (request_id=${requestId}, session_id=${session.id}): ${
|
|
89
91
|
e?.message ?? String(e)
|
|
90
92
|
}`
|
|
91
93
|
)
|
|
94
|
+
// The providers throw NOT_ALLOWED when PayPal has no approved /
|
|
95
|
+
// captured payment for the session (buyer never approved, capture
|
|
96
|
+
// declined, …). Nothing was charged, so say so — the generic
|
|
97
|
+
// "payment was processed but the order could not be finalized" below
|
|
98
|
+
// would tell a storefront to show "do not pay again" for a payment
|
|
99
|
+
// that never happened. Anything else (transient DB/PayPal errors) is
|
|
100
|
+
// still allowed to fall through to the completion attempt and its
|
|
101
|
+
// retryable 5xx. Checked via the `__isMedusaError` flag, not
|
|
102
|
+
// `instanceof`: the provider runs inside the payment module's own
|
|
103
|
+
// loader and its MedusaError is a different class instance than ours.
|
|
104
|
+
if (
|
|
105
|
+
MedusaError.isMedusaError(e) &&
|
|
106
|
+
(e as MedusaError).type === MedusaError.Types.NOT_ALLOWED
|
|
107
|
+
) {
|
|
108
|
+
return res.status(402).json({
|
|
109
|
+
success: false,
|
|
110
|
+
cart_id,
|
|
111
|
+
session_id: session.id,
|
|
112
|
+
payment_authorized: false,
|
|
113
|
+
message:
|
|
114
|
+
e.message ||
|
|
115
|
+
"The PayPal payment for this cart has not been approved.",
|
|
116
|
+
request_id: requestId,
|
|
117
|
+
})
|
|
118
|
+
}
|
|
92
119
|
}
|
|
93
120
|
}
|
|
94
121
|
|