@easypayment/medusa-payment-paypal 1.1.1 → 1.2.0
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 +7 -7
- package/.medusa/server/src/admin/index.mjs +7 -7
- package/.medusa/server/src/api/hooks/paypal/onboard-return/route.d.ts +16 -0
- package/.medusa/server/src/api/hooks/paypal/onboard-return/route.d.ts.map +1 -0
- package/.medusa/server/src/api/hooks/paypal/onboard-return/route.js +20 -0
- package/.medusa/server/src/api/hooks/paypal/onboard-return/route.js.map +1 -0
- package/.medusa/server/src/api/hooks/paypal/webhook/route.d.ts +18 -0
- package/.medusa/server/src/api/hooks/paypal/webhook/route.d.ts.map +1 -0
- package/.medusa/server/src/api/hooks/paypal/webhook/route.js +22 -0
- package/.medusa/server/src/api/hooks/paypal/webhook/route.js.map +1 -0
- package/.medusa/server/src/api/middlewares.d.ts.map +1 -1
- package/.medusa/server/src/api/middlewares.js +24 -1
- package/.medusa/server/src/api/middlewares.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/capture-order/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/capture-order/route.js +66 -13
- package/.medusa/server/src/api/store/paypal/capture-order/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/config/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/config/route.js +8 -0
- package/.medusa/server/src/api/store/paypal/config/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 +63 -9
- package/.medusa/server/src/api/store/paypal/create-order/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal-complete/route.js +1 -1
- package/.medusa/server/src/api/store/paypal-complete/route.js.map +1 -1
- package/.medusa/server/src/api/utils/rate-limit.d.ts +13 -1
- package/.medusa/server/src/api/utils/rate-limit.d.ts.map +1 -1
- package/.medusa/server/src/api/utils/rate-limit.js +18 -7
- package/.medusa/server/src/api/utils/rate-limit.js.map +1 -1
- package/.medusa/server/src/jobs/paypal-webhook-retry.d.ts.map +1 -1
- package/.medusa/server/src/jobs/paypal-webhook-retry.js +4 -0
- package/.medusa/server/src/jobs/paypal-webhook-retry.js.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/base-provider.d.ts +47 -3
- 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 +73 -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.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/card-service.js +415 -285
- 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 +0 -4
- package/.medusa/server/src/modules/paypal/payment-provider/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/payment-provider/service.js +140 -151
- package/.medusa/server/src/modules/paypal/payment-provider/service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/service.d.ts +7 -0
- package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/service.js +135 -13
- 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 +13 -0
- package/.medusa/server/src/modules/paypal/types/config.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/amounts.d.ts +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 +49 -34
- package/.medusa/server/src/modules/paypal/utils/credential-resolver.js.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/metrics.d.ts +18 -0
- package/.medusa/server/src/modules/paypal/utils/metrics.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/metrics.js +45 -0
- package/.medusa/server/src/modules/paypal/utils/metrics.js.map +1 -0
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.js +45 -28
- package/.medusa/server/src/modules/paypal/utils/paypal-fetch.js.map +1 -1
- package/.medusa/server/src/modules/paypal/webhook-processor.d.ts +27 -0
- package/.medusa/server/src/modules/paypal/webhook-processor.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/webhook-processor.js +170 -9
- package/.medusa/server/src/modules/paypal/webhook-processor.js.map +1 -1
- package/.medusa/server/src/subscribers/paypal-webhook-process.d.ts.map +1 -1
- package/.medusa/server/src/subscribers/paypal-webhook-process.js +4 -0
- package/.medusa/server/src/subscribers/paypal-webhook-process.js.map +1 -1
- package/CHANGELOG.md +208 -73
- package/README.md +175 -184
- package/package.json +91 -90
- package/src/api/hooks/paypal/onboard-return/route.ts +15 -0
- package/src/api/hooks/paypal/webhook/route.ts +17 -0
- package/src/api/middlewares.ts +24 -1
- package/src/api/store/paypal/capture-order/route.ts +83 -12
- package/src/api/store/paypal/config/route.ts +8 -0
- package/src/api/store/paypal/create-order/route.ts +73 -9
- package/src/api/store/paypal-complete/route.ts +1 -1
- package/src/api/utils/rate-limit.ts +31 -7
- package/src/jobs/paypal-webhook-retry.ts +4 -0
- package/src/modules/paypal/payment-provider/base-provider.ts +83 -0
- package/src/modules/paypal/payment-provider/card-service.ts +277 -136
- package/src/modules/paypal/payment-provider/service.ts +149 -186
- package/src/modules/paypal/service.ts +1703 -1554
- package/src/modules/paypal/types/config.ts +16 -0
- package/src/modules/paypal/utils/credential-resolver.ts +45 -36
- package/src/modules/paypal/utils/metrics.ts +48 -0
- package/src/modules/paypal/utils/paypal-fetch.ts +58 -29
- package/src/modules/paypal/webhook-processor.ts +195 -10
- package/src/subscribers/paypal-webhook-process.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,73 +1,208 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to `@easypayment/medusa-payment-paypal` are documented here.
|
|
4
|
-
|
|
5
|
-
## 1.
|
|
6
|
-
|
|
7
|
-
### Fixed
|
|
8
|
-
- **
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@easypayment/medusa-payment-paypal` are documented here.
|
|
4
|
+
|
|
5
|
+
## 1.2.0 — 2026-09-02
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **A cart edit can no longer resurrect a stale-amount PayPal order.** The
|
|
9
|
+
create-order `PayPal-Request-Id` now includes the cart total and currency.
|
|
10
|
+
Previously it was derived from the cart id alone, so after the buyer changed
|
|
11
|
+
the cart, the "create a fresh order" path was silently answered from PayPal's
|
|
12
|
+
idempotency cache with the ORIGINAL order at the original total.
|
|
13
|
+
- **`capture-order` no longer reports success for a capture that never
|
|
14
|
+
completed.** The existing-capture short-circuit now requires a demonstrably
|
|
15
|
+
COMPLETED capture; a webhook-patched `capture_id` (which is also written for
|
|
16
|
+
DENIED/PENDING captures) is verified against the live PayPal order before
|
|
17
|
+
being returned as success, so a declined payment surfaces as retryable
|
|
18
|
+
instead of "payment processed but order could not be finalized".
|
|
19
|
+
- **The capture-order idempotency key is now scoped per order.** A client
|
|
20
|
+
reusing one `Idempotency-Key` header across two orders could previously
|
|
21
|
+
receive order A's cached capture for order B. Also fixed the internal
|
|
22
|
+
variable shadowing so the request-correlation UUID appears consistently in
|
|
23
|
+
logs.
|
|
24
|
+
- **Canceling a captured payment no longer records success for a refund that
|
|
25
|
+
failed.** Both providers' `cancelPayment` now reject FAILED/CANCELLED/DENIED
|
|
26
|
+
refund statuses (PayPal returns 2xx for those too), matching the existing
|
|
27
|
+
`refundPayment` gate.
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- **Webhook-driven cart completion (safety net).** When a
|
|
31
|
+
`PAYMENT.CAPTURE.COMPLETED` webhook arrives for a cart the buyer never
|
|
32
|
+
finalized (closed tab or crash right after paying), the plugin now completes
|
|
33
|
+
the cart server-side so a captured payment always produces an order. Races
|
|
34
|
+
with the storefront's own completion are handled (whoever wins, the other
|
|
35
|
+
treats it as success); genuine failures follow the webhook retry schedule and
|
|
36
|
+
stay visible in the dead-letter queue. Disable with
|
|
37
|
+
`PAYPAL_WEBHOOK_COMPLETE_CART=false`. New metric: `webhook_cart_completed`.
|
|
38
|
+
|
|
39
|
+
### Hardened
|
|
40
|
+
- **Metric writes are now atomic everywhere.** The module service's
|
|
41
|
+
`recordMetric` uses the same single-statement `INSERT ... ON CONFLICT`
|
|
42
|
+
upsert as the payment providers (shared `utils/metrics.ts`), so concurrent
|
|
43
|
+
routes/webhooks can no longer lose increments to a read-modify-write race.
|
|
44
|
+
- **Settings singleton reads are deterministic.** All readers (module service
|
|
45
|
+
and the providers' raw-SQL credential resolver) now order by `created_at
|
|
46
|
+
ASC`, and a first-boot save race merges into the canonical row instead of
|
|
47
|
+
leaving a divergent duplicate.
|
|
48
|
+
- **Webhook endpoints can be rate-limited** (opt-in, separate from the buyer
|
|
49
|
+
routes): set `PAYPAL_WEBHOOK_RATE_LIMIT_MAX` /
|
|
50
|
+
`PAYPAL_WEBHOOK_RATE_LIMIT_WINDOW_MS`. Deliberately NOT tied to
|
|
51
|
+
`PAYPAL_RATE_LIMIT_MAX` — PayPal delivers from a handful of egress IPs, so a
|
|
52
|
+
buyer-sized cap would throttle legitimate webhook bursts.
|
|
53
|
+
- **Card provider observability parity.** The advanced-card provider now
|
|
54
|
+
records the same audit events and metrics as the wallet provider
|
|
55
|
+
(`capture_success`/`capture_failed`, `refund_*`, `void_success`,
|
|
56
|
+
`cancel_*`, `authorize_failed`), converts capture errors to `MedusaError`
|
|
57
|
+
so real PayPal failure reasons are not masked in production, and preserves
|
|
58
|
+
the `provider_id` passthrough in `updatePayment`.
|
|
59
|
+
- **Startup warning when `PAYPAL_SELLER_NONCE` is auto-generated** — in
|
|
60
|
+
multi-instance deployments a per-process nonce can race the onboarding
|
|
61
|
+
code_verifier; the warning tells operators to pin it.
|
|
62
|
+
- **Single source of truth for the BN code and API base URLs** (removed 4
|
|
63
|
+
duplicated constants and 9 duplicated environment ternaries).
|
|
64
|
+
- `npm run typecheck` (full `tsc --noEmit`, admin UI included) now passes and
|
|
65
|
+
runs in CI; added `@types/react`/`react` dev dependencies.
|
|
66
|
+
|
|
67
|
+
## 1.1.0
|
|
68
|
+
|
|
69
|
+
### Fixed (re-audit)
|
|
70
|
+
- **PayPal webhooks and the onboarding return bridge now work without a
|
|
71
|
+
publishable API key.** Medusa applies its store publishable-key middleware to
|
|
72
|
+
every `/store/*` route, and PayPal cannot send `x-publishable-api-key` — so
|
|
73
|
+
webhook deliveries and onboarding return redirects to the old `/store/paypal/*`
|
|
74
|
+
paths were rejected before the handlers ran. Both handlers are now also served
|
|
75
|
+
from `/hooks/paypal/webhook` and `/hooks/paypal/onboard-return` (no key
|
|
76
|
+
guard). New registrations use the `/hooks` URLs, and existing PayPal webhook
|
|
77
|
+
registrations pointing at the legacy path are migrated in place (best-effort,
|
|
78
|
+
on admin status view) via PayPal's webhook PATCH API. The legacy `/store`
|
|
79
|
+
routes remain for deployments that inject the key at their edge.
|
|
80
|
+
- **Unapproved orders can no longer be booked as authorized.** `authorizePayment`
|
|
81
|
+
treated a PayPal order in `CREATED`/`SAVED` status as authorized, letting a
|
|
82
|
+
cart complete (order placed, inventory reserved) with no payment approved at
|
|
83
|
+
PayPal at all. Only buyer-`APPROVED` orders now count.
|
|
84
|
+
- **PENDING / DECLINED captures are no longer booked as captured.** The
|
|
85
|
+
idempotency branches of `authorizePayment` (both providers) keyed off the mere
|
|
86
|
+
presence of a capture/authorization id and returned the settings-derived
|
|
87
|
+
status. They now derive the status from the actual PayPal resource: a
|
|
88
|
+
`COMPLETED` capture → captured; a `PENDING` (eCheck) capture → authorized
|
|
89
|
+
(order placed, funds not claimed until the `CAPTURE.COMPLETED` webhook); a
|
|
90
|
+
`DENIED`/`DECLINED`/`FAILED` capture → error.
|
|
91
|
+
- **Partial captures no longer charge the full amount.** Medusa never passes the
|
|
92
|
+
requested capture amount to a provider — only the Medusa capture-row id (as
|
|
93
|
+
`context.idempotency_key`). The providers now resolve the requested amount
|
|
94
|
+
from that row, so an admin capturing €40 of a €100 authorization no longer
|
|
95
|
+
sends a €100 capture to PayPal.
|
|
96
|
+
- **Stale PayPal orders are invalidated when the cart changes.** `updatePayment`
|
|
97
|
+
now drops the stored `paypal.order_id` when the session amount/currency
|
|
98
|
+
changes (before any capture/authorization), and `create-order` verifies a
|
|
99
|
+
stored order's amount, currency, and state against the cart before reusing it
|
|
100
|
+
— so a buyer who backs out of the PayPal popup and edits their cart is charged
|
|
101
|
+
the new total, not the stale one.
|
|
102
|
+
- **Card provider no longer 422s on approved capture-intent orders.** Its
|
|
103
|
+
`authorizePayment` called `/v2/checkout/orders/{id}/authorize` regardless of
|
|
104
|
+
intent, which PayPal rejects (`UNSUPPORTED_INTENT`) for `CAPTURE`-intent
|
|
105
|
+
orders — permanently stranding a checkout whose storefront capture call had
|
|
106
|
+
failed after 3-D Secure approval. Approved orders now return `authorized` and
|
|
107
|
+
the capture is routed by intent; `/authorize` is only called for
|
|
108
|
+
`AUTHORIZE`-intent orders. The impossible create-order-then-authorize
|
|
109
|
+
fallbacks (both providers) were replaced with clear errors.
|
|
110
|
+
- **Webhook processing no longer corrupts session data.** `PAYMENT.CAPTURE.REFUNDED`
|
|
111
|
+
/ `REVERSED` events carry a *refund* resource — its id was being stored as the
|
|
112
|
+
session's `capture_id`. Identifiers are now extracted refund-aware (with the
|
|
113
|
+
capture id taken from `related_ids` or the resource's "up" link), and patches
|
|
114
|
+
no longer overwrite stored fields (e.g. `order_id`) with null when an event
|
|
115
|
+
lacks them.
|
|
116
|
+
- **Partial refunds no longer cancel the payment session.** Refund events now
|
|
117
|
+
compare the cumulative refunded total against the captured amount and keep the
|
|
118
|
+
session status for partial refunds (recording the refund data); only full
|
|
119
|
+
refunds transition the session to canceled.
|
|
120
|
+
- **Rate limiter can no longer be bypassed via `X-Forwarded-For`.** The client
|
|
121
|
+
key now uses the right-most (proxy-appended) XFF entry instead of the
|
|
122
|
+
left-most (client-forgeable) one.
|
|
123
|
+
- **`paypal-complete` no longer 500s on an empty/non-JSON body** (missing body
|
|
124
|
+
guard before destructuring).
|
|
125
|
+
- **Client-supplied idempotency keys are now cart-scoped in `create-order`**, so
|
|
126
|
+
a reused `Idempotency-Key` header across two carts can no longer return cart
|
|
127
|
+
A's cached PayPal order (and amount) for cart B.
|
|
128
|
+
- **Circuit breaker is now keyed per host.** Failures of a non-PayPal host (e.g.
|
|
129
|
+
the onboarding service) can no longer open the breaker and block live
|
|
130
|
+
captures/refunds against a healthy PayPal API.
|
|
131
|
+
- **Raw-knex reads now respect soft deletes** (`paypal_connection` /
|
|
132
|
+
`paypal_settings` lookups in the credential resolver filter `deleted_at`).
|
|
133
|
+
- **Removed the broken `./workflows` package export** (it pointed at a file that
|
|
134
|
+
was never built; importing it always failed).
|
|
135
|
+
|
|
136
|
+
### Added (re-audit)
|
|
137
|
+
- `GET /store/paypal/config` now emits `disable_buttons` (from
|
|
138
|
+
`paypal_settings.disableButtons` / `disable_buttons`), which the UI package
|
|
139
|
+
has always read to build the SDK's `disable-funding` list.
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
### Fixed
|
|
143
|
+
- **Transient capture/refund failures now retry.** The `paypalFetchWithRetry`
|
|
144
|
+
wrapper (jittered backoff on 5xx/429/timeout) was implemented but never wired
|
|
145
|
+
in — capture and refund used the non-retrying path. They now retry safely: the
|
|
146
|
+
`PayPal-Request-Id` idempotency key means a retry re-uses the same
|
|
147
|
+
capture/refund instead of double-charging.
|
|
148
|
+
- **Provider `recordMetric` is now atomic.** The credential-resolver metric path
|
|
149
|
+
used by the payment providers (capture/refund/authorize success & failure
|
|
150
|
+
counters) now uses a single `INSERT … ON CONFLICT … count = count + 1` upsert
|
|
151
|
+
instead of a read-modify-write, so concurrent captures/refunds no longer lose
|
|
152
|
+
increments. (The module-service metric path remains best-effort and unchanged.)
|
|
153
|
+
- **Capture persisted-but-lost gap is now observable.** After a successful PayPal
|
|
154
|
+
capture, session persistence is retried, and if it still fails the route logs
|
|
155
|
+
CRITICAL and records a `capture_order_persist_failed` metric instead of
|
|
156
|
+
silently swallowing the error (the webhook and `paypal-complete`'s live
|
|
157
|
+
re-derivation remain the reconciliation backstop).
|
|
158
|
+
- **Card provider partial-capture idempotency key** now includes the amount, so
|
|
159
|
+
two sequential partial captures of the same order are no longer deduplicated by
|
|
160
|
+
PayPal into one (matching the wallet provider).
|
|
161
|
+
|
|
162
|
+
### Added
|
|
163
|
+
- **Asynchronous webhook processing.** The webhook route now verifies, persists,
|
|
164
|
+
and acknowledges (200) immediately, then processes off the request path via a
|
|
165
|
+
subscriber — so PayPal's ~15s delivery timeout is never tripped by slow
|
|
166
|
+
downstream work. The retry cron additionally recovers events left in
|
|
167
|
+
`processing` past a staleness threshold, so an event is never lost even if the
|
|
168
|
+
event bus drops a message.
|
|
169
|
+
- **Opt-in rate limiting** on the public store payment routes (`create-order`,
|
|
170
|
+
`capture-order`, `paypal-complete`). Disabled by default (a pass-through) so
|
|
171
|
+
existing deployments are unaffected; enable by setting `PAYPAL_RATE_LIMIT_MAX`
|
|
172
|
+
(and optionally `PAYPAL_RATE_LIMIT_WINDOW_MS`) once you've confirmed the real
|
|
173
|
+
client IP reaches the app (e.g. behind a proxy that forwards `x-forwarded-for`).
|
|
174
|
+
- **Encryption-key guardrail.** When `PAYPAL_ENCRYPTION_KEY` is unset, secrets
|
|
175
|
+
now emit a loud (production-flagged) warning; set `PAYPAL_ENCRYPTION_STRICT=true`
|
|
176
|
+
to fail closed instead of persisting plaintext secrets.
|
|
177
|
+
- Additional unit tests: retry/circuit-breaker behavior, the rate limiter, the
|
|
178
|
+
atomic metric upsert, and session-persistence retry.
|
|
179
|
+
|
|
180
|
+
### Changed
|
|
181
|
+
- **`client_token` is only issued when advanced card fields are enabled** — the
|
|
182
|
+
PayPal-buttons flow uses just `client_id`, so an unauthenticated config fetch no
|
|
183
|
+
longer hands out a card-fields token it won't use.
|
|
184
|
+
- **`postMessage` target origin** for the onboarding return popup is now
|
|
185
|
+
configurable (`PAYPAL_ADMIN_ORIGIN`, falling back to the first `ADMIN_CORS`
|
|
186
|
+
entry) instead of the `"*"` wildcard.
|
|
187
|
+
- **Shared provider base class.** The wallet and advanced-card providers now
|
|
188
|
+
extend a common `PayPalProviderBase` for the identical credential/token
|
|
189
|
+
handling, order lookups, idempotency keys, amount normalization, and status
|
|
190
|
+
mapping — removing a large block of duplicated code. Behavior is unchanged.
|
|
191
|
+
- Centralized the PayPal partner-attribution (BN) code into a single constant and
|
|
192
|
+
removed the unused `PayPalSellerClient` dead code.
|
|
193
|
+
|
|
194
|
+
## 1.0.2
|
|
195
|
+
|
|
196
|
+
### Fixed
|
|
197
|
+
- `toAmountNumber` no longer silently coerces a blank string (`""` / `" "`) or a
|
|
198
|
+
blank serialized `BigNumber` value to `0`. `Number("")` is `0`, so a blank amount
|
|
199
|
+
could previously turn a partial refund/capture into a full one — it now throws
|
|
200
|
+
instead, consistent with the function's existing guards against `NaN`/unparseable
|
|
201
|
+
input.
|
|
202
|
+
|
|
203
|
+
### Added
|
|
204
|
+
- Unit test suite (vitest) covering the money-critical, IO-free logic:
|
|
205
|
+
amount coercion & currency formatting, currency support checks, capture/refund
|
|
206
|
+
status mapping, secret encryption/decryption (AES-256-GCM round-trip, tamper &
|
|
207
|
+
missing-key handling), webhook signature request composition, the webhook state
|
|
208
|
+
machine, retry scheduling, identifier extraction, and provider-id detection.
|