@facto-to/connect 0.0.1-beta.1 → 0.0.1-beta.14

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.
Files changed (38) hide show
  1. package/README.md +140 -81
  2. package/dist/browser/index.cjs +29 -20
  3. package/dist/browser/index.d.cts +1 -31
  4. package/dist/browser/index.d.ts +1 -31
  5. package/dist/browser/index.js +28 -19
  6. package/dist/card-transport--tl4vJa5.d.cts +73 -0
  7. package/dist/card-transport--tl4vJa5.d.ts +73 -0
  8. package/dist/chunk-GJFQH2I6.js +2 -0
  9. package/dist/chunk-VQJMKCAN.js +1 -0
  10. package/dist/cli/index.cjs +6 -0
  11. package/dist/cli/index.d.cts +1 -0
  12. package/dist/cli/index.d.ts +1 -0
  13. package/dist/cli/index.js +5 -0
  14. package/dist/index.d-oRLzr8gp.d.cts +1124 -0
  15. package/dist/index.d-oRLzr8gp.d.ts +1124 -0
  16. package/dist/react/index.cjs +0 -1
  17. package/dist/react/index.js +0 -1
  18. package/dist/server/card-connect-admin-client.cjs +2 -0
  19. package/dist/server/card-connect-admin-client.d.cts +318 -0
  20. package/dist/server/card-connect-admin-client.d.ts +318 -0
  21. package/dist/server/card-connect-admin-client.js +1 -0
  22. package/dist/server/index.cjs +1 -2
  23. package/dist/server/index.d.cts +1202 -291
  24. package/dist/server/index.d.ts +1202 -291
  25. package/dist/server/index.js +1 -2
  26. package/dist/testing/index.cjs +1 -2
  27. package/dist/testing/index.d.cts +6 -14
  28. package/dist/testing/index.d.ts +6 -14
  29. package/dist/testing/index.js +1 -2
  30. package/package.json +64 -17
  31. package/dist/browser/index.cjs.map +0 -1
  32. package/dist/browser/index.js.map +0 -1
  33. package/dist/react/index.cjs.map +0 -1
  34. package/dist/react/index.js.map +0 -1
  35. package/dist/server/index.cjs.map +0 -1
  36. package/dist/server/index.js.map +0 -1
  37. package/dist/testing/index.cjs.map +0 -1
  38. package/dist/testing/index.js.map +0 -1
