@agent-cards/sdk 0.20.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/CHANGELOG.md +51 -0
- package/PREFLIGHT.md +34 -0
- package/README.md +1217 -15
- package/dist/aci.d.ts +173 -0
- package/dist/aci.generated.d.ts +87 -0
- package/dist/aci.generated.js +306 -0
- package/dist/aci.js +371 -0
- package/dist/adyen-merchant-hosted.generated.d.ts +3 -3
- package/dist/adyen-merchant-hosted.generated.js +283 -49
- package/dist/agentcard.d.ts +9 -2
- package/dist/agentcard.js +4 -2
- package/dist/amadeus-checkout.generated.d.ts +57 -0
- package/dist/amadeus-checkout.generated.js +549 -0
- package/dist/amadeus.d.ts +41 -0
- package/dist/amadeus.js +81 -0
- package/dist/builtin-registry.generated.js +1 -1
- package/dist/card-endpoint.d.ts +177 -0
- package/dist/card-endpoint.js +286 -0
- package/dist/card-fields.generated.d.ts +5 -3
- package/dist/card-fields.generated.js +284 -7
- package/dist/cdp.d.ts +6 -1
- package/dist/cdp.js +983 -147
- package/dist/client.d.ts +493 -13
- package/dist/client.js +1100 -82
- package/dist/creditguard.generated.d.ts +79 -0
- package/dist/creditguard.generated.js +662 -0
- package/dist/cse-body.js +11 -1
- package/dist/cybersource-flex.d.ts +183 -0
- package/dist/cybersource-flex.generated.d.ts +92 -0
- package/dist/cybersource-flex.generated.js +689 -0
- package/dist/cybersource-flex.js +275 -0
- package/dist/datatrans.d.ts +96 -0
- package/dist/datatrans.generated.d.ts +64 -0
- package/dist/datatrans.generated.js +426 -0
- package/dist/datatrans.js +178 -0
- package/dist/elavon-converge.d.ts +37 -0
- package/dist/elavon-converge.generated.d.ts +49 -0
- package/dist/elavon-converge.generated.js +439 -0
- package/dist/elavon-converge.js +84 -0
- package/dist/eprotect.d.ts +152 -0
- package/dist/eprotect.generated.d.ts +77 -0
- package/dist/eprotect.generated.js +498 -0
- package/dist/eprotect.js +222 -0
- package/dist/gmo.d.ts +63 -0
- package/dist/gmo.generated.d.ts +60 -0
- package/dist/gmo.generated.js +586 -0
- package/dist/gmo.js +119 -0
- package/dist/hosted-form.d.ts +3 -2
- package/dist/hosted-form.js +3 -2
- package/dist/index.d.ts +19 -3
- package/dist/index.js +6 -1
- package/dist/juspay-gate.d.ts +82 -0
- package/dist/juspay-gate.js +126 -0
- package/dist/juspay.generated.d.ts +89 -0
- package/dist/juspay.generated.js +705 -0
- package/dist/lifecycle.d.ts +62 -6
- package/dist/lifecycle.js +123 -8
- package/dist/merchant-card-endpoints.generated.d.ts +63 -0
- package/dist/merchant-card-endpoints.generated.js +1103 -0
- package/dist/merchant-hosted.d.ts +4 -1
- package/dist/merchant-hosted.js +5 -2
- package/dist/merchant-session-probe.d.ts +48 -0
- package/dist/merchant-session-probe.js +53 -0
- package/dist/merchant-session.generated.d.ts +69 -0
- package/dist/merchant-session.generated.js +919 -0
- package/dist/payrails.d.ts +133 -0
- package/dist/payrails.generated.d.ts +73 -0
- package/dist/payrails.generated.js +596 -0
- package/dist/payrails.js +305 -0
- package/dist/pelecard.d.ts +32 -0
- package/dist/pelecard.generated.d.ts +32 -0
- package/dist/pelecard.generated.js +283 -0
- package/dist/pelecard.js +42 -0
- package/dist/pre-claim.d.ts +84 -3
- package/dist/pre-claim.js +987 -9
- package/dist/preflight-catalog.json +2310 -263
- package/dist/preflight-schemas.json +187 -6
- package/dist/preflight.generated.d.ts +1 -1
- package/dist/preflight.generated.js +247 -4
- package/dist/preparation.d.ts +5 -2
- package/dist/preparation.js +36 -10
- package/dist/prepared-processor.d.ts +86 -5
- package/dist/prepared-processor.js +157 -6
- package/dist/primer.d.ts +53 -0
- package/dist/primer.generated.d.ts +38 -0
- package/dist/primer.generated.js +624 -0
- package/dist/primer.js +82 -0
- package/dist/registry.d.ts +114 -12
- package/dist/registry.js +85 -11
- package/dist/shiji-sts.d.ts +144 -0
- package/dist/shiji-sts.generated.d.ts +72 -0
- package/dist/shiji-sts.generated.js +913 -0
- package/dist/shiji-sts.js +222 -0
- package/dist/stripe-checkout.generated.d.ts +1 -1
- package/dist/stripe-checkout.generated.js +735 -10
- package/dist/stripe-setup.d.ts +16 -0
- package/dist/stripe-setup.js +61 -0
- package/dist/substitutions.generated.js +187 -29
- package/dist/verifone.d.ts +68 -0
- package/dist/verifone.generated.d.ts +51 -0
- package/dist/verifone.generated.js +1401 -0
- package/dist/verifone.js +119 -0
- package/dist/voice-types.d.ts +27 -0
- package/dist/voice.d.ts +6 -1
- package/dist/voice.js +6 -1
- package/dist/wspay.d.ts +41 -0
- package/dist/wspay.generated.d.ts +41 -0
- package/dist/wspay.generated.js +370 -0
- package/dist/wspay.js +65 -0
- package/examples/preflight/kernel-native/inventory.json +1 -1
- package/package.json +3 -3
package/dist/pelecard.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Pelecard Iframe/Redirect 2.0 (psp `pelecard`): the hosted payment page Uman tourist tax
|
|
2
|
+
// (aumantax.com) loads in an iframe, served from gateway21.pelecard.biz (gateway20 on older
|
|
3
|
+
// terminals). The page sends the card in one same-origin jQuery XHR, POST /PaymentGW/Transaction,
|
|
4
|
+
// whose flat JSON body carries the card at CreditCardNumber, CreditCardDate (MMYY) and CvvNumber
|
|
5
|
+
// and names no amount: the merchant's server bound the total, the currency and the action type
|
|
6
|
+
// to the page's TransactionId when it created the payment. This module holds what the SDK
|
|
7
|
+
// decides about that request. The rules themselves are payment-core's (pelecard.generated.ts):
|
|
8
|
+
// the API applies the same ones at create, and the cardholder's device applies them again
|
|
9
|
+
// before it writes a card.
|
|
10
|
+
//
|
|
11
|
+
// The processor ships dark. The API serves the pelecard recognizer only to a build that declares
|
|
12
|
+
// the `pelecard_transaction` capability (client.ts SUPPORTED_CAPABILITIES), and only for an org
|
|
13
|
+
// Agentcard enabled for Pelecard, so an SDK that has not synced, or that runs for any other org,
|
|
14
|
+
// never recognizes a Pelecard host and leaves its requests alone.
|
|
15
|
+
import { PELECARD_TRANSACTION_HOSTS, pelecardTransactionRefusal } from './pelecard.generated.js';
|
|
16
|
+
export const PELECARD_PSP = 'pelecard';
|
|
17
|
+
/** The dark-launch capability the API serves the pelecard recognizer behind. */
|
|
18
|
+
export const PELECARD_CAPABILITY = 'pelecard_transaction';
|
|
19
|
+
/** True when the URL's host is one of Pelecard's two payment page hosts. */
|
|
20
|
+
export function isPelecardHost(url) {
|
|
21
|
+
try {
|
|
22
|
+
return PELECARD_TRANSACTION_HOSTS.includes(new URL(url).hostname);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The pause decision for a card-carrying POST the registry recognized on a Pelecard host. Null
|
|
30
|
+
* when it is the page's own one-time new-card submission, which pauses for approval; otherwise
|
|
31
|
+
* the reason it is refused. It judges the whole request (the exact URL, the page's JSON content
|
|
32
|
+
* type with Payment.js's own `charse0t` spelling, jQuery's X-Requested-With, and a body of the
|
|
33
|
+
* page's own keys) with payment-core's pelecardTransactionRefusal, the check the API runs at
|
|
34
|
+
* create and the device runs before it writes a card. It never passes keep-on-file consent:
|
|
35
|
+
* that waits for an approval that asks the cardholder.
|
|
36
|
+
*/
|
|
37
|
+
export function pelecardRefusal(request) {
|
|
38
|
+
const refusal = pelecardTransactionRefusal({ url: request.url, method: 'POST', headers: request.headers ?? {}, body: request.body ?? '' });
|
|
39
|
+
if (refusal === null)
|
|
40
|
+
return null;
|
|
41
|
+
return refusal === 'keep_on_file' ? 'pelecard_keep_on_file_unsupported' : 'invalid_pelecard_request';
|
|
42
|
+
}
|
package/dist/pre-claim.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { StripeCheckoutGate } from './stripe-checkout.js';
|
|
2
2
|
import { MercadoCheckoutGate } from './mercado-checkout.js';
|
|
3
|
+
import { type JuspayCheckoutGate } from './juspay-gate.js';
|
|
4
|
+
import { DatatransRepeats } from './datatrans.js';
|
|
5
|
+
import { type AciGate } from './aci.js';
|
|
6
|
+
import type { EprotectGate } from './eprotect.js';
|
|
7
|
+
import { type ShijiStsCompanions } from './shiji-sts.js';
|
|
3
8
|
import type { CheckoutLifecycle } from './lifecycle.js';
|
|
4
9
|
import { type MerchantProfile } from './merchant-hosted.js';
|
|
5
10
|
import type { MerchantHandoffWatch } from './merchant-handoff.js';
|
|
11
|
+
import { type CybersourceFlexDecision, type CybersourceFlexPause, type FlexRequest } from './cybersource-flex.js';
|
|
12
|
+
import { type CardEndpointProfile } from './card-endpoint.js';
|
|
13
|
+
import { type PayrailsSessionCapture, type PayrailsSidecar } from './payrails.js';
|
|
14
|
+
import { type VerifoneProfile } from './verifone.js';
|
|
6
15
|
/** The native Stripe step the gate claimed, or null when none was: exactly what StripeCheckoutGate.claim returns. */
|
|
7
16
|
type StripeStep = ReturnType<StripeCheckoutGate['claim']>;
|
|
8
17
|
/** A synthetic response a gate fulfills locally. The effect applies CORS and encoding. */
|
|
@@ -17,16 +26,22 @@ type PreClaimEvent = {
|
|
|
17
26
|
detail?: unknown;
|
|
18
27
|
};
|
|
19
28
|
/** How the request was resolved. continue/answer/abort are already performed by the
|
|
20
|
-
* time the decision is returned; only pause hands work back to the adapter
|
|
29
|
+
* time the decision is returned; only pause hands work back to the adapter, with the
|
|
30
|
+
* CyberSource Flex sidecar when the Flex gate paused it. */
|
|
21
31
|
export type PreClaimDecision = {
|
|
22
32
|
kind: 'continue';
|
|
23
33
|
} | {
|
|
24
34
|
kind: 'abort';
|
|
25
35
|
} | {
|
|
26
36
|
kind: 'answer';
|
|
27
|
-
}
|
|
37
|
+
}
|
|
38
|
+
/** `payrails`: the session key a bound Payrails card save carries onto the create. */
|
|
39
|
+
| {
|
|
28
40
|
kind: 'pause';
|
|
29
41
|
stripeStep: StripeStep;
|
|
42
|
+
cybersourceFlex?: CybersourceFlexPause;
|
|
43
|
+
cardEndpoint?: CardEndpointProfile;
|
|
44
|
+
payrails?: PayrailsSidecar;
|
|
30
45
|
};
|
|
31
46
|
/** The adapter mechanics a gate performs. Each is awaited where the inline code
|
|
32
47
|
* awaited it; none swallow their own transport failure (a gate adds a .catch
|
|
@@ -49,22 +64,45 @@ export interface PreClaimContext {
|
|
|
49
64
|
/** The adapters expose headers and body as getters, read inside the gate that
|
|
50
65
|
* needs them: Playwright's postData() can throw, and Mercado reads the body in
|
|
51
66
|
* its own try, so that failure stops the native checkout instead of rejecting
|
|
52
|
-
* the route handler with the request neither aborted nor reported.
|
|
67
|
+
* the route handler with the request neither aborted nor reported. `body` is ''
|
|
68
|
+
* for a request with no body, and null when the adapter knows the request carries
|
|
69
|
+
* a body it could not read (CDP: hasPostData with no bytes, a blob or a file).
|
|
70
|
+
* Playwright cannot tell those two apart (its postData() is null for both), so
|
|
71
|
+
* attachToPlaywright hands a gate that null for either, and '' for either at an
|
|
72
|
+
* armed Verifone merchant's origin. */
|
|
53
73
|
request: {
|
|
54
74
|
url: string;
|
|
55
75
|
method: string;
|
|
56
76
|
headers: Record<string, string>;
|
|
57
77
|
body: string | null;
|
|
78
|
+
/** The request is a frame's navigation (CDP resourceType Document, Playwright isNavigationRequest). Only the ACI gate reads it. */
|
|
79
|
+
navigation?: boolean;
|
|
58
80
|
};
|
|
81
|
+
/** cardOnFilePolicy: the policy the API served with the request's recognizer (VaultClient); absent reads as none.
|
|
82
|
+
* withoutCard is VaultClient's own (card-fields.js requestWithoutCard); optional so a test double may omit it. */
|
|
59
83
|
vault: {
|
|
60
84
|
isCardRequest(url: string, method?: string): boolean;
|
|
61
85
|
merchantProfileOf?(url: string): MerchantProfile | null;
|
|
86
|
+
verifoneProfileOf?(url: string): VerifoneProfile | null;
|
|
87
|
+
cardOnFilePolicy?(url: string, method?: string): string | null;
|
|
88
|
+
withoutCard?(url: string, body: string | null | undefined): 'continue' | 'refuse' | null;
|
|
62
89
|
};
|
|
63
90
|
guards: {
|
|
64
91
|
matches(url: string, method?: string): boolean;
|
|
65
92
|
};
|
|
66
93
|
mercado: MercadoCheckoutGate;
|
|
67
94
|
stripe: StripeCheckoutGate;
|
|
95
|
+
/** ACI's split card; absent or inert until the registry serves ACI. */
|
|
96
|
+
aci?: AciGate;
|
|
97
|
+
/**
|
|
98
|
+
* Whether this browser sends the body the SDK replaced on a navigation, which removing the
|
|
99
|
+
* placeholder expiry from ACI's classic-mode /payment needs: true on the CDP adapter, which
|
|
100
|
+
* drives Chromium; the Playwright adapter asks the page's engine (aci.ts
|
|
101
|
+
* playwrightReplacesNavigationBody). Absent reads as no, so that /payment is refused.
|
|
102
|
+
*/
|
|
103
|
+
replacesNavigationBody?: () => Promise<boolean>;
|
|
104
|
+
/** Worldpay eProtect's hosts; absent or inert until the registry serves eProtect. */
|
|
105
|
+
eprotect?: EprotectGate;
|
|
68
106
|
readDocumentUrl: () => Promise<string>;
|
|
69
107
|
lifecycle: CheckoutLifecycle;
|
|
70
108
|
/** isEngaged and observeUnprepared are called only for an armed merchant profile's card request or a Fiserv card capture. */
|
|
@@ -90,10 +128,51 @@ export interface PreClaimContext {
|
|
|
90
128
|
/** The paused request itself is gone (Playwright only); CDP returns false. */
|
|
91
129
|
requestInactive: () => boolean;
|
|
92
130
|
awaitingApproval: () => boolean;
|
|
131
|
+
/**
|
|
132
|
+
* The URLs of the frame that sent the request and of every frame above it, sender first, or
|
|
133
|
+
* undefined when the adapter cannot read them: Playwright walks the request's frame up through
|
|
134
|
+
* its parents, CDP reads the frame trees of the paused session and of each session above it.
|
|
135
|
+
* Read only for a Nuvei card request whose Origin or Referer does not already name PPS (see
|
|
136
|
+
* nuveiPreClaim), so no other request waits on it.
|
|
137
|
+
*/
|
|
138
|
+
initiatorFrames?: () => readonly string[] | undefined | Promise<readonly string[] | undefined>;
|
|
93
139
|
/** Set by the Stripe gate; read by the terminal arbiter and carried into a pause. */
|
|
94
140
|
stripeStep: StripeStep;
|
|
95
141
|
/** The merchant-hosted hand-off this attachment made, if any (merchant-handoff.ts). */
|
|
96
142
|
merchantHandoff?: Pick<MerchantHandoffWatch, 'retried'>;
|
|
143
|
+
/**
|
|
144
|
+
* The adapter's reader of the Microform field iframe that sent a request (cybersource-flex.ts):
|
|
145
|
+
* CDP judges from the committed frame URLs it recorded, Playwright from request.frame().url().
|
|
146
|
+
* Absent, no CyberSource Flex request can pause: each one the registry recognizes is refused.
|
|
147
|
+
*/
|
|
148
|
+
cybersourceFlex?: {
|
|
149
|
+
judge(request: FlexRequest): CybersourceFlexDecision | Promise<CybersourceFlexDecision>;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* The attachment's Juspay gate (juspay-gate.ts). Absent, or off because the registry does not
|
|
153
|
+
* serve the Juspay recognizer, and every request to a Juspay host is judged as it was before.
|
|
154
|
+
*/
|
|
155
|
+
juspay?: JuspayCheckoutGate;
|
|
156
|
+
/** The attachment's approved Datatrans answers (the repeat rule, datatrans.ts). Absent: none are kept. */
|
|
157
|
+
datatrans?: DatatransRepeats;
|
|
158
|
+
/** The adapter's identity for the request's frame (CDP frameId, Playwright Frame); undefined when unknown. */
|
|
159
|
+
frame?: unknown;
|
|
160
|
+
/**
|
|
161
|
+
* The Payrails sessions the adapter captured, or null (or absent) when it captures none: the
|
|
162
|
+
* synced registry does not pause Payrails' save, so the Payrails gate defers every request.
|
|
163
|
+
*/
|
|
164
|
+
payrails?: PayrailsSessionCapture | null;
|
|
165
|
+
/**
|
|
166
|
+
* The attachment's Shiji STS getCvvId companion and the adapter's opaque id
|
|
167
|
+
* for the page or frame this request came from (shiji-sts.ts), read when the
|
|
168
|
+
* request is judged (attachToPlaywright reads the frame's document, so it
|
|
169
|
+
* answers asynchronously). Absent, a getCvvId has nothing to bind to and is
|
|
170
|
+
* refused.
|
|
171
|
+
*/
|
|
172
|
+
shijiSts?: {
|
|
173
|
+
companions: ShijiStsCompanions;
|
|
174
|
+
page: () => string | Promise<string>;
|
|
175
|
+
};
|
|
97
176
|
}
|
|
98
177
|
/**
|
|
99
178
|
* The URL an event may name for a request. For an armed merchant profile's
|
|
@@ -104,11 +183,13 @@ export interface PreClaimContext {
|
|
|
104
183
|
*/
|
|
105
184
|
export declare function eventUrl(vault: {
|
|
106
185
|
merchantProfileOf?(url: string): MerchantProfile | null;
|
|
186
|
+
verifoneProfileOf?(url: string): VerifoneProfile | null;
|
|
107
187
|
} | undefined, url: string): string;
|
|
108
188
|
/** A gate returns a decision when it handles the request, undefined to defer to
|
|
109
189
|
* the next gate, or a promise of either when it must do I/O first. */
|
|
110
190
|
export type PreClaimGate = (ctx: PreClaimContext) => PreClaimDecision | undefined | Promise<PreClaimDecision | undefined>;
|
|
111
191
|
export declare const MERCHANT_BODY_UNREADABLE = "the paused request carries no body the SDK could read, so Agentcard cannot tell whether it carries a card";
|
|
192
|
+
export declare const verifonePreClaim: PreClaimGate;
|
|
112
193
|
export declare const fiservPreClaim: PreClaimGate;
|
|
113
194
|
/** The processor gates, in order. A new family adds one entry here; the terminal
|
|
114
195
|
* arbiter runs after all of them and is not part of this list. A gate appended
|