@agent-cards/sdk 0.23.19 → 0.23.20

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/PREFLIGHT.md +2 -0
  3. package/README.md +34 -4
  4. package/dist/amadeus.d.ts +4 -2
  5. package/dist/amadeus.js +16 -3
  6. package/dist/buy.d.ts +84 -2
  7. package/dist/buy.js +16 -1
  8. package/dist/card-endpoint-facts.d.ts +2 -1
  9. package/dist/card-endpoint-facts.js +18 -9
  10. package/dist/card-endpoint.d.ts +20 -4
  11. package/dist/card-endpoint.js +38 -4
  12. package/dist/card-fields.generated.js +483 -17
  13. package/dist/cdp.d.ts +29 -0
  14. package/dist/cdp.js +302 -18
  15. package/dist/client.d.ts +30 -4
  16. package/dist/client.js +128 -13
  17. package/dist/hipay.generated.d.ts +56 -0
  18. package/dist/hipay.generated.js +389 -0
  19. package/dist/hold.d.ts +180 -0
  20. package/dist/hold.js +264 -0
  21. package/dist/index.d.ts +3 -1
  22. package/dist/index.js +1 -0
  23. package/dist/lifecycle.d.ts +10 -0
  24. package/dist/lifecycle.js +21 -0
  25. package/dist/merchant-card-endpoints.generated.js +102 -11
  26. package/dist/paddle-vgs.generated.d.ts +3 -2
  27. package/dist/paddle-vgs.generated.js +9 -5
  28. package/dist/pre-claim.d.ts +14 -0
  29. package/dist/pre-claim.js +76 -3
  30. package/dist/prepared-processor.d.ts +6 -2
  31. package/dist/prepared-processor.js +18 -2
  32. package/dist/primer.generated.js +510 -44
  33. package/dist/quickpay.d.ts +44 -0
  34. package/dist/quickpay.js +65 -0
  35. package/dist/stripe-checkout.generated.js +124 -2
  36. package/dist/twoc2p.d.ts +54 -0
  37. package/dist/twoc2p.generated.d.ts +33 -0
  38. package/dist/twoc2p.generated.js +1145 -0
  39. package/dist/twoc2p.js +85 -0
  40. package/dist/voice.d.ts +16 -13
  41. package/dist/voice.js +13 -10
  42. package/package.json +3 -3
