@nuanu-ai/agentify-contracts 0.3.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/dist/api.d.ts ADDED
@@ -0,0 +1,1948 @@
1
+ /**
2
+ * The HTTP surface: which calls exist, at which addresses, with which document
3
+ * going each way.
4
+ *
5
+ * It is written as data rather than as prose because two programs read it. The
6
+ * gateway serves these calls and the SDK makes them, and each of them
7
+ * previously would have learned the surface from a document a person had
8
+ * transcribed — which is how one side ends up posting to `/v0/order/:id/deliver`
9
+ * while the other serves `/v0/orders/:id/deliver`, and how a response shape
10
+ * agreed in a meeting becomes two shapes in two repositories. Here the table is
11
+ * the agreement, and both sides import it.
12
+ *
13
+ * What the table does not carry is deliberate. There is no header name for the
14
+ * merchant key, no status codes, no base address, no timeouts and no retry
15
+ * policy. `auth` says which door a call is behind, not how the door is built;
16
+ * the key's header, the status code a refusal comes back under and where the
17
+ * service lives are the gateway's, and a number invented here would read as a
18
+ * decision nobody took. What belongs here is what both sides have to agree on
19
+ * or fail: the address, the method, the door, and the documents.
20
+ *
21
+ * The paths are written the way an express-style router writes them — a colon
22
+ * and a lowercase name, `/v0/orders/:order_id/deliver`. That form was chosen
23
+ * over the braces of OpenAPI for one reason: the gateway can mount these
24
+ * strings unchanged, so the side that must never be wrong about an address is
25
+ * the side that does no translation at all. The SDK is the side that
26
+ * substitutes, and it does not write its own substitution either: `pathParamsOf`
27
+ * and `expandPath` below are here so that the encoding is done once. That is
28
+ * not a nicety. An identifier in this contract may contain a slash and a space
29
+ * — "SKU 100/1" is one we accept — and pasted into an address unencoded it
30
+ * becomes two path segments and a different route.
31
+ *
32
+ * What each route names is the document it answers with when the call works.
33
+ * How it says no is not a per-route question and is not written route by
34
+ * route: every refusal on this surface, from any call, arrives in the one
35
+ * envelope `ErrorEnvelopeSchema` describes below.
36
+ *
37
+ * Two ways of answering for an order sit in the table and they are not the
38
+ * same thing, which is worth reading before either is used. What a merchant's
39
+ * handler returns — delivered, refused, taken on — goes to the answer route,
40
+ * in every mode, and the SDK sends it without the merchant asking. `deliver`
41
+ * and `refuse` are the asynchronous mode's explicit closure verbs, called
42
+ * later by a merchant who took an order on and now has the goods or has run
43
+ * out of them. The order machine keeps the same two apart, and in the
44
+ * synchronous mode it is the returned answer that exists and the explicit
45
+ * calls that do not. The addendum of 2026-08-26 to ADR-0004 settles this; §2
46
+ * of that decision, read alone, leaves the synchronous handler with no address
47
+ * at all.
48
+ */
49
+ import { z } from "zod";
50
+ /**
51
+ * An order together with the word for where it stands.
52
+ *
53
+ * The order itself carries no state — reading state back is a separate call,
54
+ * and this is that call's document. It is the order with one field added
55
+ * rather than the order nested inside a wrapper, because to the merchant it is
56
+ * one order that has a status, and a wrapper would exist only to keep a strict
57
+ * parser happy. The consequence is worth naming: this is a different document
58
+ * from an order off the worker stream, and `OrderSchema` refuses it. That is
59
+ * the intended reading, not an accident of strictness.
60
+ */
61
+ export declare const OrderWithStatusSchema: z.ZodObject<{
62
+ id: z.ZodString;
63
+ merchant_item_id: z.ZodString;
64
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
65
+ price: z.ZodObject<{
66
+ amount: z.ZodString;
67
+ currency: z.ZodString;
68
+ at: z.ZodISODateTime;
69
+ as_of: z.ZodISODateTime;
70
+ }, z.core.$strict>;
71
+ price_id: z.ZodOptional<z.ZodString>;
72
+ test: z.ZodBoolean;
73
+ status: z.ZodEnum<{
74
+ delivered: "delivered";
75
+ in_progress: "in_progress";
76
+ rejected: "rejected";
77
+ payment_unresolved: "payment_unresolved";
78
+ declined: "declined";
79
+ expired: "expired";
80
+ cancelled: "cancelled";
81
+ refund_due: "refund_due";
82
+ refunded: "refunded";
83
+ delivered_unpaid: "delivered_unpaid";
84
+ }>;
85
+ }, z.core.$strict>;
86
+ /**
87
+ * Every order the merchant asked for.
88
+ *
89
+ * An object rather than a bare array, because a bare array is the one shape
90
+ * that cannot grow. The day this list needs a cursor or a count, an array
91
+ * would have to become an object and every reader that already parses it would
92
+ * break at once.
93
+ */
94
+ export declare const OrderListSchema: z.ZodObject<{
95
+ orders: z.ZodArray<z.ZodObject<{
96
+ id: z.ZodString;
97
+ merchant_item_id: z.ZodString;
98
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
99
+ price: z.ZodObject<{
100
+ amount: z.ZodString;
101
+ currency: z.ZodString;
102
+ at: z.ZodISODateTime;
103
+ as_of: z.ZodISODateTime;
104
+ }, z.core.$strict>;
105
+ price_id: z.ZodOptional<z.ZodString>;
106
+ test: z.ZodBoolean;
107
+ status: z.ZodEnum<{
108
+ delivered: "delivered";
109
+ in_progress: "in_progress";
110
+ rejected: "rejected";
111
+ payment_unresolved: "payment_unresolved";
112
+ declined: "declined";
113
+ expired: "expired";
114
+ cancelled: "cancelled";
115
+ refund_due: "refund_due";
116
+ refunded: "refunded";
117
+ delivered_unpaid: "delivered_unpaid";
118
+ }>;
119
+ }, z.core.$strict>>;
120
+ }, z.core.$strict>;
121
+ /**
122
+ * A merchant's own catalog: their cards, and whether they are selling at all.
123
+ *
124
+ * The merchant's own word sits beside the cards rather than being left to be
125
+ * inferred from them, because the two answer different questions and a screen
126
+ * needs both. Every card of a merchant who has stopped all selling reads
127
+ * paused, and nothing in the cards themselves says whether that is five
128
+ * separate decisions or one — which is exactly the difference between resuming
129
+ * a card and resuming the catalog.
130
+ *
131
+ * An object rather than a bare array for the reason the order list gives, and
132
+ * one more: a bare array has nowhere to put the merchant's own word at all.
133
+ */
134
+ export declare const MerchantCardListSchema: z.ZodObject<{
135
+ selling: z.ZodEnum<{
136
+ open: "open";
137
+ paused: "paused";
138
+ departed: "departed";
139
+ }>;
140
+ cards: z.ZodArray<z.ZodObject<{
141
+ id: z.ZodString;
142
+ as_of: z.ZodISODateTime;
143
+ card: z.ZodObject<{
144
+ merchant_item_id: z.ZodString;
145
+ title: z.ZodString;
146
+ description: z.ZodString;
147
+ price: z.ZodPreprocess<z.ZodObject<{
148
+ amount: z.ZodString;
149
+ currency: z.ZodString;
150
+ }, z.core.$strict>>;
151
+ params: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
152
+ type: z.ZodEnum<{
153
+ string: "string";
154
+ number: "number";
155
+ boolean: "boolean";
156
+ integer: "integer";
157
+ }>;
158
+ required: z.ZodOptional<z.ZodBoolean>;
159
+ title: z.ZodOptional<z.ZodString>;
160
+ }, z.core.$strict>>>>;
161
+ result: z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
162
+ type: z.ZodEnum<{
163
+ string: "string";
164
+ number: "number";
165
+ boolean: "boolean";
166
+ integer: "integer";
167
+ }>;
168
+ required: z.ZodOptional<z.ZodBoolean>;
169
+ title: z.ZodOptional<z.ZodString>;
170
+ }, z.core.$strict>>>;
171
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
172
+ fulfillment: z.ZodDefault<z.ZodEnum<{
173
+ sync: "sync";
174
+ async: "async";
175
+ confirm: "confirm";
176
+ }>>;
177
+ price_check: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"handler">, z.ZodObject<{
178
+ url: z.ZodURL;
179
+ }, z.core.$strict>]>>;
180
+ confirm_deadline_seconds: z.ZodOptional<z.ZodInt>;
181
+ fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
182
+ }, z.core.$strict>;
183
+ selling: z.ZodEnum<{
184
+ open: "open";
185
+ paused: "paused";
186
+ departed: "departed";
187
+ }>;
188
+ paused: z.ZodBoolean;
189
+ }, z.core.$strict>>;
190
+ }, z.core.$strict>;
191
+ /**
192
+ * Every receipt this merchant has.
193
+ *
194
+ * A receipt exists from the moment the money moves, so this is the list a
195
+ * merchant reconciles their wallet against. What it cannot show is worth
196
+ * knowing before it is reconciled from: a purchase that ended before any
197
+ * payment leaves no receipt at all, and no receipt is written while it is
198
+ * unknown whether the buyer was charged — `ReceiptSchema` works both through.
199
+ *
200
+ * An object rather than a bare array, so the day it needs paging it grows the
201
+ * field that says so instead of changing shape under every reader.
202
+ */
203
+ export declare const ReceiptListSchema: z.ZodObject<{
204
+ receipts: z.ZodArray<z.ZodObject<{
205
+ id: z.ZodString;
206
+ order_id: z.ZodString;
207
+ item_id: z.ZodString;
208
+ price: z.ZodObject<{
209
+ amount: z.ZodString;
210
+ currency: z.ZodString;
211
+ at: z.ZodISODateTime;
212
+ as_of: z.ZodISODateTime;
213
+ }, z.core.$strict>;
214
+ price_id: z.ZodOptional<z.ZodString>;
215
+ paid_at: z.ZodISODateTime;
216
+ outcome: z.ZodEnum<{
217
+ delivered: "delivered";
218
+ in_progress: "in_progress";
219
+ refund_due: "refund_due";
220
+ refunded: "refunded";
221
+ }>;
222
+ test: z.ZodBoolean;
223
+ }, z.core.$strict>>;
224
+ }, z.core.$strict>;
225
+ /**
226
+ * The question a merchant puts in the query string when listing orders.
227
+ *
228
+ * `open=true` narrows the list to the orders that are still owed something —
229
+ * which includes the two that stay open after the purchase itself is over, an
230
+ * order owing a refund and one delivered but never paid for. Leaving it out
231
+ * asks for everything.
232
+ *
233
+ * The value is text and not a boolean, because that is what a query string
234
+ * carries. Written as a boolean it would export as one, and an engineer
235
+ * generating a client from that document would build a request nobody can
236
+ * send. The two words are exact on purpose: a merchant who wrote `open=1`,
237
+ * meant "only the open ones" and silently received all of them would reconcile
238
+ * their books against the wrong list.
239
+ */
240
+ export declare const OrderListQuerySchema: z.ZodObject<{
241
+ open: z.ZodOptional<z.ZodEnum<{
242
+ true: "true";
243
+ false: "false";
244
+ }>>;
245
+ }, z.core.$strict>;
246
+ /**
247
+ * What a worker asks of one poll.
248
+ *
249
+ * Neither field carries a ceiling, and the absence is deliberate. A first
250
+ * draft put a maximum on each and called them bounds on the format; they were
251
+ * not. The bounds this package does write down are anchored in something
252
+ * outside itself — eighteen fractional digits because that is what an ERC-20
253
+ * token carries — and no such anchor exists for a number of seconds or a
254
+ * number of messages. A card is already held to that rule from the other side:
255
+ * it takes any whole positive number of seconds for its deadlines rather than
256
+ * inventing a limit that would read as a decision nobody took. How long the
257
+ * gateway will actually hold a request and how many envelopes it will actually
258
+ * return are the gateway's, and it is the one that has to answer for them.
259
+ *
260
+ * The two lower bounds stay, because each refuses something that is not a
261
+ * request at all rather than something that is merely large.
262
+ */
263
+ export declare const WorkerPollRequestSchema: z.ZodObject<{
264
+ wait_seconds: z.ZodOptional<z.ZodInt>;
265
+ max: z.ZodOptional<z.ZodInt>;
266
+ }, z.core.$strict>;
267
+ /**
268
+ * What a poll answers with.
269
+ *
270
+ * The list may be empty, and an empty batch is the ordinary answer to a quiet
271
+ * window rather than a failure. A worker that read it as one would tear down
272
+ * and rebuild its subscription every time nothing happened.
273
+ *
274
+ * The contract version rides here because this is the call every worker makes
275
+ * first and then forever. The SDK checks it and refuses to start against a
276
+ * gateway speaking another dialect, which is the difference between failing at
277
+ * startup and failing on somebody's first order.
278
+ */
279
+ export declare const WorkerPollResponseSchema: z.ZodObject<{
280
+ contract_version: z.ZodString;
281
+ envelopes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
282
+ kind: z.ZodLiteral<"order">;
283
+ id: z.ZodString;
284
+ sent_at: z.ZodISODateTime;
285
+ payload: z.ZodObject<{
286
+ id: z.ZodString;
287
+ merchant_item_id: z.ZodString;
288
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
289
+ price: z.ZodObject<{
290
+ amount: z.ZodString;
291
+ currency: z.ZodString;
292
+ at: z.ZodISODateTime;
293
+ as_of: z.ZodISODateTime;
294
+ }, z.core.$strict>;
295
+ price_id: z.ZodOptional<z.ZodString>;
296
+ test: z.ZodBoolean;
297
+ }, z.core.$strict>;
298
+ }, z.core.$strict>, z.ZodObject<{
299
+ kind: z.ZodLiteral<"quote_request">;
300
+ id: z.ZodString;
301
+ sent_at: z.ZodISODateTime;
302
+ payload: z.ZodObject<{
303
+ merchant_item_id: z.ZodString;
304
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
305
+ price_id: z.ZodString;
306
+ purpose: z.ZodEnum<{
307
+ purchase: "purchase";
308
+ poll: "poll";
309
+ }>;
310
+ expires_at: z.ZodISODateTime;
311
+ }, z.core.$strict>;
312
+ }, z.core.$strict>, z.ZodObject<{
313
+ kind: z.ZodLiteral<"order_event">;
314
+ id: z.ZodString;
315
+ sent_at: z.ZodISODateTime;
316
+ payload: z.ZodDiscriminatedUnion<[z.ZodObject<{
317
+ type: z.ZodLiteral<"order.refund_due">;
318
+ order_id: z.ZodString;
319
+ at: z.ZodISODateTime;
320
+ price: z.ZodObject<{
321
+ amount: z.ZodString;
322
+ currency: z.ZodString;
323
+ }, z.core.$strict>;
324
+ reason: z.ZodEnum<{
325
+ refused: "refused";
326
+ deadline_passed: "deadline_passed";
327
+ merchant_left: "merchant_left";
328
+ }>;
329
+ }, z.core.$strict>, z.ZodObject<{
330
+ type: z.ZodLiteral<"order.unpaid_after_confirmation">;
331
+ order_id: z.ZodString;
332
+ at: z.ZodISODateTime;
333
+ }, z.core.$strict>, z.ZodObject<{
334
+ type: z.ZodLiteral<"order.payment_failed_after_delivery">;
335
+ order_id: z.ZodString;
336
+ at: z.ZodISODateTime;
337
+ }, z.core.$strict>], "type">;
338
+ }, z.core.$strict>], "kind">>;
339
+ }, z.core.$strict>;
340
+ /**
341
+ * What delivering or refusing an order comes back as.
342
+ *
343
+ * `ok` is a value rather than a key, and it is the same envelope every
344
+ * merchant-facing call of this surface answers in; the reasons are written down
345
+ * once, in `results.ts`, rather than argued again at each route. What this
346
+ * route adds to them is a word for which success it was: the marker of success
347
+ * is one and the same for a first delivery and for a repeated one, so a
348
+ * merchant who wrote `if (result === "delivered")` would have turned their own
349
+ * safe retry into a failure branch, and branching on `ok` and recording the
350
+ * word is what this shape makes the easy thing to do.
351
+ *
352
+ * The failure is one `error` and not a list, and that is not an asymmetry with
353
+ * the publish. A call fails for one reason, wherever it is; what may be wrong
354
+ * in several places at once is the document that was sent, and those findings
355
+ * ride inside the error under `problems` — which is exactly what a delivery
356
+ * that is not what its card declares comes back with.
357
+ *
358
+ * Nothing here travels as an exception. A merchant's integration code is
359
+ * expected to read this, branch on it and write some of it down.
360
+ */
361
+ export declare const OrderCallResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
362
+ ok: z.ZodLiteral<true>;
363
+ result: z.ZodEnum<{
364
+ refused: "refused";
365
+ delivered: "delivered";
366
+ accepted: "accepted";
367
+ already_delivered: "already_delivered";
368
+ debt_closed_by_delivery: "debt_closed_by_delivery";
369
+ purchase_already_closed: "purchase_already_closed";
370
+ }>;
371
+ }, z.core.$strict>, z.ZodObject<{
372
+ ok: z.ZodLiteral<false>;
373
+ error: z.ZodObject<{
374
+ code: z.ZodString;
375
+ message: z.ZodString;
376
+ retryable: z.ZodBoolean;
377
+ problems: z.ZodOptional<z.ZodArray<z.ZodObject<{
378
+ path: z.ZodArray<z.ZodString>;
379
+ code: z.ZodString;
380
+ message: z.ZodString;
381
+ }, z.core.$strict>>>;
382
+ }, z.core.$strict>;
383
+ }, z.core.$strict>], "ok">;
384
+ /**
385
+ * What taking an order on comes back as.
386
+ *
387
+ * The success carries no word, and that is a choice rather than a gap. The
388
+ * published results include `accepted`, so there is a word to carry; this
389
+ * route declines to carry it. Underneath, taking on an order that is waiting
390
+ * and taking on one already delivered are two different answers, and this
391
+ * route reports both as the same bare success — a merchant who takes on an
392
+ * order they have already finished learns nothing new here, which is what
393
+ * makes a repeat harmless. The answer route is where the word earns its
394
+ * place, because it carries whichever of the three things a handler returned
395
+ * and its success has to name which. `ok: true` here is a whole sentence on
396
+ * its own: true is true in every language, and the shape leaves room for a
397
+ * word beside it the day this route needs to tell two successes apart.
398
+ *
399
+ * Repeats are ordinary here. Delivery is at least once, so an order already
400
+ * taken on is taken on again every time it is redelivered, and an answer with
401
+ * no word in it has nothing to get wrong on the second pass.
402
+ *
403
+ * The failures are the same ones the other order calls have — accepting an
404
+ * order that has already closed, or accepting in a mode where acceptance does
405
+ * not exist.
406
+ */
407
+ export declare const OrderAcceptResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
408
+ ok: z.ZodLiteral<true>;
409
+ }, z.core.$strict>, z.ZodObject<{
410
+ ok: z.ZodLiteral<false>;
411
+ error: z.ZodObject<{
412
+ code: z.ZodString;
413
+ message: z.ZodString;
414
+ retryable: z.ZodBoolean;
415
+ problems: z.ZodOptional<z.ZodArray<z.ZodObject<{
416
+ path: z.ZodArray<z.ZodString>;
417
+ code: z.ZodString;
418
+ message: z.ZodString;
419
+ }, z.core.$strict>>>;
420
+ }, z.core.$strict>;
421
+ }, z.core.$strict>], "ok">;
422
+ /**
423
+ * What answering a price question comes back as.
424
+ *
425
+ * One fact, because one fact is what the merchant acts on. A merchant who set
426
+ * stock aside against the question needs to know whether the answer arrived in
427
+ * time to price the purchase; if it did not, they can release what they held.
428
+ *
429
+ * `used: false` also covers a question we no longer hold at all — a worker
430
+ * that restarted and replayed an envelope from an hour ago. The two are folded
431
+ * into one word deliberately, because the merchant does the same thing in
432
+ * either case, and the fold is written down here rather than left to be
433
+ * discovered. The flag is required, not defaulted: read as used, a missing
434
+ * flag leaves stock held forever; read as unused, it releases stock out from
435
+ * under a sale that is going through.
436
+ */
437
+ export declare const QuoteAnswerAckSchema: z.ZodObject<{
438
+ used: z.ZodBoolean;
439
+ }, z.core.$strict>;
440
+ /**
441
+ * What an agent sends to buy.
442
+ *
443
+ * The parameters are always there, empty for a product that needs no input,
444
+ * for the same reason an order's are: nobody downstream should have to tell
445
+ * "no parameters" from "the field did not arrive".
446
+ *
447
+ * This document holds the envelope and not the contents. Whether these
448
+ * particular values fit this particular card is checked against that card's
449
+ * own declaration at the moment of purchase — one card, one check, one error
450
+ * message — and no schema written in advance of a catalog can do it.
451
+ */
452
+ export declare const PurchaseRequestSchema: z.ZodObject<{
453
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
454
+ }, z.core.$strict>;
455
+ /**
456
+ * What became of a purchase, told to the agent that made it.
457
+ *
458
+ * Four fields, and the shape of the list is the decision rather than its
459
+ * length. This document is what the buyer is owed — where their order stands,
460
+ * what it cost them, and the goods once those exist — and it is deliberately
461
+ * smaller than the merchant's own view of the same order. It carries no
462
+ * merchant, no merchant's key for the product, none of the parameters the
463
+ * buyer sent and nothing about any other order, because whoever holds an
464
+ * order's identifier can read it (ADR-0011) and an answer assembled from the
465
+ * merchant's record would hand all of that to whoever guessed one.
466
+ *
467
+ * Both of the agent's doors answer in it, and that is one concept rather than
468
+ * two: the purchase and the later read are the same question — where does my
469
+ * order stand — asked at two moments. Two documents for it would be two
470
+ * readers for an integrator to write, and the one that came back from the
471
+ * purchase was the merchant's own, with the merchant's key for the product and
472
+ * the buyer's own parameters in it. What a purchase answers with beyond this
473
+ * document is the payment exchange that precedes it, which is a header and not
474
+ * a document at all.
475
+ *
476
+ * The two nullable fields are required rather than optional, and that is the
477
+ * fifth gate written into a shape. `price` is null for an order nobody ever
478
+ * named a price for — a product that was gone, a price question that went
479
+ * unanswered — and `delivered` is null while there are no goods to hand over.
480
+ * Left out instead, either would be a silence a reader cannot tell from an
481
+ * oversight; present and null, it is a fact.
482
+ *
483
+ * The status vocabulary folds several of the machine's endings into `rejected`
484
+ * on the argument that the reason travels separately, in the refusal code, and
485
+ * `refusal` is where it travels. It is optional because most endings have no
486
+ * refusal behind them, and what remains coarse is said in that field's own
487
+ * words rather than left to be discovered: a product that was gone and a
488
+ * payment that failed its check both still arrive as a bare `rejected`,
489
+ * because neither was worded by anybody.
490
+ */
491
+ export declare const AgentOrderStatusSchema: z.ZodObject<{
492
+ order_id: z.ZodString;
493
+ status: z.ZodEnum<{
494
+ delivered: "delivered";
495
+ in_progress: "in_progress";
496
+ rejected: "rejected";
497
+ payment_unresolved: "payment_unresolved";
498
+ declined: "declined";
499
+ expired: "expired";
500
+ cancelled: "cancelled";
501
+ refund_due: "refund_due";
502
+ refunded: "refunded";
503
+ delivered_unpaid: "delivered_unpaid";
504
+ }>;
505
+ price: z.ZodNullable<z.ZodObject<{
506
+ amount: z.ZodString;
507
+ currency: z.ZodString;
508
+ at: z.ZodISODateTime;
509
+ as_of: z.ZodISODateTime;
510
+ }, z.core.$strict>>;
511
+ delivered: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
512
+ test: z.ZodBoolean;
513
+ refusal: z.ZodOptional<z.ZodObject<{
514
+ code: z.ZodString;
515
+ message: z.ZodString;
516
+ }, z.core.$strict>>;
517
+ }, z.core.$strict>;
518
+ /**
519
+ * The catalog as an agent reads it.
520
+ *
521
+ * An object rather than a bare array, so that the day it needs paging it can
522
+ * grow the field that says so instead of changing shape under every reader.
523
+ * Until then it makes no claim about completeness, and that is stated in the
524
+ * document itself: an agent must not read the absence of a field about paging
525
+ * as a promise that there is nothing more.
526
+ */
527
+ export declare const CatalogPageSchema: z.ZodObject<{
528
+ items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
529
+ id: z.ZodString;
530
+ title: z.ZodString;
531
+ description: z.ZodString;
532
+ price: z.ZodObject<{
533
+ amount: z.ZodString;
534
+ currency: z.ZodString;
535
+ }, z.core.$strict>;
536
+ as_of: z.ZodISODateTime;
537
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
538
+ type: z.ZodEnum<{
539
+ string: "string";
540
+ number: "number";
541
+ boolean: "boolean";
542
+ integer: "integer";
543
+ }>;
544
+ required: z.ZodOptional<z.ZodBoolean>;
545
+ title: z.ZodOptional<z.ZodString>;
546
+ }, z.core.$strict>>>;
547
+ result: z.ZodRecord<z.ZodString, z.ZodObject<{
548
+ type: z.ZodEnum<{
549
+ string: "string";
550
+ number: "number";
551
+ boolean: "boolean";
552
+ integer: "integer";
553
+ }>;
554
+ required: z.ZodOptional<z.ZodBoolean>;
555
+ title: z.ZodOptional<z.ZodString>;
556
+ }, z.core.$strict>>;
557
+ price_checked_at_purchase: z.ZodBoolean;
558
+ fulfillment: z.ZodLiteral<"sync">;
559
+ }, z.core.$strict>, z.ZodObject<{
560
+ id: z.ZodString;
561
+ title: z.ZodString;
562
+ description: z.ZodString;
563
+ price: z.ZodObject<{
564
+ amount: z.ZodString;
565
+ currency: z.ZodString;
566
+ }, z.core.$strict>;
567
+ as_of: z.ZodISODateTime;
568
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
569
+ type: z.ZodEnum<{
570
+ string: "string";
571
+ number: "number";
572
+ boolean: "boolean";
573
+ integer: "integer";
574
+ }>;
575
+ required: z.ZodOptional<z.ZodBoolean>;
576
+ title: z.ZodOptional<z.ZodString>;
577
+ }, z.core.$strict>>>;
578
+ result: z.ZodRecord<z.ZodString, z.ZodObject<{
579
+ type: z.ZodEnum<{
580
+ string: "string";
581
+ number: "number";
582
+ boolean: "boolean";
583
+ integer: "integer";
584
+ }>;
585
+ required: z.ZodOptional<z.ZodBoolean>;
586
+ title: z.ZodOptional<z.ZodString>;
587
+ }, z.core.$strict>>;
588
+ price_checked_at_purchase: z.ZodBoolean;
589
+ fulfillment: z.ZodLiteral<"async">;
590
+ fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
591
+ }, z.core.$strict>, z.ZodObject<{
592
+ id: z.ZodString;
593
+ title: z.ZodString;
594
+ description: z.ZodString;
595
+ price: z.ZodObject<{
596
+ amount: z.ZodString;
597
+ currency: z.ZodString;
598
+ }, z.core.$strict>;
599
+ as_of: z.ZodISODateTime;
600
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
601
+ type: z.ZodEnum<{
602
+ string: "string";
603
+ number: "number";
604
+ boolean: "boolean";
605
+ integer: "integer";
606
+ }>;
607
+ required: z.ZodOptional<z.ZodBoolean>;
608
+ title: z.ZodOptional<z.ZodString>;
609
+ }, z.core.$strict>>>;
610
+ result: z.ZodRecord<z.ZodString, z.ZodObject<{
611
+ type: z.ZodEnum<{
612
+ string: "string";
613
+ number: "number";
614
+ boolean: "boolean";
615
+ integer: "integer";
616
+ }>;
617
+ required: z.ZodOptional<z.ZodBoolean>;
618
+ title: z.ZodOptional<z.ZodString>;
619
+ }, z.core.$strict>>;
620
+ price_checked_at_purchase: z.ZodBoolean;
621
+ fulfillment: z.ZodLiteral<"confirm">;
622
+ confirm_deadline_seconds: z.ZodOptional<z.ZodInt>;
623
+ fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
624
+ }, z.core.$strict>], "fulfillment">>;
625
+ }, z.core.$strict>;
626
+ /**
627
+ * The methods this surface uses.
628
+ *
629
+ * `DELETE` is here for the one call that removes rows rather than marking them,
630
+ * and it earns the third verb rather than being folded into a POST: what it
631
+ * does to a key is not what disabling one does, and a surface that spelled both
632
+ * as a POST would be inviting a reader to think it was.
633
+ */
634
+ export declare const HTTP_METHODS: readonly ["GET", "POST", "DELETE"];
635
+ export type HttpMethod = (typeof HTTP_METHODS)[number];
636
+ /**
637
+ * Which door a call is behind.
638
+ *
639
+ * `merchant_key` is a key the merchant holds, sent as a bearer token; it names
640
+ * the merchant it belongs to, and a call behind this door acts on that
641
+ * merchant's cards, orders and receipts and on nobody else's. `none` is a
642
+ * call anybody may make — the catalog an agent browses, and the purchase,
643
+ * where the payment is what stands in for authorisation.
644
+ *
645
+ * `order_id` is the agent's own door and there is exactly one route behind it:
646
+ * knowing an order's identifier is what stands in for a key (ADR-0011). What
647
+ * that leans on is the identifier being generated from a random source and long
648
+ * enough not to be guessed — not on it being secret, which it is not. It
649
+ * travels in the payment challenge, on the merchant's stream and in the
650
+ * merchant's receipts, so the merchant who sold an order holds every identifier
651
+ * they would need to read one of these documents. That is why ownership of an
652
+ * order is settled by the verified payer and not by the identifier, and why the
653
+ * document behind this door carries only what the buyer is owed.
654
+ *
655
+ * It is a separate word from `none` because the two are not the same call: a
656
+ * route marked `none` answers everybody the same thing, and this one answers
657
+ * about the order the caller named and about no other. Whoever mounts it reads
658
+ * that difference off the word rather than out of a sentence. The weakness is
659
+ * stated in the decision rather than hidden: anyone who obtains an identifier
660
+ * can read that order, and the first real payment is the trigger to narrow it.
661
+ *
662
+ * `undecided` is not a scheme at all. It is the honest word for a route whose
663
+ * door nobody has chosen yet, and it exists because "I do not know" and "I
664
+ * know there is no door" cannot be the same value. A gateway must refuse to
665
+ * mount a route marked this way until somebody decides, which is exactly the
666
+ * behaviour wanted: the alternative is a route quietly serving everybody
667
+ * because `none` was the closest word to hand.
668
+ */
669
+ export declare const AUTH_MODES: readonly ["merchant_key", "none", "order_id", "undecided"];
670
+ export type AuthMode = (typeof AUTH_MODES)[number];
671
+ /**
672
+ * The header the merchant's key travels in, and the two helpers that put a key
673
+ * into it and read one back out.
674
+ *
675
+ * `auth` above says which door a call is behind and not how the door is built,
676
+ * and that omission is deliberate — but how the door is built is still a thing
677
+ * the gateway and the SDK have to agree on exactly, because a mismatch is a call
678
+ * that fails with an authorisation error while both repositories look correct.
679
+ * They had agreed, by each writing the same two strings down apart from the
680
+ * other: the gateway parsed an `Authorization: Bearer` header and the SDK sent
681
+ * one. That is agreement by luck, and it is the very thing this table exists to
682
+ * remove for the addresses and the documents. So the strings live here now, in
683
+ * the one place both sides already import, and a change to either is a change in
684
+ * one file rather than a silent drift between two.
685
+ *
686
+ * The name is `authorization` and the scheme is `Bearer`. The name
687
+ * is lower-case because that is how a client writes a header and how the wire
688
+ * carries it; a reader on the gateway matches it without regard to case anyway.
689
+ */
690
+ export declare const MERCHANT_KEY_HEADER = "authorization";
691
+ /**
692
+ * The value of the {@link MERCHANT_KEY_HEADER} header for a given key — what the
693
+ * SDK sends, so that what the gateway parses is never guessed at.
694
+ */
695
+ export declare const merchantKeyHeaderValue: (key: string) => string;
696
+ /**
697
+ * The key inside a merchant-key header value, or null where there is not one.
698
+ *
699
+ * Null is every way the value is not a bearer token this contract issued: no
700
+ * header at all, another scheme, or the scheme with nothing after it. The caller
701
+ * is handed a key it can compare or nothing to compare, and never a half-parsed
702
+ * string that a constant-time comparison would then match against a prefix of
703
+ * the real key.
704
+ */
705
+ export declare const merchantKeyFrom: (headerValue: string | undefined) => string | null;
706
+ /**
707
+ * How every call on this surface says no.
708
+ *
709
+ * One shape, for every refusal of every route, whatever it is about and
710
+ * whatever status it arrives under: an object whose only field is `error`, and
711
+ * inside it a machine-readable `code` and a sentence a person can act on. It
712
+ * is declared here, once, rather than being described route by route — a
713
+ * refusal shape written down twenty-six times is a refusal shape that is
714
+ * already twenty-six shapes, and the one thing a caller does with every call
715
+ * it makes is find out whether the call was refused.
716
+ *
717
+ * Both fields are required, and the sentence is the one worth arguing for. A
718
+ * refusal with a code and no words is a refusal only the code's author can
719
+ * read: an integrator meeting it for the first time has a string to search our
720
+ * source for and nothing to act on, and the caller printing it has an empty
721
+ * space where the reason belongs. That is why this is required rather than
722
+ * optional, and why a refusal that carries findings — a card's problems, a
723
+ * body that did not fit — carries them beside the sentence rather than instead
724
+ * of it.
725
+ *
726
+ * Inside `error` the shape is open, and that is deliberate in both directions.
727
+ * A refusal may say more about itself than these two fields, and several do:
728
+ * where an order ended, whether the payment layer might vouch for a second
729
+ * attempt, which fields of a document did not fit. What no refusal may do is
730
+ * ride beside the envelope rather than inside it, which is why the outer
731
+ * object is closed: `{ "error": … }` and nothing else is how a reader tells a
732
+ * refusal from a document that happens to mention an error.
733
+ *
734
+ * The set of codes is open, and is not enumerated here. A gateway meets
735
+ * situations this contract has not named, and a closed list would leave it
736
+ * choosing between the nearest wrong word and no answer at all. What is
737
+ * promised is the shape, so that a caller can always find out that it was
738
+ * refused and always have something to print.
739
+ */
740
+ export declare const ErrorEnvelopeSchema: z.ZodObject<{
741
+ error: z.ZodObject<{
742
+ code: z.ZodString;
743
+ message: z.ZodString;
744
+ retryable: z.ZodBoolean;
745
+ }, z.core.$loose>;
746
+ }, z.core.$strict>;
747
+ export type ErrorEnvelope = z.infer<typeof ErrorEnvelopeSchema>;
748
+ /**
749
+ * Every code this contract's gateway refuses a call with today.
750
+ *
751
+ * Named after the field it lands in — `error.code` — rather than "refusal
752
+ * code", which this contract already uses for something else: what a
753
+ * merchant's handler answers when it cannot deliver an order it was given
754
+ * (`RefusalCode` in `handler.ts`). Those are a merchant's words about one
755
+ * order; these are the surface's words about one call, and a reader who ran
756
+ * the two together would go looking for `out_of_stock` here.
757
+ *
758
+ * Two halves, and a consumer that takes only one of them will be wrong about
759
+ * this surface sooner or later.
760
+ *
761
+ * The wire is open. `ErrorEnvelopeSchema` holds `code` to a non-blank string
762
+ * and not to this list, deliberately and for the reason `results.ts` gives
763
+ * about its own codes: a situation nobody anticipated has to reach the caller
764
+ * in its own words rather than break the parse on the way. A gateway newer
765
+ * than the client, another implementation of this surface, or something
766
+ * standing in front of one, can all answer with a code that is not here, and
767
+ * the answer is still a refusal and still readable.
768
+ *
769
+ * So this list is what to switch over, not what to validate against. A
770
+ * consumer covers these exhaustively — the compiler tells them when the list
771
+ * grows — and keeps a default arm for the code it has never seen, which is not
772
+ * an error path: the envelope's `message` is required precisely so that arm
773
+ * has a sentence to show, written by the side that knows why. A consumer that
774
+ * refused an unknown code, or rendered nothing for it, would turn a version
775
+ * skew into a blank screen over a refusal the gateway explained perfectly
776
+ * well.
777
+ *
778
+ * The list is alphabetical because it is looked up rather than read through,
779
+ * and it is the codes and not their meanings: what each one means to whoever
780
+ * has to act on it belongs to the route that sends it and to the sentence the
781
+ * refusal carries.
782
+ */
783
+ export declare const ERROR_CODES: readonly ["body_too_large", "body_undecodable", "call_refused", "charset_unsupported", "encoding_unsupported", "gateway_failed", "key_made_for_a_cabinet", "key_opened_this_call", "malformed_body", "malformed_query", "merchant_departed", "no_such_item", "no_such_key", "no_such_order", "no_such_route", "not_a_cabinet_key", "not_authorised", "not_invited", "not_selling", "not_this_purchase", "order_closed_before_it_was_priced", "order_not_priced_yet", "params_do_not_fit", "payment_already_spent", "payment_not_taken", "payment_not_verified"];
784
+ /** One of the codes this gateway is known to refuse a call with. */
785
+ export type ErrorCode = (typeof ERROR_CODES)[number];
786
+ /**
787
+ * What a call answers with when it works.
788
+ *
789
+ * One document per route, always — how a call says no is not written here, it
790
+ * is {@link ErrorEnvelopeSchema} and it is the same for all of them. The
791
+ * purchase used to be the exception, on the grounds that it is a payment
792
+ * exchange before it is a document; it names a document now, and the exchange
793
+ * that precedes it is described in that route's own words. A route that
794
+ * genuinely cannot name one is a change to this type, made deliberately,
795
+ * rather than a field somebody left out.
796
+ */
797
+ export interface RouteResponse {
798
+ readonly document: z.ZodType;
799
+ }
800
+ export interface RouteDefinition {
801
+ /** The method the call is made with, and the only one that carries the body. */
802
+ readonly method: HttpMethod;
803
+ /** The address, with path parameters written the way a router writes them. */
804
+ readonly path: string;
805
+ readonly auth: AuthMode;
806
+ /** What the call is for, and anything about it the shapes cannot carry. */
807
+ readonly description: string;
808
+ /** What the query string may carry, where a call takes one. */
809
+ readonly query?: z.ZodType;
810
+ /** The body, where a call has one. */
811
+ readonly request?: z.ZodType;
812
+ readonly response: RouteResponse;
813
+ /**
814
+ * Other methods this address has to answer on, where something outside our
815
+ * design requires it.
816
+ *
817
+ * One route has this and the reason has already been paid for once: the
818
+ * validators and crawlers that list a paid resource ask for it with GET, and
819
+ * a paywall bound to a single method makes the resource invisible to them.
820
+ * It is a field rather than a sentence in the description because a gateway
821
+ * mounts from data, and a sentence would be mounted by nobody.
822
+ *
823
+ * These methods carry no body. Whatever `request` names travels on `method`
824
+ * and on nothing else.
825
+ */
826
+ readonly also_answers_on?: readonly HttpMethod[];
827
+ }
828
+ /**
829
+ * Every call of the surface, under the name it is known by in both programs.
830
+ *
831
+ * The name is the key, so two routes cannot share one; a test holds the rest —
832
+ * that no two sit at one address under one method, and that every schema named
833
+ * here is one the contract registry publishes, since the registry and this
834
+ * table are the whole of what a reader outside TypeScript has.
835
+ *
836
+ * Two prefixes are in this table and they are two different kinds of address.
837
+ * `/v0` is the merchant's API, and it is versioned for the ordinary reason a
838
+ * classic API is: an integrator writes code against it, and the number is what
839
+ * lets that code keep working while the shapes underneath it change. `/x402` is
840
+ * the storefront — the catalog an agent browses, the address it buys at, and
841
+ * the door it comes back to for its own order — and it carries no version at
842
+ * all. Those three addresses are not something an integrator holds in a client
843
+ * library; they are a product identity. A discovery catalog keys a listing on
844
+ * the address it was given, strangers' agents construct them from a base and an
845
+ * identifier, and both of those outlive any dialect we speak. So the protocol
846
+ * versions where the protocol can be read — the `x402Version` field inside the
847
+ * challenge — and the address stays put. A version segment in a storefront path
848
+ * would be a promise to keep every old segment answering forever, made to
849
+ * catalogs we do not run.
850
+ *
851
+ * Which door a call is behind is still `auth` and never the prefix. The two
852
+ * happen to agree today, and a reader who took that for the rule would mount
853
+ * the next route by its address; `apps/gateway/src/http/server.ts` says what
854
+ * that costs.
855
+ */
856
+ export declare const API_ROUTES: Readonly<{
857
+ publish_card: {
858
+ method: "POST";
859
+ path: string;
860
+ auth: "merchant_key";
861
+ description: string;
862
+ request: z.ZodObject<{
863
+ merchant_item_id: z.ZodString;
864
+ title: z.ZodString;
865
+ description: z.ZodString;
866
+ price: z.ZodPreprocess<z.ZodObject<{
867
+ amount: z.ZodString;
868
+ currency: z.ZodString;
869
+ }, z.core.$strict>>;
870
+ params: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
871
+ type: z.ZodEnum<{
872
+ string: "string";
873
+ number: "number";
874
+ boolean: "boolean";
875
+ integer: "integer";
876
+ }>;
877
+ required: z.ZodOptional<z.ZodBoolean>;
878
+ title: z.ZodOptional<z.ZodString>;
879
+ }, z.core.$strict>>>>;
880
+ result: z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
881
+ type: z.ZodEnum<{
882
+ string: "string";
883
+ number: "number";
884
+ boolean: "boolean";
885
+ integer: "integer";
886
+ }>;
887
+ required: z.ZodOptional<z.ZodBoolean>;
888
+ title: z.ZodOptional<z.ZodString>;
889
+ }, z.core.$strict>>>;
890
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
891
+ fulfillment: z.ZodDefault<z.ZodEnum<{
892
+ sync: "sync";
893
+ async: "async";
894
+ confirm: "confirm";
895
+ }>>;
896
+ price_check: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"handler">, z.ZodObject<{
897
+ url: z.ZodURL;
898
+ }, z.core.$strict>]>>;
899
+ confirm_deadline_seconds: z.ZodOptional<z.ZodInt>;
900
+ fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
901
+ }, z.core.$strict>;
902
+ response: {
903
+ document: z.ZodDiscriminatedUnion<[z.ZodObject<{
904
+ ok: z.ZodLiteral<true>;
905
+ id: z.ZodString;
906
+ }, z.core.$strict>, z.ZodObject<{
907
+ ok: z.ZodLiteral<false>;
908
+ error: z.ZodObject<{
909
+ code: z.ZodString;
910
+ message: z.ZodString;
911
+ retryable: z.ZodBoolean;
912
+ problems: z.ZodArray<z.ZodObject<{
913
+ path: z.ZodArray<z.ZodString>;
914
+ code: z.ZodString;
915
+ message: z.ZodString;
916
+ }, z.core.$strict>>;
917
+ }, z.core.$strict>;
918
+ }, z.core.$strict>], "ok">;
919
+ };
920
+ };
921
+ list_merchant_cards: {
922
+ method: "GET";
923
+ path: string;
924
+ auth: "merchant_key";
925
+ description: string;
926
+ response: {
927
+ document: z.ZodObject<{
928
+ selling: z.ZodEnum<{
929
+ open: "open";
930
+ paused: "paused";
931
+ departed: "departed";
932
+ }>;
933
+ cards: z.ZodArray<z.ZodObject<{
934
+ id: z.ZodString;
935
+ as_of: z.ZodISODateTime;
936
+ card: z.ZodObject<{
937
+ merchant_item_id: z.ZodString;
938
+ title: z.ZodString;
939
+ description: z.ZodString;
940
+ price: z.ZodPreprocess<z.ZodObject<{
941
+ amount: z.ZodString;
942
+ currency: z.ZodString;
943
+ }, z.core.$strict>>;
944
+ params: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
945
+ type: z.ZodEnum<{
946
+ string: "string";
947
+ number: "number";
948
+ boolean: "boolean";
949
+ integer: "integer";
950
+ }>;
951
+ required: z.ZodOptional<z.ZodBoolean>;
952
+ title: z.ZodOptional<z.ZodString>;
953
+ }, z.core.$strict>>>>;
954
+ result: z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
955
+ type: z.ZodEnum<{
956
+ string: "string";
957
+ number: "number";
958
+ boolean: "boolean";
959
+ integer: "integer";
960
+ }>;
961
+ required: z.ZodOptional<z.ZodBoolean>;
962
+ title: z.ZodOptional<z.ZodString>;
963
+ }, z.core.$strict>>>;
964
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
965
+ fulfillment: z.ZodDefault<z.ZodEnum<{
966
+ sync: "sync";
967
+ async: "async";
968
+ confirm: "confirm";
969
+ }>>;
970
+ price_check: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"handler">, z.ZodObject<{
971
+ url: z.ZodURL;
972
+ }, z.core.$strict>]>>;
973
+ confirm_deadline_seconds: z.ZodOptional<z.ZodInt>;
974
+ fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
975
+ }, z.core.$strict>;
976
+ selling: z.ZodEnum<{
977
+ open: "open";
978
+ paused: "paused";
979
+ departed: "departed";
980
+ }>;
981
+ paused: z.ZodBoolean;
982
+ }, z.core.$strict>>;
983
+ }, z.core.$strict>;
984
+ };
985
+ };
986
+ pause_card: {
987
+ method: "POST";
988
+ path: string;
989
+ auth: "merchant_key";
990
+ description: string;
991
+ response: {
992
+ document: z.ZodObject<{
993
+ id: z.ZodString;
994
+ as_of: z.ZodISODateTime;
995
+ card: z.ZodObject<{
996
+ merchant_item_id: z.ZodString;
997
+ title: z.ZodString;
998
+ description: z.ZodString;
999
+ price: z.ZodPreprocess<z.ZodObject<{
1000
+ amount: z.ZodString;
1001
+ currency: z.ZodString;
1002
+ }, z.core.$strict>>;
1003
+ params: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
1004
+ type: z.ZodEnum<{
1005
+ string: "string";
1006
+ number: "number";
1007
+ boolean: "boolean";
1008
+ integer: "integer";
1009
+ }>;
1010
+ required: z.ZodOptional<z.ZodBoolean>;
1011
+ title: z.ZodOptional<z.ZodString>;
1012
+ }, z.core.$strict>>>>;
1013
+ result: z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
1014
+ type: z.ZodEnum<{
1015
+ string: "string";
1016
+ number: "number";
1017
+ boolean: "boolean";
1018
+ integer: "integer";
1019
+ }>;
1020
+ required: z.ZodOptional<z.ZodBoolean>;
1021
+ title: z.ZodOptional<z.ZodString>;
1022
+ }, z.core.$strict>>>;
1023
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
1024
+ fulfillment: z.ZodDefault<z.ZodEnum<{
1025
+ sync: "sync";
1026
+ async: "async";
1027
+ confirm: "confirm";
1028
+ }>>;
1029
+ price_check: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"handler">, z.ZodObject<{
1030
+ url: z.ZodURL;
1031
+ }, z.core.$strict>]>>;
1032
+ confirm_deadline_seconds: z.ZodOptional<z.ZodInt>;
1033
+ fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
1034
+ }, z.core.$strict>;
1035
+ selling: z.ZodEnum<{
1036
+ open: "open";
1037
+ paused: "paused";
1038
+ departed: "departed";
1039
+ }>;
1040
+ paused: z.ZodBoolean;
1041
+ }, z.core.$strict>;
1042
+ };
1043
+ };
1044
+ resume_card: {
1045
+ method: "POST";
1046
+ path: string;
1047
+ auth: "merchant_key";
1048
+ description: string;
1049
+ response: {
1050
+ document: z.ZodObject<{
1051
+ id: z.ZodString;
1052
+ as_of: z.ZodISODateTime;
1053
+ card: z.ZodObject<{
1054
+ merchant_item_id: z.ZodString;
1055
+ title: z.ZodString;
1056
+ description: z.ZodString;
1057
+ price: z.ZodPreprocess<z.ZodObject<{
1058
+ amount: z.ZodString;
1059
+ currency: z.ZodString;
1060
+ }, z.core.$strict>>;
1061
+ params: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
1062
+ type: z.ZodEnum<{
1063
+ string: "string";
1064
+ number: "number";
1065
+ boolean: "boolean";
1066
+ integer: "integer";
1067
+ }>;
1068
+ required: z.ZodOptional<z.ZodBoolean>;
1069
+ title: z.ZodOptional<z.ZodString>;
1070
+ }, z.core.$strict>>>>;
1071
+ result: z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
1072
+ type: z.ZodEnum<{
1073
+ string: "string";
1074
+ number: "number";
1075
+ boolean: "boolean";
1076
+ integer: "integer";
1077
+ }>;
1078
+ required: z.ZodOptional<z.ZodBoolean>;
1079
+ title: z.ZodOptional<z.ZodString>;
1080
+ }, z.core.$strict>>>;
1081
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
1082
+ fulfillment: z.ZodDefault<z.ZodEnum<{
1083
+ sync: "sync";
1084
+ async: "async";
1085
+ confirm: "confirm";
1086
+ }>>;
1087
+ price_check: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"handler">, z.ZodObject<{
1088
+ url: z.ZodURL;
1089
+ }, z.core.$strict>]>>;
1090
+ confirm_deadline_seconds: z.ZodOptional<z.ZodInt>;
1091
+ fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
1092
+ }, z.core.$strict>;
1093
+ selling: z.ZodEnum<{
1094
+ open: "open";
1095
+ paused: "paused";
1096
+ departed: "departed";
1097
+ }>;
1098
+ paused: z.ZodBoolean;
1099
+ }, z.core.$strict>;
1100
+ };
1101
+ };
1102
+ pause_selling: {
1103
+ method: "POST";
1104
+ path: string;
1105
+ auth: "merchant_key";
1106
+ description: string;
1107
+ response: {
1108
+ document: z.ZodObject<{
1109
+ selling: z.ZodEnum<{
1110
+ open: "open";
1111
+ paused: "paused";
1112
+ departed: "departed";
1113
+ }>;
1114
+ cards: z.ZodArray<z.ZodObject<{
1115
+ id: z.ZodString;
1116
+ as_of: z.ZodISODateTime;
1117
+ card: z.ZodObject<{
1118
+ merchant_item_id: z.ZodString;
1119
+ title: z.ZodString;
1120
+ description: z.ZodString;
1121
+ price: z.ZodPreprocess<z.ZodObject<{
1122
+ amount: z.ZodString;
1123
+ currency: z.ZodString;
1124
+ }, z.core.$strict>>;
1125
+ params: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
1126
+ type: z.ZodEnum<{
1127
+ string: "string";
1128
+ number: "number";
1129
+ boolean: "boolean";
1130
+ integer: "integer";
1131
+ }>;
1132
+ required: z.ZodOptional<z.ZodBoolean>;
1133
+ title: z.ZodOptional<z.ZodString>;
1134
+ }, z.core.$strict>>>>;
1135
+ result: z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
1136
+ type: z.ZodEnum<{
1137
+ string: "string";
1138
+ number: "number";
1139
+ boolean: "boolean";
1140
+ integer: "integer";
1141
+ }>;
1142
+ required: z.ZodOptional<z.ZodBoolean>;
1143
+ title: z.ZodOptional<z.ZodString>;
1144
+ }, z.core.$strict>>>;
1145
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
1146
+ fulfillment: z.ZodDefault<z.ZodEnum<{
1147
+ sync: "sync";
1148
+ async: "async";
1149
+ confirm: "confirm";
1150
+ }>>;
1151
+ price_check: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"handler">, z.ZodObject<{
1152
+ url: z.ZodURL;
1153
+ }, z.core.$strict>]>>;
1154
+ confirm_deadline_seconds: z.ZodOptional<z.ZodInt>;
1155
+ fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
1156
+ }, z.core.$strict>;
1157
+ selling: z.ZodEnum<{
1158
+ open: "open";
1159
+ paused: "paused";
1160
+ departed: "departed";
1161
+ }>;
1162
+ paused: z.ZodBoolean;
1163
+ }, z.core.$strict>>;
1164
+ }, z.core.$strict>;
1165
+ };
1166
+ };
1167
+ resume_selling: {
1168
+ method: "POST";
1169
+ path: string;
1170
+ auth: "merchant_key";
1171
+ description: string;
1172
+ response: {
1173
+ document: z.ZodObject<{
1174
+ selling: z.ZodEnum<{
1175
+ open: "open";
1176
+ paused: "paused";
1177
+ departed: "departed";
1178
+ }>;
1179
+ cards: z.ZodArray<z.ZodObject<{
1180
+ id: z.ZodString;
1181
+ as_of: z.ZodISODateTime;
1182
+ card: z.ZodObject<{
1183
+ merchant_item_id: z.ZodString;
1184
+ title: z.ZodString;
1185
+ description: z.ZodString;
1186
+ price: z.ZodPreprocess<z.ZodObject<{
1187
+ amount: z.ZodString;
1188
+ currency: z.ZodString;
1189
+ }, z.core.$strict>>;
1190
+ params: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
1191
+ type: z.ZodEnum<{
1192
+ string: "string";
1193
+ number: "number";
1194
+ boolean: "boolean";
1195
+ integer: "integer";
1196
+ }>;
1197
+ required: z.ZodOptional<z.ZodBoolean>;
1198
+ title: z.ZodOptional<z.ZodString>;
1199
+ }, z.core.$strict>>>>;
1200
+ result: z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
1201
+ type: z.ZodEnum<{
1202
+ string: "string";
1203
+ number: "number";
1204
+ boolean: "boolean";
1205
+ integer: "integer";
1206
+ }>;
1207
+ required: z.ZodOptional<z.ZodBoolean>;
1208
+ title: z.ZodOptional<z.ZodString>;
1209
+ }, z.core.$strict>>>;
1210
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
1211
+ fulfillment: z.ZodDefault<z.ZodEnum<{
1212
+ sync: "sync";
1213
+ async: "async";
1214
+ confirm: "confirm";
1215
+ }>>;
1216
+ price_check: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"handler">, z.ZodObject<{
1217
+ url: z.ZodURL;
1218
+ }, z.core.$strict>]>>;
1219
+ confirm_deadline_seconds: z.ZodOptional<z.ZodInt>;
1220
+ fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
1221
+ }, z.core.$strict>;
1222
+ selling: z.ZodEnum<{
1223
+ open: "open";
1224
+ paused: "paused";
1225
+ departed: "departed";
1226
+ }>;
1227
+ paused: z.ZodBoolean;
1228
+ }, z.core.$strict>>;
1229
+ }, z.core.$strict>;
1230
+ };
1231
+ };
1232
+ register_merchant: {
1233
+ method: "POST";
1234
+ path: string;
1235
+ auth: "none";
1236
+ description: string;
1237
+ request: z.ZodObject<{
1238
+ invitation: z.ZodString;
1239
+ }, z.core.$strict>;
1240
+ response: {
1241
+ document: z.ZodObject<{
1242
+ merchant_id: z.ZodString;
1243
+ secret: z.ZodString;
1244
+ }, z.core.$strict>;
1245
+ };
1246
+ };
1247
+ get_seller_name: {
1248
+ method: "GET";
1249
+ path: string;
1250
+ auth: "merchant_key";
1251
+ description: string;
1252
+ response: {
1253
+ document: z.ZodObject<{
1254
+ seller_name: z.ZodNullable<z.ZodString>;
1255
+ }, z.core.$strict>;
1256
+ };
1257
+ };
1258
+ set_seller_name: {
1259
+ method: "POST";
1260
+ path: string;
1261
+ auth: "merchant_key";
1262
+ description: string;
1263
+ request: z.ZodObject<{
1264
+ seller_name: z.ZodPipe<z.ZodString, z.ZodString>;
1265
+ }, z.core.$strict>;
1266
+ response: {
1267
+ document: z.ZodObject<{
1268
+ seller_name: z.ZodNullable<z.ZodString>;
1269
+ }, z.core.$strict>;
1270
+ };
1271
+ };
1272
+ get_payout_wallet: {
1273
+ method: "GET";
1274
+ path: string;
1275
+ auth: "merchant_key";
1276
+ description: string;
1277
+ response: {
1278
+ document: z.ZodObject<{
1279
+ payout_wallet: z.ZodNullable<z.ZodString>;
1280
+ }, z.core.$strict>;
1281
+ };
1282
+ };
1283
+ set_payout_wallet: {
1284
+ method: "POST";
1285
+ path: string;
1286
+ auth: "merchant_key";
1287
+ description: string;
1288
+ request: z.ZodObject<{
1289
+ payout_wallet: z.ZodPipe<z.ZodString, z.ZodString>;
1290
+ }, z.core.$strict>;
1291
+ response: {
1292
+ document: z.ZodObject<{
1293
+ payout_wallet: z.ZodNullable<z.ZodString>;
1294
+ }, z.core.$strict>;
1295
+ };
1296
+ };
1297
+ list_keys: {
1298
+ method: "GET";
1299
+ path: string;
1300
+ auth: "merchant_key";
1301
+ description: string;
1302
+ response: {
1303
+ document: z.ZodObject<{
1304
+ keys: z.ZodArray<z.ZodObject<{
1305
+ id: z.ZodString;
1306
+ label: z.ZodString;
1307
+ created_at: z.ZodISODateTime;
1308
+ last_used_at: z.ZodNullable<z.ZodISODateTime>;
1309
+ disabled_at: z.ZodNullable<z.ZodISODateTime>;
1310
+ }, z.core.$strict>>;
1311
+ this_call: z.ZodString;
1312
+ }, z.core.$strict>;
1313
+ };
1314
+ };
1315
+ issue_key: {
1316
+ method: "POST";
1317
+ path: string;
1318
+ auth: "merchant_key";
1319
+ description: string;
1320
+ request: z.ZodObject<{
1321
+ label: z.ZodString;
1322
+ }, z.core.$strict>;
1323
+ response: {
1324
+ document: z.ZodObject<{
1325
+ key: z.ZodObject<{
1326
+ id: z.ZodString;
1327
+ label: z.ZodString;
1328
+ created_at: z.ZodISODateTime;
1329
+ last_used_at: z.ZodNullable<z.ZodISODateTime>;
1330
+ disabled_at: z.ZodNullable<z.ZodISODateTime>;
1331
+ }, z.core.$strict>;
1332
+ secret: z.ZodString;
1333
+ }, z.core.$strict>;
1334
+ };
1335
+ };
1336
+ disable_key: {
1337
+ method: "POST";
1338
+ path: string;
1339
+ auth: "merchant_key";
1340
+ description: string;
1341
+ response: {
1342
+ document: z.ZodObject<{
1343
+ key: z.ZodObject<{
1344
+ id: z.ZodString;
1345
+ label: z.ZodString;
1346
+ created_at: z.ZodISODateTime;
1347
+ last_used_at: z.ZodNullable<z.ZodISODateTime>;
1348
+ disabled_at: z.ZodNullable<z.ZodISODateTime>;
1349
+ }, z.core.$strict>;
1350
+ }, z.core.$strict>;
1351
+ };
1352
+ };
1353
+ issue_cabinet_key: {
1354
+ method: "POST";
1355
+ path: string;
1356
+ auth: "merchant_key";
1357
+ description: string;
1358
+ response: {
1359
+ document: z.ZodObject<{
1360
+ secret: z.ZodString;
1361
+ }, z.core.$strict>;
1362
+ };
1363
+ };
1364
+ forget_cabinet_key: {
1365
+ method: "DELETE";
1366
+ path: string;
1367
+ auth: "merchant_key";
1368
+ description: string;
1369
+ response: {
1370
+ document: z.ZodObject<{
1371
+ forgotten: z.ZodLiteral<true>;
1372
+ }, z.core.$strict>;
1373
+ };
1374
+ };
1375
+ get_order: {
1376
+ method: "GET";
1377
+ path: string;
1378
+ auth: "merchant_key";
1379
+ description: string;
1380
+ response: {
1381
+ document: z.ZodObject<{
1382
+ id: z.ZodString;
1383
+ merchant_item_id: z.ZodString;
1384
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1385
+ price: z.ZodObject<{
1386
+ amount: z.ZodString;
1387
+ currency: z.ZodString;
1388
+ at: z.ZodISODateTime;
1389
+ as_of: z.ZodISODateTime;
1390
+ }, z.core.$strict>;
1391
+ price_id: z.ZodOptional<z.ZodString>;
1392
+ test: z.ZodBoolean;
1393
+ status: z.ZodEnum<{
1394
+ delivered: "delivered";
1395
+ in_progress: "in_progress";
1396
+ rejected: "rejected";
1397
+ payment_unresolved: "payment_unresolved";
1398
+ declined: "declined";
1399
+ expired: "expired";
1400
+ cancelled: "cancelled";
1401
+ refund_due: "refund_due";
1402
+ refunded: "refunded";
1403
+ delivered_unpaid: "delivered_unpaid";
1404
+ }>;
1405
+ }, z.core.$strict>;
1406
+ };
1407
+ };
1408
+ list_orders: {
1409
+ method: "GET";
1410
+ path: string;
1411
+ auth: "merchant_key";
1412
+ description: string;
1413
+ query: z.ZodObject<{
1414
+ open: z.ZodOptional<z.ZodEnum<{
1415
+ true: "true";
1416
+ false: "false";
1417
+ }>>;
1418
+ }, z.core.$strict>;
1419
+ response: {
1420
+ document: z.ZodObject<{
1421
+ orders: z.ZodArray<z.ZodObject<{
1422
+ id: z.ZodString;
1423
+ merchant_item_id: z.ZodString;
1424
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1425
+ price: z.ZodObject<{
1426
+ amount: z.ZodString;
1427
+ currency: z.ZodString;
1428
+ at: z.ZodISODateTime;
1429
+ as_of: z.ZodISODateTime;
1430
+ }, z.core.$strict>;
1431
+ price_id: z.ZodOptional<z.ZodString>;
1432
+ test: z.ZodBoolean;
1433
+ status: z.ZodEnum<{
1434
+ delivered: "delivered";
1435
+ in_progress: "in_progress";
1436
+ rejected: "rejected";
1437
+ payment_unresolved: "payment_unresolved";
1438
+ declined: "declined";
1439
+ expired: "expired";
1440
+ cancelled: "cancelled";
1441
+ refund_due: "refund_due";
1442
+ refunded: "refunded";
1443
+ delivered_unpaid: "delivered_unpaid";
1444
+ }>;
1445
+ }, z.core.$strict>>;
1446
+ }, z.core.$strict>;
1447
+ };
1448
+ };
1449
+ list_receipts: {
1450
+ method: "GET";
1451
+ path: string;
1452
+ auth: "merchant_key";
1453
+ description: string;
1454
+ response: {
1455
+ document: z.ZodObject<{
1456
+ receipts: z.ZodArray<z.ZodObject<{
1457
+ id: z.ZodString;
1458
+ order_id: z.ZodString;
1459
+ item_id: z.ZodString;
1460
+ price: z.ZodObject<{
1461
+ amount: z.ZodString;
1462
+ currency: z.ZodString;
1463
+ at: z.ZodISODateTime;
1464
+ as_of: z.ZodISODateTime;
1465
+ }, z.core.$strict>;
1466
+ price_id: z.ZodOptional<z.ZodString>;
1467
+ paid_at: z.ZodISODateTime;
1468
+ outcome: z.ZodEnum<{
1469
+ delivered: "delivered";
1470
+ in_progress: "in_progress";
1471
+ refund_due: "refund_due";
1472
+ refunded: "refunded";
1473
+ }>;
1474
+ test: z.ZodBoolean;
1475
+ }, z.core.$strict>>;
1476
+ }, z.core.$strict>;
1477
+ };
1478
+ };
1479
+ poll_worker: {
1480
+ method: "POST";
1481
+ path: string;
1482
+ auth: "merchant_key";
1483
+ description: string;
1484
+ request: z.ZodObject<{
1485
+ wait_seconds: z.ZodOptional<z.ZodInt>;
1486
+ max: z.ZodOptional<z.ZodInt>;
1487
+ }, z.core.$strict>;
1488
+ response: {
1489
+ document: z.ZodObject<{
1490
+ contract_version: z.ZodString;
1491
+ envelopes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1492
+ kind: z.ZodLiteral<"order">;
1493
+ id: z.ZodString;
1494
+ sent_at: z.ZodISODateTime;
1495
+ payload: z.ZodObject<{
1496
+ id: z.ZodString;
1497
+ merchant_item_id: z.ZodString;
1498
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1499
+ price: z.ZodObject<{
1500
+ amount: z.ZodString;
1501
+ currency: z.ZodString;
1502
+ at: z.ZodISODateTime;
1503
+ as_of: z.ZodISODateTime;
1504
+ }, z.core.$strict>;
1505
+ price_id: z.ZodOptional<z.ZodString>;
1506
+ test: z.ZodBoolean;
1507
+ }, z.core.$strict>;
1508
+ }, z.core.$strict>, z.ZodObject<{
1509
+ kind: z.ZodLiteral<"quote_request">;
1510
+ id: z.ZodString;
1511
+ sent_at: z.ZodISODateTime;
1512
+ payload: z.ZodObject<{
1513
+ merchant_item_id: z.ZodString;
1514
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1515
+ price_id: z.ZodString;
1516
+ purpose: z.ZodEnum<{
1517
+ purchase: "purchase";
1518
+ poll: "poll";
1519
+ }>;
1520
+ expires_at: z.ZodISODateTime;
1521
+ }, z.core.$strict>;
1522
+ }, z.core.$strict>, z.ZodObject<{
1523
+ kind: z.ZodLiteral<"order_event">;
1524
+ id: z.ZodString;
1525
+ sent_at: z.ZodISODateTime;
1526
+ payload: z.ZodDiscriminatedUnion<[z.ZodObject<{
1527
+ type: z.ZodLiteral<"order.refund_due">;
1528
+ order_id: z.ZodString;
1529
+ at: z.ZodISODateTime;
1530
+ price: z.ZodObject<{
1531
+ amount: z.ZodString;
1532
+ currency: z.ZodString;
1533
+ }, z.core.$strict>;
1534
+ reason: z.ZodEnum<{
1535
+ refused: "refused";
1536
+ deadline_passed: "deadline_passed";
1537
+ merchant_left: "merchant_left";
1538
+ }>;
1539
+ }, z.core.$strict>, z.ZodObject<{
1540
+ type: z.ZodLiteral<"order.unpaid_after_confirmation">;
1541
+ order_id: z.ZodString;
1542
+ at: z.ZodISODateTime;
1543
+ }, z.core.$strict>, z.ZodObject<{
1544
+ type: z.ZodLiteral<"order.payment_failed_after_delivery">;
1545
+ order_id: z.ZodString;
1546
+ at: z.ZodISODateTime;
1547
+ }, z.core.$strict>], "type">;
1548
+ }, z.core.$strict>], "kind">>;
1549
+ }, z.core.$strict>;
1550
+ };
1551
+ };
1552
+ answer_order: {
1553
+ method: "POST";
1554
+ path: string;
1555
+ auth: "merchant_key";
1556
+ description: string;
1557
+ request: z.ZodUnion<readonly [z.ZodObject<{
1558
+ delivered: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1559
+ }, z.core.$strict>, z.ZodObject<{
1560
+ refused: z.ZodObject<{
1561
+ code: z.ZodString;
1562
+ message: z.ZodString;
1563
+ }, z.core.$strict>;
1564
+ }, z.core.$strict>, z.ZodObject<{
1565
+ accepted: z.ZodObject<{
1566
+ eta_seconds: z.ZodOptional<z.ZodInt>;
1567
+ }, z.core.$strict>;
1568
+ }, z.core.$strict>]>;
1569
+ response: {
1570
+ document: z.ZodDiscriminatedUnion<[z.ZodObject<{
1571
+ ok: z.ZodLiteral<true>;
1572
+ result: z.ZodEnum<{
1573
+ refused: "refused";
1574
+ delivered: "delivered";
1575
+ accepted: "accepted";
1576
+ already_delivered: "already_delivered";
1577
+ debt_closed_by_delivery: "debt_closed_by_delivery";
1578
+ purchase_already_closed: "purchase_already_closed";
1579
+ }>;
1580
+ }, z.core.$strict>, z.ZodObject<{
1581
+ ok: z.ZodLiteral<false>;
1582
+ error: z.ZodObject<{
1583
+ code: z.ZodString;
1584
+ message: z.ZodString;
1585
+ retryable: z.ZodBoolean;
1586
+ problems: z.ZodOptional<z.ZodArray<z.ZodObject<{
1587
+ path: z.ZodArray<z.ZodString>;
1588
+ code: z.ZodString;
1589
+ message: z.ZodString;
1590
+ }, z.core.$strict>>>;
1591
+ }, z.core.$strict>;
1592
+ }, z.core.$strict>], "ok">;
1593
+ };
1594
+ };
1595
+ deliver_order: {
1596
+ method: "POST";
1597
+ path: string;
1598
+ auth: "merchant_key";
1599
+ description: string;
1600
+ request: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1601
+ response: {
1602
+ document: z.ZodDiscriminatedUnion<[z.ZodObject<{
1603
+ ok: z.ZodLiteral<true>;
1604
+ result: z.ZodEnum<{
1605
+ refused: "refused";
1606
+ delivered: "delivered";
1607
+ accepted: "accepted";
1608
+ already_delivered: "already_delivered";
1609
+ debt_closed_by_delivery: "debt_closed_by_delivery";
1610
+ purchase_already_closed: "purchase_already_closed";
1611
+ }>;
1612
+ }, z.core.$strict>, z.ZodObject<{
1613
+ ok: z.ZodLiteral<false>;
1614
+ error: z.ZodObject<{
1615
+ code: z.ZodString;
1616
+ message: z.ZodString;
1617
+ retryable: z.ZodBoolean;
1618
+ problems: z.ZodOptional<z.ZodArray<z.ZodObject<{
1619
+ path: z.ZodArray<z.ZodString>;
1620
+ code: z.ZodString;
1621
+ message: z.ZodString;
1622
+ }, z.core.$strict>>>;
1623
+ }, z.core.$strict>;
1624
+ }, z.core.$strict>], "ok">;
1625
+ };
1626
+ };
1627
+ refuse_order: {
1628
+ method: "POST";
1629
+ path: string;
1630
+ auth: "merchant_key";
1631
+ description: string;
1632
+ request: z.ZodObject<{
1633
+ code: z.ZodString;
1634
+ message: z.ZodString;
1635
+ }, z.core.$strict>;
1636
+ response: {
1637
+ document: z.ZodDiscriminatedUnion<[z.ZodObject<{
1638
+ ok: z.ZodLiteral<true>;
1639
+ result: z.ZodEnum<{
1640
+ refused: "refused";
1641
+ delivered: "delivered";
1642
+ accepted: "accepted";
1643
+ already_delivered: "already_delivered";
1644
+ debt_closed_by_delivery: "debt_closed_by_delivery";
1645
+ purchase_already_closed: "purchase_already_closed";
1646
+ }>;
1647
+ }, z.core.$strict>, z.ZodObject<{
1648
+ ok: z.ZodLiteral<false>;
1649
+ error: z.ZodObject<{
1650
+ code: z.ZodString;
1651
+ message: z.ZodString;
1652
+ retryable: z.ZodBoolean;
1653
+ problems: z.ZodOptional<z.ZodArray<z.ZodObject<{
1654
+ path: z.ZodArray<z.ZodString>;
1655
+ code: z.ZodString;
1656
+ message: z.ZodString;
1657
+ }, z.core.$strict>>>;
1658
+ }, z.core.$strict>;
1659
+ }, z.core.$strict>], "ok">;
1660
+ };
1661
+ };
1662
+ accept_order: {
1663
+ method: "POST";
1664
+ path: string;
1665
+ auth: "merchant_key";
1666
+ description: string;
1667
+ request: z.ZodObject<{
1668
+ eta_seconds: z.ZodOptional<z.ZodInt>;
1669
+ }, z.core.$strict>;
1670
+ response: {
1671
+ document: z.ZodDiscriminatedUnion<[z.ZodObject<{
1672
+ ok: z.ZodLiteral<true>;
1673
+ }, z.core.$strict>, z.ZodObject<{
1674
+ ok: z.ZodLiteral<false>;
1675
+ error: z.ZodObject<{
1676
+ code: z.ZodString;
1677
+ message: z.ZodString;
1678
+ retryable: z.ZodBoolean;
1679
+ problems: z.ZodOptional<z.ZodArray<z.ZodObject<{
1680
+ path: z.ZodArray<z.ZodString>;
1681
+ code: z.ZodString;
1682
+ message: z.ZodString;
1683
+ }, z.core.$strict>>>;
1684
+ }, z.core.$strict>;
1685
+ }, z.core.$strict>], "ok">;
1686
+ };
1687
+ };
1688
+ answer_quote: {
1689
+ method: "POST";
1690
+ path: string;
1691
+ auth: "merchant_key";
1692
+ description: string;
1693
+ request: z.ZodDiscriminatedUnion<[z.ZodObject<{
1694
+ available: z.ZodLiteral<true>;
1695
+ price: z.ZodObject<{
1696
+ amount: z.ZodString;
1697
+ currency: z.ZodString;
1698
+ }, z.core.$strict>;
1699
+ as_of: z.ZodISODateTime;
1700
+ }, z.core.$strict>, z.ZodObject<{
1701
+ available: z.ZodLiteral<false>;
1702
+ as_of: z.ZodISODateTime;
1703
+ }, z.core.$strict>], "available">;
1704
+ response: {
1705
+ document: z.ZodObject<{
1706
+ used: z.ZodBoolean;
1707
+ }, z.core.$strict>;
1708
+ };
1709
+ };
1710
+ list_catalog: {
1711
+ method: "GET";
1712
+ path: string;
1713
+ auth: "none";
1714
+ description: string;
1715
+ response: {
1716
+ document: z.ZodObject<{
1717
+ items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1718
+ id: z.ZodString;
1719
+ title: z.ZodString;
1720
+ description: z.ZodString;
1721
+ price: z.ZodObject<{
1722
+ amount: z.ZodString;
1723
+ currency: z.ZodString;
1724
+ }, z.core.$strict>;
1725
+ as_of: z.ZodISODateTime;
1726
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1727
+ type: z.ZodEnum<{
1728
+ string: "string";
1729
+ number: "number";
1730
+ boolean: "boolean";
1731
+ integer: "integer";
1732
+ }>;
1733
+ required: z.ZodOptional<z.ZodBoolean>;
1734
+ title: z.ZodOptional<z.ZodString>;
1735
+ }, z.core.$strict>>>;
1736
+ result: z.ZodRecord<z.ZodString, z.ZodObject<{
1737
+ type: z.ZodEnum<{
1738
+ string: "string";
1739
+ number: "number";
1740
+ boolean: "boolean";
1741
+ integer: "integer";
1742
+ }>;
1743
+ required: z.ZodOptional<z.ZodBoolean>;
1744
+ title: z.ZodOptional<z.ZodString>;
1745
+ }, z.core.$strict>>;
1746
+ price_checked_at_purchase: z.ZodBoolean;
1747
+ fulfillment: z.ZodLiteral<"sync">;
1748
+ }, z.core.$strict>, z.ZodObject<{
1749
+ id: z.ZodString;
1750
+ title: z.ZodString;
1751
+ description: z.ZodString;
1752
+ price: z.ZodObject<{
1753
+ amount: z.ZodString;
1754
+ currency: z.ZodString;
1755
+ }, z.core.$strict>;
1756
+ as_of: z.ZodISODateTime;
1757
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1758
+ type: z.ZodEnum<{
1759
+ string: "string";
1760
+ number: "number";
1761
+ boolean: "boolean";
1762
+ integer: "integer";
1763
+ }>;
1764
+ required: z.ZodOptional<z.ZodBoolean>;
1765
+ title: z.ZodOptional<z.ZodString>;
1766
+ }, z.core.$strict>>>;
1767
+ result: z.ZodRecord<z.ZodString, z.ZodObject<{
1768
+ type: z.ZodEnum<{
1769
+ string: "string";
1770
+ number: "number";
1771
+ boolean: "boolean";
1772
+ integer: "integer";
1773
+ }>;
1774
+ required: z.ZodOptional<z.ZodBoolean>;
1775
+ title: z.ZodOptional<z.ZodString>;
1776
+ }, z.core.$strict>>;
1777
+ price_checked_at_purchase: z.ZodBoolean;
1778
+ fulfillment: z.ZodLiteral<"async">;
1779
+ fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
1780
+ }, z.core.$strict>, z.ZodObject<{
1781
+ id: z.ZodString;
1782
+ title: z.ZodString;
1783
+ description: z.ZodString;
1784
+ price: z.ZodObject<{
1785
+ amount: z.ZodString;
1786
+ currency: z.ZodString;
1787
+ }, z.core.$strict>;
1788
+ as_of: z.ZodISODateTime;
1789
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1790
+ type: z.ZodEnum<{
1791
+ string: "string";
1792
+ number: "number";
1793
+ boolean: "boolean";
1794
+ integer: "integer";
1795
+ }>;
1796
+ required: z.ZodOptional<z.ZodBoolean>;
1797
+ title: z.ZodOptional<z.ZodString>;
1798
+ }, z.core.$strict>>>;
1799
+ result: z.ZodRecord<z.ZodString, z.ZodObject<{
1800
+ type: z.ZodEnum<{
1801
+ string: "string";
1802
+ number: "number";
1803
+ boolean: "boolean";
1804
+ integer: "integer";
1805
+ }>;
1806
+ required: z.ZodOptional<z.ZodBoolean>;
1807
+ title: z.ZodOptional<z.ZodString>;
1808
+ }, z.core.$strict>>;
1809
+ price_checked_at_purchase: z.ZodBoolean;
1810
+ fulfillment: z.ZodLiteral<"confirm">;
1811
+ confirm_deadline_seconds: z.ZodOptional<z.ZodInt>;
1812
+ fulfill_deadline_seconds: z.ZodOptional<z.ZodInt>;
1813
+ }, z.core.$strict>], "fulfillment">>;
1814
+ }, z.core.$strict>;
1815
+ };
1816
+ };
1817
+ purchase_item: {
1818
+ method: "POST";
1819
+ path: string;
1820
+ auth: "none";
1821
+ description: string;
1822
+ request: z.ZodObject<{
1823
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1824
+ }, z.core.$strict>;
1825
+ also_answers_on: "GET"[];
1826
+ response: {
1827
+ document: z.ZodObject<{
1828
+ order_id: z.ZodString;
1829
+ status: z.ZodEnum<{
1830
+ delivered: "delivered";
1831
+ in_progress: "in_progress";
1832
+ rejected: "rejected";
1833
+ payment_unresolved: "payment_unresolved";
1834
+ declined: "declined";
1835
+ expired: "expired";
1836
+ cancelled: "cancelled";
1837
+ refund_due: "refund_due";
1838
+ refunded: "refunded";
1839
+ delivered_unpaid: "delivered_unpaid";
1840
+ }>;
1841
+ price: z.ZodNullable<z.ZodObject<{
1842
+ amount: z.ZodString;
1843
+ currency: z.ZodString;
1844
+ at: z.ZodISODateTime;
1845
+ as_of: z.ZodISODateTime;
1846
+ }, z.core.$strict>>;
1847
+ delivered: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1848
+ test: z.ZodBoolean;
1849
+ refusal: z.ZodOptional<z.ZodObject<{
1850
+ code: z.ZodString;
1851
+ message: z.ZodString;
1852
+ }, z.core.$strict>>;
1853
+ }, z.core.$strict>;
1854
+ };
1855
+ };
1856
+ get_order_status: {
1857
+ method: "GET";
1858
+ path: string;
1859
+ auth: "order_id";
1860
+ description: string;
1861
+ response: {
1862
+ document: z.ZodObject<{
1863
+ order_id: z.ZodString;
1864
+ status: z.ZodEnum<{
1865
+ delivered: "delivered";
1866
+ in_progress: "in_progress";
1867
+ rejected: "rejected";
1868
+ payment_unresolved: "payment_unresolved";
1869
+ declined: "declined";
1870
+ expired: "expired";
1871
+ cancelled: "cancelled";
1872
+ refund_due: "refund_due";
1873
+ refunded: "refunded";
1874
+ delivered_unpaid: "delivered_unpaid";
1875
+ }>;
1876
+ price: z.ZodNullable<z.ZodObject<{
1877
+ amount: z.ZodString;
1878
+ currency: z.ZodString;
1879
+ at: z.ZodISODateTime;
1880
+ as_of: z.ZodISODateTime;
1881
+ }, z.core.$strict>>;
1882
+ delivered: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1883
+ test: z.ZodBoolean;
1884
+ refusal: z.ZodOptional<z.ZodObject<{
1885
+ code: z.ZodString;
1886
+ message: z.ZodString;
1887
+ }, z.core.$strict>>;
1888
+ }, z.core.$strict>;
1889
+ };
1890
+ };
1891
+ }>;
1892
+ /** The name of one call in the table. */
1893
+ export type RouteName = keyof typeof API_ROUTES;
1894
+ /** The parameters an address takes, in the order it writes them. */
1895
+ export declare const pathParamsOf: (path: string) => string[];
1896
+ /**
1897
+ * The address of one call, with its parameters filled in and encoded.
1898
+ *
1899
+ * Encoding is the reason this is not left to the caller. An identifier in this
1900
+ * contract may hold a slash and a space — "SKU 100/1" is one we accept — and
1901
+ * concatenated into a path unencoded it becomes two segments and a different
1902
+ * route.
1903
+ *
1904
+ * A missing value and a value for a parameter the address does not take are
1905
+ * both refused, and both are refused by throwing rather than by returning
1906
+ * something. Everything this package returns rather than throws is a condition
1907
+ * a consumer is expected to handle; this is not one of those. An address built
1908
+ * with a hole in it is a bug in the caller, and the request it would send
1909
+ * reads in a log as a route that exists and answers nothing to anybody.
1910
+ *
1911
+ * Three refusals are less obvious and each is a way an address stops being the
1912
+ * one that was meant. A value is looked up with `Object.hasOwn`, because a
1913
+ * parameter named `constructor` would otherwise find something on the
1914
+ * prototype and expand into the source of a function. A value of "." or ".."
1915
+ * is refused, because a relative-URL resolver walks it and the request lands
1916
+ * somewhere else entirely. And a value that is not a string is refused rather
1917
+ * than stringified: `null` would otherwise become the four letters that spell
1918
+ * it, and the SDK is not always the one holding the types.
1919
+ */
1920
+ export declare const expandPath: (path: string, values: Readonly<Record<string, string>>) => string;
1921
+ /**
1922
+ * The routes a gateway may serve: every route whose door somebody has chosen.
1923
+ *
1924
+ * It exists because the natural way to mount a table is to ask whether a route
1925
+ * needs the merchant key and to treat everything else as open — and that
1926
+ * reading serves a route nobody has chosen a door for to the whole world.
1927
+ * Mounting from this list instead makes the safe reading the easy one, and a
1928
+ * route appears here the day its door is decided.
1929
+ *
1930
+ * Every route in the table has a door today, so this list is the whole of it.
1931
+ * That is a fact about the table and not a reason to mount from `API_ROUTES`
1932
+ * directly: the next route to be written down before it is designed is exactly
1933
+ * the one this filter is for.
1934
+ */
1935
+ export declare const mountableRoutes: () => [RouteName, RouteDefinition][];
1936
+ export type OrderWithStatus = z.infer<typeof OrderWithStatusSchema>;
1937
+ export type OrderList = z.infer<typeof OrderListSchema>;
1938
+ export type MerchantCardList = z.infer<typeof MerchantCardListSchema>;
1939
+ export type ReceiptList = z.infer<typeof ReceiptListSchema>;
1940
+ export type OrderListQuery = z.infer<typeof OrderListQuerySchema>;
1941
+ export type WorkerPollRequest = z.infer<typeof WorkerPollRequestSchema>;
1942
+ export type WorkerPollResponse = z.infer<typeof WorkerPollResponseSchema>;
1943
+ export type OrderCallResponse = z.infer<typeof OrderCallResponseSchema>;
1944
+ export type OrderAcceptResponse = z.infer<typeof OrderAcceptResponseSchema>;
1945
+ export type QuoteAnswerAck = z.infer<typeof QuoteAnswerAckSchema>;
1946
+ export type PurchaseRequest = z.infer<typeof PurchaseRequestSchema>;
1947
+ export type AgentOrderStatus = z.infer<typeof AgentOrderStatusSchema>;
1948
+ export type CatalogPage = z.infer<typeof CatalogPageSchema>;