@facto-to/card 0.0.0-stage → 0.0.1-beta.2
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 +20 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +63 -2
- package/dist/card-inbox-DzsHFRPT.d.cts +312 -0
- package/dist/card-inbox-DzsHFRPT.d.ts +312 -0
- package/dist/chunk-KBS2PWM4.js +2 -0
- package/dist/cli/index.js +6 -0
- package/dist/docs/README.md +9 -0
- package/dist/docs/authentication.md +96 -0
- package/dist/docs/authorization-binding.md +182 -0
- package/dist/docs/authorizations.md +182 -0
- package/dist/docs/concepts.md +36 -0
- package/dist/docs/deliveries.md +170 -0
- package/dist/docs/errors.md +100 -0
- package/dist/docs/getting-access.md +56 -0
- package/dist/docs/idempotency.md +78 -0
- package/dist/docs/integration-checklist.md +15 -0
- package/dist/docs/integration.zh.md +59 -0
- package/dist/docs/interlace-adapter-v1.md +87 -0
- package/dist/docs/interlace-adapter-v1.zh.md +87 -0
- package/dist/docs/not-yet-available.md +13 -0
- package/dist/docs/quickstart.md +126 -0
- package/dist/docs/reconciliation.md +86 -0
- package/dist/docs/reference/api.md +2541 -0
- package/dist/docs/reference/events.md +639 -0
- package/dist/docs/reference/schemas.json +6603 -0
- package/dist/docs/reference/schemas.md +1001 -0
- package/dist/docs/simulator.md +235 -0
- package/dist/docs/versioning.md +9 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +987 -0
- package/dist/index.d.ts +987 -0
- package/dist/index.js +2 -0
- package/dist/source/build.mjs +5 -0
- package/dist/source/package.json +16 -0
- package/dist/source/src/connect/cli/deliveries.ts +48 -0
- package/dist/source/src/connect/cli/index.ts +57 -0
- package/dist/source/src/connect/server/card-binding-assertion.ts +312 -0
- package/dist/source/src/connect/server/card-client.ts +1018 -0
- package/dist/source/src/connect/server/card-delivery.ts +301 -0
- package/dist/source/src/connect/server/card-events.ts +473 -0
- package/dist/source/src/connect/server/card-idempotency.ts +27 -0
- package/dist/source/src/connect/server/card-inbox.ts +82 -0
- package/dist/source/src/connect/server/card-intent-token.ts +588 -0
- package/dist/source/src/connect/server/card-polling.ts +69 -0
- package/dist/source/src/connect/server/card-signing.ts +115 -0
- package/dist/source/src/connect/server/card-transport.ts +282 -0
- package/dist/source/src/connect/server/errors.ts +280 -0
- package/dist/source/src/connect/server/fixtures/engine/card-events.synthetic.ts +84 -0
- package/dist/source/src/connect/server/retry-after.ts +12 -0
- package/dist/source/src/connect/testing/card-inbox.ts +124 -0
- package/dist/source/src/connect/testing/card-scenarios.ts +243 -0
- package/dist/source/src/connect/testing/card-simulator-vectors.ts +262 -0
- package/dist/source/src/connect/testing/card-simulator.ts +531 -0
- package/dist/source/src/connect/testing/interlace-card-transactions.ts +704 -0
- package/dist/source/src/connect/testing/pure-sha256.ts +123 -0
- package/dist/source/src/connect/wire.d.ts +544 -0
- package/dist/source/src/index.ts +163 -0
- package/dist/source/src/testing-browser.ts +24 -0
- package/dist/source/src/testing.ts +26 -0
- package/dist/source/tsconfig.json +20 -0
- package/dist/testing-browser.d.ts +220 -0
- package/dist/testing-browser.js +5 -0
- package/dist/testing.cjs +6 -0
- package/dist/testing.d.cts +199 -0
- package/dist/testing.d.ts +199 -0
- package/dist/testing.js +5 -0
- package/package.json +60 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,987 @@
|
|
|
1
|
+
export { A as AuthorizationChange, a as AuthorizationUpdateData, b as AuthorizationUpdatedEvent, C as CARD_EVENT_KINDS, c as CARD_REDELIVERY_REASONS, d as CardBindingEvent, e as CardEventKind, f as CardKnownEvent, g as CardRedeliveryReason, h as ChargeFact, i as ChargeFactsUpdatedEvent, j as ChargeFinalizedEvent, k as CipLifecycleSummary, l as CreateDeliveryVerifierOptions, D as DecodedDeliveryEvent, m as DeliveredCardDisplay, n as DeliveredChargeFinalReceipt, o as DeliveryEventRevision, p as DeliveryInboxMetadata, q as DeliveryInboxOptions, r as DeliveryInboxResult, s as DeliveryInboxStore, t as DeliveryInboxTransaction, u as DeliveryScope, v as DeliverySigningKey, w as DeliveryVerificationFailureReason, x as DeliveryVerifier, y as DeliveryVerifierInput, E as EventDeliveryVerification, O as ObservedSequenceGap, R as RefundSummary, V as VerifiedEventDelivery, z as VerifyEventDeliveryInput, B as createDeliveryVerifier, F as decodeDeliveryEvent, G as getBusinessPayloadDigest, H as receiveEventDelivery, I as verifyEventDelivery } from './card-inbox-DzsHFRPT.js';
|
|
2
|
+
|
|
3
|
+
interface AuthorizationAccepted {
|
|
4
|
+
charge_id: string;
|
|
5
|
+
status: 'processing';
|
|
6
|
+
}
|
|
7
|
+
type AuthorizationTimestamp = string;
|
|
8
|
+
interface CardholderVerification {
|
|
9
|
+
evidence_id: string;
|
|
10
|
+
method: 'pin' | 'biometric' | 'cdcvm' | 'signature' | 'no_cvm' | 'provider_attested';
|
|
11
|
+
verified_at: AuthorizationTimestamp;
|
|
12
|
+
}
|
|
13
|
+
interface AuthorizationCreateInput$1 {
|
|
14
|
+
amount: string;
|
|
15
|
+
cardholder_verification: CardholderVerification;
|
|
16
|
+
client_transaction_id?: string;
|
|
17
|
+
currency: 'USD' | 'USDC';
|
|
18
|
+
deadline_at?: string;
|
|
19
|
+
decision_mode?: 'asynchronous' | 'synchronous';
|
|
20
|
+
decision_timeout_ms?: number;
|
|
21
|
+
external_authorization_id: string;
|
|
22
|
+
external_card_id: string;
|
|
23
|
+
mapping_revision: string;
|
|
24
|
+
merchant_country?: string;
|
|
25
|
+
merchant_mcc?: string;
|
|
26
|
+
merchant_name?: string;
|
|
27
|
+
occurred_at?: string;
|
|
28
|
+
program_id: string;
|
|
29
|
+
resource_version: string;
|
|
30
|
+
supplier_transaction_id?: string;
|
|
31
|
+
}
|
|
32
|
+
interface AuthorizationDeadlineExceeded {
|
|
33
|
+
deadline_at: string;
|
|
34
|
+
decision_id: string;
|
|
35
|
+
error: 'decision_deadline_exceeded';
|
|
36
|
+
message: string;
|
|
37
|
+
request_id: string;
|
|
38
|
+
}
|
|
39
|
+
declare const AUTHORIZATION_FACT_KIND_VALUES: readonly ["facto_admission", "durable_commit", "provider_authorization", "chain_finality", "provider_settlement"];
|
|
40
|
+
type AuthorizationFactKind = (typeof AUTHORIZATION_FACT_KIND_VALUES)[number];
|
|
41
|
+
interface AuthorizationFactProperties {
|
|
42
|
+
kind: AuthorizationFactKind;
|
|
43
|
+
observed_at?: AuthorizationTimestamp;
|
|
44
|
+
recorded_at: AuthorizationTimestamp;
|
|
45
|
+
safe_code?: string;
|
|
46
|
+
source_system: 'facto' | 'provider' | 'chain';
|
|
47
|
+
state: 'unobserved' | 'pending' | 'confirmed' | 'rejected' | 'indeterminate';
|
|
48
|
+
}
|
|
49
|
+
type AuthorizationFact = AuthorizationFactProperties & (({
|
|
50
|
+
state: 'confirmed';
|
|
51
|
+
} & Required<Pick<AuthorizationFactProperties, 'observed_at'>>) | ({
|
|
52
|
+
state: Exclude<AuthorizationFactProperties['state'], 'confirmed'>;
|
|
53
|
+
})) & (({
|
|
54
|
+
state: 'unobserved';
|
|
55
|
+
} & {
|
|
56
|
+
observed_at?: never;
|
|
57
|
+
}) | ({
|
|
58
|
+
state: Exclude<AuthorizationFactProperties['state'], 'unobserved'>;
|
|
59
|
+
}));
|
|
60
|
+
interface AuthorizationFactInput$1 {
|
|
61
|
+
amount: string;
|
|
62
|
+
client_transaction_id?: string;
|
|
63
|
+
currency: 'USD' | 'USDC';
|
|
64
|
+
fact_type: 'authorization_updated' | 'clearing' | 'reversal' | 'refund' | 'chargeback' | 'settlement';
|
|
65
|
+
mapping_revision: string;
|
|
66
|
+
merchant_country?: string;
|
|
67
|
+
merchant_mcc?: string;
|
|
68
|
+
merchant_name?: string;
|
|
69
|
+
parent_supplier_transaction_id?: string;
|
|
70
|
+
predecessor_version: string;
|
|
71
|
+
program_id: string;
|
|
72
|
+
recorded_at: string;
|
|
73
|
+
resource_version: string;
|
|
74
|
+
supplier_transaction_id?: string;
|
|
75
|
+
}
|
|
76
|
+
interface AuthorizationFactReceipt {
|
|
77
|
+
operation_id: string;
|
|
78
|
+
status: 'recorded';
|
|
79
|
+
}
|
|
80
|
+
type AuthorizationFacts = [
|
|
81
|
+
AuthorizationFact & {
|
|
82
|
+
kind?: 'facto_admission';
|
|
83
|
+
},
|
|
84
|
+
AuthorizationFact & {
|
|
85
|
+
kind?: 'durable_commit';
|
|
86
|
+
},
|
|
87
|
+
AuthorizationFact & {
|
|
88
|
+
kind?: 'provider_authorization';
|
|
89
|
+
},
|
|
90
|
+
AuthorizationFact & {
|
|
91
|
+
kind?: 'chain_finality';
|
|
92
|
+
},
|
|
93
|
+
AuthorizationFact & {
|
|
94
|
+
kind?: 'provider_settlement';
|
|
95
|
+
}
|
|
96
|
+
];
|
|
97
|
+
declare const AUTHORIZATION_OPERATION_TYPE_VALUES: readonly ["authorization_requested", "authorization_updated", "clearing", "reversal", "refund", "chargeback", "settlement"];
|
|
98
|
+
type AuthorizationOperationType = (typeof AUTHORIZATION_OPERATION_TYPE_VALUES)[number];
|
|
99
|
+
type AuthorizationUsdcAmount = string;
|
|
100
|
+
interface AuthorizationRefundCase {
|
|
101
|
+
amount: AuthorizationUsdcAmount;
|
|
102
|
+
case_id: string;
|
|
103
|
+
excess_amount: AuthorizationUsdcAmount;
|
|
104
|
+
not_payable_reason?: string;
|
|
105
|
+
paid_amount?: AuthorizationUsdcAmount;
|
|
106
|
+
source_operation_type: AuthorizationOperationType;
|
|
107
|
+
source_resource_version: string;
|
|
108
|
+
status: string;
|
|
109
|
+
updated_at: string;
|
|
110
|
+
}
|
|
111
|
+
interface AuthorizationLifecycleEntry {
|
|
112
|
+
amount: AuthorizationUsdcAmount;
|
|
113
|
+
currency: 'USDC';
|
|
114
|
+
link_status: 'linked' | 'unlinked';
|
|
115
|
+
operation_type: AuthorizationOperationType;
|
|
116
|
+
recorded_at: string;
|
|
117
|
+
resource_version: string;
|
|
118
|
+
unlinked_reason?: string;
|
|
119
|
+
}
|
|
120
|
+
interface AuthorizationSupplierSummary {
|
|
121
|
+
cleared_amount: AuthorizationUsdcAmount;
|
|
122
|
+
entries: AuthorizationLifecycleEntry[];
|
|
123
|
+
refunded_amount: AuthorizationUsdcAmount;
|
|
124
|
+
reversed_amount: AuthorizationUsdcAmount;
|
|
125
|
+
state: string;
|
|
126
|
+
}
|
|
127
|
+
interface AuthorizationLifecycle {
|
|
128
|
+
issuer: AuthorizationSupplierSummary;
|
|
129
|
+
refund_cases: AuthorizationRefundCase[];
|
|
130
|
+
}
|
|
131
|
+
interface AuthorizationPaymentDetails {
|
|
132
|
+
fee_breakdown: {
|
|
133
|
+
base_fee: AuthorizationUsdcAmount;
|
|
134
|
+
fast_pay_fee: AuthorizationUsdcAmount;
|
|
135
|
+
pooled_surcharge: AuthorizationUsdcAmount;
|
|
136
|
+
};
|
|
137
|
+
fee_total: AuthorizationUsdcAmount;
|
|
138
|
+
refund_payments?: Array<{
|
|
139
|
+
case_id: string;
|
|
140
|
+
chain_id: number;
|
|
141
|
+
paid_amount: AuthorizationUsdcAmount;
|
|
142
|
+
recorded_by: string;
|
|
143
|
+
tx_hash: string;
|
|
144
|
+
}>;
|
|
145
|
+
user_payment?: {
|
|
146
|
+
asset_symbol?: string;
|
|
147
|
+
chain_id: number;
|
|
148
|
+
tx_hash: string;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
type AuthorizationProgramConnectionId = string;
|
|
152
|
+
type AuthorizationRevision = number;
|
|
153
|
+
type AuthorizationUuid = string;
|
|
154
|
+
interface ChargeFinalReceiptProperties {
|
|
155
|
+
charge_id: string;
|
|
156
|
+
execution_outcome: 'succeeded' | 'failed';
|
|
157
|
+
external_authorization_id: string;
|
|
158
|
+
facts_at_finality: AuthorizationFacts;
|
|
159
|
+
finalized_at: AuthorizationTimestamp;
|
|
160
|
+
mapping_revision: string;
|
|
161
|
+
operation_type: AuthorizationOperationType;
|
|
162
|
+
receipt_event_id: AuthorizationUuid;
|
|
163
|
+
resource_version: string;
|
|
164
|
+
terminal_action: 'releaseFor' | 'cancelReservation';
|
|
165
|
+
}
|
|
166
|
+
type ChargeFinalReceipt = ChargeFinalReceiptProperties & {
|
|
167
|
+
facts_at_finality?: [
|
|
168
|
+
ChargeFinalReceiptProperties['facts_at_finality'][0],
|
|
169
|
+
ChargeFinalReceiptProperties['facts_at_finality'][1],
|
|
170
|
+
ChargeFinalReceiptProperties['facts_at_finality'][2],
|
|
171
|
+
ChargeFinalReceiptProperties['facts_at_finality'][3] & {
|
|
172
|
+
state?: 'confirmed';
|
|
173
|
+
},
|
|
174
|
+
ChargeFinalReceiptProperties['facts_at_finality'][4]
|
|
175
|
+
];
|
|
176
|
+
} & (({
|
|
177
|
+
terminal_action: 'releaseFor';
|
|
178
|
+
} & {
|
|
179
|
+
execution_outcome?: 'succeeded';
|
|
180
|
+
facts_at_finality?: [
|
|
181
|
+
ChargeFinalReceiptProperties['facts_at_finality'][0] & {
|
|
182
|
+
state?: 'confirmed';
|
|
183
|
+
},
|
|
184
|
+
ChargeFinalReceiptProperties['facts_at_finality'][1] & {
|
|
185
|
+
state?: 'confirmed';
|
|
186
|
+
},
|
|
187
|
+
ChargeFinalReceiptProperties['facts_at_finality'][2],
|
|
188
|
+
ChargeFinalReceiptProperties['facts_at_finality'][3],
|
|
189
|
+
ChargeFinalReceiptProperties['facts_at_finality'][4]
|
|
190
|
+
];
|
|
191
|
+
}) | ({
|
|
192
|
+
terminal_action: Exclude<ChargeFinalReceiptProperties['terminal_action'], 'releaseFor'>;
|
|
193
|
+
} & {
|
|
194
|
+
execution_outcome?: 'failed';
|
|
195
|
+
}));
|
|
196
|
+
interface AuthorizationProjectionProperties {
|
|
197
|
+
charge_id?: string;
|
|
198
|
+
decision?: 'approved' | 'declined' | 'self_reversed_timeout';
|
|
199
|
+
decline_reason_code?: string;
|
|
200
|
+
external_authorization_id: string;
|
|
201
|
+
facts: AuthorizationFacts;
|
|
202
|
+
final_receipt?: ChargeFinalReceipt;
|
|
203
|
+
lifecycle?: AuthorizationLifecycle;
|
|
204
|
+
mapping_revision: string;
|
|
205
|
+
operation_type: AuthorizationOperationType;
|
|
206
|
+
origin_connection_id: AuthorizationProgramConnectionId;
|
|
207
|
+
payment_details?: AuthorizationPaymentDetails;
|
|
208
|
+
processing_status: 'processing' | 'succeeded' | 'failed' | 'indeterminate';
|
|
209
|
+
resource_version: string;
|
|
210
|
+
revision: AuthorizationRevision;
|
|
211
|
+
supplier_transaction_id?: string;
|
|
212
|
+
}
|
|
213
|
+
type AuthorizationProjection$1 = AuthorizationProjectionProperties & (({
|
|
214
|
+
processing_status: 'succeeded';
|
|
215
|
+
} & Required<Pick<AuthorizationProjectionProperties, 'charge_id'>>) | ({
|
|
216
|
+
processing_status: Exclude<AuthorizationProjectionProperties['processing_status'], 'succeeded'>;
|
|
217
|
+
} & {
|
|
218
|
+
final_receipt?: never;
|
|
219
|
+
})) & (({
|
|
220
|
+
processing_status: 'succeeded';
|
|
221
|
+
} & Required<Pick<AuthorizationProjectionProperties, 'final_receipt'>>) | ({
|
|
222
|
+
processing_status: Exclude<AuthorizationProjectionProperties['processing_status'], 'succeeded'>;
|
|
223
|
+
})) & ((Required<Pick<AuthorizationProjectionProperties, 'final_receipt'>> & {
|
|
224
|
+
decline_reason_code?: never;
|
|
225
|
+
}) | ({
|
|
226
|
+
final_receipt?: never;
|
|
227
|
+
})) & ((Required<Pick<AuthorizationProjectionProperties, 'decline_reason_code'>> & {
|
|
228
|
+
processing_status?: 'failed';
|
|
229
|
+
}) | ({
|
|
230
|
+
decline_reason_code?: never;
|
|
231
|
+
})) & ((Required<Pick<AuthorizationProjectionProperties, 'charge_id'>> & {
|
|
232
|
+
processing_status?: 'processing' | 'succeeded' | 'failed';
|
|
233
|
+
}) | ({
|
|
234
|
+
charge_id?: never;
|
|
235
|
+
})) & (({
|
|
236
|
+
processing_status: 'succeeded';
|
|
237
|
+
} & {
|
|
238
|
+
final_receipt?: {
|
|
239
|
+
execution_outcome?: 'succeeded';
|
|
240
|
+
};
|
|
241
|
+
}) | ({
|
|
242
|
+
processing_status: Exclude<AuthorizationProjectionProperties['processing_status'], 'succeeded'>;
|
|
243
|
+
})) & (({
|
|
244
|
+
processing_status: 'failed';
|
|
245
|
+
} & {
|
|
246
|
+
final_receipt?: {
|
|
247
|
+
execution_outcome?: 'failed';
|
|
248
|
+
};
|
|
249
|
+
}) | ({
|
|
250
|
+
processing_status: Exclude<AuthorizationProjectionProperties['processing_status'], 'failed'>;
|
|
251
|
+
}));
|
|
252
|
+
interface AuthorizationLookupResultProperties {
|
|
253
|
+
authorization?: AuthorizationProjection$1;
|
|
254
|
+
observed_at: AuthorizationTimestamp;
|
|
255
|
+
resolution: 'resolved' | 'pending' | 'unknown' | 'not_observed';
|
|
256
|
+
}
|
|
257
|
+
type AuthorizationLookupResult$1 = AuthorizationLookupResultProperties & (({
|
|
258
|
+
resolution: 'not_observed';
|
|
259
|
+
} & {
|
|
260
|
+
authorization?: never;
|
|
261
|
+
}) | ({
|
|
262
|
+
resolution: Exclude<AuthorizationLookupResultProperties['resolution'], 'not_observed'>;
|
|
263
|
+
})) & (({
|
|
264
|
+
resolution: 'resolved';
|
|
265
|
+
} & Required<Pick<AuthorizationLookupResultProperties, 'authorization'>> & {
|
|
266
|
+
authorization?: {
|
|
267
|
+
processing_status?: 'succeeded' | 'failed';
|
|
268
|
+
};
|
|
269
|
+
}) | ({
|
|
270
|
+
resolution: Exclude<AuthorizationLookupResultProperties['resolution'], 'resolved'>;
|
|
271
|
+
})) & (({
|
|
272
|
+
resolution: 'pending';
|
|
273
|
+
} & Required<Pick<AuthorizationLookupResultProperties, 'authorization'>> & {
|
|
274
|
+
authorization?: {
|
|
275
|
+
processing_status?: 'processing';
|
|
276
|
+
};
|
|
277
|
+
}) | ({
|
|
278
|
+
resolution: Exclude<AuthorizationLookupResultProperties['resolution'], 'pending'>;
|
|
279
|
+
})) & (({
|
|
280
|
+
resolution: 'unknown';
|
|
281
|
+
} & Required<Pick<AuthorizationLookupResultProperties, 'authorization'>> & {
|
|
282
|
+
authorization?: {
|
|
283
|
+
processing_status?: 'indeterminate';
|
|
284
|
+
};
|
|
285
|
+
}) | ({
|
|
286
|
+
resolution: Exclude<AuthorizationLookupResultProperties['resolution'], 'unknown'>;
|
|
287
|
+
}));
|
|
288
|
+
interface BindingFundingProjection {
|
|
289
|
+
configured: boolean;
|
|
290
|
+
reason?: string;
|
|
291
|
+
state: 'ready' | 'not_configured' | 'unavailable';
|
|
292
|
+
}
|
|
293
|
+
interface BindingLookupInput {
|
|
294
|
+
external_card_id: string;
|
|
295
|
+
}
|
|
296
|
+
type CardBindingId = string;
|
|
297
|
+
interface CardDisplayFacts {
|
|
298
|
+
last4: string | null;
|
|
299
|
+
network: string | null;
|
|
300
|
+
type: 'virtual' | 'physical' | 'unknown' | null;
|
|
301
|
+
}
|
|
302
|
+
interface BindingSummary$1 {
|
|
303
|
+
card: CardDisplayFacts;
|
|
304
|
+
funding?: BindingFundingProjection;
|
|
305
|
+
id: CardBindingId;
|
|
306
|
+
revision: number;
|
|
307
|
+
status: 'active' | 'revoked';
|
|
308
|
+
}
|
|
309
|
+
interface BindingLookupResult$1 {
|
|
310
|
+
binding: BindingSummary$1 | null;
|
|
311
|
+
found: boolean;
|
|
312
|
+
}
|
|
313
|
+
type BindingSessionId = string;
|
|
314
|
+
type CardTimestamp = string;
|
|
315
|
+
interface BindingProofChallenge {
|
|
316
|
+
binding_session_id: BindingSessionId;
|
|
317
|
+
expires_at: CardTimestamp;
|
|
318
|
+
facto_challenge: string;
|
|
319
|
+
session_request_digest: string;
|
|
320
|
+
}
|
|
321
|
+
interface BindingProofPolicy {
|
|
322
|
+
allowed_modes: ['provider_reauthentication' | 'provider_second_channel', ...Array<'provider_reauthentication' | 'provider_second_channel'>];
|
|
323
|
+
card_selection_supported?: true;
|
|
324
|
+
challenge_after_facto_auth: true;
|
|
325
|
+
challenge_delivery: 'browser_handoff' | 'provider_backend';
|
|
326
|
+
}
|
|
327
|
+
interface BindingSessionCreate {
|
|
328
|
+
program_ref: string;
|
|
329
|
+
requested_user_consents: ['card.metadata.view' | 'card.use_for_facto_payments', ...Array<'card.metadata.view' | 'card.use_for_facto_payments'>];
|
|
330
|
+
return_uri: string;
|
|
331
|
+
}
|
|
332
|
+
interface BindingSessionCreated {
|
|
333
|
+
binding_session_id: BindingSessionId;
|
|
334
|
+
binding_url: string;
|
|
335
|
+
expires_at: CardTimestamp;
|
|
336
|
+
proof_policy: BindingProofPolicy;
|
|
337
|
+
status: 'pending';
|
|
338
|
+
}
|
|
339
|
+
type BindingSessionStatus = {
|
|
340
|
+
binding_session_id: BindingSessionId;
|
|
341
|
+
expires_at: CardTimestamp;
|
|
342
|
+
status: 'pending';
|
|
343
|
+
} | {
|
|
344
|
+
binding_session_id: BindingSessionId;
|
|
345
|
+
expires_at: CardTimestamp;
|
|
346
|
+
status: 'proof_pending';
|
|
347
|
+
} | {
|
|
348
|
+
binding_session_id: BindingSessionId;
|
|
349
|
+
expires_at: CardTimestamp;
|
|
350
|
+
status: 'consent_pending';
|
|
351
|
+
} | {
|
|
352
|
+
binding_ids: CardBindingId[];
|
|
353
|
+
binding_session_id: BindingSessionId;
|
|
354
|
+
completed_at?: CardTimestamp;
|
|
355
|
+
expires_at: CardTimestamp;
|
|
356
|
+
outcome: 'bound';
|
|
357
|
+
status: 'completed';
|
|
358
|
+
} | {
|
|
359
|
+
binding_session_id: BindingSessionId;
|
|
360
|
+
completed_at?: CardTimestamp;
|
|
361
|
+
expires_at: CardTimestamp;
|
|
362
|
+
failure_reason: 'declined_by_user';
|
|
363
|
+
outcome: 'declined';
|
|
364
|
+
status: 'completed';
|
|
365
|
+
} | {
|
|
366
|
+
binding_session_id: BindingSessionId;
|
|
367
|
+
completed_at?: CardTimestamp;
|
|
368
|
+
expires_at: CardTimestamp;
|
|
369
|
+
failure_reason?: 'cancelled_by_user' | 'cancelled_by_partner' | 'proof_rejected' | 'admission_closed' | 'no_eligible_cards' | 'integrity_conflict';
|
|
370
|
+
status: 'cancelled';
|
|
371
|
+
} | {
|
|
372
|
+
binding_session_id: BindingSessionId;
|
|
373
|
+
expires_at: CardTimestamp;
|
|
374
|
+
failure_reason?: 'expired' | 'proof_timeout';
|
|
375
|
+
status: 'expired';
|
|
376
|
+
};
|
|
377
|
+
type CardInboundEventInput = {
|
|
378
|
+
assertion_jws: string;
|
|
379
|
+
delivery_id: string;
|
|
380
|
+
external_account_id?: null;
|
|
381
|
+
external_card_id: string;
|
|
382
|
+
kind: 'card.unbound';
|
|
383
|
+
lifecycle_status?: null;
|
|
384
|
+
} | {
|
|
385
|
+
assertion_jws: string;
|
|
386
|
+
delivery_id: string;
|
|
387
|
+
external_account_id?: null;
|
|
388
|
+
external_card_id: string;
|
|
389
|
+
kind: 'card.lifecycle_changed';
|
|
390
|
+
lifecycle_status: 'pending' | 'active' | 'frozen' | 'closed' | 'replaced' | 'unknown';
|
|
391
|
+
} | {
|
|
392
|
+
assertion_jws: string;
|
|
393
|
+
delivery_id: string;
|
|
394
|
+
external_account_id: string;
|
|
395
|
+
external_card_id?: null;
|
|
396
|
+
kind: 'account.released';
|
|
397
|
+
lifecycle_status?: null;
|
|
398
|
+
};
|
|
399
|
+
type CardInboundEventReceipt = {
|
|
400
|
+
delivery_id: string;
|
|
401
|
+
disposition: 'applied';
|
|
402
|
+
effect: 'revoked' | 'status_updated' | 'released' | 'none';
|
|
403
|
+
} | {
|
|
404
|
+
delivery_id: string;
|
|
405
|
+
disposition: 'duplicate';
|
|
406
|
+
effect: null;
|
|
407
|
+
};
|
|
408
|
+
type CardUuid = string;
|
|
409
|
+
type ConnectIntentDigest = string;
|
|
410
|
+
type ConnectIntentId = string;
|
|
411
|
+
interface DeadLetterItem {
|
|
412
|
+
binding_id: CardBindingId;
|
|
413
|
+
binding_revision: number;
|
|
414
|
+
connection_sequence: number | null;
|
|
415
|
+
dead_lettered_at: CardTimestamp | null;
|
|
416
|
+
delivery_attempts: number;
|
|
417
|
+
event_kind: string;
|
|
418
|
+
id: CardUuid;
|
|
419
|
+
last_delivery_error: string | null;
|
|
420
|
+
replay_count: number;
|
|
421
|
+
}
|
|
422
|
+
interface DeadLetterPage {
|
|
423
|
+
items: DeadLetterItem[];
|
|
424
|
+
}
|
|
425
|
+
interface DeadLetterReplayAccepted {
|
|
426
|
+
id: CardUuid;
|
|
427
|
+
status: 'accepted';
|
|
428
|
+
}
|
|
429
|
+
type ProgramConnectionId = string;
|
|
430
|
+
interface DeliveryItem$1 {
|
|
431
|
+
accepted_at?: CardTimestamp;
|
|
432
|
+
connection_sequence: number | null;
|
|
433
|
+
delivery_state: 'pending' | 'held' | 'accepted' | 'failed' | 'dead_lettered' | 'indeterminate';
|
|
434
|
+
event_id: CardUuid;
|
|
435
|
+
event_sha256: string;
|
|
436
|
+
origin_connection_id: ProgramConnectionId;
|
|
437
|
+
target_revision: CardUuid;
|
|
438
|
+
}
|
|
439
|
+
interface DeliveryPageProperties {
|
|
440
|
+
complete: boolean;
|
|
441
|
+
items: DeliveryItem$1[];
|
|
442
|
+
next_cursor: string | null;
|
|
443
|
+
snapshot_at: CardTimestamp;
|
|
444
|
+
snapshot_token: string;
|
|
445
|
+
to_at: CardTimestamp;
|
|
446
|
+
}
|
|
447
|
+
type DeliveryPage$1 = DeliveryPageProperties & (({
|
|
448
|
+
complete: true;
|
|
449
|
+
} & {
|
|
450
|
+
next_cursor?: null;
|
|
451
|
+
}) | ({
|
|
452
|
+
complete: Exclude<DeliveryPageProperties['complete'], true>;
|
|
453
|
+
}));
|
|
454
|
+
interface DeliveryReconciliationListInputProperties {
|
|
455
|
+
cursor?: string;
|
|
456
|
+
from_at?: CardTimestamp;
|
|
457
|
+
page_size: number;
|
|
458
|
+
program_id: string;
|
|
459
|
+
selection_id?: CardUuid;
|
|
460
|
+
snapshot_token?: string;
|
|
461
|
+
target_revision: CardUuid;
|
|
462
|
+
to_at?: CardTimestamp;
|
|
463
|
+
}
|
|
464
|
+
type DeliveryReconciliationListInput = DeliveryReconciliationListInputProperties & ((Required<Pick<DeliveryReconciliationListInputProperties, 'selection_id'>> & {
|
|
465
|
+
from_at?: never;
|
|
466
|
+
to_at?: never;
|
|
467
|
+
}) | (Required<Pick<DeliveryReconciliationListInputProperties, 'from_at' | 'to_at'>> & {
|
|
468
|
+
selection_id?: never;
|
|
469
|
+
}));
|
|
470
|
+
interface DeliveryReplayAccepted {
|
|
471
|
+
replay_id: CardUuid;
|
|
472
|
+
selection_id: CardUuid;
|
|
473
|
+
status: 'accepted';
|
|
474
|
+
target_revision: CardUuid;
|
|
475
|
+
}
|
|
476
|
+
interface DeliveryReplayCreateInput {
|
|
477
|
+
program_id: string;
|
|
478
|
+
selection_id: CardUuid;
|
|
479
|
+
}
|
|
480
|
+
interface IntentCancelInput {
|
|
481
|
+
intent_token: string;
|
|
482
|
+
}
|
|
483
|
+
interface IntentCancelled {
|
|
484
|
+
id: ConnectIntentId;
|
|
485
|
+
status: 'cancelled';
|
|
486
|
+
}
|
|
487
|
+
interface IntentCardItem$1 {
|
|
488
|
+
binding_id: CardBindingId;
|
|
489
|
+
card: CardDisplayFacts;
|
|
490
|
+
status: 'active' | 'revoked';
|
|
491
|
+
}
|
|
492
|
+
interface IntentCardList$1 {
|
|
493
|
+
cards: IntentCardItem$1[];
|
|
494
|
+
id: ConnectIntentId;
|
|
495
|
+
revision: ConnectIntentDigest;
|
|
496
|
+
}
|
|
497
|
+
interface TargetCardInput {
|
|
498
|
+
external_card_id: string;
|
|
499
|
+
last4?: string | null;
|
|
500
|
+
network?: string | null;
|
|
501
|
+
type?: 'virtual' | 'physical' | 'unknown' | null;
|
|
502
|
+
}
|
|
503
|
+
interface IntentCardsReplaceInput {
|
|
504
|
+
approval_id: string;
|
|
505
|
+
approval_sha256: string;
|
|
506
|
+
cards: TargetCardInput[];
|
|
507
|
+
external_account_id?: string | null;
|
|
508
|
+
intent_token: string;
|
|
509
|
+
revision: ConnectIntentDigest;
|
|
510
|
+
}
|
|
511
|
+
interface IntentCardsReplaced {
|
|
512
|
+
added_binding_ids: CardBindingId[];
|
|
513
|
+
id: ConnectIntentId;
|
|
514
|
+
kept_binding_ids: CardBindingId[];
|
|
515
|
+
removed_binding_ids: CardBindingId[];
|
|
516
|
+
revision: ConnectIntentDigest;
|
|
517
|
+
status: 'applied' | 'no_change';
|
|
518
|
+
}
|
|
519
|
+
interface ProviderProofAccepted {
|
|
520
|
+
binding_session_id: BindingSessionId;
|
|
521
|
+
proof_received_at: CardTimestamp;
|
|
522
|
+
status: 'consent_pending';
|
|
523
|
+
}
|
|
524
|
+
interface ProviderProofSubmitPayload {
|
|
525
|
+
binding_assertion: string;
|
|
526
|
+
proof_format: 'compact-jws';
|
|
527
|
+
}
|
|
528
|
+
interface SynchronousAuthorizationApproved {
|
|
529
|
+
charge_id: string;
|
|
530
|
+
deadline_at: string;
|
|
531
|
+
decided_at: string;
|
|
532
|
+
decision: 'approved';
|
|
533
|
+
decision_id: string;
|
|
534
|
+
status: 'approved';
|
|
535
|
+
}
|
|
536
|
+
interface SynchronousAuthorizationDeclined {
|
|
537
|
+
deadline_at: string;
|
|
538
|
+
decided_at: string;
|
|
539
|
+
decision: 'declined' | 'self_reversed_timeout';
|
|
540
|
+
decision_id: string;
|
|
541
|
+
error: string;
|
|
542
|
+
message: string;
|
|
543
|
+
request_id: string;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
type FactoConnectServerErrorCode = 'FACTO_CONFIG_INVALID' | 'FACTO_ENGINE_REQUEST_FAILED' | 'FACTO_ENGINE_RESPONSE_INVALID' | 'FACTO_REQUEST_ABORTED' | 'FACTO_STATUS_POLL_ABORTED';
|
|
547
|
+
type CardErrorOutcome = 'refused' | 'unknown' | 'config_invalid';
|
|
548
|
+
declare class FactoConnectServerError extends Error {
|
|
549
|
+
readonly code: FactoConnectServerErrorCode;
|
|
550
|
+
readonly retryable: boolean;
|
|
551
|
+
readonly status?: number;
|
|
552
|
+
readonly details?: unknown;
|
|
553
|
+
readonly retryAfterSeconds?: number;
|
|
554
|
+
constructor(code: FactoConnectServerErrorCode, message: string, options: {
|
|
555
|
+
retryable: boolean;
|
|
556
|
+
status?: number;
|
|
557
|
+
details?: unknown;
|
|
558
|
+
retryAfterSeconds?: number;
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
declare class CardError extends FactoConnectServerError {
|
|
562
|
+
readonly outcome: CardErrorOutcome;
|
|
563
|
+
readonly engineCode: string | undefined;
|
|
564
|
+
readonly httpStatus: number | undefined;
|
|
565
|
+
readonly requestId: string | undefined;
|
|
566
|
+
constructor(code: FactoConnectServerErrorCode, message: string, options: {
|
|
567
|
+
retryable: boolean;
|
|
568
|
+
status?: number;
|
|
569
|
+
httpStatus?: number;
|
|
570
|
+
details?: unknown;
|
|
571
|
+
retryAfterSeconds?: number;
|
|
572
|
+
outcome?: CardErrorOutcome;
|
|
573
|
+
engineCode?: string;
|
|
574
|
+
requestId?: string;
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
interface ServerRetryOptions<TError extends FactoConnectServerError = FactoConnectServerError> {
|
|
578
|
+
maxRetries?: number;
|
|
579
|
+
baseDelayMs?: number;
|
|
580
|
+
maxDelayMs?: number;
|
|
581
|
+
respectRetryAfter?: boolean;
|
|
582
|
+
maxRetryAfterMs?: number;
|
|
583
|
+
signal?: AbortSignal;
|
|
584
|
+
onRetry?: (info: {
|
|
585
|
+
attempt: number;
|
|
586
|
+
error: TError;
|
|
587
|
+
delayMs: number;
|
|
588
|
+
}) => void;
|
|
589
|
+
sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
590
|
+
}
|
|
591
|
+
type CardServerRetryOptions = ServerRetryOptions<CardError>;
|
|
592
|
+
declare function withCardServerRetry<T>(fn: () => Promise<T>, options?: CardServerRetryOptions): Promise<T>;
|
|
593
|
+
|
|
594
|
+
type CardEnvironment = 'dev' | 'production';
|
|
595
|
+
type OpenVocabulary<T extends string> = T | (string & {});
|
|
596
|
+
interface CardRequestOptions {
|
|
597
|
+
readonly signal?: AbortSignal;
|
|
598
|
+
}
|
|
599
|
+
interface TransportOptions {
|
|
600
|
+
readonly environment: CardEnvironment;
|
|
601
|
+
readonly apiBaseUrl?: string;
|
|
602
|
+
readonly timeoutMs?: number;
|
|
603
|
+
readonly retry?: CardServerRetryOptions;
|
|
604
|
+
readonly maxResponseBytes?: number;
|
|
605
|
+
readonly fetch?: (input: string, init?: RequestInit) => Promise<Response>;
|
|
606
|
+
}
|
|
607
|
+
declare const authorizationErrorCodes: readonly ["integrity_conflict", "idempotency_payload_mismatch", "version_already_recorded", "mapping_revision_not_approved", "fact_type_not_allowed", "managed_route_refused", "ambiguous_lookup_selector", "stale_revision", "intent_token_rejected", "authorization_admission_closed", "route_not_payable", "consent_scope_not_payable", "spending_limit_exceeded", "onchain_insufficient_balance", "yield_source_underfunded", "too_many_requests", "rate_limited", "internal_error"];
|
|
608
|
+
type CardAuthorizationErrorCode = (typeof authorizationErrorCodes)[number] | (string & {});
|
|
609
|
+
interface CardErrorEnvelope {
|
|
610
|
+
readonly error: CardAuthorizationErrorCode;
|
|
611
|
+
readonly message: string;
|
|
612
|
+
readonly request_id: string;
|
|
613
|
+
}
|
|
614
|
+
interface CardNestedErrorEnvelope {
|
|
615
|
+
error: {
|
|
616
|
+
category: string;
|
|
617
|
+
code: string;
|
|
618
|
+
message: string;
|
|
619
|
+
request_id: string;
|
|
620
|
+
retryable: boolean;
|
|
621
|
+
details?: unknown;
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
declare function isCardErrorEnvelope(value: unknown): value is CardErrorEnvelope;
|
|
625
|
+
declare function isCardNestedErrorEnvelope(value: unknown): value is CardNestedErrorEnvelope;
|
|
626
|
+
|
|
627
|
+
declare const CARD_BINDING_ASSERTION_TYP: "facto-card-binding+jwt";
|
|
628
|
+
declare const ALLOWED_CONSENTS: readonly ["card.metadata.view", "card.use_for_facto_payments"];
|
|
629
|
+
declare const ALLOWED_ASSURANCES: readonly ["passkey", "mfa", "reauthenticated_session"];
|
|
630
|
+
declare const ALLOWED_SECOND_CHANNELS: readonly ["provider_authenticated_app", "device_bound_confirmation"];
|
|
631
|
+
type BindingUserConsentPurpose = (typeof ALLOWED_CONSENTS)[number];
|
|
632
|
+
type BindingProofAssurance = (typeof ALLOWED_ASSURANCES)[number];
|
|
633
|
+
type BindingSecondChannelType = (typeof ALLOWED_SECOND_CHANNELS)[number];
|
|
634
|
+
type BindingAssertionProofInput = {
|
|
635
|
+
readonly mode: 'provider_reauthentication';
|
|
636
|
+
readonly authenticatedAtSeconds: number;
|
|
637
|
+
readonly assurance: BindingProofAssurance;
|
|
638
|
+
} | {
|
|
639
|
+
readonly mode: 'provider_second_channel';
|
|
640
|
+
readonly approvedAtSeconds: number;
|
|
641
|
+
readonly approvalRef: string;
|
|
642
|
+
readonly channelType: BindingSecondChannelType;
|
|
643
|
+
};
|
|
644
|
+
interface BindingAssertionCardDisplay {
|
|
645
|
+
readonly network?: string;
|
|
646
|
+
readonly cardType?: string;
|
|
647
|
+
readonly last4?: string;
|
|
648
|
+
}
|
|
649
|
+
interface BindingAssertionCardInput {
|
|
650
|
+
readonly externalCardId: string;
|
|
651
|
+
readonly isEntryCard?: boolean;
|
|
652
|
+
readonly display?: BindingAssertionCardDisplay;
|
|
653
|
+
}
|
|
654
|
+
interface BindingAssertionEd25519Jwk {
|
|
655
|
+
readonly kty: 'OKP';
|
|
656
|
+
readonly crv: 'Ed25519';
|
|
657
|
+
readonly x: string;
|
|
658
|
+
readonly d: string;
|
|
659
|
+
readonly kid?: string;
|
|
660
|
+
readonly alg?: 'EdDSA' | 'Ed25519';
|
|
661
|
+
readonly use?: 'sig';
|
|
662
|
+
readonly key_ops?: readonly string[];
|
|
663
|
+
readonly ext?: boolean;
|
|
664
|
+
}
|
|
665
|
+
type BindingAssertionSigner = BindingAssertionEd25519Jwk | ((signingInput: Uint8Array) => Uint8Array | Promise<Uint8Array>);
|
|
666
|
+
interface SignBindingAssertionInput {
|
|
667
|
+
readonly environment: CardEnvironment;
|
|
668
|
+
readonly providerConnectionId: string;
|
|
669
|
+
readonly programId: string;
|
|
670
|
+
readonly bindingSessionId: string;
|
|
671
|
+
readonly issuer: string;
|
|
672
|
+
readonly subject: string;
|
|
673
|
+
readonly jti: string;
|
|
674
|
+
readonly factoChallenge: string;
|
|
675
|
+
readonly sessionRequestDigest: string;
|
|
676
|
+
readonly requestedUserConsents: readonly [BindingUserConsentPurpose, ...BindingUserConsentPurpose[]];
|
|
677
|
+
readonly proof: BindingAssertionProofInput;
|
|
678
|
+
readonly cards: readonly [BindingAssertionCardInput, ...BindingAssertionCardInput[]];
|
|
679
|
+
readonly signingKeyId: string;
|
|
680
|
+
readonly signer: BindingAssertionSigner;
|
|
681
|
+
readonly issuedAtSeconds?: number;
|
|
682
|
+
readonly notBeforeSeconds?: number;
|
|
683
|
+
readonly expiresAtSeconds?: number;
|
|
684
|
+
}
|
|
685
|
+
declare function signBindingAssertion(input: SignBindingAssertionInput): Promise<string>;
|
|
686
|
+
|
|
687
|
+
type CardRequestMethod = 'GET' | 'PUT' | 'POST';
|
|
688
|
+
type CardRequestBody = string | Uint8Array;
|
|
689
|
+
type CardApiKeySecret = {
|
|
690
|
+
readonly encoding: 'hex';
|
|
691
|
+
readonly value: string;
|
|
692
|
+
} | {
|
|
693
|
+
readonly encoding: 'utf8';
|
|
694
|
+
readonly value: string;
|
|
695
|
+
} | Uint8Array;
|
|
696
|
+
interface CardSigningInput {
|
|
697
|
+
readonly secret: CardApiKeySecret;
|
|
698
|
+
readonly apiKeyId: string;
|
|
699
|
+
readonly method: CardRequestMethod;
|
|
700
|
+
readonly target: string;
|
|
701
|
+
readonly timestamp: number;
|
|
702
|
+
readonly nonce: string;
|
|
703
|
+
readonly body: CardRequestBody;
|
|
704
|
+
readonly idempotencyKey?: string;
|
|
705
|
+
}
|
|
706
|
+
declare function signCardRequest(input: CardSigningInput): Headers;
|
|
707
|
+
|
|
708
|
+
type AuthorizationLookupCriteria = {
|
|
709
|
+
readonly by: 'external_authorization_id';
|
|
710
|
+
readonly external_authorization_id: string;
|
|
711
|
+
readonly fact_type?: AuthorizationOperationType;
|
|
712
|
+
readonly mapping_revision: string;
|
|
713
|
+
readonly resource_version: string;
|
|
714
|
+
} | {
|
|
715
|
+
readonly by: 'supplier_transaction_id';
|
|
716
|
+
readonly supplier_transaction_id: string;
|
|
717
|
+
readonly fact_type?: AuthorizationOperationType;
|
|
718
|
+
readonly mapping_revision: string;
|
|
719
|
+
readonly resource_version: string;
|
|
720
|
+
} | {
|
|
721
|
+
readonly by: 'idempotency_key';
|
|
722
|
+
readonly idempotency_key: string;
|
|
723
|
+
readonly original_credential_key_id: string;
|
|
724
|
+
readonly operation?: 'create_authorization';
|
|
725
|
+
} | {
|
|
726
|
+
readonly by: 'charge_id';
|
|
727
|
+
readonly charge_id: string;
|
|
728
|
+
};
|
|
729
|
+
interface AuthorizationLookupInput {
|
|
730
|
+
readonly program_id: string;
|
|
731
|
+
readonly criteria: AuthorizationLookupCriteria;
|
|
732
|
+
}
|
|
733
|
+
type OpenLifecycle = Omit<AuthorizationLifecycle, 'issuer' | 'refund_cases'> & {
|
|
734
|
+
issuer: Omit<AuthorizationLifecycle['issuer'], 'entries'> & {
|
|
735
|
+
entries: Array<Omit<AuthorizationLifecycle['issuer']['entries'][number], 'operation_type' | 'link_status'> & {
|
|
736
|
+
operation_type: OpenVocabulary<AuthorizationOperationType>;
|
|
737
|
+
link_status: OpenVocabulary<'linked' | 'unlinked'>;
|
|
738
|
+
}>;
|
|
739
|
+
};
|
|
740
|
+
refund_cases: Array<Omit<AuthorizationLifecycle['refund_cases'][number], 'source_operation_type'> & {
|
|
741
|
+
source_operation_type: OpenVocabulary<AuthorizationOperationType>;
|
|
742
|
+
}>;
|
|
743
|
+
};
|
|
744
|
+
type AuthorizationProjectionBase = Omit<AuthorizationProjection$1, 'processing_status' | 'charge_id' | 'final_receipt' | 'decline_reason_code' | 'lifecycle' | 'facts' | 'operation_type' | 'revision'> & {
|
|
745
|
+
facts?: AuthorizationFacts;
|
|
746
|
+
operation_type?: OpenVocabulary<AuthorizationOperationType>;
|
|
747
|
+
revision?: number;
|
|
748
|
+
lifecycle?: OpenLifecycle;
|
|
749
|
+
};
|
|
750
|
+
type AuthorizationProjection = AuthorizationProjectionBase & ({
|
|
751
|
+
processing_status: 'succeeded';
|
|
752
|
+
charge_id?: string | null;
|
|
753
|
+
final_receipt?: ChargeFinalReceipt & {
|
|
754
|
+
execution_outcome: 'succeeded';
|
|
755
|
+
};
|
|
756
|
+
decline_reason_code?: never;
|
|
757
|
+
} | {
|
|
758
|
+
processing_status: 'failed';
|
|
759
|
+
charge_id: string;
|
|
760
|
+
final_receipt: ChargeFinalReceipt & {
|
|
761
|
+
execution_outcome: 'failed';
|
|
762
|
+
};
|
|
763
|
+
decline_reason_code?: never;
|
|
764
|
+
} | ({
|
|
765
|
+
processing_status: 'failed';
|
|
766
|
+
final_receipt?: never;
|
|
767
|
+
decline_reason_code?: string;
|
|
768
|
+
} & ({
|
|
769
|
+
charge_id: string;
|
|
770
|
+
} | {
|
|
771
|
+
charge_id?: null;
|
|
772
|
+
decision?: 'declined' | 'self_reversed_timeout';
|
|
773
|
+
})) | {
|
|
774
|
+
processing_status: 'processing';
|
|
775
|
+
charge_id?: string | null;
|
|
776
|
+
final_receipt?: never;
|
|
777
|
+
decline_reason_code?: never;
|
|
778
|
+
} | {
|
|
779
|
+
processing_status: 'indeterminate';
|
|
780
|
+
charge_id?: null;
|
|
781
|
+
final_receipt?: never;
|
|
782
|
+
decline_reason_code?: never;
|
|
783
|
+
});
|
|
784
|
+
type AuthorizationLookupResult = Omit<AuthorizationLookupResult$1, 'resolution' | 'authorization'> & ({
|
|
785
|
+
resolution: 'not_observed';
|
|
786
|
+
authorization?: never;
|
|
787
|
+
} | {
|
|
788
|
+
resolution: 'unknown';
|
|
789
|
+
authorization: Extract<AuthorizationProjection, {
|
|
790
|
+
processing_status: 'indeterminate';
|
|
791
|
+
}>;
|
|
792
|
+
} | {
|
|
793
|
+
resolution: 'pending';
|
|
794
|
+
authorization: Extract<AuthorizationProjection, {
|
|
795
|
+
processing_status: 'processing';
|
|
796
|
+
}>;
|
|
797
|
+
} | {
|
|
798
|
+
resolution: 'resolved';
|
|
799
|
+
authorization: Extract<AuthorizationProjection, {
|
|
800
|
+
processing_status: 'succeeded' | 'failed';
|
|
801
|
+
}>;
|
|
802
|
+
});
|
|
803
|
+
type IntentCardItem = Omit<IntentCardItem$1, 'status'> & {
|
|
804
|
+
status: OpenVocabulary<IntentCardItem$1['status']>;
|
|
805
|
+
};
|
|
806
|
+
type IntentCardList = Omit<IntentCardList$1, 'cards'> & {
|
|
807
|
+
cards: IntentCardItem[];
|
|
808
|
+
};
|
|
809
|
+
type BindingSummary = Omit<BindingSummary$1, 'status'> & {
|
|
810
|
+
status: OpenVocabulary<BindingSummary$1['status']>;
|
|
811
|
+
};
|
|
812
|
+
type BindingLookupResult = Omit<BindingLookupResult$1, 'binding'> & {
|
|
813
|
+
binding: BindingSummary | null;
|
|
814
|
+
};
|
|
815
|
+
type DeliveryItem = Omit<DeliveryItem$1, 'delivery_state'> & {
|
|
816
|
+
delivery_state: OpenVocabulary<DeliveryItem$1['delivery_state']>;
|
|
817
|
+
};
|
|
818
|
+
type DeliveryPage = Omit<DeliveryPage$1, 'items'> & {
|
|
819
|
+
items: DeliveryItem[];
|
|
820
|
+
};
|
|
821
|
+
interface CardClientOptions extends TransportOptions {
|
|
822
|
+
readonly connectionId: string;
|
|
823
|
+
readonly programId: string;
|
|
824
|
+
readonly apiKeyId: string;
|
|
825
|
+
readonly apiKeySecret: CardApiKeySecret;
|
|
826
|
+
readonly nowSeconds?: () => number;
|
|
827
|
+
readonly createNonce?: () => string;
|
|
828
|
+
}
|
|
829
|
+
interface CardIdempotentRequestOptions extends CardRequestOptions {
|
|
830
|
+
readonly idempotencyKey: string;
|
|
831
|
+
}
|
|
832
|
+
interface CardOpaqueRequestOptions extends CardRequestOptions {
|
|
833
|
+
readonly rawBody?: string;
|
|
834
|
+
}
|
|
835
|
+
interface IntentCardsListOptions extends CardRequestOptions {
|
|
836
|
+
readonly intentToken: string;
|
|
837
|
+
}
|
|
838
|
+
type DeliveryReconciliationInput = Omit<DeliveryReconciliationListInput, 'program_id' | 'selection_id' | 'from_at' | 'to_at'> & ({
|
|
839
|
+
readonly selection_id: string;
|
|
840
|
+
readonly from_at?: never;
|
|
841
|
+
readonly to_at?: never;
|
|
842
|
+
} | {
|
|
843
|
+
readonly selection_id?: never;
|
|
844
|
+
readonly from_at: string;
|
|
845
|
+
readonly to_at: string;
|
|
846
|
+
});
|
|
847
|
+
type DeliveryReplayInput = Omit<DeliveryReplayCreateInput, 'program_id'>;
|
|
848
|
+
interface DeadLetterListParams {
|
|
849
|
+
readonly limit?: number | null;
|
|
850
|
+
}
|
|
851
|
+
type AuthorizationLookupClientInput = Omit<AuthorizationLookupInput, 'program_id'> | AuthorizationLookupCriteria;
|
|
852
|
+
type AuthorizationCreateInput = Omit<AuthorizationCreateInput$1, 'program_id' | 'decision_mode' | 'decision_timeout_ms' | 'deadline_at'> & {
|
|
853
|
+
readonly decision_mode?: 'asynchronous';
|
|
854
|
+
};
|
|
855
|
+
type SynchronousAuthorizationCreateInput = Omit<AuthorizationCreateInput, 'decision_mode'> & {
|
|
856
|
+
readonly decision_mode: 'synchronous';
|
|
857
|
+
readonly decision_timeout_ms?: number;
|
|
858
|
+
readonly deadline_at?: string;
|
|
859
|
+
};
|
|
860
|
+
type SynchronousAuthorizationResult = SynchronousAuthorizationApproved | SynchronousAuthorizationDeclined | AuthorizationDeadlineExceeded;
|
|
861
|
+
type AuthorizationFactInput = Omit<AuthorizationFactInput$1, 'program_id'>;
|
|
862
|
+
type BindingSessionCreateInput = Omit<BindingSessionCreate, 'program_ref'>;
|
|
863
|
+
interface BindingSessionCreateOptions extends CardIdempotentRequestOptions {
|
|
864
|
+
readonly cardSelection?: boolean;
|
|
865
|
+
}
|
|
866
|
+
type SessionProofAssertionInput = Omit<SignBindingAssertionInput, 'environment' | 'programId' | 'bindingSessionId'>;
|
|
867
|
+
type BindingProofSubmitInput = ProviderProofSubmitPayload | SessionProofAssertionInput;
|
|
868
|
+
type BindingSessionCancelOptions = CardIdempotentRequestOptions & CardOpaqueRequestOptions;
|
|
869
|
+
interface CardSessionsApi {
|
|
870
|
+
create(input: BindingSessionCreateInput, options: BindingSessionCreateOptions): Promise<BindingSessionCreated>;
|
|
871
|
+
get(id: string, options?: CardRequestOptions): Promise<BindingSessionStatus>;
|
|
872
|
+
submitProof(id: string, input: BindingProofSubmitInput, options: CardIdempotentRequestOptions): Promise<ProviderProofAccepted>;
|
|
873
|
+
getProofChallenge(id: string, options?: CardRequestOptions): Promise<BindingProofChallenge>;
|
|
874
|
+
cancel(id: string, options: BindingSessionCancelOptions): Promise<BindingSessionStatus>;
|
|
875
|
+
}
|
|
876
|
+
interface CardIntentsApi {
|
|
877
|
+
listCards(id: string, options: IntentCardsListOptions): Promise<IntentCardList>;
|
|
878
|
+
replaceCards(id: string, input: IntentCardsReplaceInput, options: CardIdempotentRequestOptions): Promise<IntentCardsReplaced>;
|
|
879
|
+
cancel(id: string, input: IntentCancelInput, options?: CardRequestOptions): Promise<IntentCancelled>;
|
|
880
|
+
}
|
|
881
|
+
interface CardBindingsApi {
|
|
882
|
+
lookup(input: BindingLookupInput, options?: CardRequestOptions): Promise<BindingLookupResult>;
|
|
883
|
+
}
|
|
884
|
+
interface CardAuthorizationsApi {
|
|
885
|
+
create(input: SynchronousAuthorizationCreateInput, options: CardIdempotentRequestOptions): Promise<SynchronousAuthorizationResult>;
|
|
886
|
+
create(input: AuthorizationCreateInput, options: CardIdempotentRequestOptions): Promise<AuthorizationAccepted>;
|
|
887
|
+
create(input: AuthorizationCreateInput | SynchronousAuthorizationCreateInput, options: CardIdempotentRequestOptions): Promise<AuthorizationAccepted | SynchronousAuthorizationResult>;
|
|
888
|
+
recordFact(externalId: string, input: AuthorizationFactInput, options: CardIdempotentRequestOptions): Promise<AuthorizationFactReceipt>;
|
|
889
|
+
lookup(input: AuthorizationLookupClientInput, options?: CardRequestOptions): Promise<AuthorizationLookupResult>;
|
|
890
|
+
}
|
|
891
|
+
interface CardEventsApi {
|
|
892
|
+
record(input: CardInboundEventInput, options?: CardRequestOptions): Promise<CardInboundEventReceipt>;
|
|
893
|
+
}
|
|
894
|
+
interface CardDeliveriesApi {
|
|
895
|
+
list(input: DeliveryReconciliationInput, options?: CardRequestOptions): Promise<DeliveryPage>;
|
|
896
|
+
}
|
|
897
|
+
interface CardDeliveryReplaysApi {
|
|
898
|
+
create(input: DeliveryReplayInput, options: CardIdempotentRequestOptions): Promise<DeliveryReplayAccepted>;
|
|
899
|
+
}
|
|
900
|
+
interface CardDeadLettersApi {
|
|
901
|
+
list(params?: DeadLetterListParams, options?: CardRequestOptions): Promise<DeadLetterPage>;
|
|
902
|
+
replay(id: string, options?: CardOpaqueRequestOptions): Promise<DeadLetterReplayAccepted>;
|
|
903
|
+
}
|
|
904
|
+
interface CardClient {
|
|
905
|
+
readonly scope: Readonly<{
|
|
906
|
+
connectionId: string;
|
|
907
|
+
environment: CardEnvironment;
|
|
908
|
+
programId: string;
|
|
909
|
+
}>;
|
|
910
|
+
readonly sessions: CardSessionsApi;
|
|
911
|
+
readonly intents: CardIntentsApi;
|
|
912
|
+
readonly bindings: CardBindingsApi;
|
|
913
|
+
readonly authorizations: CardAuthorizationsApi;
|
|
914
|
+
readonly events: CardEventsApi;
|
|
915
|
+
readonly deliveries: CardDeliveriesApi;
|
|
916
|
+
readonly deliveryReplays: CardDeliveryReplaysApi;
|
|
917
|
+
readonly deadLetters: CardDeadLettersApi;
|
|
918
|
+
}
|
|
919
|
+
declare function createCardClient(options: CardClientOptions): CardClient;
|
|
920
|
+
|
|
921
|
+
declare const CARD_INTENT_JWKS_PATH: "/.well-known/facto/card/connect/jwks.json";
|
|
922
|
+
interface CardIntentJwk {
|
|
923
|
+
kty: string;
|
|
924
|
+
crv: string;
|
|
925
|
+
x: string;
|
|
926
|
+
kid?: string;
|
|
927
|
+
alg?: string;
|
|
928
|
+
use?: string;
|
|
929
|
+
}
|
|
930
|
+
interface CardIntentJwks {
|
|
931
|
+
keys: CardIntentJwk[];
|
|
932
|
+
}
|
|
933
|
+
type CardIntentJwksInput = CardIntentJwks | string | (() => CardIntentJwks | Promise<CardIntentJwks>);
|
|
934
|
+
interface VerifyCardIntentTokenInput {
|
|
935
|
+
intentToken: string;
|
|
936
|
+
jwks?: CardIntentJwksInput;
|
|
937
|
+
apiBaseUrl?: string;
|
|
938
|
+
environment?: CardEnvironment;
|
|
939
|
+
audience: string;
|
|
940
|
+
issuer?: string;
|
|
941
|
+
nowMs?: number | Date;
|
|
942
|
+
clockToleranceSeconds?: number;
|
|
943
|
+
}
|
|
944
|
+
interface VerifiedCardIntentToken {
|
|
945
|
+
programId: string;
|
|
946
|
+
pairwiseSubject: string;
|
|
947
|
+
nonce: string;
|
|
948
|
+
expiresAt: string;
|
|
949
|
+
}
|
|
950
|
+
type FactoIntentTokenErrorCode = 'FACTO_INTENT_TOKEN_INPUT_INVALID' | 'FACTO_INTENT_TOKEN_JWKS_INVALID' | 'FACTO_INTENT_TOKEN_MALFORMED' | 'FACTO_INTENT_TOKEN_UNSUPPORTED_ALG' | 'FACTO_INTENT_TOKEN_SIGNATURE_INVALID' | 'FACTO_INTENT_TOKEN_ISSUER_MISMATCH' | 'FACTO_INTENT_TOKEN_AUDIENCE_MISMATCH' | 'FACTO_INTENT_TOKEN_EXPIRED' | 'FACTO_INTENT_TOKEN_CLAIMS_INVALID';
|
|
951
|
+
declare class FactoIntentTokenError extends Error {
|
|
952
|
+
readonly code: FactoIntentTokenErrorCode;
|
|
953
|
+
readonly details?: unknown;
|
|
954
|
+
constructor(code: FactoIntentTokenErrorCode, message: string, options?: {
|
|
955
|
+
details?: unknown;
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
declare function verifyCardIntentToken(input: VerifyCardIntentTokenInput): Promise<VerifiedCardIntentToken>;
|
|
959
|
+
|
|
960
|
+
interface AuthorizationPollingOptions {
|
|
961
|
+
readonly deadlineEpochMs: number;
|
|
962
|
+
readonly intervalMs: number;
|
|
963
|
+
readonly maxIntervalMs: number;
|
|
964
|
+
readonly backoffFactor: number;
|
|
965
|
+
readonly signal?: AbortSignal;
|
|
966
|
+
readonly nowMs?: () => number;
|
|
967
|
+
readonly sleep?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
|
|
968
|
+
}
|
|
969
|
+
type AuthorizationPollingResult = {
|
|
970
|
+
readonly status: 'resolved';
|
|
971
|
+
readonly result: AuthorizationLookupResult;
|
|
972
|
+
} | {
|
|
973
|
+
readonly status: 'poll_deadline_exceeded';
|
|
974
|
+
};
|
|
975
|
+
declare function pollAuthorization(client: {
|
|
976
|
+
readonly authorizations: Pick<CardAuthorizationsApi, 'lookup'>;
|
|
977
|
+
}, input: AuthorizationLookupClientInput, options: AuthorizationPollingOptions): Promise<AuthorizationPollingResult>;
|
|
978
|
+
|
|
979
|
+
interface AuthorizationIdentity {
|
|
980
|
+
readonly connectionId: string;
|
|
981
|
+
readonly externalAuthorizationId: string;
|
|
982
|
+
readonly supplierTransactionId?: string;
|
|
983
|
+
readonly clientTransactionId?: string;
|
|
984
|
+
}
|
|
985
|
+
declare function deriveAuthorizationIdempotencyKey(identity: AuthorizationIdentity): string;
|
|
986
|
+
|
|
987
|
+
export { type AuthorizationAccepted, type AuthorizationCreateInput, type AuthorizationDeadlineExceeded, type AuthorizationFactInput, type AuthorizationFactReceipt, type AuthorizationFactInput$1 as AuthorizationFactRecordInput, type AuthorizationFacts, type AuthorizationIdentity, type AuthorizationLookupClientInput, type AuthorizationLookupCriteria, type AuthorizationLookupInput, type AuthorizationLookupResult, type AuthorizationPollingOptions, type AuthorizationPollingResult, type AuthorizationProjection, type AuthorizationCreateInput$1 as AuthorizationSubmitInput, type BindingAssertionCardDisplay, type BindingAssertionCardInput, type BindingAssertionEd25519Jwk, type BindingAssertionProofInput, type BindingAssertionSigner, type BindingFundingProjection as BindingFundingSummary, type BindingLookupInput, type BindingLookupResult, type BindingProofAssurance, type BindingProofChallenge, type BindingProofPolicy, type BindingProofSubmitInput, type BindingSecondChannelType, type BindingSessionCancelOptions, type BindingSessionCreate, type BindingSessionCreateInput, type BindingSessionCreateOptions, type BindingSessionCreated, type BindingSessionStatus, type BindingSummary, type BindingUserConsentPurpose, CARD_BINDING_ASSERTION_TYP, CARD_INTENT_JWKS_PATH, type CardApiKeySecret, type CardAuthorizationErrorCode, type AuthorizationLifecycle as CardAuthorizationLifecycle, type CardAuthorizationsApi, type CardBindingsApi, type CardClient, type CardClientOptions, type CardDeadLettersApi, type CardDeliveriesApi, type CardDeliveryReplaysApi, type CardDisplayFacts, type CardEnvironment, CardError, type CardErrorEnvelope, type CardErrorOutcome, type CardEventsApi, type ChargeFinalReceipt as CardFinalReceipt, type CardIdempotentRequestOptions, type CardInboundEventInput, type CardInboundEventReceipt, type CardIntentJwk, type CardIntentJwks, type CardIntentJwksInput, type CardIntentsApi, type CardNestedErrorEnvelope, type CardOpaqueRequestOptions, type AuthorizationPaymentDetails as CardPaymentDetails, type CardRequestOptions, type CardSessionsApi, type CardSigningInput, type CardholderVerification, type DeadLetterItem, type DeadLetterListParams, type DeadLetterPage, type DeadLetterReplayAccepted, type DeliveryItem, type DeliveryPage, type DeliveryReconciliationInput, type DeliveryReconciliationListInput, type DeliveryReplayAccepted, type DeliveryReplayCreateInput, type DeliveryReplayInput, CardError as FactoConnectServerError, type FactoConnectServerErrorCode, FactoIntentTokenError, type FactoIntentTokenErrorCode, type IntentCancelInput, type IntentCancelled, type IntentCardItem, type IntentCardList, type IntentCardsListOptions, type IntentCardsReplaceInput, type IntentCardsReplaced, type ProviderProofAccepted, type ProviderProofSubmitPayload, type CardServerRetryOptions as ServerRetryOptions, type SessionProofAssertionInput, type SignBindingAssertionInput, type SynchronousAuthorizationApproved, type SynchronousAuthorizationCreateInput, type SynchronousAuthorizationDeclined, type SynchronousAuthorizationResult, type TargetCardInput, type VerifiedCardIntentToken, type VerifyCardIntentTokenInput, createCardClient, deriveAuthorizationIdempotencyKey, isCardErrorEnvelope, isCardNestedErrorEnvelope, pollAuthorization, signBindingAssertion, signCardRequest, verifyCardIntentToken, withCardServerRetry as withServerRetry };
|