@@ -0,0 +1,1124 @@
1
+ /** Wire metadata: {"x-facto-contract-revision":"2026-10-23-green-proposal.4","x-facto-status":"candidate"} */
2
+ /** Exact existing demo-grade success fields retained, not a settlement claim. */
3
+ interface AuthorizationAccepted {
4
+ /** Wire validation: {"maxLength":255,"minLength":1} */
5
+ charge_id: string;
6
+ status: 'processing';
7
+ }
8
+ /** Wire metadata: {"x-facto-contract-revision":"2026-10-23-green-proposal.4","x-facto-status":"candidate"} */
9
+ /** Wire validation: {"format":"date-time"} */
10
+ type AuthorizationTimestamp = string;
11
+ interface CardholderVerification {
12
+ /** Wire validation: {"maxLength":256,"minLength":1} */
13
+ evidence_id: string;
14
+ method: 'pin' | 'biometric' | 'cdcvm' | 'signature' | 'no_cvm' | 'provider_attested';
15
+ verified_at: AuthorizationTimestamp;
16
+ }
17
+ interface AuthorizationCreateInput {
18
+ /** Wire validation: {"maxLength":64,"minLength":1} */
19
+ amount: string;
20
+ cardholder_verification: CardholderVerification;
21
+ /** Wire validation: {"maxLength":256,"minLength":1} */
22
+ client_transaction_id?: string;
23
+ currency: 'USD' | 'USDC';
24
+ /** Wire validation: {"format":"date-time"} */
25
+ deadline_at?: string;
26
+ decision_mode?: 'asynchronous' | 'synchronous';
27
+ /** Wire validation: {"maximum":5000,"minimum":50} */
28
+ decision_timeout_ms?: number;
29
+ /** Wire validation: {"maxLength":256,"minLength":1} */
30
+ external_authorization_id: string;
31
+ /** Wire validation: {"maxLength":512,"minLength":1} */
32
+ external_card_id: string;
33
+ /** Wire validation: {"maxLength":255,"minLength":1} */
34
+ mapping_revision: string;
35
+ /** Wire validation: {"maxLength":8,"minLength":1} */
36
+ merchant_country?: string;
37
+ /** Wire validation: {"maxLength":16,"minLength":0} */
38
+ merchant_mcc?: string;
39
+ /** Wire validation: {"maxLength":256,"minLength":0} */
40
+ merchant_name?: string;
41
+ /** Wire validation: {"format":"date-time"} */
42
+ occurred_at?: string;
43
+ /** Wire validation: {"maxLength":512,"minLength":1} */
44
+ program_id: string;
45
+ /** Wire validation: {"maxLength":255,"minLength":1} */
46
+ resource_version: string;
47
+ /** Wire validation: {"maxLength":256,"minLength":1} */
48
+ supplier_transaction_id?: string;
49
+ }
50
+ interface AuthorizationDeadlineExceeded {
51
+ /** Wire validation: {"format":"date-time"} */
52
+ deadline_at: string;
53
+ /** Wire validation: {"format":"uuid"} */
54
+ decision_id: string;
55
+ error: 'decision_deadline_exceeded';
56
+ message: string;
57
+ request_id: string;
58
+ }
59
+ /** Wire metadata: {"x-facto-contract-revision":"2026-10-23-green-proposal.4","x-facto-status":"candidate"} */
60
+ /** provider_authorization is supplier approval of this consumption, never card issuance. durable_commit is technical persistence only; it does not by itself create irreversible payment, debt, settlement or legal responsibility. */
61
+ declare const AUTHORIZATION_FACT_KIND_VALUES: readonly ["facto_admission", "durable_commit", "provider_authorization", "chain_finality", "provider_settlement"];
62
+ type AuthorizationFactKind = (typeof AUTHORIZATION_FACT_KIND_VALUES)[number];
63
+ /** Wire metadata: {"x-facto-contract-revision":"2026-10-23-green-proposal.4","x-facto-status":"candidate"} */
64
+ /** Safe public five-axis fact summary only. Confirmed requires an internal authoritative evidence record and observed_at; internal evidence locators, transaction hashes and storage identifiers never cross this projection. Source system is an allowlisted category, not a host/name/reference. */
65
+ interface AuthorizationFactProperties {
66
+ kind: AuthorizationFactKind;
67
+ observed_at?: AuthorizationTimestamp;
68
+ recorded_at: AuthorizationTimestamp;
69
+ /** Wire validation: {"maxLength":64,"minLength":1} */
70
+ safe_code?: string;
71
+ source_system: 'facto' | 'provider' | 'chain';
72
+ state: 'unobserved' | 'pending' | 'confirmed' | 'rejected' | 'indeterminate';
73
+ }
74
+ type AuthorizationFact = AuthorizationFactProperties & (({
75
+ state: 'confirmed';
76
+ } & Required<Pick<AuthorizationFactProperties, 'observed_at'>>) | ({
77
+ state: Exclude<AuthorizationFactProperties['state'], 'confirmed'>;
78
+ })) & (({
79
+ state: 'unobserved';
80
+ } & {
81
+ observed_at?: never;
82
+ }) | ({
83
+ state: Exclude<AuthorizationFactProperties['state'], 'unobserved'>;
84
+ }));
85
+ interface AuthorizationFactInput {
86
+ /** Wire validation: {"maxLength":64,"minLength":1} */
87
+ amount: string;
88
+ /** Wire validation: {"maxLength":256,"minLength":1} */
89
+ client_transaction_id?: string;
90
+ currency: 'USD' | 'USDC';
91
+ fact_type: 'authorization_updated' | 'clearing' | 'reversal' | 'refund' | 'chargeback' | 'settlement';
92
+ /** Wire validation: {"maxLength":255,"minLength":1} */
93
+ mapping_revision: string;
94
+ /** Wire validation: {"maxLength":8,"minLength":1} */
95
+ merchant_country?: string;
96
+ /** Wire validation: {"maxLength":16,"minLength":0} */
97
+ merchant_mcc?: string;
98
+ /** Wire validation: {"maxLength":256,"minLength":0} */
99
+ merchant_name?: string;
100
+ /** Wire validation: {"maxLength":256,"minLength":1} */
101
+ parent_supplier_transaction_id?: string;
102
+ /** Wire validation: {"maxLength":255,"minLength":1} */
103
+ predecessor_version: string;
104
+ /** Wire validation: {"maxLength":512,"minLength":1} */
105
+ program_id: string;
106
+ /** Wire validation: {"format":"date-time"} */
107
+ recorded_at: string;
108
+ /** Wire validation: {"maxLength":255,"minLength":1} */
109
+ resource_version: string;
110
+ /** Wire validation: {"maxLength":256,"minLength":1} */
111
+ supplier_transaction_id?: string;
112
+ }
113
+ interface AuthorizationFactReceipt {
114
+ /** Wire validation: {"format":"uuid"} */
115
+ operation_id: string;
116
+ status: 'recorded';
117
+ }
118
+ /** Wire metadata: {"x-facto-contract-revision":"2026-10-23-green-proposal.4","x-facto-status":"candidate"} */
119
+ /** Fixed order, exactly one per fact kind; not a progress ladder. */
120
+ /** Wire validation: {"maxItems":5,"minItems":5,"prefixItems":[{"allOf":[{"$ref":"#/components/schemas/AuthorizationFact"},{"properties":{"kind":{"const":"facto_admission"}}}]},{"allOf":[{"$ref":"#/components/schemas/AuthorizationFact"},{"properties":{"kind":{"const":"durable_commit"}}}]},{"allOf":[{"$ref":"#/components/schemas/AuthorizationFact"},{"properties":{"kind":{"const":"provider_authorization"}}}]},{"allOf":[{"$ref":"#/components/schemas/AuthorizationFact"},{"properties":{"kind":{"const":"chain_finality"}}}]},{"allOf":[{"$ref":"#/components/schemas/AuthorizationFact"},{"properties":{"kind":{"const":"provider_settlement"}}}]}]} */
121
+ type AuthorizationFacts = [
122
+ AuthorizationFact & {
123
+ kind?: 'facto_admission';
124
+ },
125
+ AuthorizationFact & {
126
+ kind?: 'durable_commit';
127
+ },
128
+ AuthorizationFact & {
129
+ kind?: 'provider_authorization';
130
+ },
131
+ AuthorizationFact & {
132
+ kind?: 'chain_finality';
133
+ },
134
+ AuthorizationFact & {
135
+ kind?: 'provider_settlement';
136
+ }
137
+ ];
138
+ /** Wire metadata: {"x-facto-contract-revision":"2026-10-23-green-proposal.4","x-facto-status":"candidate"} */
139
+ declare const AUTHORIZATION_OPERATION_TYPE_VALUES: readonly ["authorization_requested", "authorization_updated", "clearing", "reversal", "refund", "chargeback", "settlement"];
140
+ type AuthorizationOperationType = (typeof AUTHORIZATION_OPERATION_TYPE_VALUES)[number];
141
+ /** USDC with exactly six fractional digits. */
142
+ /** Wire validation: {"pattern":"^-?[0-9]+\\.[0-9]{6}$"} */
143
+ type AuthorizationUsdcAmount = string;
144
+ /** Opened by a reversal or refund fact once the original charge exists. amount = min(fact amount, principal not yet claimed by other payable cases); fees are not refundable. Status machine: awaiting_charge_final -> awaiting_funds (charge collected) -> payable (operator confirmed funds returned to Facto) -> paid | failed; no-pay terminal not_payable. */
145
+ interface AuthorizationRefundCase {
146
+ amount: AuthorizationUsdcAmount;
147
+ /** Wire validation: {"pattern":"^rfc_[0-9a-f]{32}$"} */
148
+ case_id: string;
149
+ excess_amount: AuthorizationUsdcAmount;
150
+ /** Open: below_minimum (< 0.01 USD) | exceeds_charge (no principal left) | charge_failed | rejected (administrator). */
151
+ not_payable_reason?: string;
152
+ paid_amount?: AuthorizationUsdcAmount;
153
+ source_operation_type: AuthorizationOperationType;
154
+ /** Wire validation: {"maxLength":255,"minLength":1} */
155
+ source_resource_version: string;
156
+ /** Open: awaiting_charge_final | awaiting_funds | payable | paid | failed | not_payable. */
157
+ status: string;
158
+ /** Wire validation: {"format":"date-time"} */
159
+ updated_at: string;
160
+ }
161
+ interface AuthorizationLifecycleEntry {
162
+ amount: AuthorizationUsdcAmount;
163
+ currency: 'USDC';
164
+ link_status: 'linked' | 'unlinked';
165
+ operation_type: AuthorizationOperationType;
166
+ /** Wire validation: {"format":"date-time"} */
167
+ recorded_at: string;
168
+ /** Wire validation: {"maxLength":255,"minLength":1} */
169
+ resource_version: string;
170
+ /** Open, only when unlinked: original_declined | original_not_dispatched | lineage_missing_charge. */
171
+ unlinked_reason?: string;
172
+ }
173
+ /** Issuer state derived from the multiset of linked facts, independent of arrival order. First match wins: reversals summing to at least the authorized amount -> reversed (a later clearing never restores cleared); any chargeback -> charged_back; refunds summing to at least the cleared amount (authorized amount when nothing cleared) -> refunded, any refund -> partially_refunded; any clearing or settlement -> cleared; any reversal -> partially_reversed; otherwise authorized. cleared_amount is the larger of the clearing and settlement sums. authorization_updated is listed and does not change state. */
174
+ interface AuthorizationSupplierSummary {
175
+ cleared_amount: AuthorizationUsdcAmount;
176
+ entries: AuthorizationLifecycleEntry[];
177
+ refunded_amount: AuthorizationUsdcAmount;
178
+ reversed_amount: AuthorizationUsdcAmount;
179
+ /** Open: authorized | partially_reversed | reversed | cleared | partially_refunded | refunded | charged_back. */
180
+ state: string;
181
+ }
182
+ /** Optional on an original authorization read; present only when the read grant's approved scope names the optional projection field `lifecycle` and a later issuer fact or refund case exists. A scope listing only the complete projection never carries this member. Issuer facts link to the charge only through the original authorization's lineage. Pushes carry bounded summaries and one change, not this full history. Amounts are six-decimal USDC strings. `state`, `status`, `not_payable_reason` and `unlinked_reason` are open vocabularies: tolerate unknown values. Refund cases are recorded by Facto operators; the engine never pays automatically. */
183
+ interface AuthorizationLifecycle {
184
+ issuer: AuthorizationSupplierSummary;
185
+ refund_cases: AuthorizationRefundCase[];
186
+ }
187
+ /** Only for an explicitly approved payment_details read projection. Refund payments additionally require lifecycle. User payment hashes are exposed only for a successful proven settlement; refund hashes are operator-recorded, not chain-verified. Receive subscription does not grant read access. */
188
+ interface AuthorizationPaymentDetails {
189
+ fee_breakdown: {
190
+ base_fee: AuthorizationUsdcAmount;
191
+ fast_pay_fee: AuthorizationUsdcAmount;
192
+ pooled_surcharge: AuthorizationUsdcAmount;
193
+ };
194
+ fee_total: AuthorizationUsdcAmount;
195
+ refund_payments?: Array<{
196
+ /** Wire validation: {"maxLength":36} */
197
+ case_id: string;
198
+ /** Wire validation: {"format":"int64"} */
199
+ chain_id: number;
200
+ paid_amount: AuthorizationUsdcAmount;
201
+ /** Open value; operator means manually recorded, not chain-verified. */
202
+ recorded_by: string;
203
+ /** Wire validation: {"pattern":"^0x[0-9a-fA-F]{64}$"} */
204
+ tx_hash: string;
205
+ }>;
206
+ user_payment?: {
207
+ /** Wire validation: {"maxLength":32} */
208
+ asset_symbol?: string;
209
+ /** Wire validation: {"format":"int64"} */
210
+ chain_id: number;
211
+ /** Wire validation: {"pattern":"^0x[0-9a-fA-F]{64}$"} */
212
+ tx_hash: string;
213
+ };
214
+ }
215
+ /** Wire metadata: {"x-facto-contract-revision":"2026-10-23-green-proposal.4","x-facto-status":"candidate"} */
216
+ /** Wire validation: {"pattern":"^pconn_[A-Za-z0-9_-]{16,}$"} */
217
+ type AuthorizationProgramConnectionId = string;
218
+ /** Wire metadata: {"x-facto-contract-revision":"2026-10-23-green-proposal.4","x-facto-status":"candidate"} */
219
+ /** Wire validation: {"maximum":2147483647,"minimum":1} */
220
+ type AuthorizationRevision = number;
221
+ /** Wire metadata: {"x-facto-contract-revision":"2026-10-23-green-proposal.4","x-facto-status":"candidate"} */
222
+ /** Wire validation: {"format":"uuid"} */
223
+ type AuthorizationUuid = string;
224
+ /** Wire metadata: {"x-facto-contract-revision":"2026-10-23-green-proposal.4","x-facto-status":"candidate"} */
225
+ /** Exactly one immutable safe receipt core per public charge identity in its original Program/environment. Generated only after actual releaseFor/cancelReservation is on chain and past existing per-chain pipeline_finality_secs. Never a provisional receipt. releaseFor=>succeeded; cancelReservation=>failed, describing that finalized pipeline action only, not supplier settlement, refund, discharge or legal responsibility. receipt_event_id is the established public logical delivery event identity, not an added storage ID. Pull and push serialize this same persisted core. Correlation discloses only the original caller-known business ref and approved public mapping/type/version; no card ref/subject/storage UUID/internal digest/evidence/route/tx hash. */
226
+ interface ChargeFinalReceiptProperties {
227
+ /** Wire validation: {"maxLength":255,"minLength":1} */
228
+ charge_id: string;
229
+ execution_outcome: 'succeeded' | 'failed';
230
+ /** Wire validation: {"maxLength":256,"minLength":1} */
231
+ external_authorization_id: string;
232
+ facts_at_finality: AuthorizationFacts;
233
+ finalized_at: AuthorizationTimestamp;
234
+ /** Wire validation: {"maxLength":255,"minLength":1} */
235
+ mapping_revision: string;
236
+ operation_type: AuthorizationOperationType;
237
+ receipt_event_id: AuthorizationUuid;
238
+ /** Wire validation: {"maxLength":255,"minLength":1} */
239
+ resource_version: string;
240
+ terminal_action: 'releaseFor' | 'cancelReservation';
241
+ }
242
+ type ChargeFinalReceipt = ChargeFinalReceiptProperties & {
243
+ /** Wire validation: {"prefixItems":[{},{},{},{"properties":{"state":{"const":"confirmed"}}}]} */
244
+ facts_at_finality?: [
245
+ ChargeFinalReceiptProperties['facts_at_finality'][0],
246
+ ChargeFinalReceiptProperties['facts_at_finality'][1],
247
+ ChargeFinalReceiptProperties['facts_at_finality'][2],
248
+ ChargeFinalReceiptProperties['facts_at_finality'][3] & {
249
+ state?: 'confirmed';
250
+ },
251
+ ChargeFinalReceiptProperties['facts_at_finality'][4]
252
+ ];
253
+ } & (({
254
+ terminal_action: 'releaseFor';
255
+ } & {
256
+ execution_outcome?: 'succeeded';
257
+ /** Wire validation: {"prefixItems":[{"properties":{"state":{"const":"confirmed"}}},{"properties":{"state":{"const":"confirmed"}}}]} */
258
+ facts_at_finality?: [
259
+ ChargeFinalReceiptProperties['facts_at_finality'][0] & {
260
+ state?: 'confirmed';
261
+ },
262
+ ChargeFinalReceiptProperties['facts_at_finality'][1] & {
263
+ state?: 'confirmed';
264
+ },
265
+ ChargeFinalReceiptProperties['facts_at_finality'][2],
266
+ ChargeFinalReceiptProperties['facts_at_finality'][3],
267
+ ChargeFinalReceiptProperties['facts_at_finality'][4]
268
+ ];
269
+ }) | ({
270
+ terminal_action: Exclude<ChargeFinalReceiptProperties['terminal_action'], 'releaseFor'>;
271
+ } & {
272
+ execution_outcome?: 'failed';
273
+ }));
274
+ /** Wire metadata: {"x-facto-contract-revision":"2026-10-23-green-proposal.4","x-facto-status":"candidate"} */
275
+ /** Safe exact-operation projection. Before the FR107 terminal-action finality condition, a known charge is only processing, even with confirmed admission and durable persistence. succeeded requires the single persisted final receipt. A terminal PRE-DISPATCH refusal is `failed` with `charge_id` plus a bounded `decline_reason_code` and deliberately no final receipt, because no money moved. A `failed` WITH a receipt keeps the persisted-core contract. The two are mutually exclusive, but the residual rule (a failed projection must carry a receipt OR a decline_reason_code) is not expressible in the SDK's closed keyword subset and is enforced by the strict consuming parser/engine instead. Unknown original-action lineage has indeterminate status and no borrowed charge. No internal record IDs or internal digests. Mapping revision is an approved Program-scoped public locator, not a raw mapping storage UUID. */
276
+ interface AuthorizationProjectionProperties {
277
+ /** Wire validation: {"maxLength":255,"minLength":1} */
278
+ charge_id?: string;
279
+ decision?: 'approved' | 'declined' | 'self_reversed_timeout';
280
+ /** Bounded engine decline code for a terminal PRE-DISPATCH refusal (no money moved, so no final receipt). Never a message body. */
281
+ /** Wire validation: {"maxLength":64,"minLength":1,"pattern":"^[A-Za-z0-9_.:-]+$"} */
282
+ decline_reason_code?: string;
283
+ /** Wire validation: {"maxLength":256,"minLength":1} */
284
+ external_authorization_id: string;
285
+ facts: AuthorizationFacts;
286
+ final_receipt?: ChargeFinalReceipt;
287
+ lifecycle?: AuthorizationLifecycle;
288
+ /** Exact original immutable trusted mapping revision locator, never caller authority or current-profile fallback. It must uniquely recover namespace inside the authenticated original scope before intersecting current read or money eligibility. */
289
+ /** Wire validation: {"maxLength":255,"minLength":1} */
290
+ mapping_revision: string;
291
+ operation_type: AuthorizationOperationType;
292
+ origin_connection_id: AuthorizationProgramConnectionId;
293
+ payment_details?: AuthorizationPaymentDetails;
294
+ processing_status: 'processing' | 'succeeded' | 'failed' | 'indeterminate';
295
+ /** Wire validation: {"maxLength":255,"minLength":1} */
296
+ resource_version: string;
297
+ revision: AuthorizationRevision;
298
+ /** Wire validation: {"maxLength":256,"minLength":1} */
299
+ supplier_transaction_id?: string;
300
+ }
301
+ type AuthorizationProjection = AuthorizationProjectionProperties & (({
302
+ processing_status: 'succeeded';
303
+ } & Required<Pick<AuthorizationProjectionProperties, 'charge_id'>>) | ({
304
+ processing_status: Exclude<AuthorizationProjectionProperties['processing_status'], 'succeeded'>;
305
+ } & {
306
+ final_receipt?: never;
307
+ })) & (({
308
+ processing_status: 'succeeded';
309
+ } & Required<Pick<AuthorizationProjectionProperties, 'final_receipt'>>) | ({
310
+ processing_status: Exclude<AuthorizationProjectionProperties['processing_status'], 'succeeded'>;
311
+ })) & ((Required<Pick<AuthorizationProjectionProperties, 'final_receipt'>> & {
312
+ decline_reason_code?: never;
313
+ }) | ({
314
+ final_receipt?: never;
315
+ })) & ((Required<Pick<AuthorizationProjectionProperties, 'decline_reason_code'>> & {
316
+ processing_status?: 'failed';
317
+ }) | ({
318
+ decline_reason_code?: never;
319
+ })) & ((Required<Pick<AuthorizationProjectionProperties, 'charge_id'>> & {
320
+ processing_status?: 'processing' | 'succeeded' | 'failed';
321
+ }) | ({
322
+ charge_id?: never;
323
+ })) & (({
324
+ processing_status: 'succeeded';
325
+ } & {
326
+ final_receipt?: {
327
+ execution_outcome?: 'succeeded';
328
+ };
329
+ }) | ({
330
+ processing_status: Exclude<AuthorizationProjectionProperties['processing_status'], 'succeeded'>;
331
+ })) & (({
332
+ processing_status: 'failed';
333
+ } & {
334
+ final_receipt?: {
335
+ execution_outcome?: 'failed';
336
+ };
337
+ }) | ({
338
+ processing_status: Exclude<AuthorizationProjectionProperties['processing_status'], 'failed'>;
339
+ }));
340
+ /** Wire metadata: {"x-facto-contract-revision":"2026-10-23-green-proposal.4","x-facto-status":"candidate"} */
341
+ /** Original ref/key or public charge ID, strictly one lookup. All undergo current authority before existence disclosure. resolved means final receipt exists; pending known charge/request never implies terminal; unknown identity remains unknown. Charge without confirmed terminal-action finality is processing only. */
342
+ interface AuthorizationLookupResultProperties {
343
+ authorization?: AuthorizationProjection;
344
+ observed_at: AuthorizationTimestamp;
345
+ resolution: 'resolved' | 'pending' | 'unknown' | 'not_observed';
346
+ }
347
+ type AuthorizationLookupResult = AuthorizationLookupResultProperties & (({
348
+ resolution: 'not_observed';
349
+ } & {
350
+ authorization?: never;
351
+ }) | ({
352
+ resolution: Exclude<AuthorizationLookupResultProperties['resolution'], 'not_observed'>;
353
+ })) & (({
354
+ resolution: 'resolved';
355
+ } & Required<Pick<AuthorizationLookupResultProperties, 'authorization'>> & {
356
+ authorization?: {
357
+ processing_status?: 'succeeded' | 'failed';
358
+ };
359
+ }) | ({
360
+ resolution: Exclude<AuthorizationLookupResultProperties['resolution'], 'resolved'>;
361
+ })) & (({
362
+ resolution: 'pending';
363
+ } & Required<Pick<AuthorizationLookupResultProperties, 'authorization'>> & {
364
+ authorization?: {
365
+ processing_status?: 'processing';
366
+ };
367
+ }) | ({
368
+ resolution: Exclude<AuthorizationLookupResultProperties['resolution'], 'pending'>;
369
+ })) & (({
370
+ resolution: 'unknown';
371
+ } & Required<Pick<AuthorizationLookupResultProperties, 'authorization'>> & {
372
+ authorization?: {
373
+ processing_status?: 'indeterminate';
374
+ };
375
+ }) | ({
376
+ resolution: Exclude<AuthorizationLookupResultProperties['resolution'], 'unknown'>;
377
+ }));
378
+ interface BindingFundingAvailableToCharge {
379
+ amount?: string;
380
+ constrained_by?: string;
381
+ currency?: string;
382
+ reason?: string;
383
+ state: 'available' | 'not_chargeable' | 'unavailable';
384
+ }
385
+ /** Wire validation: {"format":"date-time"} */
386
+ type CardTimestamp = string;
387
+ interface BindingFundingLimitsProjection {
388
+ available_to_charge: BindingFundingAvailableToCharge;
389
+ currency: string;
390
+ expires_at?: CardTimestamp | null;
391
+ per_tx_limit?: string | null;
392
+ period: string;
393
+ period_limit?: string | null;
394
+ period_remaining?: string | null;
395
+ period_used?: string | null;
396
+ }
397
+ interface BindingFundingPipelineProjection {
398
+ account_ref: string;
399
+ /** Wire validation: {"format":"int32"} */
400
+ asset_decimals: number;
401
+ asset_symbol: string;
402
+ balance?: string | null;
403
+ balance_raw?: string | null;
404
+ balance_updated_at?: CardTimestamp | null;
405
+ /** Wire validation: {"format":"int64"} */
406
+ chain_id: number;
407
+ name: string;
408
+ protocol: string;
409
+ spend_mode: string;
410
+ yield_token_symbol: string;
411
+ }
412
+ interface BindingFundingProjection {
413
+ configured: boolean;
414
+ limits?: BindingFundingLimitsProjection;
415
+ pipeline?: BindingFundingPipelineProjection;
416
+ reason?: string;
417
+ state: 'ready' | 'not_configured' | 'unavailable';
418
+ }
419
+ interface BindingLookupInput {
420
+ /** Wire validation: {"maxLength":255,"minLength":1,"not":{"pattern":"[0-9]{13}"}} */
421
+ external_card_id: string;
422
+ }
423
+ /** Wire validation: {"pattern":"^cb_[A-Za-z0-9_-]{16,}$"} */
424
+ type CardBindingId = string;
425
+ interface CardDisplayFacts {
426
+ last4: string | null;
427
+ network: string | null;
428
+ type: 'virtual' | 'physical' | 'unknown' | null;
429
+ }
430
+ interface BindingSummary {
431
+ card: CardDisplayFacts;
432
+ funding?: BindingFundingProjection;
433
+ id: CardBindingId;
434
+ /** Wire validation: {"format":"int32","minimum":1} */
435
+ revision: number;
436
+ status: 'active' | 'revoked';
437
+ }
438
+ interface BindingLookupResult {
439
+ binding: BindingSummary | null;
440
+ found: boolean;
441
+ }
442
+ /** Wire validation: {"pattern":"^cbs_[A-Za-z0-9_-]{16,}$"} */
443
+ type BindingSessionId = string;
444
+ interface BindingProofChallenge {
445
+ binding_session_id: BindingSessionId;
446
+ expires_at: CardTimestamp;
447
+ facto_challenge: string;
448
+ session_request_digest: string;
449
+ }
450
+ interface BindingProofPolicy {
451
+ /** Wire validation: {"minItems":1,"uniqueItems":true} */
452
+ allowed_modes: ['provider_reauthentication' | 'provider_second_channel', ...Array<'provider_reauthentication' | 'provider_second_channel'>];
453
+ /** Present only when the create request opted in with `x-facto-card-selection: 1`. */
454
+ card_selection_supported?: true;
455
+ challenge_after_facto_auth: true;
456
+ challenge_delivery: 'browser_handoff' | 'provider_backend';
457
+ }
458
+ interface BindingSessionCreate {
459
+ /** Wire validation: {"maxLength":255,"minLength":1} */
460
+ program_ref: string;
461
+ /** Wire validation: {"minItems":1,"uniqueItems":true} */
462
+ requested_user_consents: ['card.metadata.view' | 'card.use_for_facto_payments', ...Array<'card.metadata.view' | 'card.use_for_facto_payments'>];
463
+ /** Exact pre-registered URI; maximum 2048 UTF-8 bytes. The existing shape validator is not a general URL normalizer. */
464
+ /** Wire validation: {"maxLength":2048,"pattern":"^https://[^/@?#\\r\\n]+(?:[/?][^#\\r\\n]*)?$"} */
465
+ return_uri: string;
466
+ }
467
+ interface BindingSessionCreated {
468
+ binding_session_id: BindingSessionId;
469
+ /** Sensitive one-time URL returned only to the authenticated Program backend. */
470
+ binding_url: string;
471
+ expires_at: CardTimestamp;
472
+ proof_policy: BindingProofPolicy;
473
+ status: 'pending';
474
+ }
475
+ type BindingSessionStatus = {
476
+ binding_session_id: BindingSessionId;
477
+ expires_at: CardTimestamp;
478
+ status: 'pending';
479
+ } | {
480
+ binding_session_id: BindingSessionId;
481
+ expires_at: CardTimestamp;
482
+ status: 'proof_pending';
483
+ } | {
484
+ binding_session_id: BindingSessionId;
485
+ expires_at: CardTimestamp;
486
+ status: 'consent_pending';
487
+ } | {
488
+ binding_ids: CardBindingId[];
489
+ binding_session_id: BindingSessionId;
490
+ completed_at?: CardTimestamp;
491
+ expires_at: CardTimestamp;
492
+ outcome: 'bound';
493
+ status: 'completed';
494
+ } | {
495
+ binding_session_id: BindingSessionId;
496
+ completed_at?: CardTimestamp;
497
+ expires_at: CardTimestamp;
498
+ failure_reason: 'declined_by_user';
499
+ outcome: 'declined';
500
+ status: 'completed';
501
+ } | {
502
+ binding_session_id: BindingSessionId;
503
+ completed_at?: CardTimestamp;
504
+ expires_at: CardTimestamp;
505
+ failure_reason?: 'cancelled_by_user' | 'cancelled_by_partner' | 'proof_rejected' | 'admission_closed' | 'no_eligible_cards' | 'integrity_conflict';
506
+ status: 'cancelled';
507
+ } | {
508
+ binding_session_id: BindingSessionId;
509
+ expires_at: CardTimestamp;
510
+ failure_reason?: 'expired' | 'proof_timeout';
511
+ status: 'expired';
512
+ };
513
+ /** Wire validation: {"pattern":"^sha256:[a-f0-9]{64}$"} */
514
+ type CardDigest = string;
515
+ declare const CARD_ENVIRONMENT_VALUES: readonly ["dev", "production"];
516
+ type CardEnvironment = (typeof CARD_ENVIRONMENT_VALUES)[number];
517
+ type CardInboundEventInput = {
518
+ /** Nonblank compact JWS; certified typ/audience/jti and exact scope verified by the handler. */
519
+ /** Wire validation: {"minLength":1,"pattern":"\\S","writeOnly":true} */
520
+ assertion_jws: string;
521
+ /** Wire validation: {"maxLength":255,"minLength":1} */
522
+ delivery_id: string;
523
+ external_account_id?: null;
524
+ /** Wire validation: {"maxLength":255,"minLength":1,"not":{"pattern":"[0-9]{13}"}} */
525
+ external_card_id: string;
526
+ kind: 'card.unbound';
527
+ lifecycle_status?: null;
528
+ } | {
529
+ /** Nonblank compact JWS; certified typ/audience/jti and exact scope verified by the handler. */
530
+ /** Wire validation: {"minLength":1,"pattern":"\\S","writeOnly":true} */
531
+ assertion_jws: string;
532
+ /** Wire validation: {"maxLength":255,"minLength":1} */
533
+ delivery_id: string;
534
+ external_account_id?: null;
535
+ /** Wire validation: {"maxLength":255,"minLength":1,"not":{"pattern":"[0-9]{13}"}} */
536
+ external_card_id: string;
537
+ kind: 'card.lifecycle_changed';
538
+ lifecycle_status: 'pending' | 'active' | 'frozen' | 'closed' | 'replaced' | 'unknown';
539
+ } | {
540
+ /** Nonblank compact JWS; certified typ/audience/jti and exact scope verified by the handler. */
541
+ /** Wire validation: {"minLength":1,"pattern":"\\S","writeOnly":true} */
542
+ assertion_jws: string;
543
+ /** Wire validation: {"maxLength":255,"minLength":1} */
544
+ delivery_id: string;
545
+ /** Wire validation: {"maxLength":512,"minLength":1} */
546
+ external_account_id: string;
547
+ external_card_id?: null;
548
+ kind: 'account.released';
549
+ lifecycle_status?: null;
550
+ };
551
+ type CardInboundEventReceipt = {
552
+ /** Wire validation: {"maxLength":255,"minLength":1} */
553
+ delivery_id: string;
554
+ disposition: 'applied';
555
+ effect: 'revoked' | 'status_updated' | 'released' | 'none';
556
+ } | {
557
+ /** Wire validation: {"maxLength":255,"minLength":1} */
558
+ delivery_id: string;
559
+ disposition: 'duplicate';
560
+ effect: null;
561
+ };
562
+ /** Wire validation: {"maximum":2147483647,"minimum":1} */
563
+ type CardRevision = number;
564
+ /** Wire validation: {"format":"uuid"} */
565
+ type CardUuid = string;
566
+ /** Wire validation: {"pattern":"^sha256:[a-fA-F0-9]{64}$"} */
567
+ type ConnectIntentDigest = string;
568
+ /** Wire validation: {"pattern":"^cint_[A-Za-z0-9_-]{16,}$"} */
569
+ type ConnectIntentId = string;
570
+ declare const SANDBOX_PERSONA_KIND_VALUES: readonly ["ready", "setup_required", "authorization_required", "mandate_payable"];
571
+ type SandboxPersonaKind = (typeof SANDBOX_PERSONA_KIND_VALUES)[number];
572
+ declare const MANDATE_LIMIT_PERIOD_VALUES: readonly ["daily", "weekly", "monthly"];
573
+ type MandateLimitPeriod = (typeof MANDATE_LIMIT_PERIOD_VALUES)[number];
574
+ interface MandateLimits {
575
+ perTxAmount: string;
576
+ period: MandateLimitPeriod;
577
+ periodAmount: string;
578
+ }
579
+ declare const MANDATE_USE_CASE_VALUES: readonly ["immediate", "recurring", "top_up", "metered"];
580
+ type MandateUseCase = (typeof MANDATE_USE_CASE_VALUES)[number];
581
+ interface CreateMandatePaymentRequest {
582
+ amount: string;
583
+ currency: string;
584
+ description?: string | null;
585
+ mandateId: string;
586
+ merchantPaymentRef: string;
587
+ metadata?: Record<string, string> | null;
588
+ paymentOptionId?: string | null;
589
+ /**
590
+ * The sub-merchant name to show on the consumer's billing line. Returned
591
+ * on authenticated payment reads; NOT included in webhook payloads.
592
+ * Rejects control, zero-width and bidi override characters.
593
+ */
594
+ subMerchantDisplayName?: string | null;
595
+ /**
596
+ * Your reconciliation anchor for the sub-merchant this payment was
597
+ * collected for. Echoed on every payment projection and included in
598
+ * payment webhooks. Display and reconciliation only — Facto never keys,
599
+ * joins or deduplicates on it.
600
+ */
601
+ subMerchantRef?: string | null;
602
+ useCase: MandateUseCase;
603
+ }
604
+ interface CreatePathChangeSessionRequest {
605
+ /**
606
+ * Must equal the authenticated credential's app. Present so the merchant's
607
+ * own request is self-describing in its logs; it is asserted, never
608
+ * trusted.
609
+ */
610
+ appId: string;
611
+ /**
612
+ * The authorization to re-point. Asserted against the authenticated app
613
+ * inside the insert statement — a mandate belonging to another merchant
614
+ * and a mandate that does not exist give the same answer.
615
+ */
616
+ mandateId: string;
617
+ /**
618
+ * Where the shopper is sent when the flow ends. Must be an exact
619
+ * `allowed_origins` member; its origin also becomes the postMessage
620
+ * target.
621
+ */
622
+ returnUrl: string;
623
+ }
624
+ interface CreateTestMandateRequest {
625
+ /**
626
+ * Idempotency key for this surface. `Idempotency-Key` is NOT read here;
627
+ * replay is keyed on this field, which is why it is required.
628
+ */
629
+ clientRef: string;
630
+ defaultLimits: MandateLimits;
631
+ /** Enum only. A raw persona id is never accepted from request data. */
632
+ persona: SandboxPersonaKind;
633
+ requestedUseCases: MandateUseCase[];
634
+ }
635
+ interface CreateTestMandateResponse {
636
+ mandateId: string;
637
+ settlementMode: string;
638
+ }
639
+ interface DeadLetterItem {
640
+ binding_id: CardBindingId;
641
+ /** Wire validation: {"format":"int32"} */
642
+ binding_revision: number;
643
+ connection_sequence: number | null;
644
+ dead_lettered_at: CardTimestamp | null;
645
+ /** Wire validation: {"format":"int32"} */
646
+ delivery_attempts: number;
647
+ event_kind: string;
648
+ id: CardUuid;
649
+ last_delivery_error: string | null;
650
+ /** Wire validation: {"format":"int32"} */
651
+ replay_count: number;
652
+ }
653
+ interface DeadLetterPage {
654
+ items: DeadLetterItem[];
655
+ }
656
+ interface DeadLetterReplayAccepted {
657
+ id: CardUuid;
658
+ status: 'accepted';
659
+ }
660
+ interface DeliveryReceiverReplacementProperties {
661
+ /** Wire validation: {"maxLength":255,"minLength":1} */
662
+ approval_ref: string;
663
+ /** Wire validation: {"format":"uri","maxLength":2048,"minLength":1,"pattern":"^https://[^@#]+$"} */
664
+ endpoint_url: string;
665
+ /** Kinds must belong to the approved catalog; authorization.updated requires the approved authorization_updates feature. */
666
+ /** Wire validation: {"maxItems":32,"minItems":1,"uniqueItems":true} */
667
+ event_kinds: ['card.binding.linked' | 'card.binding.relinked' | 'card.binding.revoked' | 'card.binding.route_changed' | 'card.binding.limits_changed' | 'card.binding.ownership_transferred' | 'card.charge.finalized' | 'card.charge.facts_updated' | 'card.authorization.updated' | 'card_program.card_binding.linked' | 'card_program.card_binding.relinked' | 'card_program.card_binding.revoked' | 'card_program.card_binding.route_association_changed' | 'card_program.card_binding.spend_envelope_changed' | 'card_program.card_binding.ownership_transferred' | 'card_program.charge.finalized' | 'card_program.charge.facts_updated' | 'card_program.authorization.updated', ...Array<'card.binding.linked' | 'card.binding.relinked' | 'card.binding.revoked' | 'card.binding.route_changed' | 'card.binding.limits_changed' | 'card.binding.ownership_transferred' | 'card.charge.finalized' | 'card.charge.facts_updated' | 'card.authorization.updated' | 'card_program.card_binding.linked' | 'card_program.card_binding.relinked' | 'card_program.card_binding.revoked' | 'card_program.card_binding.route_association_changed' | 'card_program.card_binding.spend_envelope_changed' | 'card_program.card_binding.ownership_transferred' | 'card_program.charge.finalized' | 'card_program.charge.facts_updated' | 'card_program.authorization.updated'>];
668
+ expected_grant_revision: CardRevision;
669
+ /** Wire validation: {"format":"uuid"} */
670
+ expected_target_revision: string | null;
671
+ /** Wire validation: {"maxLength":255,"minLength":1} */
672
+ principal_ref: string;
673
+ required_event_catalog_digest: CardDigest;
674
+ /** Published catalogs are immutable. New catalogs do not invalidate approved connections; changing catalog requires a newly approved revision. */
675
+ required_event_catalog_revision: '2026-10-23-green-proposal.4' | '2026-10-23-green-proposal.5' | '2026-11-18-card-events.1';
676
+ /** Wire validation: {"maxLength":255,"minLength":1} */
677
+ signing_key_id: string;
678
+ }
679
+ type DeliveryReceiverReplacement = DeliveryReceiverReplacementProperties & (({
680
+ required_event_catalog_revision: '2026-10-23-green-proposal.4';
681
+ } & {
682
+ /** Wire validation: {"not":{"contains":{"const":"card_program.authorization.updated"}}} */
683
+ event_kinds?: Exclude<DeliveryReceiverReplacementProperties['event_kinds'][number], 'card_program.authorization.updated'>[];
684
+ required_event_catalog_digest?: 'sha256:117822c07295b7b574f488dfd74a32d4edf3f648e5d2a8333916301354798367';
685
+ }) | ({
686
+ required_event_catalog_revision: Exclude<DeliveryReceiverReplacementProperties['required_event_catalog_revision'], '2026-10-23-green-proposal.4'>;
687
+ })) & (({
688
+ required_event_catalog_revision: '2026-10-23-green-proposal.5';
689
+ } & {
690
+ required_event_catalog_digest?: 'sha256:b17e2170470adda15c7f02e3341f7afeab7680abcfbae6610e1eb6094bf4f6ab';
691
+ }) | ({
692
+ required_event_catalog_revision: Exclude<DeliveryReceiverReplacementProperties['required_event_catalog_revision'], '2026-10-23-green-proposal.5'>;
693
+ })) & (({
694
+ required_event_catalog_revision: '2026-11-18-card-events.1';
695
+ } & {
696
+ required_event_catalog_digest?: 'sha256:9fcad68499ef3f770533ad3f3a4c4950d16c0385c56b2b0af6bba5375038aa98';
697
+ }) | ({
698
+ required_event_catalog_revision: Exclude<DeliveryReceiverReplacementProperties['required_event_catalog_revision'], '2026-11-18-card-events.1'>;
699
+ }));
700
+ type DeliveryGrantTransition = {
701
+ /** Wire validation: {"maxLength":255,"minLength":1} */
702
+ approval_ref: string;
703
+ expected_grant_revision: CardRevision;
704
+ expected_target_revision: CardUuid;
705
+ /** Wire validation: {"maxLength":64,"minLength":2,"pattern":"^[a-z][a-z0-9_]{1,63}$"} */
706
+ reason_code: string;
707
+ transition: 'activate';
708
+ } | {
709
+ /** Wire validation: {"maxLength":64,"minLength":2,"pattern":"^[a-z][a-z0-9_]{1,63}$"} */
710
+ reason_code: string;
711
+ transition: 'disable' | 'revoke';
712
+ } | {
713
+ /** Wire validation: {"maxLength":255,"minLength":1} */
714
+ approval_ref: string;
715
+ expected_target_revision: CardUuid;
716
+ new_credential_binding_id: CardUuid;
717
+ /** Wire validation: {"maxLength":255,"minLength":1} */
718
+ new_credential_key_id: string;
719
+ /** Wire validation: {"maxLength":255,"minLength":1} */
720
+ new_principal_ref: string;
721
+ /** Wire validation: {"maxLength":64,"minLength":2,"pattern":"^[a-z][a-z0-9_]{1,63}$"} */
722
+ reason_code: string;
723
+ replacement_receiver: DeliveryReceiverReplacement & {
724
+ expected_target_revision?: CardUuid;
725
+ };
726
+ transition: 'handover';
727
+ };
728
+ /** Wire validation: {"pattern":"^pconn_[A-Za-z0-9_-]{16,}$"} */
729
+ type ProgramConnectionId = string;
730
+ interface DeliveryItem {
731
+ accepted_at?: CardTimestamp;
732
+ /** Wire validation: {"minimum":1} */
733
+ connection_sequence: number | null;
734
+ delivery_state: 'pending' | 'held' | 'accepted' | 'failed' | 'dead_lettered' | 'indeterminate';
735
+ event_id: CardUuid;
736
+ /** Wire validation: {"pattern":"^[a-f0-9]{64}$"} */
737
+ event_sha256: string;
738
+ origin_connection_id: ProgramConnectionId;
739
+ target_revision: CardUuid;
740
+ }
741
+ interface DeliveryOperationReceiptProperties {
742
+ /** Wire validation: {"maxItems":100,"minItems":0,"uniqueItems":true} */
743
+ evidence_refs: string[];
744
+ expected_revision: CardRevision;
745
+ /** Wire validation: {"maxLength":255,"minLength":1} */
746
+ operation: string;
747
+ operation_receipt_id: CardUuid;
748
+ /** Wire validation: {"maxLength":64,"minLength":1} */
749
+ reason_code?: string;
750
+ recorded_at: CardTimestamp;
751
+ request_digest: CardDigest;
752
+ result_revision?: CardRevision;
753
+ scope_ref: ProgramConnectionId;
754
+ status: 'accepted' | 'committed' | 'rejected' | 'indeterminate';
755
+ }
756
+ type DeliveryOperationReceipt = DeliveryOperationReceiptProperties & (({
757
+ status: 'committed';
758
+ } & Required<Pick<DeliveryOperationReceiptProperties, 'result_revision'>>) | ({
759
+ status: Exclude<DeliveryOperationReceiptProperties['status'], 'committed'>;
760
+ })) & (({
761
+ status: 'accepted' | 'rejected' | 'indeterminate';
762
+ } & {
763
+ result_revision?: never;
764
+ }) | ({
765
+ status: Exclude<DeliveryOperationReceiptProperties['status'], 'accepted' | 'rejected' | 'indeterminate'>;
766
+ }));
767
+ /** Wire validation: {"pattern":"^pc_[A-Za-z0-9_-]{16,}$"} */
768
+ type ProviderConnectionId = string;
769
+ interface DeliveryReceiverViewProperties {
770
+ /** Wire validation: {"maxLength":255,"minLength":1} */
771
+ approval_ref: string;
772
+ callback_endpoint_id: CardUuid;
773
+ created_at: CardTimestamp;
774
+ /** Wire validation: {"format":"uri","maxLength":2048,"minLength":1} */
775
+ endpoint_url: string;
776
+ environment: CardEnvironment;
777
+ /** Wire validation: {"maxItems":32,"minItems":1,"uniqueItems":true} */
778
+ event_kinds: [string, ...Array<string>];
779
+ grant_revision: CardRevision;
780
+ pending_operation_receipt_id?: CardUuid;
781
+ /** Wire validation: {"maxLength":255,"minLength":1} */
782
+ principal_ref: string;
783
+ program_connection_id: ProgramConnectionId;
784
+ provider_connection_id: ProviderConnectionId;
785
+ /** Wire validation: {"maxLength":255,"minLength":1} */
786
+ registered_by_actor_ref: string;
787
+ /** Wire validation: {"maxLength":255,"minLength":1} */
788
+ signing_key_id: string;
789
+ status: 'active' | 'disabled' | 'stopping' | 'indeterminate';
790
+ target_revision: CardUuid;
791
+ updated_at: CardTimestamp;
792
+ }
793
+ type DeliveryReceiverView = DeliveryReceiverViewProperties & (({
794
+ status: 'stopping' | 'indeterminate';
795
+ } & Required<Pick<DeliveryReceiverViewProperties, 'pending_operation_receipt_id'>>) | ({
796
+ status: Exclude<DeliveryReceiverViewProperties['status'], 'stopping' | 'indeterminate'>;
797
+ } & {
798
+ pending_operation_receipt_id?: never;
799
+ }));
800
+ interface DeliveryOperationViewProperties {
801
+ current_receiver?: DeliveryReceiverView;
802
+ effective_at?: CardTimestamp;
803
+ operation_receipt: DeliveryOperationReceipt;
804
+ previous_target_revision?: CardUuid;
805
+ requested_target_revision?: CardUuid;
806
+ status: 'pending' | 'effective' | 'indeterminate' | 'rejected';
807
+ }
808
+ type DeliveryOperationView = DeliveryOperationViewProperties & (({
809
+ status: 'effective';
810
+ } & Required<Pick<DeliveryOperationViewProperties, 'effective_at'>> & {
811
+ operation_receipt?: {
812
+ status?: 'committed';
813
+ };
814
+ }) | ({
815
+ status: Exclude<DeliveryOperationViewProperties['status'], 'effective'>;
816
+ })) & (({
817
+ status: 'pending' | 'indeterminate' | 'rejected';
818
+ } & {
819
+ effective_at?: never;
820
+ current_receiver?: never;
821
+ }) | ({
822
+ status: Exclude<DeliveryOperationViewProperties['status'], 'pending' | 'indeterminate' | 'rejected'>;
823
+ })) & (({
824
+ status: 'pending';
825
+ } & {
826
+ operation_receipt?: {
827
+ status?: 'accepted';
828
+ };
829
+ }) | ({
830
+ status: Exclude<DeliveryOperationViewProperties['status'], 'pending'>;
831
+ })) & (({
832
+ status: 'indeterminate';
833
+ } & {
834
+ operation_receipt?: {
835
+ status?: 'indeterminate';
836
+ };
837
+ }) | ({
838
+ status: Exclude<DeliveryOperationViewProperties['status'], 'indeterminate'>;
839
+ })) & (({
840
+ status: 'rejected';
841
+ } & {
842
+ operation_receipt?: {
843
+ status?: 'rejected';
844
+ };
845
+ }) | ({
846
+ status: Exclude<DeliveryOperationViewProperties['status'], 'rejected'>;
847
+ }));
848
+ interface DeliveryPageProperties {
849
+ complete: boolean;
850
+ /** Wire validation: {"maxItems":100,"minItems":0} */
851
+ items: DeliveryItem[];
852
+ /** Wire validation: {"maxLength":4096} */
853
+ next_cursor: string | null;
854
+ snapshot_at: CardTimestamp;
855
+ /** Wire validation: {"maxLength":4096,"minLength":16} */
856
+ snapshot_token: string;
857
+ to_at: CardTimestamp;
858
+ }
859
+ type DeliveryPage = DeliveryPageProperties & (({
860
+ complete: true;
861
+ } & {
862
+ next_cursor?: null;
863
+ }) | ({
864
+ complete: Exclude<DeliveryPageProperties['complete'], true>;
865
+ }));
866
+ interface DeliveryReceiverTransition {
867
+ expected_target_revision: CardUuid;
868
+ /** Wire validation: {"maxLength":64,"minLength":2,"pattern":"^[a-z][a-z0-9_]{1,63}$"} */
869
+ reason_code: string;
870
+ status: 'disabled';
871
+ }
872
+ interface DeliveryReconciliationListInputProperties {
873
+ /** Wire validation: {"maxLength":4096,"minLength":16} */
874
+ cursor?: string;
875
+ from_at?: CardTimestamp;
876
+ /** Wire validation: {"maximum":100,"minimum":1} */
877
+ page_size: number;
878
+ /** Wire validation: {"maxLength":512,"minLength":1} */
879
+ program_id: string;
880
+ selection_id?: CardUuid;
881
+ /** Wire validation: {"maxLength":4096,"minLength":16} */
882
+ snapshot_token?: string;
883
+ target_revision: CardUuid;
884
+ to_at?: CardTimestamp;
885
+ }
886
+ type DeliveryReconciliationListInput = DeliveryReconciliationListInputProperties & ((Required<Pick<DeliveryReconciliationListInputProperties, 'selection_id'>> & {
887
+ from_at?: never;
888
+ to_at?: never;
889
+ }) | (Required<Pick<DeliveryReconciliationListInputProperties, 'from_at' | 'to_at'>> & {
890
+ selection_id?: never;
891
+ }));
892
+ interface DeliveryReplayAccepted {
893
+ replay_id: CardUuid;
894
+ selection_id: CardUuid;
895
+ status: 'accepted';
896
+ target_revision: CardUuid;
897
+ }
898
+ interface DeliveryReplayCreateInput {
899
+ /** Wire validation: {"maxLength":512,"minLength":1} */
900
+ program_id: string;
901
+ selection_id: CardUuid;
902
+ }
903
+ interface ExchangeLinkCodeResponse {
904
+ appId: string;
905
+ cardRef?: string | null;
906
+ factoServerWalletAddress?: string | null;
907
+ factoUserId?: string | null;
908
+ grantStatus: string;
909
+ pipelineReady: boolean;
910
+ scopes: string[];
911
+ /**
912
+ * Opaque public link handle (GA contract). Store this; the legacy
913
+ * factoUserId/factoServerWalletAddress fields remain for pre-GA callers.
914
+ */
915
+ userLinkRef: string;
916
+ }
917
+ interface IntentCancelInput {
918
+ /** Wire validation: {"writeOnly":true} */
919
+ intent_token: string;
920
+ }
921
+ interface IntentCancelled {
922
+ id: ConnectIntentId;
923
+ status: 'cancelled';
924
+ }
925
+ interface IntentCardItem {
926
+ binding_id: CardBindingId;
927
+ card: CardDisplayFacts;
928
+ status: 'active' | 'revoked';
929
+ }
930
+ interface IntentCardList {
931
+ cards: IntentCardItem[];
932
+ id: ConnectIntentId;
933
+ revision: ConnectIntentDigest;
934
+ }
935
+ interface TargetCardInput {
936
+ /** Wire validation: {"maxLength":255,"minLength":1,"not":{"pattern":"[0-9]{13}"}} */
937
+ external_card_id: string;
938
+ last4?: string | null;
939
+ network?: string | null;
940
+ type?: 'virtual' | 'physical' | 'unknown' | null;
941
+ }
942
+ interface IntentCardsReplaceInput {
943
+ /** Wire validation: {"maxLength":255,"minLength":1} */
944
+ approval_id: string;
945
+ /** Wire validation: {"pattern":"^[a-f0-9]{64}$"} */
946
+ approval_sha256: string;
947
+ /** Wire validation: {"maxItems":50} */
948
+ cards: TargetCardInput[];
949
+ external_account_id?: string | null;
950
+ /** Wire validation: {"writeOnly":true} */
951
+ intent_token: string;
952
+ revision: ConnectIntentDigest;
953
+ }
954
+ interface IntentCardsReplaced {
955
+ added_binding_ids: CardBindingId[];
956
+ id: ConnectIntentId;
957
+ kept_binding_ids: CardBindingId[];
958
+ removed_binding_ids: CardBindingId[];
959
+ revision: ConnectIntentDigest;
960
+ status: 'applied' | 'no_change';
961
+ }
962
+ declare const MANDATE_DECLINE_REASON_VALUES: readonly ["mandate_inactive", "mandate_revoked", "mandate_expired", "use_case_not_allowed", "mandate_limit_exceeded", "mandate_period_limit_exceeded", "user_limit_exceeded", "limit_check_unavailable", "payment_path_unavailable", "funding_source_not_authorized", "payment_option_not_pinned", "settlement_reverted", "idempotency_conflict"];
963
+ type MandateDeclineReason = (typeof MANDATE_DECLINE_REASON_VALUES)[number];
964
+ declare const MANDATE_PAYMENT_STATUS_VALUES: readonly ["accepted", "declined", "charging", "finalizing", "succeeded", "paid_via_coverage", "failed", "canceled"];
965
+ type MandatePaymentStatus = (typeof MANDATE_PAYMENT_STATUS_VALUES)[number];
966
+ declare const MANDATE_STATUS_VALUES: readonly ["pending", "active", "paused", "revoked", "expired", "suspended"];
967
+ type MandateStatus = (typeof MANDATE_STATUS_VALUES)[number];
968
+ declare const MANDATE_AUTHORIZATION_SESSION_STATUS_VALUES: readonly ["created", "authorized", "declined", "expired"];
969
+ type MandateAuthorizationSessionStatus = (typeof MANDATE_AUTHORIZATION_SESSION_STATUS_VALUES)[number];
970
+ interface MandatePayment {
971
+ amount: string;
972
+ /**
973
+ * Cumulative refunded amount — merchants compute the remaining
974
+ * refundable headroom as `amount - amountRefunded` without local
975
+ * bookkeeping (spec 012 FR-004).
976
+ */
977
+ amountRefunded: string;
978
+ chargeId?: string | null;
979
+ /** Wire validation: {"format":"date-time"} */
980
+ createdAt: string;
981
+ currency: string;
982
+ declineReason?: null | MandateDeclineReason;
983
+ /** Wire validation: {"format":"int64","minimum":0} */
984
+ finalityEtaSeconds?: number | null;
985
+ mandateId: string;
986
+ merchantPaymentRef: string;
987
+ paymentId: string;
988
+ status: MandatePaymentStatus;
989
+ /** The name shown on the consumer's billing line. */
990
+ subMerchantDisplayName?: string | null;
991
+ /**
992
+ * Echoed back so a PSP can reconcile without a local join. DISPLAY ONLY:
993
+ * no read path keys, matches, joins or deduplicates on it (migration 281's
994
+ * rule, inherited by 329).
995
+ */
996
+ subMerchantRef?: string | null;
997
+ /** When the payment reached a terminal status. Serialized as `terminalAt`. */
998
+ /** Wire validation: {"format":"date-time"} */
999
+ terminalAt?: string | null;
1000
+ /**
1001
+ * On-chain settlement tx hash of the linked charge, stamped by the settler
1002
+ * once the payment reaches a terminal status. Serialized as `txHash`.
1003
+ */
1004
+ txHash?: string | null;
1005
+ /** Wire validation: {"format":"date-time"} */
1006
+ updatedAt?: string | null;
1007
+ useCase: MandateUseCase;
1008
+ }
1009
+ declare const PATH_CHANGE_SESSION_STATUS_VALUES: readonly ["pending", "claimed", "completed", "expired", "cancelled"];
1010
+ type PathChangeSessionStatus = (typeof PATH_CHANGE_SESSION_STATUS_VALUES)[number];
1011
+ interface PathChangeSession {
1012
+ /** Wire validation: {"format":"date-time"} */
1013
+ expiresAt: string;
1014
+ /**
1015
+ * The URL the merchant frontend opens. Carries the session id and nothing
1016
+ * else — no mandate id, no origin, no state.
1017
+ */
1018
+ pathChangeUrl: string;
1019
+ sessionId: string;
1020
+ /**
1021
+ * Server-minted. The merchant frontend accepts a wake-only message only
1022
+ * when it echoes this value.
1023
+ */
1024
+ state: string;
1025
+ status: PathChangeSessionStatus;
1026
+ /** Server-issued. The hosted page posts here and nowhere else. */
1027
+ targetOrigin: string;
1028
+ }
1029
+ /** Property bag shared by every `anyOf` branch of `PaymentCapabilityRequest`. */
1030
+ interface PaymentCapabilityRequestProperties {
1031
+ /** Legacy shape: merchant app id, sent together with `facto_server_wallet_address`. */
1032
+ app_id?: string;
1033
+ /** Legacy shape: Facto server wallet address of the linked user. */
1034
+ facto_server_wallet_address?: string;
1035
+ /** Optional merchant mandate. When present, readiness follows that mandate's pinned route. */
1036
+ mandateId?: string;
1037
+ /** GA shape: opaque user-link reference minted by the link-code exchange. */
1038
+ userLinkRef?: string;
1039
+ }
1040
+ declare const PAYMENT_READINESS_NOT_READY_REASON_VALUES: readonly ["payment_route_not_provisioned", "protocol_config_incomplete"];
1041
+ type PaymentReadinessNotReadyReason = (typeof PAYMENT_READINESS_NOT_READY_REASON_VALUES)[number];
1042
+ declare const PAYMENT_READINESS_SCOPE_VALUES: readonly ["account_default", "mandate_pinned"];
1043
+ type PaymentReadinessScope = (typeof PAYMENT_READINESS_SCOPE_VALUES)[number];
1044
+ interface PaymentCapabilityResponse {
1045
+ appId: string;
1046
+ assetSymbol: string;
1047
+ /** Wire validation: {"format":"int64"} */
1048
+ chainId: number;
1049
+ factoServerWalletAddress?: string | null;
1050
+ factoUserId?: string | null;
1051
+ notReadyReason?: null | PaymentReadinessNotReadyReason;
1052
+ pipelineReady: boolean;
1053
+ protocolId: string;
1054
+ readinessScope: PaymentReadinessScope;
1055
+ spendMode: string;
1056
+ userLinkRef: string;
1057
+ }
1058
+ interface ProviderProofAccepted {
1059
+ binding_session_id: BindingSessionId;
1060
+ proof_received_at: CardTimestamp;
1061
+ status: 'consent_pending';
1062
+ }
1063
+ interface ProviderProofSubmitPayload {
1064
+ /** Wire validation: {"maxLength":16384,"minLength":128,"pattern":"^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$","writeOnly":true} */
1065
+ binding_assertion: string;
1066
+ proof_format: 'compact-jws';
1067
+ }
1068
+ /** Response to a partner revoking an authorization it holds. */
1069
+ interface RevokeAuthorizationResponse {
1070
+ mandateId: string;
1071
+ /**
1072
+ * Whether this call is what moved it. `false` means it was already
1073
+ * revoked, which is a success -- included so a partner reconciling its own
1074
+ * records can tell an effective call from a repeat without inferring it
1075
+ * from timing.
1076
+ */
1077
+ revokedByThisRequest: boolean;
1078
+ /** Always `revoked` on a 200. A repeat call reports the same thing. */
1079
+ status: string;
1080
+ }
1081
+ declare const SETTLE_OUTCOME_VALUES: readonly ["succeeded", "failed"];
1082
+ type SettleOutcome = (typeof SETTLE_OUTCOME_VALUES)[number];
1083
+ interface SettleTestPaymentRequest {
1084
+ declineReason?: null | MandateDeclineReason;
1085
+ outcome: SettleOutcome;
1086
+ }
1087
+ interface SynchronousAuthorizationApproved {
1088
+ charge_id: string;
1089
+ /** Wire validation: {"format":"date-time"} */
1090
+ deadline_at: string;
1091
+ /** Wire validation: {"format":"date-time"} */
1092
+ decided_at: string;
1093
+ decision: 'approved';
1094
+ /** Wire validation: {"format":"uuid"} */
1095
+ decision_id: string;
1096
+ status: 'approved';
1097
+ }
1098
+ interface SynchronousAuthorizationDeclined {
1099
+ /** Wire validation: {"format":"date-time"} */
1100
+ deadline_at: string;
1101
+ /** Wire validation: {"format":"date-time"} */
1102
+ decided_at: string;
1103
+ decision: 'declined' | 'self_reversed_timeout';
1104
+ /** Wire validation: {"format":"uuid"} */
1105
+ decision_id: string;
1106
+ error: string;
1107
+ message: string;
1108
+ request_id: string;
1109
+ }
1110
+ /**
1111
+ * Byte-for-byte the `data.object` of `user_link.revoked`, so a merchant that
1112
+ * reconciles by polling and a merchant that reacts to the webhook parse the
1113
+ * same thing.
1114
+ */
1115
+ interface UserLinkResponse {
1116
+ appId: string;
1117
+ /** `active` or `revoked` — the authority on whether this link still exists. */
1118
+ grantStatus: string;
1119
+ paymentReady: boolean;
1120
+ scopes: string[];
1121
+ userLinkRef: string;
1122
+ }
1123
+
1124
+ export type { MandateStatus as $, AuthorizationCreateInput as A, BindingSessionCreate as B, ChargeFinalReceipt as C, DeliveryReconciliationListInput as D, ExchangeLinkCodeResponse as E, DeliveryReplayCreateInput as F, DeliveryReplayAccepted as G, DeadLetterPage as H, IntentCardList as I, DeadLetterReplayAccepted as J, DeliveryReceiverView as K, DeliveryReceiverReplacement as L, DeliveryOperationView as M, DeliveryReceiverTransition as N, DeliveryGrantTransition as O, ProviderProofSubmitPayload as P, MandatePayment as Q, CreateMandatePaymentRequest as R, SynchronousAuthorizationApproved as S, MandateUseCase as T, MandateLimitPeriod as U, CreatePathChangeSessionRequest as V, CreateTestMandateRequest as W, CreateTestMandateResponse as X, PaymentCapabilityRequestProperties as Y, PaymentCapabilityResponse as Z, MandateAuthorizationSessionStatus as _, BindingSessionCreated as a, MandatePaymentStatus as a0, MandateDeclineReason as a1, UserLinkResponse as a2, RevokeAuthorizationResponse as a3, PathChangeSession as a4, SettleTestPaymentRequest as a5, PathChangeSessionStatus as a6, PaymentReadinessNotReadyReason as a7, PaymentReadinessScope as a8, SandboxPersonaKind as a9, SettleOutcome as aa, BindingSessionStatus as b, ProviderProofAccepted as c, BindingProofChallenge as d, IntentCardItem as e, IntentCardsReplaceInput as f, IntentCardsReplaced as g, IntentCancelInput as h, IntentCancelled as i, BindingLookupInput as j, BindingLookupResult as k, BindingSummary as l, SynchronousAuthorizationDeclined as m, AuthorizationDeadlineExceeded as n, AuthorizationAccepted as o, AuthorizationFactInput as p, AuthorizationFactReceipt as q, AuthorizationOperationType as r, AuthorizationLookupResult as s, AuthorizationProjection as t, AuthorizationFacts as u, AuthorizationLifecycle as v, CardInboundEventInput as w, CardInboundEventReceipt as x, DeliveryPage as y, DeliveryItem as z };