@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/client.d.ts
CHANGED
|
@@ -3,10 +3,15 @@ import type { Substitutions } from './substitute.js';
|
|
|
3
3
|
import { type MerchantHostedSubstitutions, type MerchantProfile, type SandboxMerchantDeclaration } from './merchant-hosted.js';
|
|
4
4
|
import { type MerchantTotalApproved, type MerchantTotalCapture } from './merchant-total.js';
|
|
5
5
|
import { type PreparationMode, type PreparationProcessor } from './prepared-processor.js';
|
|
6
|
+
import { type VerifoneProfile, type VerifoneSubstitutions } from './verifone.js';
|
|
7
|
+
import { type MerchantSessionCapture } from './merchant-session-probe.js';
|
|
6
8
|
import { VoiceModule, type VoiceOptions } from './voice.js';
|
|
7
9
|
import { BuyModule } from './buy.js';
|
|
8
10
|
import { RequestRegistry } from './requests.js';
|
|
9
11
|
import type { ApiTransport } from './api-module.js';
|
|
12
|
+
import { type MicroformSidecar } from './cybersource-flex.js';
|
|
13
|
+
import { type CardEndpointSession } from './card-endpoint.js';
|
|
14
|
+
import { type PayrailsSidecar } from './payrails.js';
|
|
10
15
|
export interface PausedRequest {
|
|
11
16
|
url: string;
|
|
12
17
|
method: string;
|
|
@@ -14,11 +19,38 @@ export interface PausedRequest {
|
|
|
14
19
|
body: string;
|
|
15
20
|
/** Captured native Checkout Pro initialization, validated before use. */
|
|
16
21
|
mercado_checkout?: unknown;
|
|
22
|
+
/**
|
|
23
|
+
* CyberSource Flex only: the capture context the card field iframe was loaded with, byte for
|
|
24
|
+
* byte from its URL fragment. The cardholder's device seals the real card under it, so the API
|
|
25
|
+
* verifies it before anything exists. The adapters read it; refused on any other processor.
|
|
26
|
+
*/
|
|
27
|
+
capture_context?: string;
|
|
28
|
+
/** CyberSource Flex only: the Microform fields that loaded and the one that sent this request. */
|
|
29
|
+
microform?: MicroformSidecar;
|
|
30
|
+
/**
|
|
31
|
+
* A reviewed merchant's own card endpoint (see card-endpoint.ts): the profile and the
|
|
32
|
+
* paused request's session, which the adapters capture. Cardholder data: it travels
|
|
33
|
+
* only in the create's `merchant_card_endpoint` member, never in `request`.
|
|
34
|
+
*/
|
|
35
|
+
merchant_card_endpoint?: {
|
|
36
|
+
profile: string;
|
|
37
|
+
session: CardEndpointSession;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A Payrails card save (mode device_encrypt) only: the session key the page's
|
|
41
|
+
* Payrails init payload named (vaultConfiguration.encryptionPublicKey), which
|
|
42
|
+
* the save itself does not carry. The adapters capture it; a caller running
|
|
43
|
+
* its own interception passes it here, and a save without it is refused
|
|
44
|
+
* before anything is created.
|
|
45
|
+
*/
|
|
46
|
+
payrails?: PayrailsSidecar;
|
|
17
47
|
}
|
|
18
48
|
/**
|
|
19
49
|
* The modes this SDK can finish. Asked for on syncRegistry (the API serves
|
|
20
50
|
* only recognizers in these modes, so a request this build cannot complete
|
|
21
|
-
* is never paused) and sent on every create.
|
|
51
|
+
* is never paused) and sent on every create. `device_encrypt`: the adapters
|
|
52
|
+
* capture the Payrails session key the page's init payload names (payrails.ts),
|
|
53
|
+
* and the cardholder's device encrypts and sends the save.
|
|
22
54
|
*/
|
|
23
55
|
export declare const SUPPORTED_MODES: readonly CheckoutMode[];
|
|
24
56
|
/**
|
|
@@ -34,12 +66,109 @@ export declare const SUPPORTED_REGISTRY_FEATURES: readonly string[];
|
|
|
34
66
|
/**
|
|
35
67
|
* Dark-launch capabilities this build can finish. Sent on syncRegistry as
|
|
36
68
|
* ?capabilities= so the API also serves the recognizers gated behind one of
|
|
37
|
-
* these
|
|
69
|
+
* these, and only to an org Agentcard enabled for the processor.
|
|
70
|
+
* `fiserv_card_capture`: Fiserv Commerce Hub's Secure Data Capture card
|
|
38
71
|
* capture, which this build pauses and pays only through a prepared checkout
|
|
39
72
|
* (pre-claim.ts, fiserv.ts). The API serves Fiserv's recognizer only to a build
|
|
40
73
|
* that lists it and only for a company Agentcard turned Fiserv on for, so an older
|
|
41
74
|
* SDK never pauses a capture it cannot finish and no SDK pauses one for a company
|
|
42
75
|
* Fiserv is off for; the API also refuses a Fiserv payment for every such company.
|
|
76
|
+
* `gmo_shared_pk`: GMO token v2's getToken on the shared-key path, which this
|
|
77
|
+
* build judges before it pauses (gmo.ts) and pays only for the amount the
|
|
78
|
+
* agent passes. A gated recognizer never sits in BUILTIN_REGISTRY, so it is
|
|
79
|
+
* paused only after a sync.
|
|
80
|
+
* `capture_context`: CyberSource Flex Microform, whose create carries the capture
|
|
81
|
+
* context this build reads from the card field iframe (cybersource-flex.ts); the API
|
|
82
|
+
* serves Flex's recognizer the same way, only for a company Agentcard turned it on for.
|
|
83
|
+
* A gated recognizer is never in BUILTIN_REGISTRY, so a build reaches it only through a
|
|
84
|
+
* sync that declares its capability.
|
|
85
|
+
* `juspay_txns.v1`: Juspay's card flow (juspay-gate.ts), whose page tokenize
|
|
86
|
+
* this build answers locally and whose /txns it pauses, served and refused by
|
|
87
|
+
* the same rule. A gated recognizer is never in BUILTIN_REGISTRY, so a build
|
|
88
|
+
* reaches it only through a sync that declares its capability.
|
|
89
|
+
* `datatrans_secure_fields_tokenize`: Datatrans Secure Fields' TOKENIZE card
|
|
90
|
+
* post, which this build judges before it pauses, under the card-on-file
|
|
91
|
+
* policy served with the entry, and answers again for a repeat of the same
|
|
92
|
+
* form (datatrans.ts). A gated recognizer never sits in BUILTIN_REGISTRY, so
|
|
93
|
+
* it is paused only after a sync.
|
|
94
|
+
* `authorize_net_dpm_form`: the Authorize.Net Direct Post Method and SIM card
|
|
95
|
+
* form, one form navigation to transact.dll that the cardholder's device submits
|
|
96
|
+
* itself (hosted_form). This build finishes it with the hosted_form flow it
|
|
97
|
+
* already speaks, holds the bare endpoint the entry names (bareEndpoint in
|
|
98
|
+
* findRecognizer), and reads the form's keys without regard to case
|
|
99
|
+
* (card-fields.js). The API serves it, like Fiserv's, only to an org Agentcard
|
|
100
|
+
* enabled for that processor; every other org is served the ungated catalog.
|
|
101
|
+
* `pelecard_transaction`: Pelecard's card submission, which this build judges
|
|
102
|
+
* before it pauses (pelecard.ts) and pays only for the amount the agent passes.
|
|
103
|
+
* Declaring it is not enough: the API serves a gated recognizer only to an org
|
|
104
|
+
* Agentcard has enabled for that processor, so for every other org this build
|
|
105
|
+
* syncs the same catalog as one that declares nothing and leaves the processor's
|
|
106
|
+
* requests alone. A gated recognizer never sits in BUILTIN_REGISTRY, so it is
|
|
107
|
+
* paused only after a sync.
|
|
108
|
+
* `aci_split_card.v1`: ACI's COPYandPAY widget, whose card reaches ACI as
|
|
109
|
+
* several requests to one checkout. This build pauses the card-number request
|
|
110
|
+
* for a prepared checkout, holds the page's own CVC and expiry requests and
|
|
111
|
+
* answers them with that request's answer, and continues the page's /payment
|
|
112
|
+
* submission once, with the placeholder expiry removed (aci.ts). A gated
|
|
113
|
+
* recognizer is never in BUILTIN_REGISTRY, so a build reaches it only through a
|
|
114
|
+
* sync that declares its capability, and whether an org may pay through it
|
|
115
|
+
* stays the API's decision.
|
|
116
|
+
* `creditguard_pps_process`: CreditGuard's hosted payment page (Hyp PPS), whose
|
|
117
|
+
* card submit this build pays only under a prepared checkout that names the
|
|
118
|
+
* framed page (prepare({ psp: 'creditguard', environment, paymentPageUrl })). The
|
|
119
|
+
* API serves CreditGuard's recognizer on the same terms as Fiserv's.
|
|
120
|
+
* `primer_payment_instruments`: Primer's card tokenization, which this build
|
|
121
|
+
* judges before it pauses (primer.ts) and hands back to the page only as a
|
|
122
|
+
* single-use token. A merchant's client session can save the card after the
|
|
123
|
+
* payment with no sign in that request, so the API creates a Primer
|
|
124
|
+
* authorization only for a test-mode client and refuses a live one (400
|
|
125
|
+
* invalid_primer_request, live_keep_on_file) until the cardholder can consent
|
|
126
|
+
* to that save; this build then aborts the paused request with nothing sent. A
|
|
127
|
+
* gated recognizer never sits in BUILTIN_REGISTRY, so it is paused only after a
|
|
128
|
+
* sync.
|
|
129
|
+
* `payrails_device_encrypt`: Payrails' card-form save, which this build pauses
|
|
130
|
+
* only once it has bound the save to a captured session (payrails.ts). A gated
|
|
131
|
+
* recognizer never sits in BUILTIN_REGISTRY, so it is paused only after a sync.
|
|
132
|
+
* `converge_hpp_process`: Elavon Converge's Hosted Payment Page card request
|
|
133
|
+
* (elavon-converge.ts), paused in token mode and judged by the pre-claim gate.
|
|
134
|
+
* A gated recognizer never sits in BUILTIN_REGISTRY, so it is paused only after a
|
|
135
|
+
* sync, and the API also refuses a Converge payment for every company the
|
|
136
|
+
* processor is off for.
|
|
137
|
+
* `worldpay_eprotect_jsonp`: Worldpay eProtect, whose card rides in the query of
|
|
138
|
+
* a JSONP <script> GET that this build pauses, binds to a prepared checkout and
|
|
139
|
+
* answers with the registration in the script's own callback (eprotect.ts). A
|
|
140
|
+
* gated recognizer is never in BUILTIN_REGISTRY, so a build reaches either only
|
|
141
|
+
* through a sync that declares its capability, and the API serves it on that
|
|
142
|
+
* sync only for a company it has turned the processor on for.
|
|
143
|
+
* `wspay_confirm`: WSPay Components' card confirm, which this build judges
|
|
144
|
+
* before it pauses (wspay.ts) and pays only for the amount the agent passes.
|
|
145
|
+
* The API serves a gated recognizer only to a build that lists its capability
|
|
146
|
+
* and only for a company Agentcard turned that processor on for, so an older
|
|
147
|
+
* SDK never pauses a request it cannot finish and no SDK pauses one for a
|
|
148
|
+
* company the processor is off for; the API also refuses that processor's
|
|
149
|
+
* payment for every such company. A gated recognizer never sits in
|
|
150
|
+
* BUILTIN_REGISTRY, so it is paused only after a sync.
|
|
151
|
+
* `shiji_sts_pinned_key`: this build swaps Shiji STS's ciphertexts at the body
|
|
152
|
+
* root under the pinned key, binds the getCvvId companion to the getTokenId it
|
|
153
|
+
* continued, and refuses every other Shiji request in the browser (shiji-sts.ts).
|
|
154
|
+
* The API serves it on the same terms, only for a company Agentcard turned Shiji
|
|
155
|
+
* STS on for.
|
|
156
|
+
* `amadeus_checkout_actions.v1`: Amadeus Checkout (the Checkout Web SDK add and
|
|
157
|
+
* the Data Collection Page store), served on the same terms. This build lets every
|
|
158
|
+
* other action on those URLs through without claiming a preparation, so the page's
|
|
159
|
+
* own `load` never spends or blocks one, takes the card request only through a
|
|
160
|
+
* prepared checkout bound to the approved page's host, and fails a paused SDK add
|
|
161
|
+
* the device has not started 20 seconds after the pause (AMADEUS_SEND_WINDOW_MS).
|
|
162
|
+
* `worldline_mycheckout_form`: Worldline MyCheckout's card form (DHL Express),
|
|
163
|
+
* a top-level form POST this build holds like Tranzila's (mode hosted_form) and
|
|
164
|
+
* answers with the submission notice once the cardholder's device submitted the
|
|
165
|
+
* form itself. The page's cancel and its other payment methods on the same URL
|
|
166
|
+
* carry no card and continue untouched. The API serves the recognizer only to a
|
|
167
|
+
* build that lists it and only for a company Agentcard turned it on for.
|
|
168
|
+
* `verifone_card_capture`: a reviewed Verifone merchant's own card request (a
|
|
169
|
+
* verifone.js blob sent to the merchant's server), which this build pauses and pays
|
|
170
|
+
* only through a prepared checkout (verifone.ts); the API serves the Verifone
|
|
171
|
+
* profiles only to a build that lists it, for a company Agentcard turned Verifone on for.
|
|
43
172
|
*/
|
|
44
173
|
export declare const SUPPORTED_CAPABILITIES: readonly string[];
|
|
45
174
|
/**
|
|
@@ -58,6 +187,17 @@ export declare const SUPPORTED_CAPABILITIES: readonly string[];
|
|
|
58
187
|
export type AmountAuthority = 'processor' | 'agent' | 'page' | 'none';
|
|
59
188
|
/** An integer in the smallest unit, or a decimal string in normal units with a point; nothing else. */
|
|
60
189
|
export declare function validAmountInput(amount: unknown): amount is number | string;
|
|
190
|
+
/** Digits after the point when the API reads an amount in `currency`. */
|
|
191
|
+
export declare function amountDigits(currency: string): 0 | 2 | 3;
|
|
192
|
+
/**
|
|
193
|
+
* Why an amount is refused, worded for the agent that sent it: the rule, the value it passed, and
|
|
194
|
+
* each amount that value can mean, in the forms the API accepts. An agent told only the rule sends
|
|
195
|
+
* the same value again, and a tool harness that serializes every argument as text turns 2667 into
|
|
196
|
+
* "2667" on each try. A value that does not read as a price (long, or more digits than any amount)
|
|
197
|
+
* is described and never echoed, so a card number typed into the wrong field cannot reach a log
|
|
198
|
+
* line. A value below zero is named as such and never offered back as a positive amount.
|
|
199
|
+
*/
|
|
200
|
+
export declare function amountRefusal(amount: unknown, currency?: unknown): string;
|
|
61
201
|
/** How an existing authorization is being handled; omitted by older APIs. */
|
|
62
202
|
export interface ExecutionMetadata {
|
|
63
203
|
executionMode?: 'user_approval' | 'autopilot';
|
|
@@ -121,6 +261,14 @@ export interface CseReplay extends ExecutionMetadata {
|
|
|
121
261
|
kind?: undefined;
|
|
122
262
|
authorizationId: string;
|
|
123
263
|
substitutions: Substitutions;
|
|
264
|
+
/**
|
|
265
|
+
* Shiji STS only: the getCvvId keySequence values the API reviewed as the booking page's own and
|
|
266
|
+
* served beside the set (`shiji_sts_companion`). The adapters bind the companion getCvvId to them
|
|
267
|
+
* (shiji-sts.ts ShijiStsCompanions), so the device's CVV goes under no other key.
|
|
268
|
+
*/
|
|
269
|
+
shijiStsCompanion?: Readonly<{
|
|
270
|
+
keySequences: readonly string[];
|
|
271
|
+
}>;
|
|
124
272
|
amountAuthority?: AmountAuthority;
|
|
125
273
|
}
|
|
126
274
|
/**
|
|
@@ -157,6 +305,29 @@ export interface MerchantHostedReplay extends ExecutionMetadata {
|
|
|
157
305
|
merchantTotal?: MerchantTotalApproved;
|
|
158
306
|
amountAuthority?: AmountAuthority;
|
|
159
307
|
}
|
|
308
|
+
/**
|
|
309
|
+
* The cse flow at a reviewed Verifone merchant's OWN endpoint (verifone.ts): the
|
|
310
|
+
* cardholder's device encrypted the card with verifone.js's format under the key
|
|
311
|
+
* Agentcard pinned for that merchant, and nothing was sent. The paused request
|
|
312
|
+
* continues from this browser with the device's blob in place of the page's
|
|
313
|
+
* (substituteVerifoneBody), and only when the live body still hashes to
|
|
314
|
+
* `bodySha256`, the body the API checked at create. The merchant's server charges
|
|
315
|
+
* the card and answers its own page; its order state is the outcome. Only a
|
|
316
|
+
* prepared checkout pays one, never Autopilot.
|
|
317
|
+
*/
|
|
318
|
+
export interface VerifoneReplay extends ExecutionMetadata {
|
|
319
|
+
mode: 'cse';
|
|
320
|
+
kind: 'verifone';
|
|
321
|
+
authorizationId: string;
|
|
322
|
+
/** The reviewed Verifone profile the approval pays. */
|
|
323
|
+
profile: string;
|
|
324
|
+
substitutions: VerifoneSubstitutions;
|
|
325
|
+
/** SHA-256 (lowercase hex) of the paused body the API checked at create. */
|
|
326
|
+
bodySha256: string;
|
|
327
|
+
/** When the API stops serving this blob, if it said. */
|
|
328
|
+
substitutionsExpiresAt: string | null;
|
|
329
|
+
amountAuthority?: AmountAuthority;
|
|
330
|
+
}
|
|
160
331
|
/**
|
|
161
332
|
* The hosted_form flow (Tranzila): the cardholder's device rebuilt the
|
|
162
333
|
* processor's own form with the real card and submitted it itself, top-level,
|
|
@@ -185,8 +356,54 @@ export interface HostedFormReplay extends ExecutionMetadata {
|
|
|
185
356
|
submittedAt: string;
|
|
186
357
|
amountAuthority?: AmountAuthority;
|
|
187
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* The card_endpoint flow: a reviewed merchant's own card endpoint. The cardholder's
|
|
361
|
+
* device sent the merchant's card request itself, with the real card and the paused
|
|
362
|
+
* request's session, and reported the merchant's answer, which the adapters hand to
|
|
363
|
+
* the paused request: `status`, the profile's answer `headers`, and `body`, with
|
|
364
|
+
* `setCookies` written into the agent's browser on the endpoint host, or on the parent
|
|
365
|
+
* domain of a cookie the browser already holds there, which the write replaces.
|
|
366
|
+
*
|
|
367
|
+
* `withheld` is set when the device found the card in the answer, or a compressed
|
|
368
|
+
* stream it cannot read: nothing of the answer travels, the adapters answer the paused
|
|
369
|
+
* request with a fixed error, and the outcome is unknown until the merchant order is
|
|
370
|
+
* checked. The card request was sent either way. Amounts are not reconciled on this
|
|
371
|
+
* mode: the agent's amount is the only authority.
|
|
372
|
+
*/
|
|
373
|
+
export interface CardEndpointReplay extends ExecutionMetadata {
|
|
374
|
+
mode: 'card_endpoint';
|
|
375
|
+
authorizationId: string;
|
|
376
|
+
/** The reviewed profile the device paid. */
|
|
377
|
+
profile: string;
|
|
378
|
+
/** The merchant's HTTP status for the card request. */
|
|
379
|
+
status: number;
|
|
380
|
+
headers: Record<string, string>;
|
|
381
|
+
setCookies: string[];
|
|
382
|
+
body: string;
|
|
383
|
+
withheld: 'card_in_response' | 'unreadable_in_response' | null;
|
|
384
|
+
amountAuthority?: AmountAuthority;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* The device_encrypt flow (Payrails): the cardholder's device encrypted the
|
|
388
|
+
* real card under the session key the page's init payload named and sent the
|
|
389
|
+
* save to Payrails itself. This is Payrails' 201 for that save, rebuilt from an
|
|
390
|
+
* allow-list (the instrument's identifiers, its status, the network, the BIN
|
|
391
|
+
* cut to six digits, the last four, the expiry, the holder name and the
|
|
392
|
+
* fingerprint), to replay into the paused request as in the token flow. The
|
|
393
|
+
* ciphertext the device made never reaches the runtime or the page. Never an
|
|
394
|
+
* autopilot result: autopilot refuses this mode.
|
|
395
|
+
*/
|
|
396
|
+
export interface DeviceEncryptReplay extends ExecutionMetadata {
|
|
397
|
+
mode: 'device_encrypt';
|
|
398
|
+
authorizationId: string;
|
|
399
|
+
status: number;
|
|
400
|
+
headers: Record<string, string>;
|
|
401
|
+
/** Body to hand back to the browser, verbatim. */
|
|
402
|
+
body: string;
|
|
403
|
+
amountAuthority?: AmountAuthority;
|
|
404
|
+
}
|
|
188
405
|
/** What authorize() resolves with; branch on `mode` (absent means token). */
|
|
189
|
-
export type ReplayResponse = TokenReplay | CseReplay | MerchantHostedReplay | HostedFormReplay;
|
|
406
|
+
export type ReplayResponse = TokenReplay | CseReplay | MerchantHostedReplay | VerifoneReplay | HostedFormReplay | CardEndpointReplay | DeviceEncryptReplay;
|
|
190
407
|
export interface PrepareCheckoutOptions {
|
|
191
408
|
psp: PreparationProcessor;
|
|
192
409
|
/** The processor environment, independent of your Agentcard client's mode. */
|
|
@@ -203,8 +420,34 @@ export interface PrepareCheckoutOptions {
|
|
|
203
420
|
* approve a payment to the merchant that key belongs to, so the checkout's `merchant`
|
|
204
421
|
* must be that merchant's name (`Agentcard sandbox` for `agentcard_sandbox`), and the
|
|
205
422
|
* one card capture this preparation pays must carry an envelope under that key.
|
|
423
|
+
*
|
|
424
|
+
* A Verifone checkout (psp 'verifone'): the id of the Verifone profile Agentcard
|
|
425
|
+
* reviewed for the merchant, which this client must have armed and enabled
|
|
426
|
+
* (syncRegistry), in the profile's own environment. The cardholder is shown the
|
|
427
|
+
* merchant the profile names, whatever label `merchant` carries, and the profile's
|
|
428
|
+
* reviewed card request is the one request this preparation pays.
|
|
206
429
|
*/
|
|
207
430
|
merchantProfile?: string;
|
|
431
|
+
/**
|
|
432
|
+
* CreditGuard only, and required there: the address of CreditGuard's hosted
|
|
433
|
+
* payment page the checkout framed, the iframe's `src` as CreditGuard handed
|
|
434
|
+
* it to the merchant (https://pps.creditguard.co.il/?txId=<transaction id>;
|
|
435
|
+
* pps2 is production too, ppsuat is the sandbox). Agentcard reads that
|
|
436
|
+
* transaction from CreditGuard before the cardholder is asked, and only that
|
|
437
|
+
* transaction's card submit can use the preparation.
|
|
438
|
+
*/
|
|
439
|
+
paymentPageUrl?: string;
|
|
440
|
+
/**
|
|
441
|
+
* Worldpay eProtect only, and required there: the merchant's eProtect
|
|
442
|
+
* paypageId, 1 to 64 letters and digits. It names the Worldpay merchant the
|
|
443
|
+
* card registration is for, which is also the merchant Worldpay lets charge
|
|
444
|
+
* the card again, so it is fixed before the page sends anything: a
|
|
445
|
+
* registration naming another paypageId never spends the approval. Read it off
|
|
446
|
+
* the checkout before Pay (the Worldpay iframe's `payframe_<paypageId>_...`
|
|
447
|
+
* URL, or the merchant's eProtect configuration). Refused on every other
|
|
448
|
+
* processor.
|
|
449
|
+
*/
|
|
450
|
+
paypageId?: string;
|
|
208
451
|
signal?: AbortSignal;
|
|
209
452
|
}
|
|
210
453
|
export interface PrepareCheckoutInput extends PrepareCheckoutOptions {
|
|
@@ -247,11 +490,22 @@ export interface PreparedCheckout {
|
|
|
247
490
|
endpoint: string;
|
|
248
491
|
clientKey: string;
|
|
249
492
|
}>;
|
|
493
|
+
/** CreditGuard only: the hosted payment page whose transaction the cardholder approved. */
|
|
494
|
+
readonly paymentPageUrl?: string;
|
|
495
|
+
/** Worldpay eProtect only: the paypageId the API confirmed, the one merchant whose registration may spend this approval. */
|
|
496
|
+
readonly paypageId?: string;
|
|
250
497
|
}
|
|
251
498
|
export declare class CheckoutPreparationError extends Error {
|
|
252
499
|
preparationId: string | null;
|
|
253
500
|
reason: string;
|
|
254
|
-
|
|
501
|
+
/**
|
|
502
|
+
* The API's own reason code under `reason`, when it gave one: a CreditGuard
|
|
503
|
+
* transaction refused as `creditguard_transaction_refused` names what the
|
|
504
|
+
* Vault cannot finish here (`three_d_secure`, `otp`, `installments`, ...).
|
|
505
|
+
*/
|
|
506
|
+
readonly detail?: string;
|
|
507
|
+
/** `explanation` follows the reason in the message: what the caller passed and what to send instead. */
|
|
508
|
+
constructor(preparationId: string | null, reason: string, detail?: string, explanation?: string);
|
|
255
509
|
}
|
|
256
510
|
export interface AuthorizeInput extends ExecutionMetadata {
|
|
257
511
|
/** Native Checkout defaults to TEST; LIVE requires this explicit opt-in. */
|
|
@@ -273,6 +527,13 @@ export interface AuthorizeInput extends ExecutionMetadata {
|
|
|
273
527
|
* smallest unit is refused with nothing charged (an AmountMismatchError;
|
|
274
528
|
* `stage` says which check). Agentcard derives the display string; you
|
|
275
529
|
* never send one. Both or neither: one without the other is refused.
|
|
530
|
+
* Required when the processor's request names no amount at all (GMO,
|
|
531
|
+
* Pelecard, WSPay): then this pair is what the cardholder approves, and a
|
|
532
|
+
* request without it throws AmountRequiredError before anything is created.
|
|
533
|
+
* No Pelecard answer states an amount, so for Pelecard the page's total
|
|
534
|
+
* (`pageAmount`) is required beside it: see the README's Pelecard section.
|
|
535
|
+
* WSPay's answer is compared with it only when that answer names an amount;
|
|
536
|
+
* a 3-D Secure step names none (see the README's WSPay section).
|
|
276
537
|
*/
|
|
277
538
|
amount?: number | string;
|
|
278
539
|
currency?: string;
|
|
@@ -280,6 +541,9 @@ export interface AuthorizeInput extends ExecutionMetadata {
|
|
|
280
541
|
* The total read off the checkout page, the lowest authority: used only
|
|
281
542
|
* when neither the processor's request nor your hint names an amount. The
|
|
282
543
|
* adapters fill it from `[data-agentcard-amount]` when a page carries one.
|
|
544
|
+
* Required for Pelecard, whose request names no amount: the API holds the
|
|
545
|
+
* agent's pair to it, and a Pelecard request without it throws
|
|
546
|
+
* PageAmountRequiredError before anything is created.
|
|
283
547
|
*/
|
|
284
548
|
pageAmount?: {
|
|
285
549
|
amount: number;
|
|
@@ -337,6 +601,51 @@ export declare class UnsupportedModeError extends Error {
|
|
|
337
601
|
mode: string;
|
|
338
602
|
constructor(mode: string);
|
|
339
603
|
}
|
|
604
|
+
/**
|
|
605
|
+
* The recognizer is gated behind a dark-launch capability this SDK build does not
|
|
606
|
+
* declare (SUPPORTED_CAPABILITIES), so it cannot send what that processor's create
|
|
607
|
+
* needs. Thrown locally before any create or prompt, and terminal. A registry the
|
|
608
|
+
* API served never holds such an entry (it serves a gated one only to a build that
|
|
609
|
+
* declares it); a hand-built one can.
|
|
610
|
+
*/
|
|
611
|
+
export declare class UnsupportedCapabilityError extends Error {
|
|
612
|
+
capability: string;
|
|
613
|
+
constructor(capability: string);
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* placeholderCard() found no stored card to describe (`card_not_found`), the stored card's
|
|
617
|
+
* network has no documented placeholder number (`brand_unsupported`), or the stored card
|
|
618
|
+
* carries no usable expiry (`expiry_unknown`). Nothing was created and nothing was charged.
|
|
619
|
+
*/
|
|
620
|
+
export declare class PlaceholderCardError extends Error {
|
|
621
|
+
reason: 'card_not_found' | 'brand_unsupported' | 'expiry_unknown';
|
|
622
|
+
constructor(reason: 'card_not_found' | 'brand_unsupported' | 'expiry_unknown');
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* What the agent types into a checkout so the page's own card facts match the stored card
|
|
626
|
+
* that pays: a documented test number of the same network, a placeholder security code of that
|
|
627
|
+
* network's length, and the stored card's real expiry. CyberSource Flex merchants post the brand
|
|
628
|
+
* the card field detected from the typed number and the expiry typed into their own fields beside
|
|
629
|
+
* the token (Sonos, Amtrak), so a mismatch there fails the merchant's payment.
|
|
630
|
+
*/
|
|
631
|
+
export interface PlaceholderCard {
|
|
632
|
+
/**
|
|
633
|
+
* The stored card these facts describe (GET /api/v2/vault_cards). Pass it as `cardId` to
|
|
634
|
+
* attachToCdp, attachToPlaywright or authorize(): the approval page then preselects this card.
|
|
635
|
+
* Without it the page preselects its own choice, which can be another card.
|
|
636
|
+
*/
|
|
637
|
+
readonly cardId: string;
|
|
638
|
+
/** Its network, as GET /api/v2/vault_cards names it. */
|
|
639
|
+
readonly brand: string;
|
|
640
|
+
/** A documented test card number of that network. Never a real card: the device supplies the real one. */
|
|
641
|
+
readonly number: string;
|
|
642
|
+
/** A placeholder security code of the length that network uses. */
|
|
643
|
+
readonly securityCode: string;
|
|
644
|
+
/** The stored card's expiry month, two digits ("04"). */
|
|
645
|
+
readonly expiryMonth: string;
|
|
646
|
+
/** The stored card's expiry year, four digits ("2031"). */
|
|
647
|
+
readonly expiryYear: string;
|
|
648
|
+
}
|
|
340
649
|
/**
|
|
341
650
|
* The recognizer says this processor is preparation-required, and no preparation
|
|
342
651
|
* was passed. Its card may be sent only after the cardholder approved a
|
|
@@ -349,6 +658,38 @@ export declare class PreparationRequiredError extends Error {
|
|
|
349
658
|
psp: string;
|
|
350
659
|
constructor(psp: string);
|
|
351
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* The paused request names no amount and none was passed. A GMO card token
|
|
663
|
+
* request carries no amount (the merchant's server charges the token later),
|
|
664
|
+
* and neither does a Pelecard card submission (the merchant's server bound it
|
|
665
|
+
* to the payment page when it created it) or a WSPay confirm (WSPay fixed it
|
|
666
|
+
* when the merchant's server created the payment), so the `amount` and
|
|
667
|
+
* `currency` you pass are what the cardholder approves, and for WSPay the
|
|
668
|
+
* figure the API compares with WSPay's answer when that answer names one (a
|
|
669
|
+
* 3-D Secure step names none). Thrown locally before any create or
|
|
670
|
+
* prompt, and terminal: the same request without an amount fails the same
|
|
671
|
+
* way. The API answers 400 amount_required for the same case. A page total
|
|
672
|
+
* (`pageAmount`) does not count.
|
|
673
|
+
*/
|
|
674
|
+
export declare class AmountRequiredError extends Error {
|
|
675
|
+
psp: string;
|
|
676
|
+
readonly code: "amount_required";
|
|
677
|
+
constructor(psp: string);
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* The paused request names no amount, and the total its payment page shows
|
|
681
|
+
* (`pageAmount`) was not passed. Pelecard's merchant bound the total to the
|
|
682
|
+
* payment page when it created it, and no Pelecard request or answer states
|
|
683
|
+
* it, so the page's total is the one figure that ties the `amount` the
|
|
684
|
+
* cardholder approves to what the page charges. Thrown locally before any
|
|
685
|
+
* create or prompt; the API answers 400 page_amount_required for the same
|
|
686
|
+
* case. Not terminal: the page's next submission reads the total again.
|
|
687
|
+
*/
|
|
688
|
+
export declare class PageAmountRequiredError extends Error {
|
|
689
|
+
psp: string;
|
|
690
|
+
readonly code: "page_amount_required";
|
|
691
|
+
constructor(psp: string);
|
|
692
|
+
}
|
|
352
693
|
export declare class ApprovalTimeoutError extends Error {
|
|
353
694
|
constructor(ms: number);
|
|
354
695
|
}
|
|
@@ -609,9 +950,20 @@ export declare class CheckoutApiError extends Error {
|
|
|
609
950
|
* already has, or already answered, the prompt for this submission, and
|
|
610
951
|
* once that prior authorization is declined or expired the same form is a
|
|
611
952
|
* new question. The adapters quiet the page's re-post the way they quiet a
|
|
612
|
-
* decline instead of latching the attachment.
|
|
953
|
+
* decline instead of latching the attachment. NOT a stale form fingerprint
|
|
954
|
+
* either (isStaleFingerprint): the bytes of that form are refused for good,
|
|
955
|
+
* but the merchant's page renders a fresh fingerprint on reload, so the
|
|
956
|
+
* page's next form is a new question and is quieted the same way.
|
|
613
957
|
*/
|
|
614
958
|
get permanent(): boolean;
|
|
959
|
+
/**
|
|
960
|
+
* True for a 400 `hosted_form_field_refused` whose reason is
|
|
961
|
+
* `stale_fingerprint`: an Authorize.Net DPM or SIM form signed more than 40
|
|
962
|
+
* minutes before the create, or ahead of the API's clock. Authorize.Net
|
|
963
|
+
* would refuse that fingerprint itself, and the page renders a fresh one
|
|
964
|
+
* when it reloads, so the refusal holds for this form only.
|
|
965
|
+
*/
|
|
966
|
+
get isStaleFingerprint(): boolean;
|
|
615
967
|
}
|
|
616
968
|
/** The client-credentials exchange was refused: the RFC 6749 error, with the status the token endpoint answered. */
|
|
617
969
|
export declare class CheckoutAuthError extends Error {
|
|
@@ -623,6 +975,13 @@ export declare class CheckoutAuthError extends Error {
|
|
|
623
975
|
* A URL as it may appear in an error message: origin + path only. A paused
|
|
624
976
|
* request's URL can carry a client secret in its query string, and error
|
|
625
977
|
* messages travel further than anyone intends (onEvent, logs, crash reports).
|
|
978
|
+
* CreditGuard puts one in the path: on its hosts the transaction id after
|
|
979
|
+
* /txn/ is that transaction's only credential (payment-core's creditguard.js),
|
|
980
|
+
* so it reads {txId}, as does any other id-shaped segment there.
|
|
981
|
+
* On the Monri and WSPay hosts the secret is a path segment, so it is replaced
|
|
982
|
+
* with `{client_secret}`: https://proxy.wspay.biz/v2/payment/{client_secret}/confirm.
|
|
983
|
+
* A string that is not a URL keeps the part before any `?` or `#`, with the
|
|
984
|
+
* same segment masked.
|
|
626
985
|
*/
|
|
627
986
|
export declare function redactUrl(raw: string): string;
|
|
628
987
|
export interface VaultClientOptions {
|
|
@@ -706,6 +1065,12 @@ export declare class VaultClient {
|
|
|
706
1065
|
* in 'observe' until a sync reads that the API enabled it (armServedProfiles).
|
|
707
1066
|
*/
|
|
708
1067
|
private merchantProfiles;
|
|
1068
|
+
/**
|
|
1069
|
+
* The reviewed Verifone profiles this client arms: only the ones the API served on the
|
|
1070
|
+
* last sync, which it serves only to a company Agentcard turned Verifone on for
|
|
1071
|
+
* (armServedVerifoneProfiles). None before a sync.
|
|
1072
|
+
*/
|
|
1073
|
+
private verifoneProfiles;
|
|
709
1074
|
/** This client's own sandbox declarations (sandboxMerchants), armed at construction, one per profile. */
|
|
710
1075
|
private readonly declaredProfiles;
|
|
711
1076
|
private readonly preparations;
|
|
@@ -757,10 +1122,26 @@ export declare class VaultClient {
|
|
|
757
1122
|
find: (url: string) => Recognizer | null;
|
|
758
1123
|
};
|
|
759
1124
|
private mergedRegistry;
|
|
760
|
-
/**
|
|
1125
|
+
/**
|
|
1126
|
+
* The recogniser that claims a card request, or null; what a paused request names as
|
|
1127
|
+
* `recognizer`. A POST to a recognised endpoint, or for a recognizer whose card request is a
|
|
1128
|
+
* GET (Worldpay eProtect) that exact GET, query included.
|
|
1129
|
+
*/
|
|
761
1130
|
recognizerOf(url: string, method?: string): Recognizer | null;
|
|
762
1131
|
/** Refresh recognizers from the API so new PSPs work without a redeploy. */
|
|
763
1132
|
syncRegistry(): Promise<void>;
|
|
1133
|
+
/**
|
|
1134
|
+
* The armed Verifone profile whose endpoint origin this URL is on, with its status on
|
|
1135
|
+
* this client; null for any other URL, and for every URL before a sync served one. The
|
|
1136
|
+
* adapters pause every request to that origin and judge it with
|
|
1137
|
+
* classifyVerifoneProfileRequest. A raw runtime that pauses one must never continue a
|
|
1138
|
+
* body carrying a verifone.js blob there unless authorize() paid it.
|
|
1139
|
+
*/
|
|
1140
|
+
verifoneProfileOf(url: string): VerifoneProfile | null;
|
|
1141
|
+
/** The armed Verifone profile with this id, or null. */
|
|
1142
|
+
verifoneProfile(id: string): VerifoneProfile | null;
|
|
1143
|
+
/** Fetch.enable globs for every armed Verifone profile's endpoint origins; none before a sync served one. */
|
|
1144
|
+
verifoneProfileUrlPatterns(): string[];
|
|
764
1145
|
/**
|
|
765
1146
|
* The reviewed Adyen merchant profile whose card endpoint (or a sibling of it,
|
|
766
1147
|
* the same path under another query) this URL is, with its status on this
|
|
@@ -780,21 +1161,52 @@ export declare class VaultClient {
|
|
|
780
1161
|
* after syncRegistry; a sync changes only a profile's status.
|
|
781
1162
|
*/
|
|
782
1163
|
merchantProfileUrlPatterns(): string[];
|
|
783
|
-
/**
|
|
1164
|
+
/**
|
|
1165
|
+
* The card-on-file policy the API served with the recognizer for this
|
|
1166
|
+
* request (Recognizer.cardOnFile), or null when no recognizer matches or
|
|
1167
|
+
* its entry names none. The Datatrans gate refuses a post that asks to keep
|
|
1168
|
+
* the card on file only while this is `refuse` or a value it does not know.
|
|
1169
|
+
*/
|
|
1170
|
+
cardOnFilePolicy(url: string, method?: string): string | null;
|
|
1171
|
+
/**
|
|
1172
|
+
* True when this request is a card tokenization we can take over: a POST to
|
|
1173
|
+
* a recognized endpoint, or for a recognizer whose card request is a GET
|
|
1174
|
+
* (Worldpay eProtect) that exact GET, query included.
|
|
1175
|
+
*/
|
|
784
1176
|
isCardRequest(url: string, method?: string): boolean;
|
|
1177
|
+
/**
|
|
1178
|
+
* Whether the current registry holds this processor's recognizer. A
|
|
1179
|
+
* processor that ships dark is served only to a build that declares its
|
|
1180
|
+
* capability (syncRegistry does), so before a sync, or against an API that
|
|
1181
|
+
* withheld it, the adapters leave that processor's traffic exactly as they
|
|
1182
|
+
* found it. prepare() asks this for ACI, whose card-number request names a
|
|
1183
|
+
* checkout id the merchant mints only at Pay time, and for a processor whose
|
|
1184
|
+
* card request is a GET (Worldpay eProtect), since that request is recognized
|
|
1185
|
+
* by a query the page has not written yet.
|
|
1186
|
+
*/
|
|
1187
|
+
recognizesProcessor(psp: string): boolean;
|
|
785
1188
|
/**
|
|
786
1189
|
* What happens to a card request (by URL) whose body carries no card: null
|
|
787
1190
|
* when it carries one, so it is a card request as usual; 'continue' when the
|
|
788
1191
|
* recognizer marks the endpoint as one where such requests are routine and
|
|
789
1192
|
* never ours; 'refuse' otherwise, such as a Stripe confirmation paying with
|
|
790
|
-
* a method this checkout never approved. The adapters
|
|
791
|
-
*
|
|
792
|
-
*
|
|
1193
|
+
* a method this checkout never approved. The adapters continue a 'continue'
|
|
1194
|
+
* in every state and judge a 'refuse' after their holds. A body that could
|
|
1195
|
+
* not be read is not judged here.
|
|
1196
|
+
*
|
|
1197
|
+
* `handedTo` lists the requests the attachment has already handed the card
|
|
1198
|
+
* to (CheckoutLifecycle.cardHandoffs). Once one of them went to the same
|
|
1199
|
+
* processor, a processor in CARD_FREE_AFTER_HANDOFF_REFUSED answers 'refuse'
|
|
1200
|
+
* where it would have answered 'continue'.
|
|
1201
|
+
*
|
|
1202
|
+
* A sandbox client's loopback fixture is judged on the processor's own
|
|
1203
|
+
* hosts, as it is recognised (urlsOnProcessorHosts), so a card-free request
|
|
1204
|
+
* the catalog lets through there continues on the fixture too.
|
|
793
1205
|
*/
|
|
794
|
-
withoutCard(url: string, body: string | null | undefined): 'continue' | 'refuse' | null;
|
|
1206
|
+
withoutCard(url: string, body: string | null | undefined, handedTo?: readonly string[]): 'continue' | 'refuse' | null;
|
|
795
1207
|
/**
|
|
796
|
-
* How the card would reach the processor on this request (`token`, `cse
|
|
797
|
-
* or `
|
|
1208
|
+
* How the card would reach the processor on this request (`token`, `cse`,
|
|
1209
|
+
* `hosted_form` or `device_encrypt`; absent on the entry means `token`), or null when the
|
|
798
1210
|
* registry does not recognize it. The adapters read it to decide whether an
|
|
799
1211
|
* approval outlives the page's own request: a hosted form is a navigation
|
|
800
1212
|
* and cannot.
|
|
@@ -812,10 +1224,35 @@ export declare class VaultClient {
|
|
|
812
1224
|
* these patterns pause.
|
|
813
1225
|
*/
|
|
814
1226
|
cardUrlPatterns(): string[];
|
|
1227
|
+
/**
|
|
1228
|
+
* What to type into a checkout so the page's own card facts match the stored card that
|
|
1229
|
+
* pays (see PlaceholderCard): read from GET /api/v2/vault_cards, which lists each stored card's
|
|
1230
|
+
* network and expiry. `cardId` names the stored card; omitted, the user's most recently added
|
|
1231
|
+
* card. Pin the returned `cardId` on the attachment or authorize(), so the approval page
|
|
1232
|
+
* preselects that card: without a pin the page preselects its own choice (its recommended
|
|
1233
|
+
* card, or the first card the cardholder's device can open), which can be another card. After
|
|
1234
|
+
* prepare(), pass the prepared checkout's `cardId`, the card the cardholder already approved.
|
|
1235
|
+
* The facts hold only while the cardholder pays with that card. Throws PlaceholderCardError
|
|
1236
|
+
* when there is no such card, its network has no placeholder, or it carries no expiry.
|
|
1237
|
+
*/
|
|
1238
|
+
placeholderCard(input: {
|
|
1239
|
+
user: string;
|
|
1240
|
+
cardId?: string;
|
|
1241
|
+
signal?: AbortSignal;
|
|
1242
|
+
}): Promise<PlaceholderCard>;
|
|
815
1243
|
/** Wait for real device approval before the caller starts native tokenization. */
|
|
816
1244
|
prepareCheckout(input: PrepareCheckoutInput): Promise<PreparedCheckout>;
|
|
817
1245
|
/** Cancel only an unconsumed preparation; a bound request is reconciled separately. */
|
|
818
1246
|
cancelPreparation(id: string): Promise<void>;
|
|
1247
|
+
/**
|
|
1248
|
+
* Retire a ready preparation whose authorization create has not answered, and name the request
|
|
1249
|
+
* that already holds it. Resolves null once the API confirms no merchant request can bind the
|
|
1250
|
+
* preparation any more (cancelled or expired: the API takes a cancel and a create's bind under one
|
|
1251
|
+
* lock), or the ID of the authorization it is already bound to, which the caller retires like any
|
|
1252
|
+
* other (cancelAuthorization). Rejects when the API confirms neither. The Amadeus send window uses
|
|
1253
|
+
* it (amadeus.ts).
|
|
1254
|
+
*/
|
|
1255
|
+
retirePreparation(id: string): Promise<string | null>;
|
|
819
1256
|
observePreparation(id: string, guidance: 'presented_not_filled' | 'not_presented', reason?: string): Promise<void>;
|
|
820
1257
|
reportDuplicateGuard(authorizationId: string): Promise<void>;
|
|
821
1258
|
/**
|
|
@@ -872,6 +1309,49 @@ export declare class VaultClient {
|
|
|
872
1309
|
amount: number;
|
|
873
1310
|
currency: string;
|
|
874
1311
|
}>;
|
|
1312
|
+
/**
|
|
1313
|
+
* Ask whether the page may save the card with the Stripe payment method an
|
|
1314
|
+
* approval produced: a SetupIntent confirm that carries no card and pays with
|
|
1315
|
+
* exactly the approved payment method (the page's own, or written by the
|
|
1316
|
+
* adapters in place of a card the confirm carries again).
|
|
1317
|
+
* The API allows a card save only for a company Agentcard turned it on for,
|
|
1318
|
+
* for an approval given on the Vault page, not by voice, with no amount, and
|
|
1319
|
+
* a SetupIntent Stripe reports still confirmable on the same Stripe account;
|
|
1320
|
+
* any other answer rejects with a CheckoutApiError whose code says why (for
|
|
1321
|
+
* example `continuation_invalid` where it is off, `amount_mismatch`). Nothing
|
|
1322
|
+
* is charged: the adapters continue the page's request once this resolves.
|
|
1323
|
+
*/
|
|
1324
|
+
checkStripeSetupContinuation(authorizationId: string, request: {
|
|
1325
|
+
url: string;
|
|
1326
|
+
method: string;
|
|
1327
|
+
headers: Record<string, string>;
|
|
1328
|
+
body: string;
|
|
1329
|
+
}): Promise<{
|
|
1330
|
+
setupIntentId: string;
|
|
1331
|
+
}>;
|
|
1332
|
+
/**
|
|
1333
|
+
* Create a merchant-session probe, the phase-0 read of the deterministic merchant total:
|
|
1334
|
+
* `user` is the org's connected user, who opens the returned Vault link and reads the
|
|
1335
|
+
* merchant's own total once through Agentcard's merchant-session relay. The capture is
|
|
1336
|
+
* the merchant's cookie jar as captureMerchantSession read it; the capture rules run
|
|
1337
|
+
* again here, so no bot-manager cookie and no signed-in session ever leaves. No card is
|
|
1338
|
+
* involved. The API answers 404 for every org not on its probe list.
|
|
1339
|
+
*/
|
|
1340
|
+
createMerchantSessionProbe(input: {
|
|
1341
|
+
user: string;
|
|
1342
|
+
capture: MerchantSessionCapture;
|
|
1343
|
+
}): Promise<{
|
|
1344
|
+
id: string;
|
|
1345
|
+
profile: string;
|
|
1346
|
+
approvalUrl: string;
|
|
1347
|
+
expiresAt: string;
|
|
1348
|
+
}>;
|
|
1349
|
+
/**
|
|
1350
|
+
* Record the same read made from the autopilot egress by the rustls runner (the API's
|
|
1351
|
+
* egressResultSchema: statuses, header names, sizes, times, totals, hashes and the
|
|
1352
|
+
* certificate chain's SPKI hashes). Once per probe.
|
|
1353
|
+
*/
|
|
1354
|
+
recordMerchantSessionEgress(probeId: string, result: unknown): Promise<void>;
|
|
875
1355
|
/**
|
|
876
1356
|
* After a merchant-hosted payment priced by the merchant's own total: what the merchant's
|
|
877
1357
|
* confirmation says it charged (merchant-total.ts merchantChargeReport builds `report`
|