@@ -0,0 +1,44 @@
1
+ /**
2
+ * QuickPay's hosted payment window (where most Danish and Nordic webshops send the buyer), as this SDK reads it.
3
+ *
4
+ * The merchant's page posts a signed entry form, top-level, to https://payment.quickpay.net/ (QuickPay's Form
5
+ * API v10), and QuickPay answers with a redirect to its own window under a session of its own (/<32 hex>). That
6
+ * entry carries no card, and it is the one request this SDK pauses: the cardholder's device repeats it over the
7
+ * end-to-end TLS relay and fills the card into the window QuickPay returns to it (payment-core
8
+ * processors/quickpay.js). Everything else the agent's browser posts to QuickPay carries a card the agent typed
9
+ * or follows one: the window's card post (/process_card), its fee lookup (/calculate_fee, which carries the card
10
+ * number), its wallet token post (/process_payment_token) and its 3-D Secure step (/<session>/3ds_auth). The
11
+ * window also looks up the card's first eight digits with a GET (/payment-methods?bin=...). This SDK aborts every
12
+ * one of them, so a placeholder card never reaches QuickPay.
13
+ *
14
+ * The host is payment-core's QUICKPAY_HOSTS; quickpay.test.mjs pins the two lists together. QuickPay has no test
15
+ * host: a test payment runs on the same host with QuickPay's own test cards.
16
+ */
17
+ export declare const QUICKPAY_PSP = "quickpay";
18
+ export declare const QUICKPAY_HOSTS: readonly string[];
19
+ /** Whether this URL is on QuickPay's window host (https, no credentials, any port, a trailing dot or not). */
20
+ export declare function isQuickpayHost(url: string): boolean;
21
+ /**
22
+ * The only request on QuickPay's host that is the merchant's entry: a POST to the host's root, written exactly as
23
+ * a form action writes it, with no port, query or fragment (payment-core isQuickpayEntryUrl, which takes that one
24
+ * string only). The entry the SDK pauses; every other POST there is aborted.
25
+ */
26
+ export declare function isQuickpayEntry(url: string, method: string): boolean;
27
+ /**
28
+ * The window's card lookup: a GET on QuickPay's host to /payment-methods, which names the first eight digits of
29
+ * the card typed so far in its `bin` query. Any other GET there (the window itself, its scripts and images) is
30
+ * not a card request.
31
+ */
32
+ export declare function isQuickpayCardLookup(url: string, method: string): boolean;
33
+ /** The entry URL the registry recognizes when this build is armed for QuickPay, for any URL on QuickPay's host. */
34
+ export declare function quickpayEntryUrl(url: string): string | null;
35
+ /**
36
+ * Whether an adapter must hand this request to the pre-claim gates: it is on QuickPay's host and this build's
37
+ * registry serves QuickPay's entry. The window's card post and the other card requests are not the entry, so the
38
+ * registry's card-request test does not name them; the CDP adapter still pauses them through the recognizer's
39
+ * host pattern, and attachToPlaywright's route predicate asks this, so both adapters show the gates every
40
+ * request to QuickPay's host once QuickPay is armed.
41
+ */
42
+ export declare function isArmedQuickpayUrl(vault: {
43
+ isCardRequest(url: string, method?: string): boolean;
44
+ }, url: string): boolean;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * QuickPay's hosted payment window (where most Danish and Nordic webshops send the buyer), as this SDK reads it.
3
+ *
4
+ * The merchant's page posts a signed entry form, top-level, to https://payment.quickpay.net/ (QuickPay's Form
5
+ * API v10), and QuickPay answers with a redirect to its own window under a session of its own (/<32 hex>). That
6
+ * entry carries no card, and it is the one request this SDK pauses: the cardholder's device repeats it over the
7
+ * end-to-end TLS relay and fills the card into the window QuickPay returns to it (payment-core
8
+ * processors/quickpay.js). Everything else the agent's browser posts to QuickPay carries a card the agent typed
9
+ * or follows one: the window's card post (/process_card), its fee lookup (/calculate_fee, which carries the card
10
+ * number), its wallet token post (/process_payment_token) and its 3-D Secure step (/<session>/3ds_auth). The
11
+ * window also looks up the card's first eight digits with a GET (/payment-methods?bin=...). This SDK aborts every
12
+ * one of them, so a placeholder card never reaches QuickPay.
13
+ *
14
+ * The host is payment-core's QUICKPAY_HOSTS; quickpay.test.mjs pins the two lists together. QuickPay has no test
15
+ * host: a test payment runs on the same host with QuickPay's own test cards.
16
+ */
17
+ export const QUICKPAY_PSP = 'quickpay';
18
+ export const QUICKPAY_HOSTS = Object.freeze(['payment.quickpay.net']);
19
+ const QUICKPAY_ENTRY_URL = 'https://payment.quickpay.net/';
20
+ /** Whether this URL is on QuickPay's window host (https, no credentials, any port, a trailing dot or not). */
21
+ export function isQuickpayHost(url) {
22
+ let parsed;
23
+ try {
24
+ parsed = new URL(url);
25
+ }
26
+ catch {
27
+ return false;
28
+ }
29
+ return parsed.protocol === 'https:' && !parsed.username && !parsed.password
30
+ && QUICKPAY_HOSTS.includes(parsed.hostname.toLowerCase().replace(/\.$/, ''));
31
+ }
32
+ /**
33
+ * The only request on QuickPay's host that is the merchant's entry: a POST to the host's root, written exactly as
34
+ * a form action writes it, with no port, query or fragment (payment-core isQuickpayEntryUrl, which takes that one
35
+ * string only). The entry the SDK pauses; every other POST there is aborted.
36
+ */
37
+ export function isQuickpayEntry(url, method) {
38
+ return String(method).toUpperCase() === 'POST' && url === QUICKPAY_ENTRY_URL;
39
+ }
40
+ /**
41
+ * The window's card lookup: a GET on QuickPay's host to /payment-methods, which names the first eight digits of
42
+ * the card typed so far in its `bin` query. Any other GET there (the window itself, its scripts and images) is
43
+ * not a card request.
44
+ */
45
+ export function isQuickpayCardLookup(url, method) {
46
+ if (String(method).toUpperCase() !== 'GET' || !isQuickpayHost(url))
47
+ return false;
48
+ const parsed = new URL(url);
49
+ return /(?:^|\/)payment-methods\/?$/i.test(parsed.pathname) || parsed.searchParams.has('bin');
50
+ }
51
+ /** The entry URL the registry recognizes when this build is armed for QuickPay, for any URL on QuickPay's host. */
52
+ export function quickpayEntryUrl(url) {
53
+ return isQuickpayHost(url) ? QUICKPAY_ENTRY_URL : null;
54
+ }
55
+ /**
56
+ * Whether an adapter must hand this request to the pre-claim gates: it is on QuickPay's host and this build's
57
+ * registry serves QuickPay's entry. The window's card post and the other card requests are not the entry, so the
58
+ * registry's card-request test does not name them; the CDP adapter still pauses them through the recognizer's
59
+ * host pattern, and attachToPlaywright's route predicate asks this, so both adapters show the gates every
60
+ * request to QuickPay's host once QuickPay is armed.
61
+ */
62
+ export function isArmedQuickpayUrl(vault, url) {
63
+ const entry = quickpayEntryUrl(url);
64
+ return entry !== null && vault.isCardRequest(entry, 'POST');
65
+ }
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
2
  // Generated from @agent-cards/payment-core. Do not edit.
