@agent-cards/checkout 0.19.0 → 0.22.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/README.md +6 -753
- package/cdp.d.ts +1 -0
- package/cdp.js +2 -0
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/package.json +33 -33
- package/playwright.d.ts +1 -0
- package/playwright.js +2 -0
- package/preflight.d.ts +1 -0
- package/preflight.js +2 -0
- package/CHANGELOG.md +0 -132
- package/PREFLIGHT.md +0 -312
- package/dist/adyen-merchant-hosted.generated.d.ts +0 -277
- package/dist/adyen-merchant-hosted.generated.js +0 -1902
- package/dist/adyen.generated.d.ts +0 -24
- package/dist/adyen.generated.js +0 -64
- package/dist/attachment.d.ts +0 -11
- package/dist/attachment.js +0 -50
- package/dist/braintree.d.ts +0 -2
- package/dist/braintree.generated.d.ts +0 -10
- package/dist/braintree.generated.js +0 -302
- package/dist/braintree.js +0 -2
- package/dist/builtin-registry.generated.d.ts +0 -2
- package/dist/builtin-registry.generated.js +0 -1
- package/dist/card-fields.generated.d.ts +0 -3
- package/dist/card-fields.generated.js +0 -46
- package/dist/cdp.d.ts +0 -192
- package/dist/cdp.js +0 -2393
- package/dist/checkout-com.generated.d.ts +0 -4
- package/dist/checkout-com.generated.js +0 -183
- package/dist/client.d.ts +0 -849
- package/dist/client.js +0 -1754
- package/dist/cse-body.d.ts +0 -25
- package/dist/cse-body.js +0 -41
- package/dist/fiserv.d.ts +0 -65
- package/dist/fiserv.generated.d.ts +0 -73
- package/dist/fiserv.generated.js +0 -830
- package/dist/fiserv.js +0 -104
- package/dist/hosted-form.d.ts +0 -44
- package/dist/hosted-form.js +0 -78
- package/dist/index.d.ts +0 -18
- package/dist/index.js +0 -10
- package/dist/lifecycle.d.ts +0 -179
- package/dist/lifecycle.js +0 -395
- package/dist/mercado-checkout.d.ts +0 -20
- package/dist/mercado-checkout.generated.d.ts +0 -52
- package/dist/mercado-checkout.generated.js +0 -198
- package/dist/mercado-checkout.js +0 -108
- package/dist/merchant-handoff.d.ts +0 -54
- package/dist/merchant-handoff.js +0 -100
- package/dist/merchant-hosted.d.ts +0 -140
- package/dist/merchant-hosted.js +0 -170
- package/dist/merchant-total-watch.d.ts +0 -115
- package/dist/merchant-total-watch.js +0 -268
- package/dist/merchant-total.d.ts +0 -257
- package/dist/merchant-total.js +0 -383
- package/dist/owned-shop.generated.d.ts +0 -24
- package/dist/owned-shop.generated.js +0 -108
- package/dist/paysafe.generated.d.ts +0 -12
- package/dist/paysafe.generated.js +0 -87
- package/dist/playwright.d.ts +0 -3
- package/dist/playwright.js +0 -3
- package/dist/pre-claim.d.ts +0 -123
- package/dist/pre-claim.js +0 -386
- package/dist/preflight-capabilities.generated.d.ts +0 -1253
- package/dist/preflight-capabilities.generated.js +0 -1929
- package/dist/preflight-catalog.json +0 -4727
- package/dist/preflight-playwright.d.ts +0 -34
- package/dist/preflight-playwright.js +0 -355
- package/dist/preflight-schemas.json +0 -1122
- package/dist/preflight.d.ts +0 -1
- package/dist/preflight.generated.d.ts +0 -1965
- package/dist/preflight.generated.js +0 -570
- package/dist/preflight.js +0 -2
- package/dist/preparation.d.ts +0 -38
- package/dist/preparation.js +0 -191
- package/dist/prepared-processor.d.ts +0 -43
- package/dist/prepared-processor.js +0 -172
- package/dist/recurly.generated.d.ts +0 -1
- package/dist/recurly.generated.js +0 -87
- package/dist/registry.d.ts +0 -121
- package/dist/registry.js +0 -310
- package/dist/spreedly.generated.d.ts +0 -10
- package/dist/spreedly.generated.js +0 -332
- package/dist/stripe-checkout.d.ts +0 -81
- package/dist/stripe-checkout.generated.d.ts +0 -82
- package/dist/stripe-checkout.generated.js +0 -1093
- package/dist/stripe-checkout.js +0 -140
- package/dist/substitute.d.ts +0 -38
- package/dist/substitute.js +0 -23
- package/dist/substitutions.generated.d.ts +0 -11
- package/dist/substitutions.generated.js +0 -818
- package/examples/existing-browser.mjs +0 -63
- package/examples/preflight/classify-direct.mjs +0 -21
- package/examples/preflight/classify-kernel.mjs +0 -30
- package/examples/preflight/inspect-browser.mjs +0 -44
- package/examples/preflight/kernel-native/README.md +0 -112
- package/examples/preflight/kernel-native/documented-adapters.json +0 -113
- package/examples/preflight/kernel-native/inventory.json +0 -233
- package/examples/preflight/kernel-native/qualification.mjs +0 -182
- package/examples/preflight/kernel-profile.empty.json +0 -11
- package/examples/preflight/mollie-hosted.observations.json +0 -23
- package/examples/preflight/mollie-hosted.result.json +0 -103
- package/examples/preflight/stripe-script.direct.result.json +0 -92
- package/examples/preflight/stripe-script.observations.json +0 -16
- package/examples/preflight/stripe-script.result.json +0 -87
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
declare function checkoutComPreparationUrl(environment: any): any;
|
|
2
|
-
declare function checkoutComEnvironment(url: any): "production" | "sandbox" | undefined;
|
|
3
|
-
declare function isPreparedCheckoutComRequest(url: any, method: any, body: any, environment: any, headers: any): boolean;
|
|
4
|
-
export { checkoutComEnvironment, checkoutComPreparationUrl, isPreparedCheckoutComRequest };
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// Generated from @agent-cards/payment-core. Do not edit.
|
|
3
|
-
// artifact-sha256: aaa2f76129db849a23bf8bb44043f5cff2b45e853b16b5de4d61a1f6a10cd392
|
|
4
|
-
// src/checkout-com.js
|
|
5
|
-
var ENDPOINTS = Object.freeze({
|
|
6
|
-
production: ["https://api.checkout.com/tokens", "https://card-acquisition-gateway.checkout.com/tokens"],
|
|
7
|
-
sandbox: ["https://api.sandbox.checkout.com/tokens", "https://card-acquisition-gateway.sandbox.checkout.com/tokens"]
|
|
8
|
-
});
|
|
9
|
-
var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
10
|
-
var own = (value, name) => Object.prototype.hasOwnProperty.call(value, name);
|
|
11
|
-
var keys = (value, allowed) => record(value) && Object.keys(value).every((name) => allowed.includes(name));
|
|
12
|
-
var exact = (pattern, value) => typeof value === "string" && pattern.exec(value)?.[0] === value;
|
|
13
|
-
var text = (value, max = 1024) => typeof value === "string" && value.length <= max && !/[\u0000-\u001f\u007f]/.test(value);
|
|
14
|
-
var digits = (value, min, max) => typeof value === "string" && value.length >= min && value.length <= max && !/[^0-9]/.test(value);
|
|
15
|
-
function readBody(body) {
|
|
16
|
-
if (typeof body !== "string" || !body || body.length > 65536)
|
|
17
|
-
return null;
|
|
18
|
-
let at = 0, nodes = 0;
|
|
19
|
-
const fail = () => {
|
|
20
|
-
throw new Error("invalid_checkout_com_json");
|
|
21
|
-
};
|
|
22
|
-
const space = () => {
|
|
23
|
-
while (" \r\n".includes(body[at] ?? "\0"))
|
|
24
|
-
at++;
|
|
25
|
-
};
|
|
26
|
-
const string = () => {
|
|
27
|
-
space();
|
|
28
|
-
const start = at;
|
|
29
|
-
if (body[at++] !== '"')
|
|
30
|
-
fail();
|
|
31
|
-
while (at < body.length) {
|
|
32
|
-
const char = body[at++];
|
|
33
|
-
if (char === "\\") {
|
|
34
|
-
at++;
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
if (char === '"')
|
|
38
|
-
return JSON.parse(body.slice(start, at));
|
|
39
|
-
}
|
|
40
|
-
return fail();
|
|
41
|
-
};
|
|
42
|
-
const value = (depth) => {
|
|
43
|
-
if (depth > 12 || ++nodes > 1e3)
|
|
44
|
-
fail();
|
|
45
|
-
space();
|
|
46
|
-
const char = body[at];
|
|
47
|
-
if (char === '"')
|
|
48
|
-
return string();
|
|
49
|
-
if (char === "{") {
|
|
50
|
-
at++;
|
|
51
|
-
const result = /* @__PURE__ */ Object.create(null), seen = /* @__PURE__ */ new Set();
|
|
52
|
-
space();
|
|
53
|
-
if (body[at] === "}") {
|
|
54
|
-
at++;
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
while (true) {
|
|
58
|
-
const key = string();
|
|
59
|
-
if (seen.has(key) || ["__proto__", "constructor", "prototype"].includes(key))
|
|
60
|
-
fail();
|
|
61
|
-
seen.add(key);
|
|
62
|
-
space();
|
|
63
|
-
if (body[at++] !== ":")
|
|
64
|
-
fail();
|
|
65
|
-
result[key] = value(depth + 1);
|
|
66
|
-
space();
|
|
67
|
-
const next = body[at++];
|
|
68
|
-
if (next === "}")
|
|
69
|
-
return result;
|
|
70
|
-
if (next !== ",")
|
|
71
|
-
fail();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (char === "[") {
|
|
75
|
-
at++;
|
|
76
|
-
const result = [];
|
|
77
|
-
space();
|
|
78
|
-
if (body[at] === "]") {
|
|
79
|
-
at++;
|
|
80
|
-
return result;
|
|
81
|
-
}
|
|
82
|
-
while (true) {
|
|
83
|
-
result.push(value(depth + 1));
|
|
84
|
-
space();
|
|
85
|
-
const next = body[at++];
|
|
86
|
-
if (next === "]")
|
|
87
|
-
return result;
|
|
88
|
-
if (next !== ",")
|
|
89
|
-
fail();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
for (const literal of ["true", "false", "null"]) {
|
|
93
|
-
if (body.startsWith(literal, at)) {
|
|
94
|
-
at += literal.length;
|
|
95
|
-
return JSON.parse(literal);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
const number = /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?/.exec(body.slice(at));
|
|
99
|
-
if (!number)
|
|
100
|
-
fail();
|
|
101
|
-
at += number[0].length;
|
|
102
|
-
const parsed = Number(number[0]);
|
|
103
|
-
if (!Number.isFinite(parsed))
|
|
104
|
-
fail();
|
|
105
|
-
return parsed;
|
|
106
|
-
};
|
|
107
|
-
try {
|
|
108
|
-
const parsed = value(0);
|
|
109
|
-
space();
|
|
110
|
-
return at === body.length && record(parsed) ? parsed : null;
|
|
111
|
-
}
|
|
112
|
-
catch {
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
function checkoutComPreparationUrl(environment) {
|
|
117
|
-
if (environment !== "production" && environment !== "sandbox")
|
|
118
|
-
throw new Error("unsupported_preparation_environment");
|
|
119
|
-
return ENDPOINTS[environment][1];
|
|
120
|
-
}
|
|
121
|
-
function checkoutComEnvironment(url) {
|
|
122
|
-
if (ENDPOINTS.production.includes(url))
|
|
123
|
-
return "production";
|
|
124
|
-
if (ENDPOINTS.sandbox.includes(url))
|
|
125
|
-
return "sandbox";
|
|
126
|
-
return void 0;
|
|
127
|
-
}
|
|
128
|
-
var ADDRESS_TEXT = ["address_line1", "address_line2", "city", "state", "zip", "name"];
|
|
129
|
-
function billing(value) {
|
|
130
|
-
if (!keys(value, [...ADDRESS_TEXT, "country", "phone"]) || ADDRESS_TEXT.some((key) => own(value, key) && !text(value[key])))
|
|
131
|
-
return false;
|
|
132
|
-
if (own(value, "country") && !exact(/^[A-Za-z]{2}$/, value.country))
|
|
133
|
-
return false;
|
|
134
|
-
return !own(value, "phone") || keys(value.phone, ["country_code", "number"]) && Object.values(value.phone).every((value2) => text(value2, 64));
|
|
135
|
-
}
|
|
136
|
-
function guestCard(value) {
|
|
137
|
-
if (!keys(value, ["type", "number", "expiry_month", "expiry_year", "cvv", "name", "billing_address", "consumer_wallet"]) || value.type !== "card" || !digits(value.number, 12, 19) || !digits(value.cvv, 3, 4) || !Number.isInteger(value.expiry_month) || value.expiry_month < 1 || value.expiry_month > 12 || !Number.isInteger(value.expiry_year) || value.expiry_year < 2e3 || value.expiry_year > 9999 || own(value, "name") && !text(value.name) || own(value, "billing_address") && !billing(value.billing_address))
|
|
138
|
-
return false;
|
|
139
|
-
if (own(value, "consumer_wallet")) {
|
|
140
|
-
const wallet = value.consumer_wallet;
|
|
141
|
-
if (!keys(wallet, ["settings"]) || !keys(wallet.settings, ["preferred_locale"]) || !exact(/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8}){0,3}$/, wallet.settings.preferred_locale))
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
var BROWSER_HEADERS = /* @__PURE__ */ new Set([
|
|
147
|
-
"accept",
|
|
148
|
-
"accept-language",
|
|
149
|
-
"accept-encoding",
|
|
150
|
-
"content-length",
|
|
151
|
-
"origin",
|
|
152
|
-
"referer",
|
|
153
|
-
"user-agent",
|
|
154
|
-
"host",
|
|
155
|
-
"connection",
|
|
156
|
-
"cache-control",
|
|
157
|
-
"pragma",
|
|
158
|
-
"priority",
|
|
159
|
-
"dnt",
|
|
160
|
-
"sec-fetch-dest",
|
|
161
|
-
"sec-fetch-mode",
|
|
162
|
-
"sec-fetch-site",
|
|
163
|
-
"sec-fetch-user"
|
|
164
|
-
]);
|
|
165
|
-
function guestHeaders(headers) {
|
|
166
|
-
if (!record(headers))
|
|
167
|
-
return false;
|
|
168
|
-
const parsed = /* @__PURE__ */ new Map();
|
|
169
|
-
let bytes = 0;
|
|
170
|
-
for (const [name, value] of Object.entries(headers)) {
|
|
171
|
-
const lower = name.toLowerCase();
|
|
172
|
-
if (parsed.size >= 64 || parsed.has(lower) || !exact(/^[A-Za-z0-9-]+$/, name) || !text(value, 8192) || (bytes += name.length + value.length) > 32768)
|
|
173
|
-
return false;
|
|
174
|
-
if (!["content-type", "authorization"].includes(lower) && !BROWSER_HEADERS.has(lower) && !exact(/^sec-ch-ua(?:-[a-z0-9-]+)?$/, lower))
|
|
175
|
-
return false;
|
|
176
|
-
parsed.set(lower, value);
|
|
177
|
-
}
|
|
178
|
-
return exact(/^application\/json(?:;\s*charset=utf-8)?$/i, parsed.get("content-type")) && exact(/^(?:Bearer )?pk_[A-Za-z0-9_-]{1,256}\$?$/, parsed.get("authorization"));
|
|
179
|
-
}
|
|
180
|
-
function isPreparedCheckoutComRequest(url, method, body, environment, headers) {
|
|
181
|
-
return (environment === "production" || environment === "sandbox") && method === "POST" && checkoutComEnvironment(url) === environment && guestHeaders(headers) && guestCard(readBody(body));
|
|
182
|
-
}
|
|
183
|
-
export { checkoutComEnvironment, checkoutComPreparationUrl, isPreparedCheckoutComRequest };
|