@agent-cards/sdk 0.23.20 → 0.23.22
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 +55 -2
- package/PREFLIGHT.md +6 -0
- package/README.md +169 -5
- package/dist/amadeus-checkout.generated.d.ts +6 -1
- package/dist/amadeus-checkout.generated.js +26 -2
- package/dist/card-fields.generated.js +2341 -127
- package/dist/cdp.js +199 -28
- package/dist/client.d.ts +177 -9
- package/dist/client.js +387 -37
- package/dist/comgate.d.ts +50 -0
- package/dist/comgate.js +80 -0
- package/dist/creditguard.generated.js +4 -2
- package/dist/cse-body.js +11 -0
- package/dist/cybersource-secure-acceptance.generated.d.ts +1 -1
- package/dist/ebanx.d.ts +1 -1
- package/dist/ebanx.js +1 -1
- package/dist/eprotect.generated.d.ts +1 -1
- package/dist/eximbay.d.ts +46 -0
- package/dist/eximbay.js +69 -0
- package/dist/gmo.generated.js +7 -3
- package/dist/hipay.generated.d.ts +5 -5
- package/dist/hipay.generated.js +5 -2
- package/dist/hold.d.ts +1 -1
- package/dist/hold.js +10 -4
- package/dist/hosted-entry.d.ts +4 -0
- package/dist/hosted-entry.js +32 -0
- package/dist/index.d.ts +1 -0
- package/dist/lifecycle.d.ts +9 -4
- package/dist/lifecycle.js +16 -4
- package/dist/paddle-tokenex.generated.js +7 -3
- package/dist/paygent.generated.d.ts +60 -0
- package/dist/paygent.generated.js +425 -0
- package/dist/payrails.generated.js +7 -3
- package/dist/payrexx.d.ts +91 -0
- package/dist/payrexx.generated.d.ts +91 -0
- package/dist/payrexx.generated.js +536 -0
- package/dist/payrexx.js +141 -0
- package/dist/pre-claim.d.ts +30 -1
- package/dist/pre-claim.js +257 -39
- package/dist/preflight-catalog.json +58 -0
- package/dist/preflight-schemas.json +4 -0
- package/dist/preflight.generated.js +26 -2
- package/dist/prepared-processor.d.ts +7 -2
- package/dist/prepared-processor.js +16 -2
- package/dist/primer.generated.js +2469 -255
- package/dist/przelewy24.d.ts +47 -0
- package/dist/przelewy24.js +88 -0
- package/dist/registry.d.ts +6 -5
- package/dist/registry.js +27 -7
- package/dist/shiji-sts.generated.js +7 -3
- package/dist/stripe-checkout.generated.js +896 -19
- package/dist/toast-seal.generated.d.ts +37 -0
- package/dist/toast-seal.generated.js +625 -0
- package/dist/toast.generated.d.ts +41 -0
- package/dist/toast.generated.js +113 -0
- package/dist/tokenex-iframe.d.ts +93 -0
- package/dist/tokenex-iframe.generated.d.ts +81 -0
- package/dist/tokenex-iframe.generated.js +403 -0
- package/dist/tokenex-iframe.js +195 -0
- package/dist/transbank.d.ts +45 -0
- package/dist/transbank.js +73 -0
- package/dist/twoc2p.generated.js +7 -3
- package/examples/preflight/kernel-native/inventory.json +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transbank's Webpay Plus (webpay3g.transbank.cl, the card payment form most Chilean shops send a buyer to), as this
|
|
3
|
+
* SDK reads it.
|
|
4
|
+
*
|
|
5
|
+
* The merchant's server creates the transaction at Transbank and sends the buyer's browser to Webpay with a GET,
|
|
6
|
+
* https://webpay3g.transbank.cl/webpayserver/initTransaction?token_ws=<64 lowercase hex>, the way the official
|
|
7
|
+
* WooCommerce plugin redirects. That GET carries no card and nothing but Transbank's token, and it is the one request
|
|
8
|
+
* a build that declares Webpay's capability pauses for Webpay (hosted-entry.ts): the cardholder's device repeats it
|
|
9
|
+
* over the end-to-end TLS relay and sends Webpay's card steps inside the session it opens (payment-core
|
|
10
|
+
* processors/transbank.js). Everything else the agent's browser sends Webpay spends the token or carries a card the
|
|
11
|
+
* agent typed: the token's one submit (/webpayserver/init_transaction.cgi), the card lookup and card check under
|
|
12
|
+
* /webpayserver/wswebpay/services/, and the card post (/webpayserver/bp_control.cgi). Once Webpay is served this SDK
|
|
13
|
+
* aborts every one of them (pre-claim.ts transbankPreClaim), so the token is never spent in the agent's browser and
|
|
14
|
+
* no placeholder card reaches Webpay. Only the link exactly as the merchant's redirect writes it is the entry; any
|
|
15
|
+
* other spelling would be handed on to Webpay's own route, which these rules never see.
|
|
16
|
+
*
|
|
17
|
+
* TRANSBANK_HOSTS is payment-core's TRANSBANK_HOSTS, and isTransbankEntryUrl is payment-core's rule of the same name;
|
|
18
|
+
* transbank.test.mjs pins both to payment-core on every case payment-core's own tests list.
|
|
19
|
+
*/
|
|
20
|
+
export const TRANSBANK_PSP = 'transbank_webpay';
|
|
21
|
+
/** The dark-launch capability the API serves Webpay's recognizer behind (payment-core definitions.js). */
|
|
22
|
+
export const TRANSBANK_CAPABILITY = 'transbank_webpay_hosted_payment_page';
|
|
23
|
+
/** Webpay's live host and Transbank's integration host, each a host of its own entry. */
|
|
24
|
+
export const TRANSBANK_HOSTS = Object.freeze(['webpay3g.transbank.cl', 'webpay3gint.transbank.cl']);
|
|
25
|
+
const TRANSBANK_ENTRY_PATH = '/webpayserver/initTransaction';
|
|
26
|
+
// A Webpay token as Transbank's REST reference defines it: 64 lowercase hex characters.
|
|
27
|
+
const TOKEN_QUERY = /^\?token_ws=[0-9a-f]{64}$/;
|
|
28
|
+
// An entry in the shape the merchant's redirect writes it: the registry reads Webpay as served when it takes this as a GET entry.
|
|
29
|
+
const TRANSBANK_SAMPLE_ENTRY = `https://webpay3g.transbank.cl${TRANSBANK_ENTRY_PATH}?token_ws=${'0'.repeat(64)}`;
|
|
30
|
+
/**
|
|
31
|
+
* Whether a URL is Webpay's entry exactly as the merchant's redirect writes it: https, one of Transbank's two hosts in
|
|
32
|
+
* lower case, no port, credentials or fragment, the path /webpayserver/initTransaction, and a query of the one
|
|
33
|
+
* `token_ws` parameter holding 64 lowercase hex characters. A string that parses to another spelling is not it.
|
|
34
|
+
*/
|
|
35
|
+
export function isTransbankEntryUrl(raw) {
|
|
36
|
+
if (typeof raw !== 'string' || raw.length > 256 || raw.includes('#'))
|
|
37
|
+
return false;
|
|
38
|
+
let url;
|
|
39
|
+
try {
|
|
40
|
+
url = new URL(raw);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
if (url.href !== raw || url.protocol !== 'https:' || url.port || url.username || url.password)
|
|
46
|
+
return false;
|
|
47
|
+
return TRANSBANK_HOSTS.includes(url.hostname) && url.pathname === TRANSBANK_ENTRY_PATH && TOKEN_QUERY.test(url.search);
|
|
48
|
+
}
|
|
49
|
+
/** Whether this URL is on one of Webpay's two hosts (https, no credentials, any port, a trailing dot or not). */
|
|
50
|
+
export function isTransbankHost(url) {
|
|
51
|
+
let parsed;
|
|
52
|
+
try {
|
|
53
|
+
parsed = new URL(url);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return parsed.protocol === 'https:' && !parsed.username && !parsed.password
|
|
59
|
+
&& TRANSBANK_HOSTS.includes(parsed.hostname.toLowerCase().replace(/\.$/, ''));
|
|
60
|
+
}
|
|
61
|
+
/** Whether this build's registry serves Webpay's entry: a company Agentcard turned Webpay on for, on a build that declares it. */
|
|
62
|
+
export function servesTransbank(vault) {
|
|
63
|
+
return typeof vault?.isCardRequest === 'function' && vault.isCardRequest(TRANSBANK_SAMPLE_ENTRY, 'GET');
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Whether an adapter must hand this request to the pre-claim gates: it is on one of Webpay's hosts and this build's
|
|
67
|
+
* registry serves Webpay. attachToCdp pauses every request there through the recognizer's host patterns;
|
|
68
|
+
* attachToPlaywright's route predicate asks this, so both adapters show the Webpay gate every request to a Webpay host
|
|
69
|
+
* once Webpay is served.
|
|
70
|
+
*/
|
|
71
|
+
export function isArmedTransbankUrl(vault, url) {
|
|
72
|
+
return isTransbankHost(url) && servesTransbank(vault);
|
|
73
|
+
}
|
package/dist/twoc2p.generated.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// Generated from @agent-cards/payment-core. Do not edit.
|
|
3
|
-
// artifact-sha256:
|
|
3
|
+
// artifact-sha256: 3c735198962459f0b06c7fbbdfa58de91ab1f76adeec6fa17b4e1a8d33e4b8c3
|
|
4
4
|
// src/sha256.js
|
|
5
5
|
var K = /* @__PURE__ */ new Uint32Array([
|
|
6
6
|
1116352408,
|
|
@@ -153,6 +153,9 @@ var typedArrayName = Object.getOwnPropertyDescriptor(TYPED_ARRAY, Symbol.toStrin
|
|
|
153
153
|
function parseRsaPublicKey(key) {
|
|
154
154
|
const spki = key && typeof key === "object" ? key.spki : void 0;
|
|
155
155
|
const pin = key && typeof key === "object" ? key.sha256 : void 0;
|
|
156
|
+
const named = key && typeof key === "object" && Object.prototype.hasOwnProperty.call(key, "exponent") ? key.exponent : void 0;
|
|
157
|
+
if (named !== void 0 && named !== 17)
|
|
158
|
+
throw refuse("key");
|
|
156
159
|
if (typeof spki !== "string" || spki.length > 1024 || spki.length % 4 !== 0 || !BASE64.test(spki))
|
|
157
160
|
throw refuse("key");
|
|
158
161
|
if (typeof pin !== "string" || !SHA256_HEX.test(pin))
|
|
@@ -188,9 +191,10 @@ function parseRsaPublicKey(key) {
|
|
|
188
191
|
if (!MODULUS_BYTES.includes(n.length) || !(n[0] & 128) || !(n[n.length - 1] & 1))
|
|
189
192
|
throw refuse("key");
|
|
190
193
|
const e = exponent.bytes;
|
|
191
|
-
|
|
194
|
+
const expected = named === 17 ? [17] : [1, 0, 1];
|
|
195
|
+
if (e.length !== expected.length || !expected.every((byte, i) => e[i] === byte))
|
|
192
196
|
throw refuse("key");
|
|
193
|
-
return Object.freeze({ n: toBigInt(n), e: 65537n, size: n.length });
|
|
197
|
+
return Object.freeze({ n: toBigInt(n), e: named === 17 ? 17n : 65537n, size: n.length });
|
|
194
198
|
}
|
|
195
199
|
function rsaesPkcs1v15Encrypt(key, message, random) {
|
|
196
200
|
const { n, e, size } = parseRsaPublicKey(key);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": 1,
|
|
3
3
|
"catalog_version": "2026-09-15.1",
|
|
4
|
-
"catalog_sha256": "
|
|
4
|
+
"catalog_sha256": "7f65e0f07138296b0cbff7dd1ed4331842b6dd45e2950f08273fcc772c7f63f6",
|
|
5
5
|
"baseline_version": "kernel-native-docs-2026-09-11.1",
|
|
6
6
|
"baseline_sha256": "d86722f49633d8223fccae54cd3d485df4375aee06aa156a273cc689b7c8507c",
|
|
7
7
|
"native_build": null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-cards/sdk",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.22",
|
|
4
4
|
"description": "Agentcard's SDK: one client, Agentcard, with two modules. checkout pauses a browser purchase and pays it with the person's own card; voice connects a person to your product once and approves a purchase by voice inside it. Card data never enters your process.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"_comment_test": "check:built runs first and names the command when a file the build generates (the copies in src/, the preflight contracts in dist/, the Kernel inventory) is missing or stale; verify:pack runs last, on the same dist.",
|
|
31
31
|
"check:built": "node scripts/generate-payment-core.mjs --check && node scripts/generate-voice-stream.mjs --check && node scripts/generate-preflight-contract.mjs --check && node scripts/generate-kernel-native-inventory.mjs --check",
|
|
32
32
|
"verify:pack": "node scripts/verify-pack.mjs",
|
|
33
|
-
"test": "npm run check:built && node test.mjs && node --test lifecycle.test.mjs merchant-abort.test.mjs preparation.test.mjs braintree.test.mjs pre-claim.test.mjs ekashu.test.mjs redsys.test.mjs quickpay.test.mjs paypal-hosted-fields.test.mjs paypal-card-forms.test.mjs cybersource-secure-acceptance.test.mjs ebanx.test.mjs autopilot.test.mjs stripe-checkout.test.mjs stripe-setup.test.mjs stripe-legacy-checkout.test.mjs payment-core.test.mjs prepared-processor.test.mjs merchant-hosted.test.mjs merchant-total.test.mjs sandbox-declaration.test.mjs minimum-delay.test.mjs paysafe.test.mjs wix-payments.test.mjs hipay.test.mjs payu.test.mjs attachment.test.mjs worker-targets.test.mjs mercado-checkout.test.mjs mercado-polling.test.mjs amadeus.test.mjs pelecard.test.mjs aci.test.mjs primer.test.mjs payrails.test.mjs elavon-converge.test.mjs voice.test.mjs agentcard.test.mjs buy.test.mjs readme.test.mjs gmo.test.mjs cybersource-flex.test.mjs juspay-gate.test.mjs card-endpoint.test.mjs card-endpoint-fastspring.test.mjs card-endpoint-navigation.test.mjs merchant-session-probe.test.mjs datatrans.test.mjs authorize-net-dpm.test.mjs creditguard.test.mjs eprotect.test.mjs wspay.test.mjs shiji-sts.test.mjs worldline-mycheckout.test.mjs verifone.test.mjs gravy.test.mjs paddle-vgs.test.mjs hold.test.mjs paddle-tokenex.test.mjs lyra.test.mjs twoc2p.test.mjs redact-url.test.mjs && node --test preflight-package.test.mjs preflight-collector.test.mjs && node --test kernel-native-qualification.test.mjs && node --test ../vault/scripts/recurly-validation/watch-duty-sdk-result.test.mjs && node scripts/verify-pack.mjs",
|
|
34
|
-
"test:browser": "node browser
|
|
33
|
+
"test": "npm run check:built && node test.mjs && node --test lifecycle.test.mjs merchant-abort.test.mjs preparation.test.mjs braintree.test.mjs pre-claim.test.mjs ekashu.test.mjs redsys.test.mjs quickpay.test.mjs paypal-hosted-fields.test.mjs paypal-card-forms.test.mjs cybersource-secure-acceptance.test.mjs ebanx.test.mjs payrexx.test.mjs payrexx-follow-ups.test.mjs payrexx-adapters.test.mjs autopilot.test.mjs stripe-checkout.test.mjs stripe-setup.test.mjs stripe-legacy-checkout.test.mjs payment-core.test.mjs prepared-processor.test.mjs merchant-hosted.test.mjs merchant-total.test.mjs sandbox-declaration.test.mjs minimum-delay.test.mjs paysafe.test.mjs wix-payments.test.mjs hipay.test.mjs payu.test.mjs attachment.test.mjs worker-targets.test.mjs mercado-checkout.test.mjs mercado-polling.test.mjs amadeus.test.mjs pelecard.test.mjs aci.test.mjs primer.test.mjs payrails.test.mjs elavon-converge.test.mjs voice.test.mjs agentcard.test.mjs buy.test.mjs readme.test.mjs gmo.test.mjs cybersource-flex.test.mjs juspay-gate.test.mjs card-endpoint.test.mjs card-endpoint-fastspring.test.mjs card-endpoint-navigation.test.mjs merchant-session-probe.test.mjs datatrans.test.mjs authorize-net-dpm.test.mjs creditguard.test.mjs eprotect.test.mjs wspay.test.mjs shiji-sts.test.mjs worldline-mycheckout.test.mjs verifone.test.mjs gravy.test.mjs paddle-vgs.test.mjs hold.test.mjs paddle-tokenex.test.mjs lyra.test.mjs gopay.test.mjs paygent.test.mjs twoc2p.test.mjs pay-nl.test.mjs toast.test.mjs redact-url.test.mjs hosted-entry.test.mjs comgate.test.mjs przelewy24.test.mjs tokenex-iframe.test.mjs transbank.test.mjs sumup.test.mjs clover.test.mjs eximbay.test.mjs && node --test preflight-package.test.mjs preflight-collector.test.mjs browser-tests.test.mjs && node --test kernel-native-qualification.test.mjs && node --test ../vault/scripts/recurly-validation/watch-duty-sdk-result.test.mjs && node scripts/verify-pack.mjs",
|
|
34
|
+
"test:browser": "node browser-tests.mjs",
|
|
35
35
|
"check:payment-core": "node scripts/generate-payment-core.mjs --check",
|
|
36
36
|
"check:voice-stream": "node scripts/generate-voice-stream.mjs --check",
|
|
37
37
|
"test:preflight": "node --test preflight-package.test.mjs preflight-collector.test.mjs kernel-native-qualification.test.mjs",
|