3
- // artifact-sha256: 75a1d6551b8b0f5af53c9ce72e709e523f6911e0f96a1705fca0855b180d8532
3
+ // artifact-sha256: abafbcce1536643bd38817e2332c0e107e93b04bc347051096c6e031cda00722
4
4
  // src/deep-freeze.js
5
5
  function deepFreeze(value) {
6
6
  if (value && typeof value === "object" && !Object.isFrozen(value)) {
@@ -2133,6 +2133,100 @@ var PROCESSOR_DEFINITIONS = deepFreeze([
2133
2133
  passthroughHeaders: ["^x-sumup-correlation-id$", "^x-sumup-widget-session-id$"],
2134
2134
  jsonCardFields: [["card", "number"]],
2135
2135
  request: { method: "PUT", cardIn: "body", response: "json" }
2136
+ },
2137
+ {
2138
+ psp: "twoc2p",
2139
+ // 2C2P's hosted payment page (pgw-ui.2c2p.com, builds 4.1 to 4.5), where most 2C2P merchants in Thailand,
2140
+ // Malaysia and Singapore send a buyer, top level or in a frame. On Pay the page encrypts the card with
2141
+ // 2C2P's own library under one static RSA-1024 key and posts one JSON request to
2142
+ // pgwv4.2c2p.com/payment/<build>/Payment (sandbox-pgwv4 for a sandbox token), the card only as
2143
+ // payment.data.securePayToken. twoc2p.js holds the rule the pause decision, the API's create, the approve
2144
+ // and the SDK read: the exact Payment URL of a reviewed build, the page's own body, and a request that keeps,
2145
+ // reuses or exposes a card, pays in instalments, converts the currency or redeems points refused. cse mode,
2146
+ // as Paddle TokenEx and Shiji STS ship: the cardholder's device writes a new securePayToken from the real
2147
+ // card under the key payment-core pins (twoc2p-keys.js), the runtime swaps it over the placeholder's, and the
2148
+ // agent's page continues the request (substituteTwoC2p). A Payment request with no card field (a QR code, a
2149
+ // bank transfer) carries none of the cardholder's cards and continues untouched (passWithoutCard). The
2150
+ // request names no amount and no merchant: the payment token binds both, which the API reads from 2C2P's
2151
+ // own session answer (twoc2p-answers.js), and a live payment is taken only for a merchant a reviewed pin
2152
+ // names. Ships dark: served only to a client that declares `twoc2p_secure_pay`, gated off for every org
2153
+ // until an operator lists one (`twoc2p:<org>`), and autopilot never sends this request (autopilot.js
2154
+ // DEVICE_REPLAY_REFUSED_OPERATIONS). The environment is pinned (S7): sandbox-pgwv4 only on test rows and
2155
+ // only with documented test cards. `(?![\w/.-])` ends the path for a consumer that tests `match` unanchored.
2156
+ capability: "twoc2p_secure_pay",
2157
+ match: "(?:sandbox-)?pgwv4\\.2c2p\\.com/payment/4\\.[0-9]{1,2}/Payment(?![\\w/.-])",
2158
+ hosts: ["^pgwv4\\.2c2p\\.com$", "^sandbox-pgwv4\\.2c2p\\.com$"],
2159
+ sandboxHosts: ["^sandbox-pgwv4\\.2c2p\\.com$"],
2160
+ hostEnvironmentPinned: true,
2161
+ encoding: "json",
2162
+ // The page continues its own request with its own headers; none is stored.
2163
+ passthroughHeaders: [],
2164
+ jsonCardFields: [["payment", "data", "securePayToken"]],
2165
+ passWithoutCard: "(?:sandbox-)?pgwv4\\.2c2p\\.com/payment/4\\.[0-9]{1,2}/Payment",
2166
+ clientSideEncrypted: true,
2167
+ mode: "cse",
2168
+ cse: { scheme: "twoc2p-secure-pay", at: "payment.data", fields: ["securePayToken"] },
2169
+ // The device's one field carries the whole card (number, expiry and code), so the client table names it once.
2170
+ encryptedCardFields: { card: "securePayToken" }
2171
+ },
2172
+ {
2173
+ psp: "hipay",
2174
+ // HiPay Enterprise (France, Portugal, Italy, Spain): HiPay's JavaScript SDK (libs.hipay.com/js/sdkjs.js)
2175
+ // takes the card in hosted fields, and their hidden controller frame on libs.hipay.com (or a direct post
2176
+ // from the merchant's own origin) posts it as one JSON body to HiPay's Secure Vault under the merchant's
2177
+ // public Basic credential: card_number, card_expiry_month (MM), card_expiry_year (YYYY), cvc, card_holder
2178
+ // when the page has the field, and multi_use. hipay.js holds the request rule the pause decision, the API's
2179
+ // create, the prepared bind and the device all read: exactly a token URL, a JSON Content-Type, a public
2180
+ // username of the vault's own environment, and a complete create byte for byte. The hosted fields also post
2181
+ // the number alone while it is typed; that body is refused (hipay_number_only) and the SDK fails it in the
2182
+ // browser, so the frame keeps the number and Pay sends one complete create. The merchant's page gives the
2183
+ // frame 20 seconds after Pay, so the lane is prepared only (preparationRequired). HiPay's vault answers any
2184
+ // browser origin, so the card leaves the cardholder's device by a direct fetch. The body names no amount and
2185
+ // no merchant: a live request is taken only for a checkout origin and a public username one reviewed pin
2186
+ // names together. stage-secure2-vault.hipay-tpp.com is HiPay's stage vault: pinned (S7) to test rows, which
2187
+ // send only test cards. Ships dark: served only to a client that declares `hipay_vault_token`, gated off
2188
+ // for every org until an operator lists one (`hipay:<org>`), and autopilot never sends this request
2189
+ // (autopilot.js DEVICE_REPLAY_REFUSED_OPERATIONS). `(?![\w/.-])` ends the path for a consumer that tests
2190
+ // `match` unanchored, so /rest/v2/token/update is never this entry.
2191
+ capability: "hipay_vault_token",
2192
+ match: "(?:stage-)?secure2-vault\\.hipay-tpp\\.com/rest/v2/token(?![\\w/.-])",
2193
+ hosts: ["^secure2-vault\\.hipay-tpp\\.com$", "^stage-secure2-vault\\.hipay-tpp\\.com$"],
2194
+ sandboxHosts: ["^stage-secure2-vault\\.hipay-tpp\\.com$"],
2195
+ hostEnvironmentPinned: true,
2196
+ preparationRequired: true,
2197
+ encoding: "json",
2198
+ // The merchant's public credential and the frame's JSON Accept. Origin, Referer and cookies never ride.
2199
+ passthroughHeaders: ["^authorization$", "^accept$"]
2200
+ },
2201
+ {
2202
+ psp: "amazon_payment_services",
2203
+ // Amazon Payment Services (formerly PayFort; the UAE, Saudi Arabia, Egypt), its custom merchant page: the
2204
+ // merchant's own card form posts top-level, as a document navigation, to /FortAPI/paymentPage on
2205
+ // checkout.payfort.com, form encoded, with service_command=TOKENIZATION and the merchant's signed fields
2206
+ // beside card_number, expiry_date (YYMM) and card_security_code. amazon-payment-services.js holds the rule
2207
+ // the pause decision reads: exactly that URL, and the form field by field, with another service command, a
2208
+ // saved card (token_name) and a recurring agreement (merchant_extra) refused by name. The same URL takes
2209
+ // APS's redirection and iframe entries, which carry no card and continue untouched (passWithoutCard); APS's
2210
+ // own page then takes the card, and no Vault mode pays it. The request names no amount: the merchant
2211
+ // charges the token APS answers with later, from its own server, so the agent's amount is the figure the
2212
+ // cardholder approves. APS answers no browser origin, so the card leaves the cardholder's device only
2213
+ // through the checkout relay, with the page's own Origin and Referer. sbcheckout.payfort.com is APS's
2214
+ // sandbox: pinned (S7) to test rows, which send only test cards.
2215
+ // Ships dark: served only to a client that declares `aps_custom_merchant_page`, gated off for every org
2216
+ // until an operator lists one (`amazon_payment_services:<org>`), and autopilot never sends this request
2217
+ // (autopilot.js DEVICE_REPLAY_REFUSED_OPERATIONS). `(?![\w/.%-])` ends the path for a consumer that tests
2218
+ // `match` unanchored.
2219
+ capability: "aps_custom_merchant_page",
2220
+ match: "(?:sb)?checkout\\.payfort\\.com/FortAPI/paymentPage(?![\\w/.%-])",
2221
+ hosts: ["^checkout\\.payfort\\.com$", "^sbcheckout\\.payfort\\.com$"],
2222
+ sandboxHosts: ["^sbcheckout\\.payfort\\.com$"],
2223
+ hostEnvironmentPinned: true,
2224
+ encoding: "form",
2225
+ // The form's own Origin and Referer: a browser sends both on the page's POST, and the request rule holds
2226
+ // them to the checkout page. Cookies and every other header never ride.
2227
+ passthroughHeaders: ["^origin$", "^referer$"],
2228
+ cardFields: ["card_number"],
2229
+ passWithoutCard: "(?:sb)?checkout\\.payfort\\.com/FortAPI/paymentPage"
2136
2230
  }
2137
2231
  ]);
2138
2232
  var PSP_RECOGNIZERS = deepFreeze(PROCESSOR_DEFINITIONS.map(({ compose, encryptedCardFields, deviceSteps, deviceEncrypt, ...definition }) => definition));
@@ -2313,6 +2407,10 @@ var WIX_PAYMENTS_MERCHANT_PINS = /* @__PURE__ */ Object.freeze([
2313
2407
  // src/paymongo.js
2314
2408
  var PAYMONGO_CHECKOUT_HOST = "checkout.paymongo.com";
2315
2409
  var ORIGIN = `https://${PAYMONGO_CHECKOUT_HOST}/`;
2410
+ // src/payrexx.js
2411
+ var PAYREXX_FOLLOW_UP_WINDOW_MS = 15 * 60 * 1e3;
2412
+ var PAYREXX_FOLLOW_UP_IDLE_MS = 60 * 1e3;
2413
+ var PAYREXX_FOLLOW_UP_CHALLENGE_MS = 11 * 60 * 1e3;
2316
2414
  // src/paygent.js
2317
2415
  var PAYGENT_PSP = "paygent";
2318
2416
  var PAYGENT_TOKEN_HOSTS = /* @__PURE__ */ Object.freeze({
@@ -2335,6 +2433,22 @@ var PAY_NL_MERCHANT_PINS = /* @__PURE__ */ Object.freeze([
2335
2433
  ]);
2336
2434
  var ERROR_KEYS = /* @__PURE__ */ Object.freeze(["errorId", "errorTag", "errorMessage", "errorFieldName"]);
2337
2435
  var REQUEST_KEYS = /* @__PURE__ */ Object.freeze(["result", ...ERROR_KEYS]);
2436
+ // src/twoc2p-keys.js
2437
+ var TWOC2P_KEYS = /* @__PURE__ */ Object.freeze({
2438
+ production: Object.freeze({
2439
+ spki: "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/1ljsxI+r6qQraTFrHfWNrV41vxumBF+4ILAG3WsN6HEBQU2wSUv/IyQmZkiys1ilOb+OOuQTH8OXMnqQg9E4epyePW3L7IeOieSbIIDeSX6UpTWmT/Fs7moWZkN8RpuCV0u87n3AY2tQbtcSqwEKi2sxzWLFwscoGn6N5yVIpQIDAQAB",
2440
+ sha256: "bb8f27929ce140c6ef0ec9c4a20d7ca0b83376bc35a501985dc40d16669384fe",
2441
+ script: Object.freeze({ url: "https://t.2c2p.com/SecurePayment/api/my2c2p.1.7.6.min.js", sha256: "4a745a37765a2e28e299d64f6ea5811aab27b176da61db6f840fa85d6a47e763" })
2442
+ }),
2443
+ sandbox: Object.freeze({
2444
+ spki: "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDKakJC+2MSZikKoPzlNqXvJCuWNLhejg3gMRePSetYNNgnhyqFwwAR7t7i/B2QFZoixSYc2/23cJz0jA5O+q+Cu3fycqKlf1L9966+X3B9nyHe2eKQZr8KrcS/8+sEKcd0pLATY4AleW1iktuN+2oghrDKuv+aDNztWcOy+PTofwIDAQAB",
2445
+ sha256: "7f80c07f1d72db28ede10dae942940657c72dfa789836c9fdf283cba6feff2e6",
2446
+ script: Object.freeze({ url: "https://demo2.2c2p.com/2C2PFrontEnd/SecurePayment/api/my2c2p.1.7.6.min.js", sha256: "435723d92bfefb00607a56851967e0b745d52b8d49443de5f0000f0583fde5cc" })
2447
+ })
2448
+ });
2449
+ // src/amazon-payment-services.js
2450
+ var BODY_LIMIT = 32 * 1024;
2451
+ var ANSWER_LIMIT = 64 * 1024;
2338
2452
  // src/cybersource-secure-acceptance.js
2339
2453
  var SA_BODY_LIMIT = 32 * 1024;
2340
2454
  var SA_REPLY_LIMIT = 64 * 1024;
@@ -2561,7 +2675,15 @@ var METHOD_PAGE = /* @__PURE__ */ new Set(["resultadoMethod", ...BROWSER_FIELDS,
2561
2675
  var REDSYS_REFUSALS = Object.freeze(["redsys_card_page", "redsys_3ds_challenge", "redsys_declined"]);
2562
2676
  // src/processors/quickpay.js
2563
2677
  var QUICKPAY_HOSTS = Object.freeze(["payment.quickpay.net"]);
2564
- var QUICKPAY_MERCHANTS = Object.freeze([]);
2678
+ var QUICKPAY_MERCHANTS = Object.freeze([
2679
+ Object.freeze({
2680
+ merchantId: "107268",
2681
+ agreementId: null,
2682
+ merchant: "Skandinavisk Dyrepark",
2683
+ host: "shop.skandinaviskdyrepark.dk",
2684
+ callbackHost: "shop.skandinaviskdyrepark.dk"
2685
+ })
2686
+ ]);
2565
2687
  var MAX_ENTRY3 = 16 * 1024;
2566
2688
  var REQUIRED3 = Object.freeze([
2567
2689
  "version",
@@ -0,0 +1,54 @@
1
+ /** The PSP id the API and the recognizer name this lane, re-exported so the client dispatches by it. */
2
+ export { TWOC2P_PSP } from './twoc2p.generated.js';
3
+ /** The dark-launch capability a build declares when it fills a 2C2P Payment with the device's card field. */
4
+ export declare const TWOC2P_CAPABILITY = "twoc2p_secure_pay";
5
+ /** A cse substitution as the API serves it (substitute.ts Substitutions): here the one card field. */
6
+ interface TwoC2pServedSubstitution {
7
+ encoding: string;
8
+ at: string;
9
+ fields: Record<string, string>;
10
+ remove?: string[];
11
+ }
12
+ /**
13
+ * Whether an approved 2C2P authorization's served substitution is one this SDK can continue: JSON at payment.data,
14
+ * no sibling to remove, and exactly the one card field, a non-empty string. substituteTwoC2p checks the field
15
+ * against the pinned key for the Payment's environment; this is the shape gate the continuation runs first.
16
+ */
17
+ export declare function isTwoC2pServedSubstitution(sub: unknown): sub is TwoC2pServedSubstitution;
18
+ /** The part of the client a refused continuation retires its approval through. */
19
+ interface TwoC2pRetiringClient {
20
+ cancelAuthorization?: (authorizationId: string, reason: 'merchant_never_retried') => Promise<unknown>;
21
+ }
22
+ /**
23
+ * The retirement a refused 2C2P continuation runs (twoC2pContinuation's `retire`), or undefined for a client that
24
+ * cannot cancel: the approval is cancelled as merchant_never_retried, since its field went to no request, and the
25
+ * API stops serving the field. The paused request fails at once, so the cancel is not awaited; when the API does not
26
+ * confirm it, `onEvent` hears approval_retire_unconfirmed with the authorization's id. The API's sweep drops the field
27
+ * once its readable window passes either way.
28
+ */
29
+ export declare function twoC2pRetire(client: TwoC2pRetiringClient | undefined, authorizationId: string, onEvent?: (event: {
30
+ type: string;
31
+ detail?: unknown;
32
+ }) => void): (() => void) | undefined;
33
+ /** The paused request an approval was created from: the URL and body the API reviewed at create. */
34
+ export interface TwoC2pApprovedRequest {
35
+ url: string;
36
+ body: string;
37
+ }
38
+ /**
39
+ * The continuation of an approved 2C2P Payment: the paused body with the device's card field written over the
40
+ * placeholder's (payment-core substituteTwoC2p, which refuses a field that is not one under the pinned key for the
41
+ * Payment's environment, or one already in the paused body).
42
+ *
43
+ * Only into `approved`, the paused Payment the approval was created from: `url` and `body` must equal it byte for
44
+ * byte. 2C2P's key is the same for every merchant, so the field would pay any later Payment of the same shape;
45
+ * binding it to the one request keeps this lane from ever writing one payment's field into another.
46
+ *
47
+ * Null when neither URL is a 2C2P Payment, so every other processor keeps its own swap. Throws for any other body or
48
+ * URL, and for a substitution the shape gate or the swap refuses, in each case before anything continues. A refusal
49
+ * means the device's field went to no request, so `retire` runs first: the caller retires the approval as
50
+ * merchant_never_retried, and the API stops serving the field (cdp.ts cseContinuation).
51
+ */
52
+ export declare function twoC2pContinuation(url: string, body: string, sub: unknown, approved: TwoC2pApprovedRequest, retire?: () => void): {
53
+ body: string;
54
+ } | null;
@@ -0,0 +1,33 @@
1
+ declare var TWOC2P_PSP: string;
2
+ declare var TWOC2P_CAPABILITY: string;
3
+ declare var TWOC2P_OPERATION: string;
4
+ declare var TWOC2P_SCHEME: string;
5
+ declare var TWOC2P_FIELD_AT: string;
6
+ declare var TWOC2P_FIELD: string;
7
+ declare var TWOC2P_REVIEWED_BUILDS: readonly string[];
8
+ declare var TWOC2P_REFUSAL_CODES: readonly string[];
9
+ declare function twoC2pPaymentTarget(url: any): Readonly<{
10
+ environment: "production" | "sandbox";
11
+ version: string;
12
+ reviewed: boolean;
13
+ }> | null;
14
+ declare function twoC2pPaymentCarriesCard(body: any): boolean;
15
+ declare function twoC2pBodyVerdict(body: any, keyBytes?: number, environment?: undefined): Readonly<{
16
+ verdict: "continue";
17
+ }> | Readonly<{
18
+ verdict: "refuse";
19
+ code: any;
20
+ }> | Readonly<{
21
+ verdict: "card";
22
+ }>;
23
+ declare function twoC2pRequestRefusal(request: any, environment: any): any;
24
+ declare function twoC2pRefusalMessage(code: any): any;
25
+ declare function encryptTwoC2pCard(card: any, environment: any, facilities?: {}): Promise<string>;
26
+ declare function twoC2pSubstitutionOf(value: any, environment: any): any;
27
+ declare function substituteTwoC2p(url: any, body: any, field: any): string;
28
+ declare function twoC2pSubstitutionsRefusal(template: any, substitution: any): {
29
+ code: string;
30
+ message: any;
31
+ } | null;
32
+ declare function twoC2pKeyUsable(authorization: any): boolean;
33
+ export { TWOC2P_CAPABILITY, TWOC2P_FIELD, TWOC2P_FIELD_AT, TWOC2P_OPERATION, TWOC2P_PSP, TWOC2P_REFUSAL_CODES, TWOC2P_REVIEWED_BUILDS, TWOC2P_SCHEME, encryptTwoC2pCard, substituteTwoC2p, twoC2pBodyVerdict, twoC2pKeyUsable, twoC2pPaymentCarriesCard, twoC2pPaymentTarget, twoC2pRefusalMessage, twoC2pRequestRefusal, twoC2pSubstitutionOf, twoC2pSubstitutionsRefusal };