@agent-cards/checkout 0.17.0 → 0.19.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/CHANGELOG.md +16 -0
- package/PREFLIGHT.md +4 -0
- package/README.md +106 -14
- package/dist/adyen-merchant-hosted.generated.d.ts +277 -0
- package/dist/adyen-merchant-hosted.generated.js +1902 -0
- package/dist/builtin-registry.generated.js +1 -1
- package/dist/card-fields.generated.d.ts +3 -0
- package/dist/card-fields.generated.js +46 -0
- package/dist/cdp.d.ts +6 -1
- package/dist/cdp.js +574 -220
- package/dist/client.d.ts +285 -5
- package/dist/client.js +590 -12
- package/dist/cse-body.d.ts +25 -0
- package/dist/cse-body.js +41 -0
- package/dist/fiserv.d.ts +65 -0
- package/dist/fiserv.generated.d.ts +73 -0
- package/dist/fiserv.generated.js +830 -0
- package/dist/fiserv.js +104 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.js +5 -1
- package/dist/lifecycle.d.ts +38 -1
- package/dist/lifecycle.js +77 -5
- package/dist/merchant-handoff.d.ts +54 -0
- package/dist/merchant-handoff.js +100 -0
- package/dist/merchant-hosted.d.ts +140 -0
- package/dist/merchant-hosted.js +170 -0
- package/dist/merchant-total-watch.d.ts +115 -0
- package/dist/merchant-total-watch.js +268 -0
- package/dist/merchant-total.d.ts +257 -0
- package/dist/merchant-total.js +383 -0
- package/dist/pre-claim.d.ts +123 -0
- package/dist/pre-claim.js +386 -0
- package/dist/preflight-capabilities.generated.d.ts +1 -1
- package/dist/preflight-capabilities.generated.js +1 -1
- package/dist/preflight-catalog.json +133 -1
- package/dist/preflight-schemas.json +14 -2
- package/dist/preflight.generated.d.ts +1 -1
- package/dist/preflight.generated.js +15 -1
- package/dist/preparation.d.ts +13 -0
- package/dist/preparation.js +46 -9
- package/dist/prepared-processor.d.ts +36 -3
- package/dist/prepared-processor.js +53 -3
- package/dist/registry.d.ts +60 -0
- package/dist/registry.js +14 -0
- package/dist/stripe-checkout.generated.js +140 -20
- package/dist/substitutions.generated.d.ts +2 -1
- package/dist/substitutions.generated.js +758 -6
- package/examples/preflight/kernel-native/inventory.json +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// Generated from @agent-cards/payment-core. Do not edit.
|
|
3
|
-
// artifact-sha256:
|
|
4
|
-
// src/
|
|
3
|
+
// artifact-sha256: 9edf78da59b3bdfe310b4422e06d333cd164497cdb4070db59ffed348492198a
|
|
4
|
+
// src/deep-freeze.js
|
|
5
5
|
function deepFreeze(value) {
|
|
6
6
|
if (value && typeof value === "object" && !Object.isFrozen(value)) {
|
|
7
7
|
for (const child of Object.values(value))
|
|
@@ -10,6 +10,7 @@ function deepFreeze(value) {
|
|
|
10
10
|
}
|
|
11
11
|
return value;
|
|
12
12
|
}
|
|
13
|
+
// src/definitions.js
|
|
13
14
|
var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
14
15
|
{
|
|
15
16
|
psp: "spreedly",
|
|
@@ -28,26 +29,48 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
28
29
|
},
|
|
29
30
|
{
|
|
30
31
|
psp: "stripe",
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
// (
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
|
|
32
|
+
// Every endpoint Stripe.js sends a card to, read from its own controller
|
|
33
|
+
// bundle: `tokens` (createToken), `payment_methods` (createPaymentMethod),
|
|
34
|
+
// `sources` (createSource, the older API), `confirmation_tokens`
|
|
35
|
+
// (createConfirmationToken: the page collects the card and confirms on its
|
|
36
|
+
// own server), and the intent confirmations that carry the card inline as
|
|
37
|
+
// `payment_method_data[card][number]` (confirmPayment, confirmSetup). The
|
|
38
|
+
// modern Payment Element mostly confirms inline or through a confirmation
|
|
39
|
+
// token, so matching the tokenizers alone never paused it. Observed live on
|
|
40
|
+
// Anthropic's own billing page (platform.claude.com/settings/billing),
|
|
41
|
+
// which posts to /v1/setup_intents/{seti_...}/confirm, the "save a card"
|
|
42
|
+
// flow; /v1/payment_intents/{pi_...}/confirm is the same shape for "pay
|
|
43
|
+
// now". Stripe Checkout Sessions confirm at
|
|
44
|
+
// /v1/payment_pages/{cs_...}/confirm: Checkout Elements (initCheckout)
|
|
45
|
+
// sends the card there inline, while hosted and embedded Checkout send only
|
|
46
|
+
// the payment method they created first. The id segment is matched
|
|
47
|
+
// narrowly (seti_/pi_/cs_ + word chars) rather than `.*` so the pattern
|
|
48
|
+
// cannot be widened by a crafted path. A client that does not check
|
|
49
|
+
// cardFields is served the pattern it knew before sources, confirmation
|
|
50
|
+
// tokens and Checkout Sessions joined (recognition.js recognizersForClient).
|
|
51
|
+
match: "api\\.stripe\\.com/v1/(payment_methods|tokens|sources|confirmation_tokens|setup_intents/seti_\\w+/confirm|payment_intents/pi_\\w+/confirm|payment_pages/cs_(?:test|live)_\\w+/confirm)",
|
|
42
52
|
hosts: ["^api\\.stripe\\.com$"],
|
|
43
53
|
encoding: "form",
|
|
44
54
|
// Elements' own surface markers; without these Stripe rejects the surface.
|
|
45
|
-
passthroughHeaders: ["^authorization$", "^stripe-version$", "^x-stripe-client-user-agent$"]
|
|
55
|
+
passthroughHeaders: ["^authorization$", "^stripe-version$", "^x-stripe-client-user-agent$"],
|
|
56
|
+
// The same confirmations also run WITHOUT a card: a page that created the
|
|
57
|
+
// method first confirms with `payment_method=pm_...`. Only a body that
|
|
58
|
+
// carries one of these fields is a card request (card-fields.js). Any
|
|
59
|
+
// other request on these endpoints has no card to approve, so it is
|
|
60
|
+
// refused (requestWithoutCard) instead of paused for the cardholder,
|
|
61
|
+
// unless passWithoutCard below names its endpoint.
|
|
62
|
+
cardFields: ["card[number]", "payment_method_data[card][number]"],
|
|
63
|
+
// A confirmation token that wraps a saved method, a source for a bank, or a
|
|
64
|
+
// Checkout Session confirm paying with the method hosted or embedded
|
|
65
|
+
// Checkout created first carries no card and was never ours: it continues
|
|
66
|
+
// untouched, as it did before these endpoints were recognized.
|
|
67
|
+
passWithoutCard: "api\\.stripe\\.com/v1/(sources|confirmation_tokens|payment_pages/cs_(?:test|live)_\\w+/confirm)"
|
|
46
68
|
},
|
|
47
69
|
{
|
|
48
70
|
psp: "braintree",
|
|
49
71
|
match: "payments(\\.sandbox)?\\.braintree-api\\.com/graphql",
|
|
50
72
|
hosts: ["^payments\\.braintree-api\\.com$", "^payments\\.sandbox\\.braintree-api\\.com$"],
|
|
73
|
+
sandboxHosts: ["^payments\\.sandbox\\.braintree-api\\.com$"],
|
|
51
74
|
encoding: "json",
|
|
52
75
|
passthroughHeaders: ["^authorization$", "^braintree-version$"]
|
|
53
76
|
},
|
|
@@ -65,6 +88,7 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
65
88
|
"^card-acquisition-gateway\\.checkout\\.com$",
|
|
66
89
|
"^card-acquisition-gateway\\.sandbox\\.checkout\\.com$"
|
|
67
90
|
],
|
|
91
|
+
sandboxHosts: ["^api\\.sandbox\\.checkout\\.com$", "^card-acquisition-gateway\\.sandbox\\.checkout\\.com$"],
|
|
68
92
|
encoding: "json",
|
|
69
93
|
passthroughHeaders: ["^authorization$"]
|
|
70
94
|
},
|
|
@@ -93,6 +117,15 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
93
117
|
// merchants on them were silently never paused.
|
|
94
118
|
match: "(checkoutshopper-(test|live(-[a-z]+)?)\\.adyen\\.com|([a-z0-9-]+\\.)*adyenpayments\\.com)/checkoutshopper/v1/sessions/[A-Za-z0-9_-]+/payments",
|
|
95
119
|
hosts: ["^checkoutshopper-(test|live(-[a-z]+)?)\\.adyen\\.com$", "^([a-z0-9-]+\\.)*adyenpayments\\.com$"],
|
|
120
|
+
// The sandbox marker matches ONLY the TEST hostname, a subset of the first
|
|
121
|
+
// host source (which matches checkoutshopper-test and every checkoutshopper-live
|
|
122
|
+
// regional host). checkoutshopper-live* and *.adyenpayments.com are live.
|
|
123
|
+
// Load-bearing for Adyen although Adyen does not pin its environment: the
|
|
124
|
+
// Adyen TEST platform rule (backend.js adyenLivePlatform) reads this marker
|
|
125
|
+
// on the server's authorization create and cardholder legs
|
|
126
|
+
// (services/checkout-cse-adyen.ts in the backend), on the device and in the
|
|
127
|
+
// enclave. Dropping or widening it moves which payments count as Adyen TEST.
|
|
128
|
+
sandboxHosts: ["^checkoutshopper-test\\.adyen\\.com$"],
|
|
96
129
|
encoding: "json",
|
|
97
130
|
passthroughHeaders: [],
|
|
98
131
|
clientSideEncrypted: true,
|
|
@@ -162,6 +195,7 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
162
195
|
// PAN@ card_data.number. POST /v2/card-nonce (URL always carries ?_=&version=).
|
|
163
196
|
match: "pci-connect\\.squareup(?:sandbox)?\\.com/v2/card-nonce",
|
|
164
197
|
hosts: ["^pci-connect\\.squareup\\.com$", "^pci-connect\\.squareupsandbox\\.com$"],
|
|
198
|
+
sandboxHosts: ["^pci-connect\\.squareupsandbox\\.com$"],
|
|
165
199
|
encoding: "json",
|
|
166
200
|
passthroughHeaders: []
|
|
167
201
|
// auth = client_id in body; no auth header
|
|
@@ -182,6 +216,7 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
182
216
|
// request types on the same URL — the body, not the URL, is what distinguishes them.
|
|
183
217
|
match: "(api2|apitest)\\.authorize\\.net/xml/v1/request\\.api",
|
|
184
218
|
hosts: ["^api2\\.authorize\\.net$", "^apitest\\.authorize\\.net$"],
|
|
219
|
+
sandboxHosts: ["^apitest\\.authorize\\.net$"],
|
|
185
220
|
encoding: "json",
|
|
186
221
|
// JSON body; Content-Type is sometimes text/plain (preflight dodge), replayed as-is
|
|
187
222
|
passthroughHeaders: []
|
|
@@ -192,6 +227,8 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
192
227
|
// the two paths need DIFFERENT vendor media types; `application/json` → HTTP 406.
|
|
193
228
|
match: "(try\\.)?access\\.worldpay\\.com/(sessions/card|verifiedTokens/sessions)",
|
|
194
229
|
hosts: ["^access\\.worldpay\\.com$", "^try\\.access\\.worldpay\\.com$"],
|
|
230
|
+
sandboxHosts: ["^try\\.access\\.worldpay\\.com$"],
|
|
231
|
+
// try.* is Worldpay's try/test host
|
|
195
232
|
encoding: "json",
|
|
196
233
|
passthroughHeaders: ["^accept$"]
|
|
197
234
|
},
|
|
@@ -208,6 +245,7 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
208
245
|
// with no branch back to the covered path.
|
|
209
246
|
match: "(secure|ppp-test)\\.safecharge\\.com/ppp/api/v1/(?:cardTokenization|clientPayment|websdk/initPaymentWithCardTokenization)\\.do",
|
|
210
247
|
hosts: ["^secure\\.safecharge\\.com$", "^ppp-test\\.safecharge\\.com$"],
|
|
248
|
+
sandboxHosts: ["^ppp-test\\.safecharge\\.com$"],
|
|
211
249
|
encoding: "json",
|
|
212
250
|
passthroughHeaders: []
|
|
213
251
|
},
|
|
@@ -242,6 +280,7 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
242
280
|
"^pci-api\\.airwallex\\.com$",
|
|
243
281
|
"^pci-api\\.sandbox\\.airwallex\\.com$"
|
|
244
282
|
],
|
|
283
|
+
sandboxHosts: ["^checkout\\.sandbox\\.airwallex\\.com$", "^pci-api\\.sandbox\\.airwallex\\.com$"],
|
|
245
284
|
encoding: "json",
|
|
246
285
|
passthroughHeaders: ["^client-secret$", "^authorization$", "^x-auth-token$", "^x-on-behalf-of$", "^x-api-version$"]
|
|
247
286
|
},
|
|
@@ -255,6 +294,7 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
255
294
|
// Checkout Page (signature-authed, server-to-server, no card) — the POST gate is what splits them.
|
|
256
295
|
match: "(api|sandboxapi)\\.rapyd\\.net/v1/(?:hosted/collect/card/[^/?#]+/payment_method|checkout/checkout_[A-Za-z0-9]+)(?:[?#]|$)",
|
|
257
296
|
hosts: ["^api\\.rapyd\\.net$", "^sandboxapi\\.rapyd\\.net$"],
|
|
297
|
+
sandboxHosts: ["^sandboxapi\\.rapyd\\.net$"],
|
|
258
298
|
encoding: "json",
|
|
259
299
|
passthroughHeaders: []
|
|
260
300
|
// auth rides the opaque hosted-page / checkout token in the URL
|
|
@@ -266,6 +306,7 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
266
306
|
// multi-tenant surface: `ppmcc` is dlocal-operated, not merchant-registrable.
|
|
267
307
|
match: "ppmcc(-sandbox)?\\.dlocal\\.com/cvault/credit-card/temporal",
|
|
268
308
|
hosts: ["^ppmcc\\.dlocal\\.com$", "^ppmcc-sandbox\\.dlocal\\.com$"],
|
|
309
|
+
sandboxHosts: ["^ppmcc-sandbox\\.dlocal\\.com$"],
|
|
269
310
|
encoding: "json",
|
|
270
311
|
passthroughHeaders: ["^x-fields-api-key$", "^x-uow$", "^x-dlocal-infrav2$"]
|
|
271
312
|
},
|
|
@@ -297,6 +338,7 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
297
338
|
"^api\\.ebanxpay\\.com$",
|
|
298
339
|
"^sandbox\\.ebanxpay\\.com$"
|
|
299
340
|
],
|
|
341
|
+
sandboxHosts: ["^sandbox\\.ebanx\\.com$", "^sandbox-local-latam\\.ebanx\\.com$", "^sandbox\\.ebanxpay\\.com$"],
|
|
300
342
|
encoding: "json",
|
|
301
343
|
passthroughHeaders: []
|
|
302
344
|
},
|
|
@@ -321,6 +363,8 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
321
363
|
// GPO Secure Forms. PAN@ card.number.
|
|
322
364
|
match: "(secure\\.payu\\.com|(merch-prod|secure)\\.snd\\.payu\\.com)/api/front/tokens",
|
|
323
365
|
hosts: ["^secure\\.payu\\.com$", "^(merch-prod|secure)\\.snd\\.payu\\.com$"],
|
|
366
|
+
sandboxHosts: ["^(merch-prod|secure)\\.snd\\.payu\\.com$"],
|
|
367
|
+
// .snd. is PayU's sandbox
|
|
324
368
|
encoding: "json",
|
|
325
369
|
// Native checkout attaches a bearer to tokenization; preserve it on replay.
|
|
326
370
|
passthroughHeaders: ["^authorization$"]
|
|
@@ -382,6 +426,7 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
382
426
|
// card/tokenize uses a saved paymentToken, and 3DS-specific paths are unverified.
|
|
383
427
|
match: "(?:api(\\.test)?\\.paysafe\\.com/(?:paymenthub/v1/singleusepaymenthandles|js/api/v1/tokenize)|hosted(\\.test)?\\.paysafe\\.com/checkout/api/v1/tokenize)(?![\\w/-])",
|
|
384
428
|
hosts: ["^api\\.paysafe\\.com$", "^api\\.test\\.paysafe\\.com$", "^hosted\\.paysafe\\.com$", "^hosted\\.test\\.paysafe\\.com$"],
|
|
429
|
+
sandboxHosts: ["^api\\.test\\.paysafe\\.com$", "^hosted\\.test\\.paysafe\\.com$"],
|
|
385
430
|
encoding: "json",
|
|
386
431
|
passthroughHeaders: ["^authorization$", "^x-paysafe-credentials$", "^correlationid$"]
|
|
387
432
|
},
|
|
@@ -425,6 +470,8 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
425
470
|
"^gatewayt\\.moneris\\.com$",
|
|
426
471
|
"^gatewaydev\\.moneris\\.com$"
|
|
427
472
|
],
|
|
473
|
+
// Live: www3, gateway. Test/QA/dev: esqa, gatewayqa, gatewayt, gatewaydev.
|
|
474
|
+
sandboxHosts: ["^esqa\\.moneris\\.com$", "^gatewayqa\\.moneris\\.com$", "^gatewayt\\.moneris\\.com$", "^gatewaydev\\.moneris\\.com$"],
|
|
428
475
|
encoding: "form",
|
|
429
476
|
passthroughHeaders: []
|
|
430
477
|
},
|
|
@@ -465,8 +512,66 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
|
|
|
465
512
|
"^apis\\.eu\\.globalpay\\.com$",
|
|
466
513
|
"^apis\\.sandbox\\.eu\\.globalpay\\.com$"
|
|
467
514
|
],
|
|
515
|
+
// Heartland/Portico cert.* is the certification (sandbox) host; GP-API sandbox is apis.sandbox[.eu].
|
|
516
|
+
sandboxHosts: ["^cert\\.api2\\.heartlandportico\\.com$", "^apis\\.sandbox\\.globalpay\\.com$", "^apis\\.sandbox\\.eu\\.globalpay\\.com$"],
|
|
468
517
|
encoding: "json",
|
|
469
518
|
passthroughHeaders: ["^authorization$", "^x-gp-version$"]
|
|
519
|
+
},
|
|
520
|
+
// ── Encrypted on the device under a pinned key ────────────────────────────
|
|
521
|
+
{
|
|
522
|
+
psp: "fiserv",
|
|
523
|
+
// Fiserv Commerce Hub card capture from the Secure Data Capture (SDC) frame,
|
|
524
|
+
// the request Home Depot's OrangePay checkout sends (payment-fields.js and
|
|
525
|
+
// sdk-secure 3.8.14). The frame always encrypts: it seals the card with
|
|
526
|
+
// AES-256-GCM under a fresh key, wraps that key with RSA-OAEP-SHA256 under the
|
|
527
|
+
// public key the page passed it, and posts the envelope as
|
|
528
|
+
// source.encryptionData. It picks its endpoint by the page's auth type
|
|
529
|
+
// (iframe.js @85480): an AccessToken (Security Credentials) posts here, to
|
|
530
|
+
// card-capture; a Checkout Sessions JWT posts to /ch/checkouts/v1/payment-link
|
|
531
|
+
// instead. payment-link also carries the card, and it is left out on purpose:
|
|
532
|
+
// `match` names card-capture only, so a Sessions merchant's capture is never
|
|
533
|
+
// paused and fails as it does today. Fastlane (PaymentToken), ACH
|
|
534
|
+
// (PaymentCheck), gift and EBT captures share this URL, carry no Vault card,
|
|
535
|
+
// and the SDK continues them unpaused (fiserv.js isFiservPausableBody).
|
|
536
|
+
// The Wave 0 sandbox gate (2026-09-24, connect-cert, Fiserv simulator cards)
|
|
537
|
+
// settled the mode: card-capture refuses a plaintext source.card (400
|
|
538
|
+
// GATEWAY 302 "Missing or Invalid Encryption Data") and captures the frame's
|
|
539
|
+
// own envelope with no Origin, so the device builds that envelope under a
|
|
540
|
+
// key Agentcard pinned (fiserv-keys.js), the runtime writes its four members
|
|
541
|
+
// over the paused ones, and the capture continues from the agent's browser.
|
|
542
|
+
// The AccessToken the agent can read was refused on charges and tokens at
|
|
543
|
+
// Fiserv's edge in that sandbox. Every other Commerce Hub path is refused
|
|
544
|
+
// here: charges, tokens, security/keys, payment-link, and the non-production
|
|
545
|
+
// hosts (connect-dev, -qa, -uat, -test); resolveRecognizerForUrl also takes
|
|
546
|
+
// only the two endpoints written exactly (fiserv-environment.js). The
|
|
547
|
+
// envelope carries no timestamp or session binding, so it is approved by the
|
|
548
|
+
// cardholder every time: dark until an org is allowlisted, and autopilot
|
|
549
|
+
// refuses fiserv at all three gates.
|
|
550
|
+
capability: "fiserv_card_capture",
|
|
551
|
+
// A Fiserv card is sealed only for a capture the cardholder already approved
|
|
552
|
+
// through a prepare(): the backend refuses an unprepared create (409
|
|
553
|
+
// preparation_required), the internal buy loop never mints a Fiserv round,
|
|
554
|
+
// and the SDK refuses locally before it prompts.
|
|
555
|
+
preparationRequired: true,
|
|
556
|
+
match: "connect(?:-cert)?\\.fiservapis\\.com/ch/payments-vas/v1/card-capture(?![\\w/.-])",
|
|
557
|
+
hosts: ["^connect\\.fiservapis\\.com$", "^connect-cert\\.fiservapis\\.com$"],
|
|
558
|
+
sandboxHosts: ["^connect-cert\\.fiservapis\\.com$"],
|
|
559
|
+
// A live row reaches connect only and a test row connect-cert only, and
|
|
560
|
+
// connect-cert receives only documented test cards (device-replay.js).
|
|
561
|
+
hostEnvironmentPinned: true,
|
|
562
|
+
encoding: "json",
|
|
563
|
+
// The browser continues the capture with its own headers, so only the ones
|
|
564
|
+
// the backend checks against the body and the merchant are kept:
|
|
565
|
+
// Auth-Token-Type, the merchant and terminal ids, and the embedding frame's
|
|
566
|
+
// origin the SDC names (x-integration-origin, self-asserted). The
|
|
567
|
+
// AccessToken, the API key, Client-Request-Id and Timestamp are never stored.
|
|
568
|
+
passthroughHeaders: ["^auth-token-type$", "^x-integration-merchant-id$", "^x-integration-terminal-id$", "^x-integration-origin$"],
|
|
569
|
+
clientSideEncrypted: true,
|
|
570
|
+
mode: "cse",
|
|
571
|
+
cse: {
|
|
572
|
+
at: "source.encryptionData",
|
|
573
|
+
fields: ["keyId", "encryptedKey", "encryptionBlock", "aesIv"]
|
|
574
|
+
}
|
|
470
575
|
}
|
|
471
576
|
]);
|
|
472
577
|
var PSP_RECOGNIZERS = deepFreeze(PROCESSOR_DEFINITIONS.map(({ compose, encryptedCardFields, ...definition }) => definition));
|
|
@@ -476,17 +581,22 @@ var PSP_CLIENT_TABLE = deepFreeze(PROCESSOR_DEFINITIONS.map((definition) => ({
|
|
|
476
581
|
hosts: definition.hosts.map((source) => new RegExp(source, "i")),
|
|
477
582
|
encoding: definition.encoding,
|
|
478
583
|
headers: definition.passthroughHeaders.map((source) => new RegExp(source, "i")),
|
|
584
|
+
...definition.sandboxHosts ? { sandboxHosts: definition.sandboxHosts.map((source) => new RegExp(source, "i")) } : {},
|
|
585
|
+
...definition.hostEnvironmentPinned ? { hostEnvironmentPinned: true } : {},
|
|
479
586
|
...definition.mode ? { mode: definition.mode } : {},
|
|
480
587
|
...definition.clientSideEncrypted ? { clientSideEncrypted: true } : {},
|
|
481
588
|
...definition.compose ? { compose: definition.compose } : {},
|
|
482
589
|
...definition.encryptedCardFields ? { cse: { fields: definition.encryptedCardFields } } : {},
|
|
483
590
|
...definition.hostedForm ? { form: definition.hostedForm.card } : {}
|
|
484
591
|
})));
|
|
485
|
-
|
|
486
|
-
...definition
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
592
|
+
function buildBuiltinRegistry(recognizers) {
|
|
593
|
+
return recognizers.filter((definition) => !definition.capability).map(({ cse, hostedForm, ...definition }) => ({
|
|
594
|
+
...definition,
|
|
595
|
+
match: new RegExp(definition.match, "i"),
|
|
596
|
+
passthroughHeaders: definition.passthroughHeaders.map((source) => new RegExp(source, "i"))
|
|
597
|
+
}));
|
|
598
|
+
}
|
|
599
|
+
var BUILTIN_REGISTRY = deepFreeze(buildBuiltinRegistry(PSP_RECOGNIZERS));
|
|
490
600
|
var CHECKOUT_MODES = deepFreeze(["token", "cse", "hosted_form"]);
|
|
491
601
|
function recognizerByPsp(psp) {
|
|
492
602
|
return typeof psp === "string" ? PSP_CLIENT_TABLE.find((entry) => entry.psp === psp) ?? null : null;
|
|
@@ -498,6 +608,16 @@ function trustedClientRecognizer(pspOrEntry) {
|
|
|
498
608
|
throw new Error("Refusing to pay: unknown payment processor.");
|
|
499
609
|
return definition;
|
|
500
610
|
}
|
|
611
|
+
// src/recognition.js
|
|
612
|
+
var PATTERN_WITHOUT_CARD_FIELDS = Object.freeze({
|
|
613
|
+
stripe: "api\\.stripe\\.com/v1/(payment_methods|tokens|setup_intents/seti_\\w+/confirm|payment_intents/pi_\\w+/confirm)"
|
|
614
|
+
});
|
|
615
|
+
var WITHOUT_CHECKOUT_SESSIONS = Object.freeze({
|
|
616
|
+
stripe: Object.freeze({
|
|
617
|
+
match: "api\\.stripe\\.com/v1/(payment_methods|tokens|sources|confirmation_tokens|setup_intents/seti_\\w+/confirm|payment_intents/pi_\\w+/confirm)",
|
|
618
|
+
passWithoutCard: "api\\.stripe\\.com/v1/(sources|confirmation_tokens)"
|
|
619
|
+
})
|
|
620
|
+
});
|
|
501
621
|
// src/request-policy.js
|
|
502
622
|
var HEADER_NEVER_FORWARD = /^(cookie|set-cookie|authorization2|proxy-authorization|host|content-length|origin|referer)$/i;
|
|
503
623
|
var ALLOWED_MEDIA_TYPES = {
|
|
@@ -591,7 +711,7 @@ function validateStripeCheckoutCard(card, environment = "test") {
|
|
|
591
711
|
reject();
|
|
592
712
|
}
|
|
593
713
|
else {
|
|
594
|
-
if (!/^\d{
|
|
714
|
+
if (!/^\d{12,19}(?![\s\S])/.test(card.number) || /^(\d)\1+(?![\s\S])/.test(card.number) || !/^\d{3,4}(?![\s\S])/.test(card.cvc) || SYNTHETIC_CARDS.includes(card.number))
|
|
595
715
|
reject();
|
|
596
716
|
let sum = 0, double = false;
|
|
597
717
|
for (let i = card.number.length - 1; i >= 0; i--) {
|
|
@@ -7,4 +7,5 @@ declare var SubstitutionError: {
|
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
9
|
declare function substituteEncryptedFields(body: any, sub: any): string;
|
|
10
|
-
|
|
10
|
+
declare function substituteMerchantHosted(body: any, sub: any, opts: any): string;
|
|
11
|
+
export { SubstitutionError, substituteEncryptedFields, substituteMerchantHosted };
|