@timbro/invoices 0.8.3 → 0.9.0-next.1

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 (102) hide show
  1. package/README.md +95 -258
  2. package/dist/admin.d.ts +44 -0
  3. package/dist/admin.d.ts.map +1 -0
  4. package/dist/admin.js +16 -0
  5. package/dist/certificate-custody-import.d.ts +4 -2
  6. package/dist/certificate-custody-import.d.ts.map +1 -1
  7. package/dist/certificate-custody-import.js +1 -1
  8. package/dist/collection.d.ts +1 -1
  9. package/dist/collection.js +4 -4
  10. package/dist/fiscal-engine-runtime.manifest.json +16 -16
  11. package/dist/fiscal-engine-runtime.provenance.json +17 -17
  12. package/dist/generated/hosted/index.d.ts +4 -0
  13. package/dist/generated/hosted/index.d.ts.map +1 -0
  14. package/dist/generated/hosted/index.js +3 -0
  15. package/dist/generated/hosted/sdk.gen.d.ts +106 -0
  16. package/dist/generated/hosted/sdk.gen.d.ts.map +1 -0
  17. package/dist/generated/hosted/sdk.gen.js +1049 -0
  18. package/dist/generated/hosted/types.gen.d.ts +2425 -0
  19. package/dist/generated/hosted/types.gen.d.ts.map +1 -0
  20. package/dist/generated/hosted/types.gen.js +2 -0
  21. package/dist/generated/hosted/zod.gen.d.ts +1772 -0
  22. package/dist/generated/hosted/zod.gen.d.ts.map +1 -0
  23. package/dist/generated/hosted/zod.gen.js +2269 -0
  24. package/dist/generated/index.d.ts +3 -3
  25. package/dist/generated/index.d.ts.map +1 -1
  26. package/dist/generated/index.js +2 -2
  27. package/dist/generated/invoice-api-contract.d.ts +6346 -0
  28. package/dist/generated/invoice-api-contract.d.ts.map +1 -0
  29. package/dist/generated/invoice-api-contract.js +11005 -0
  30. package/dist/generated/problem-catalog.d.ts.map +1 -1
  31. package/dist/generated/problem-catalog.js +6 -3
  32. package/dist/generated/sdk.gen.d.ts +70 -38
  33. package/dist/generated/sdk.gen.d.ts.map +1 -1
  34. package/dist/generated/sdk.gen.js +1261 -251
  35. package/dist/generated/types.gen.d.ts +4350 -2686
  36. package/dist/generated/types.gen.d.ts.map +1 -1
  37. package/dist/generated/zod.gen.d.ts +54065 -22789
  38. package/dist/generated/zod.gen.d.ts.map +1 -1
  39. package/dist/generated/zod.gen.js +5731 -665
  40. package/dist/generated-operation-client.d.ts +1 -0
  41. package/dist/generated-operation-client.d.ts.map +1 -1
  42. package/dist/generated-operation-client.js +3 -2
  43. package/dist/generated-problem.d.ts +1 -1
  44. package/dist/generated-problem.d.ts.map +1 -1
  45. package/dist/generated-problem.js +4 -4
  46. package/dist/index.d.ts +8 -37
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +2 -12
  49. package/dist/{fiscal-error.d.ts → invoice-error.d.ts} +10 -9
  50. package/dist/invoice-error.d.ts.map +1 -0
  51. package/dist/{fiscal-error.js → invoice-error.js} +7 -4
  52. package/dist/invoice-hosted-controls.d.ts +62 -0
  53. package/dist/invoice-hosted-controls.d.ts.map +1 -0
  54. package/dist/invoice-hosted-controls.js +188 -0
  55. package/dist/invoice-receipt.d.ts +10 -0
  56. package/dist/invoice-receipt.d.ts.map +1 -0
  57. package/dist/invoice-receipt.js +49 -0
  58. package/dist/invoice-replacement.d.ts +8 -0
  59. package/dist/invoice-replacement.d.ts.map +1 -0
  60. package/dist/invoice-replacement.js +18 -0
  61. package/dist/invoice.d.ts +94 -0
  62. package/dist/invoice.d.ts.map +1 -0
  63. package/dist/invoice.js +251 -0
  64. package/dist/printed-representation.d.ts +0 -1
  65. package/dist/printed-representation.d.ts.map +1 -1
  66. package/dist/printed-representation.js +3 -3
  67. package/dist/problem-contract.d.ts +14 -117
  68. package/dist/problem-contract.d.ts.map +1 -1
  69. package/dist/public-case.d.ts +1 -1
  70. package/dist/received-documents.d.ts +13 -12
  71. package/dist/received-documents.d.ts.map +1 -1
  72. package/dist/received-documents.js +26 -20
  73. package/dist/source-connection.d.ts +5 -5
  74. package/dist/source-connection.d.ts.map +1 -1
  75. package/dist/source-connection.js +8 -9
  76. package/dist/stamp-server-http-transport.js +6 -6
  77. package/dist/timbro-client.d.ts +5 -37
  78. package/dist/timbro-client.d.ts.map +1 -1
  79. package/dist/timbro-client.js +4 -20
  80. package/dist/timbro_fiscal_engine_bg.wasm +0 -0
  81. package/dist/transport-contract.d.ts +1 -1
  82. package/dist/transport-contract.d.ts.map +1 -1
  83. package/dist/webhook-delivery.js +1 -1
  84. package/dist/webhook-event.d.ts +124 -842
  85. package/dist/webhook-event.d.ts.map +1 -1
  86. package/dist/webhook-event.js +3 -1
  87. package/dist/webhook-registration.d.ts +1 -2
  88. package/dist/webhook-registration.d.ts.map +1 -1
  89. package/dist/webhook-registration.js +1 -2
  90. package/dist/webhook-replay.d.ts +1 -2
  91. package/dist/webhook-replay.d.ts.map +1 -1
  92. package/dist/webhook-replay.js +3 -4
  93. package/dist/workspace.d.ts.map +1 -1
  94. package/dist/workspace.js +2 -2
  95. package/package.json +26 -16
  96. package/dist/fiscal-delivery.d.ts +0 -12
  97. package/dist/fiscal-delivery.d.ts.map +0 -1
  98. package/dist/fiscal-delivery.js +0 -45
  99. package/dist/fiscal-error.d.ts.map +0 -1
  100. package/dist/fiscal-receipt.d.ts +0 -19
  101. package/dist/fiscal-receipt.d.ts.map +0 -1
  102. package/dist/fiscal-receipt.js +0 -66
@@ -0,0 +1,2269 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ import * as z from "zod";
3
+ /**
4
+ * MerchantBusinessFiscalSetupUnavailable
5
+ */
6
+ export const zMerchantBusinessFiscalSetupUnavailable = z.strictObject({
7
+ status: z.literal("unavailable"),
8
+ cause: z.literal("timbro_unreachable"),
9
+ });
10
+ /**
11
+ * MerchantBusinessFiscalBinding
12
+ *
13
+ * The Timbro Organization, Legal issuer, Source connection, and webhook.
14
+ */
15
+ export const zMerchantBusinessFiscalBinding = z.union([
16
+ z.strictObject({
17
+ status: z.literal("unbound"),
18
+ }),
19
+ z.strictObject({
20
+ status: z.literal("provisioning"),
21
+ }),
22
+ z.strictObject({
23
+ status: z.literal("bound"),
24
+ webhookSecret: z.union([z.literal("sealed"), z.literal("pending")]),
25
+ }),
26
+ z.strictObject({
27
+ status: z.literal("failed"),
28
+ }),
29
+ z.strictObject({
30
+ status: z.literal("conflict"),
31
+ }),
32
+ ]);
33
+ /**
34
+ * MerchantBusinessLegalIssuer
35
+ *
36
+ * Whether Timbro holds every profile field the hosted Legal issuer requires.
37
+ */
38
+ export const zMerchantBusinessLegalIssuer = z.union([
39
+ z.strictObject({
40
+ status: z.literal("missing"),
41
+ }),
42
+ z.strictObject({
43
+ status: z.literal("incomplete"),
44
+ }),
45
+ z.strictObject({
46
+ status: z.literal("complete"),
47
+ }),
48
+ ]);
49
+ /**
50
+ * MerchantBusinessSigningCertificate
51
+ *
52
+ * The certificate Timbro's custody holds for the Legal issuer.
53
+ */
54
+ export const zMerchantBusinessSigningCertificate = z.union([
55
+ z.strictObject({
56
+ status: z.literal("missing"),
57
+ }),
58
+ z.strictObject({
59
+ status: z.literal("active"),
60
+ sha256: z.string().regex(/^[0-9a-f]{64}$/),
61
+ signerSerialNumber: z.string().refine((text) => Array.from(text).length >= 1),
62
+ notBefore: z.iso.datetime(),
63
+ notAfter: z.iso.datetime(),
64
+ }),
65
+ ]);
66
+ /**
67
+ * MerchantBusinessFiscalSetupAvailable
68
+ */
69
+ export const zMerchantBusinessFiscalSetupAvailable = z.strictObject({
70
+ status: z.literal("available"),
71
+ binding: zMerchantBusinessFiscalBinding,
72
+ legalIssuer: zMerchantBusinessLegalIssuer,
73
+ signingCertificate: zMerchantBusinessSigningCertificate,
74
+ testFiscalDocument: z.union([
75
+ z.strictObject({
76
+ status: z.literal("not_sent"),
77
+ }),
78
+ z.strictObject({
79
+ status: z.literal("processing"),
80
+ id: z.string().refine((text) => Array.from(text).length >= 1),
81
+ documentType: z.union([
82
+ z.literal("31"),
83
+ z.literal("32"),
84
+ z.literal("33"),
85
+ z.literal("34"),
86
+ z.literal("41"),
87
+ z.literal("43"),
88
+ z.literal("44"),
89
+ z.literal("45"),
90
+ z.literal("46"),
91
+ z.literal("47"),
92
+ ]),
93
+ }),
94
+ z.strictObject({
95
+ status: z.literal("accepted"),
96
+ id: z.string().refine((text) => Array.from(text).length >= 1),
97
+ documentType: z.union([
98
+ z.literal("31"),
99
+ z.literal("32"),
100
+ z.literal("33"),
101
+ z.literal("34"),
102
+ z.literal("41"),
103
+ z.literal("43"),
104
+ z.literal("44"),
105
+ z.literal("45"),
106
+ z.literal("46"),
107
+ z.literal("47"),
108
+ ]),
109
+ }),
110
+ z.strictObject({
111
+ status: z.literal("rejected"),
112
+ id: z.string().refine((text) => Array.from(text).length >= 1),
113
+ documentType: z.union([
114
+ z.literal("31"),
115
+ z.literal("32"),
116
+ z.literal("33"),
117
+ z.literal("34"),
118
+ z.literal("41"),
119
+ z.literal("43"),
120
+ z.literal("44"),
121
+ z.literal("45"),
122
+ z.literal("46"),
123
+ z.literal("47"),
124
+ ]),
125
+ reason: z.union([z.literal("timbro_rejected"), z.literal("authority_rejected")]),
126
+ messages: z.array(z.string()),
127
+ }),
128
+ z.strictObject({
129
+ status: z.literal("operator_required"),
130
+ id: z.string().refine((text) => Array.from(text).length >= 1),
131
+ documentType: z.union([
132
+ z.literal("31"),
133
+ z.literal("32"),
134
+ z.literal("33"),
135
+ z.literal("34"),
136
+ z.literal("41"),
137
+ z.literal("43"),
138
+ z.literal("44"),
139
+ z.literal("45"),
140
+ z.literal("46"),
141
+ z.literal("47"),
142
+ ]),
143
+ }),
144
+ ]),
145
+ });
146
+ /**
147
+ * MerchantBusinessFiscalSetup
148
+ *
149
+ * Timbro's view of electronic invoicing provisioning, or why it cannot be read.
150
+ */
151
+ export const zMerchantBusinessFiscalSetup = z.union([
152
+ zMerchantBusinessFiscalSetupUnavailable,
153
+ zMerchantBusinessFiscalSetupAvailable,
154
+ ]);
155
+ /**
156
+ * MerchantBusinessLiveFiscalSetupAvailable
157
+ */
158
+ export const zMerchantBusinessLiveFiscalSetupAvailable = z.strictObject({
159
+ status: z.literal("available"),
160
+ binding: zMerchantBusinessFiscalBinding,
161
+ legalIssuer: zMerchantBusinessLegalIssuer,
162
+ signingCertificate: zMerchantBusinessSigningCertificate,
163
+ });
164
+ /**
165
+ * MerchantBusinessLiveFiscalSetup
166
+ *
167
+ * Production binding and custody facts. These do not establish DGII production qualification.
168
+ */
169
+ export const zMerchantBusinessLiveFiscalSetup = z.union([
170
+ zMerchantBusinessFiscalSetupUnavailable,
171
+ zMerchantBusinessLiveFiscalSetupAvailable,
172
+ ]);
173
+ /**
174
+ * Problem
175
+ *
176
+ * RFC 9457 problem details. Every failure of this API is one of these, and each operation narrows `code` to the subset it can emit.
177
+ */
178
+ export const zProblem = z.strictObject({
179
+ code: z.enum([
180
+ "merchant_authentication_unavailable",
181
+ "platform_test_profile_unavailable",
182
+ "merchant_fiscal_binding_unavailable",
183
+ "merchant_fiscal_setup_unavailable",
184
+ "merchant_contact_email_confirmation_required",
185
+ "merchant_service_scope_required",
186
+ "merchant_business_address_required",
187
+ "merchant_business_contact_required",
188
+ "merchant_business_location_official_codes_required",
189
+ "merchant_business_details_invalid",
190
+ "merchant_current_payment_methods_required",
191
+ "merchant_current_sales_channels_required",
192
+ "merchant_existing_card_service_not_applicable",
193
+ "merchant_existing_card_service_other_provider_name_invalid",
194
+ "merchant_existing_card_service_other_provider_name_not_allowed",
195
+ "merchant_existing_card_service_other_provider_name_required",
196
+ "merchant_existing_card_service_providers_exclusive_choice",
197
+ "merchant_existing_card_service_providers_required",
198
+ "merchant_existing_card_service_required",
199
+ "merchant_location_catalog_changed",
200
+ "merchant_location_catalog_unavailable",
201
+ "merchant_location_selection_invalid",
202
+ "merchant_payment_methods_not_applicable",
203
+ "merchant_sales_channels_exclusive_choice",
204
+ "merchant_sales_channels_not_applicable",
205
+ "merchant_business_type_not_applicable",
206
+ "merchant_charge_timing_not_applicable",
207
+ "merchant_charge_timing_required",
208
+ "merchant_payment_methods_exclusive_choice",
209
+ "merchant_session_missing",
210
+ "merchant_guest_notice_acceptance_required",
211
+ "merchant_workspace_organization_required",
212
+ "merchant_onboarding_revision_conflict",
213
+ "merchant_checkout_policy_revision_conflict",
214
+ "merchant_business_already_claimed",
215
+ "merchant_business_attachment_conflict",
216
+ "merchant_business_identity_required",
217
+ "merchant_business_not_member",
218
+ "merchant_business_revision_conflict",
219
+ "merchant_business_capabilities_required",
220
+ "merchant_fiscal_setup_incomplete",
221
+ "merchant_payment_setup_assessment_incomplete",
222
+ "merchant_certificate_conflict",
223
+ "merchant_test_fiscal_document_blocked",
224
+ "merchant_dgii_assistance_not_applicable",
225
+ "merchant_dgii_assistance_notes_invalid",
226
+ "parameter_missing",
227
+ "parameter_invalid",
228
+ "provider_not_available",
229
+ "currency_not_supported",
230
+ "amount_below_minimum",
231
+ "amount_above_maximum",
232
+ "checkout_reference_invalid",
233
+ "checkout_reference_expired",
234
+ "fiscal_buyer_tax_id_invalid",
235
+ "fiscal_lines_required",
236
+ "payment_split_invalid",
237
+ "submission_token_invalid",
238
+ "submission_token_expired",
239
+ "request_body_malformed",
240
+ "collection_cursor_invalid",
241
+ "webhook_replay_scope_invalid",
242
+ "api_key_missing",
243
+ "api_key_invalid",
244
+ "checkout_token_invalid",
245
+ "checkout_token_expired",
246
+ "payer_session_missing",
247
+ "operation_not_permitted",
248
+ "invoice_delivery_not_permitted",
249
+ "journey_scope_mismatch",
250
+ "journey_report_timeout",
251
+ "merchant_fiscal_binding_conflict",
252
+ "live_mode_not_enabled",
253
+ "origin_not_allowed",
254
+ "payer_step_up_required",
255
+ "certificate_handoff_person_mismatch",
256
+ "route_not_found",
257
+ "api_key_not_found",
258
+ "payment_not_found",
259
+ "payment_reference_conflict",
260
+ "refund_reference_conflict",
261
+ "payment_reference_invalid",
262
+ "refund_reference_invalid",
263
+ "payment_tax_required",
264
+ "payment_tax_invalid",
265
+ "payment_items_invalid",
266
+ "payment_totals_mismatch",
267
+ "payment_invoice_item_fields_required",
268
+ "payments_contract_migration_required",
269
+ "merchant_payments_api_paused",
270
+ "refund_not_found",
271
+ "refund_invoice_not_ready",
272
+ "refund_invoice_not_accepted",
273
+ "refund_invoice_mismatch",
274
+ "refund_invoice_conflict",
275
+ "payment_part_not_found",
276
+ "payment_split_not_found",
277
+ "fiscal_document_not_found",
278
+ "merchant_account_not_found",
279
+ "merchant_account_card_capability_not_found",
280
+ "merchant_business_not_found",
281
+ "agent_client_not_found",
282
+ "connected_agent_not_found",
283
+ "certificate_handoff_not_found",
284
+ "webhook_endpoint_not_found",
285
+ "webhook_event_not_found",
286
+ "three_ds_not_found",
287
+ "payer_not_found",
288
+ "saved_card_not_found",
289
+ "payer_credential_not_found",
290
+ "payer_purchase_not_found",
291
+ "payer_fiscal_profile_not_found",
292
+ "idempotency_key_reused",
293
+ "idempotency_request_in_progress",
294
+ "idempotency_key_expired",
295
+ "api_key_retired",
296
+ "payment_method_already_in_progress",
297
+ "payment_not_payable",
298
+ "refund_not_allowed",
299
+ "refund_already_exists",
300
+ "payment_awaiting_verification",
301
+ "payment_attempt_invalid",
302
+ "payment_attempt_mismatch",
303
+ "payment_attempt_stale",
304
+ "payment_method_mismatch",
305
+ "provider_response_invalid",
306
+ "decline_not_retryable",
307
+ "checkout_window_closed",
308
+ "payment_not_editable",
309
+ "payment_cancel_not_allowed",
310
+ "payment_cancellation_pending",
311
+ "invoicing_locked",
312
+ "source_identity_conflict",
313
+ "refund_source_identity_conflict",
314
+ "refund_payment_not_captured",
315
+ "refund_exceeds_captured",
316
+ "refund_allocation_not_found",
317
+ "refund_allocation_conflict",
318
+ "refund_allocation_ledger_unavailable",
319
+ "fiscal_buyer_required",
320
+ "fiscal_artifact_not_ready",
321
+ "payment_invoice_not_ready",
322
+ "payment_invoice_not_allowed",
323
+ "invoice_reference_stale",
324
+ "fiscal_delivery_not_ready",
325
+ "payment_split_not_allowed",
326
+ "payment_split_exists",
327
+ "payment_split_locked",
328
+ "payment_split_not_capturable",
329
+ "payment_split_not_expired",
330
+ "payment_split_not_renewable",
331
+ "payment_split_complete",
332
+ "payment_split_part_required",
333
+ "payment_part_not_payable",
334
+ "webhook_endpoint_deleted",
335
+ "webhook_endpoint_suspended",
336
+ "three_ds_binding_mismatch",
337
+ "payer_enrollment_unavailable",
338
+ "payer_claim_unavailable",
339
+ "payer_claim_conflict",
340
+ "payer_claim_proof_invalid",
341
+ "payer_delivery_address_unavailable",
342
+ "payer_fiscal_profile_unavailable",
343
+ "certificate_handoff_used",
344
+ "receipt_retention_elapsed",
345
+ "certificate_handoff_expired",
346
+ "request_body_too_large",
347
+ "unsupported_media_type",
348
+ "merchant_account_not_ready",
349
+ "merchant_checkout_policy_invalid",
350
+ "merchant_account_provider_mismatch",
351
+ "merchant_account_identity_mismatch",
352
+ "merchant_profile_incomplete",
353
+ "payment_description_required",
354
+ "sale_amount_invalid",
355
+ "credential_storage_unavailable",
356
+ "refund_credentials_unavailable",
357
+ "refund_provider_unavailable",
358
+ "refund_provider_reference_unavailable",
359
+ "provider_not_eligible",
360
+ "no_eligible_provider",
361
+ "currency_not_supported_by_provider",
362
+ "currency_not_supported_for_fiscal_document",
363
+ "fiscal_total_mismatch",
364
+ "fiscal_line_total_invalid",
365
+ "fiscal_line_legal_tip_invalid",
366
+ "fiscal_document_kind_not_allowed",
367
+ "fiscal_document_kind_unsupported",
368
+ "fiscal_government_eligibility_required",
369
+ "fiscal_government_eligibility_not_allowed",
370
+ "certificate_p12_password_invalid",
371
+ "certificate_pkcs12_invalid",
372
+ "certificate_not_supported",
373
+ "taxpayer_unregistered",
374
+ "taxpayer_inactive",
375
+ "voluntary_tip_currency_mismatch",
376
+ "voluntary_tip_not_allowed_for_split",
377
+ "voluntary_tip_not_available",
378
+ "voluntary_tip_exceeds_maximum",
379
+ "refund_tip_amount_invalid",
380
+ "refund_tip_allocation_unknown",
381
+ "refund_amount_invalid",
382
+ "refund_currency_mismatch",
383
+ "payer_fiscal_profile_invalid",
384
+ "rate_limit_exceeded",
385
+ "internal_error",
386
+ "provider_unavailable",
387
+ "provider_rejected_request",
388
+ "taxpayer_directory_unavailable",
389
+ "fiscal_artifact_retrieval_unavailable",
390
+ "fiscal_delivery_unavailable",
391
+ "journey_marks_unavailable",
392
+ "contact_request_delivery_unavailable",
393
+ "unauthenticated",
394
+ "invalid_login",
395
+ "email_already_registered",
396
+ "organization_slug_taken",
397
+ "organization_not_found",
398
+ "hosted_tenant_conflict",
399
+ "insufficient_role",
400
+ "service_role_not_permitted",
401
+ "invalid_fiscal_identity",
402
+ "invalid_certificate_custody_signer_identity",
403
+ "custody_certificate_malformed",
404
+ "custody_certificate_not_yet_valid",
405
+ "custody_certificate_expired",
406
+ "custody_p12_work_limit_exceeded",
407
+ "custody_signature_algorithm_unsupported",
408
+ "custody_certificate_trust_profile_unsupported",
409
+ "custody_certificate_chain_untrusted",
410
+ "custody_certificate_purpose_unsupported",
411
+ "legal_issuer_already_registered",
412
+ "onboarding_legal_issuer_identity_conflict",
413
+ "legal_issuer_profile_incomplete",
414
+ "legal_issuer_not_found",
415
+ "invitation_invalid",
416
+ "invitation_expired",
417
+ "already_a_member",
418
+ "environment_not_active",
419
+ "certificate_custody_binding_not_found",
420
+ "certificate_custody_binding_conflict",
421
+ "certificate_custody_certificate_version_not_active",
422
+ "source_connection_not_found",
423
+ "source_connection_not_connected",
424
+ "source_provider_unavailable",
425
+ "source_provider_authorization_required",
426
+ "source_provider_installation_disabled",
427
+ "source_provider_installation_removed",
428
+ "source_provider_scope_insufficient",
429
+ "source_provider_target_access_removed",
430
+ "source_provider_throttled",
431
+ "source_provider_outcome_unknown",
432
+ "source_provider_authorization_not_found",
433
+ "source_provider_authorization_conflict",
434
+ "source_provider_installation_request_invalid",
435
+ "source_provider_installation_request_expired",
436
+ "source_provider_installation_callback_replayed",
437
+ "source_connection_creation_conflict",
438
+ "source_connection_activation_conflict",
439
+ "source_connection_activation_verification_rejected",
440
+ "delegated_authorization_verifier_forbidden",
441
+ "invalid_credential",
442
+ "credential_revoked",
443
+ "issuer_not_authorized",
444
+ "missing_idempotency_key",
445
+ "invalid_idempotency_key",
446
+ "request_too_large",
447
+ "request_body_timeout",
448
+ "malformed_json",
449
+ "invalid_request",
450
+ "invalid_collection_query",
451
+ "invalid_collection_cursor",
452
+ "document_type_not_enabled",
453
+ "fiscal_intent_rejected",
454
+ "idempotency_key_conflict",
455
+ "fiscal_number_already_used",
456
+ "fiscal_number_authorization_changed",
457
+ "fiscal_number_authorization_source_record_conflict",
458
+ "source_version_stale",
459
+ "source_predecessor_conflict",
460
+ "source_history_requires_reconciliation",
461
+ "source_content_conflict",
462
+ "source_action_conflict",
463
+ "source_command_conflict",
464
+ "invoice_reference_conflict",
465
+ "invoice_totals_mismatch",
466
+ "printed_representation_profile_conflict",
467
+ "source_record_already_fiscalized",
468
+ "source_operation_pending",
469
+ "source_outcome_unknown",
470
+ "authority_rejected_replacement",
471
+ "correction_target_unsettled",
472
+ "unsupported_printed_representation_profile",
473
+ "affected_fiscal_operation_unsupported",
474
+ "fiscal_issuance_blocked",
475
+ "fiscal_operation_not_found",
476
+ "invoice_not_found",
477
+ "fiscal_artifact_not_found",
478
+ "fiscal_artifact_unverified",
479
+ "fiscal_artifact_unavailable",
480
+ "invoice_receipt_not_found",
481
+ "invoice_receipt_not_ready",
482
+ "invoice_receipt_unavailable",
483
+ "fiscal_delivery_not_found",
484
+ "fiscal_delivery_outcome_conflict",
485
+ "webhook_endpoint_registration_conflict",
486
+ "invalid_replay_scope",
487
+ "webhook_destination_not_allowed",
488
+ "unsigned_document_schema_invalid",
489
+ "signed_document_schema_invalid",
490
+ "custody_unavailable",
491
+ "received_document_not_found",
492
+ "commercial_response_motive_invalid",
493
+ "commercial_response_decision_conflict",
494
+ "method_not_allowed",
495
+ ]),
496
+ detail: z.string().optional(),
497
+ invoiceId: z.string().optional(),
498
+ issuanceBlockers: z
499
+ .array(z.enum([
500
+ "invalid_request",
501
+ "unsupported_protocol",
502
+ "unsupported_rules_version",
503
+ "invalid_resolved_facts",
504
+ "numbering_verifier_missing",
505
+ "numbering_mode_not_enabled",
506
+ "document_type_not_recognized",
507
+ "authorization_missing",
508
+ "authorization_not_observed_on_effective_date",
509
+ "authorization_suspended",
510
+ "authorization_cancelled",
511
+ "authorization_superseded",
512
+ "authorization_exhausted",
513
+ "authorization_conflicting",
514
+ "authorization_document_type_mismatch",
515
+ "central_assignment_requires_verified_authorization",
516
+ "authorization_expired",
517
+ "authorization_range_overlap",
518
+ "fiscal_number_capacity_exhausted",
519
+ "invalid_fiscal_number",
520
+ "fiscal_number_outside_authorized_range",
521
+ "fiscal_number_before_verified_floor",
522
+ "sequence_expiration_mismatch",
523
+ ]))
524
+ .optional(),
525
+ problems: z
526
+ .array(z.strictObject({
527
+ code: z.string(),
528
+ message: z.string(),
529
+ path: z.string(),
530
+ }))
531
+ .optional(),
532
+ requestId: z.string(),
533
+ status: z.int().gte(400).lte(599),
534
+ title: z.string(),
535
+ type: z.enum(["about:blank"]),
536
+ });
537
+ /**
538
+ * MerchantBusiness
539
+ *
540
+ * The business the credential selects, its capabilities, and the requirements that remain.
541
+ */
542
+ export const zRetrieveBusinessResponse = z.strictObject({
543
+ object: z.literal("merchant_business"),
544
+ id: z.string().regex(/^mbiz_[0-9a-hjkmnp-tv-z]{24,}$/),
545
+ rnc: z.string().regex(/^[0-9]{9}$/),
546
+ legalName: z.string().refine((text) => Array.from(text).length >= 1),
547
+ revision: z.int().gte(0),
548
+ capabilities: z.strictObject({
549
+ payments: z.strictObject({
550
+ requested: z.boolean(),
551
+ test: z.strictObject({
552
+ status: z.union([
553
+ z.literal("active"),
554
+ z.literal("pending"),
555
+ z.literal("inactive"),
556
+ z.literal("unavailable"),
557
+ ]),
558
+ }),
559
+ live: z.strictObject({
560
+ status: z.union([
561
+ z.literal("active"),
562
+ z.literal("pending"),
563
+ z.literal("inactive"),
564
+ z.literal("unavailable"),
565
+ ]),
566
+ }),
567
+ }),
568
+ invoices: z.strictObject({
569
+ requested: z.boolean(),
570
+ test: z.strictObject({
571
+ status: z.union([
572
+ z.literal("active"),
573
+ z.literal("pending"),
574
+ z.literal("inactive"),
575
+ z.literal("unavailable"),
576
+ ]),
577
+ }),
578
+ live: z.strictObject({
579
+ status: z.union([
580
+ z.literal("active"),
581
+ z.literal("pending"),
582
+ z.literal("inactive"),
583
+ z.literal("unavailable"),
584
+ ]),
585
+ }),
586
+ }),
587
+ }),
588
+ fiscalDetails: z.strictObject({
589
+ commercialName: z.string().nullable(),
590
+ address: z.string().nullable(),
591
+ location: z
592
+ .strictObject({
593
+ placeId: z
594
+ .string()
595
+ .regex(/^place_[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
596
+ catalogReleaseId: z.string().regex(/^dr_[A-Za-z0-9._-]+$/),
597
+ municipalityCode: z
598
+ .string()
599
+ .regex(/^[0-9]{6}$/)
600
+ .nullable(),
601
+ name: z
602
+ .string()
603
+ .refine((text) => Array.from(text).length >= 1)
604
+ .refine((text) => Array.from(text).length <= 160),
605
+ kind: z.union([
606
+ z.literal("country"),
607
+ z.literal("region"),
608
+ z.literal("national_district"),
609
+ z.literal("province"),
610
+ z.literal("municipality"),
611
+ z.literal("municipal_district"),
612
+ z.literal("urban_zone"),
613
+ z.literal("section"),
614
+ z.literal("barrio"),
615
+ z.literal("paraje"),
616
+ z.literal("subbarrio"),
617
+ ]),
618
+ qualityStatus: z.union([
619
+ z.literal("verified"),
620
+ z.literal("provisional"),
621
+ z.literal("conflicted"),
622
+ ]),
623
+ ancestors: z
624
+ .array(z.strictObject({
625
+ placeId: z
626
+ .string()
627
+ .regex(/^place_[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
628
+ name: z
629
+ .string()
630
+ .refine((text) => Array.from(text).length >= 1)
631
+ .refine((text) => Array.from(text).length <= 160),
632
+ kind: z.union([
633
+ z.literal("country"),
634
+ z.literal("region"),
635
+ z.literal("national_district"),
636
+ z.literal("province"),
637
+ z.literal("municipality"),
638
+ z.literal("municipal_district"),
639
+ z.literal("urban_zone"),
640
+ z.literal("section"),
641
+ z.literal("barrio"),
642
+ z.literal("paraje"),
643
+ z.literal("subbarrio"),
644
+ ]),
645
+ qualityStatus: z.union([
646
+ z.literal("verified"),
647
+ z.literal("provisional"),
648
+ z.literal("conflicted"),
649
+ ]),
650
+ }))
651
+ .max(32),
652
+ })
653
+ .nullable(),
654
+ phone: z.string().nullable(),
655
+ email: z.string().nullable(),
656
+ defaultIncomeType: z.string().nullable(),
657
+ }),
658
+ paymentsProfile: z
659
+ .strictObject({
660
+ displayName: z
661
+ .string()
662
+ .refine((text) => Array.from(text).length >= 1)
663
+ .refine((text) => Array.from(text).length <= 80)
664
+ .regex(/\S/),
665
+ statementDescriptor: z
666
+ .string()
667
+ .refine((text) => Array.from(text).length >= 1)
668
+ .refine((text) => Array.from(text).length <= 22)
669
+ .regex(/\S/),
670
+ permanentAddress: z.strictObject({
671
+ line1: z
672
+ .string()
673
+ .refine((text) => Array.from(text).length >= 1)
674
+ .refine((text) => Array.from(text).length <= 160)
675
+ .regex(/\S/),
676
+ line2: z
677
+ .string()
678
+ .refine((text) => Array.from(text).length >= 1)
679
+ .refine((text) => Array.from(text).length <= 160)
680
+ .regex(/\S/)
681
+ .optional(),
682
+ city: z
683
+ .string()
684
+ .refine((text) => Array.from(text).length >= 1)
685
+ .refine((text) => Array.from(text).length <= 80)
686
+ .regex(/\S/),
687
+ province: z
688
+ .string()
689
+ .refine((text) => Array.from(text).length >= 1)
690
+ .refine((text) => Array.from(text).length <= 80)
691
+ .regex(/\S/)
692
+ .optional(),
693
+ postalCode: z
694
+ .string()
695
+ .refine((text) => Array.from(text).length >= 1)
696
+ .refine((text) => Array.from(text).length <= 20)
697
+ .regex(/\S/)
698
+ .optional(),
699
+ countryCode: z.string().regex(/^[A-Z]{2}$/),
700
+ }),
701
+ supportEmail: z.email().refine((text) => Array.from(text).length <= 254),
702
+ supportPhone: z.string().regex(/^\+[1-9][0-9]{7,14}$/),
703
+ deliveryPolicy: z.union([
704
+ z.strictObject({
705
+ kind: z.literal("not_offered"),
706
+ }),
707
+ z.strictObject({
708
+ kind: z.literal("merchant_managed"),
709
+ summary: z
710
+ .string()
711
+ .refine((text) => Array.from(text).length >= 1)
712
+ .refine((text) => Array.from(text).length <= 160)
713
+ .regex(/\S/),
714
+ url: z
715
+ .url()
716
+ .refine((text) => Array.from(text).length <= 2048)
717
+ .regex(/^https?:\/\//)
718
+ .optional(),
719
+ }),
720
+ ]),
721
+ })
722
+ .nullable(),
723
+ invoicing: z.strictObject({
724
+ test: zMerchantBusinessFiscalSetup,
725
+ live: zMerchantBusinessLiveFiscalSetup,
726
+ }),
727
+ requirements: z.array(z.strictObject({
728
+ code: z.union([
729
+ z.literal("capabilities_required"),
730
+ z.literal("commercial_name_required"),
731
+ z.literal("address_required"),
732
+ z.literal("location_required"),
733
+ z.literal("phone_required"),
734
+ z.literal("default_income_type_required"),
735
+ z.literal("contact_email_verification_required"),
736
+ z.literal("fiscal_details_rejected"),
737
+ z.literal("taxpayer_registration_required"),
738
+ z.literal("signing_certificate_required"),
739
+ z.literal("signing_certificate_expiring"),
740
+ z.literal("test_fiscal_document_rejected"),
741
+ z.literal("test_fiscal_document_pending"),
742
+ z.literal("test_fiscal_document_send_pending"),
743
+ z.literal("fiscal_binding_pending"),
744
+ z.literal("legal_issuer_sync_pending"),
745
+ z.literal("fiscal_setup_unavailable"),
746
+ z.literal("fiscal_binding_conflict"),
747
+ z.literal("fiscal_issuer_rejected"),
748
+ z.literal("test_fiscal_document_operator_required"),
749
+ z.literal("payments_profile_required"),
750
+ z.literal("test_payments_unavailable"),
751
+ z.literal("merchant_account_required"),
752
+ z.literal("merchant_account_disabled"),
753
+ z.literal("active_credential_required"),
754
+ z.literal("credential_material_invalid"),
755
+ z.literal("test_live_mode_mismatch"),
756
+ z.literal("callback_configuration_failed"),
757
+ z.literal("callback_configuration_required"),
758
+ z.literal("connectivity_check_failed"),
759
+ z.literal("connectivity_check_required"),
760
+ z.literal("provider_qualification_failed"),
761
+ z.literal("provider_qualification_required"),
762
+ z.literal("provider_adapter_unavailable"),
763
+ ]),
764
+ owner: z.union([
765
+ z.literal("merchant"),
766
+ z.literal("dgii"),
767
+ z.literal("timbro"),
768
+ z.literal("provider"),
769
+ z.literal("operator"),
770
+ ]),
771
+ blocks: z.array(z.union([z.literal("payments"), z.literal("invoices")])).max(2),
772
+ mode: z.union([z.literal("test"), z.literal("live")]).optional(),
773
+ field: z.string().optional(),
774
+ errors: z
775
+ .array(z.strictObject({
776
+ code: z.string(),
777
+ message: z.string(),
778
+ }))
779
+ .min(1)
780
+ .optional(),
781
+ })),
782
+ onboardingUrl: z.url(),
783
+ });
784
+ /**
785
+ * MerchantBusinessUpdateRequest
786
+ *
787
+ * Each member the request carries replaces that member of the business.
788
+ */
789
+ export const zUpdateBusinessBody = z.strictObject({
790
+ expectedRevision: z.int().gte(0).optional(),
791
+ capabilities: z
792
+ .strictObject({
793
+ payments: z
794
+ .strictObject({
795
+ requested: z.boolean(),
796
+ })
797
+ .optional(),
798
+ invoices: z
799
+ .strictObject({
800
+ requested: z.boolean(),
801
+ })
802
+ .optional(),
803
+ })
804
+ .optional(),
805
+ fiscalDetails: z
806
+ .strictObject({
807
+ commercialName: z
808
+ .string()
809
+ .refine((text) => Array.from(text).length >= 1)
810
+ .refine((text) => Array.from(text).length <= 150)
811
+ .regex(/^(?!\s*$)[\s\S]{1,150}$/)
812
+ .optional(),
813
+ address: z
814
+ .string()
815
+ .refine((text) => Array.from(text).length >= 1)
816
+ .refine((text) => Array.from(text).length <= 100)
817
+ .regex(/^(?!\s*$)[\s\S]{1,100}$/)
818
+ .optional(),
819
+ location: z
820
+ .union([
821
+ z.strictObject({
822
+ placeId: z
823
+ .string()
824
+ .regex(/^place_[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
825
+ catalogReleaseId: z.string().regex(/^dr_[A-Za-z0-9._-]+$/),
826
+ }),
827
+ z.strictObject({
828
+ municipalityCode: z.string().regex(/^(?![0-9]{2}0000$)[0-9]{6}$/),
829
+ }),
830
+ ])
831
+ .optional(),
832
+ phone: z
833
+ .string()
834
+ .regex(/^\+1(?:809|829|849)[0-9]{7}$/)
835
+ .optional(),
836
+ defaultIncomeType: z
837
+ .union([
838
+ z.literal("01"),
839
+ z.literal("02"),
840
+ z.literal("03"),
841
+ z.literal("04"),
842
+ z.literal("05"),
843
+ z.literal("06"),
844
+ ])
845
+ .optional(),
846
+ })
847
+ .optional(),
848
+ paymentsProfile: z
849
+ .strictObject({
850
+ displayName: z
851
+ .string()
852
+ .refine((text) => Array.from(text).length >= 1)
853
+ .refine((text) => Array.from(text).length <= 80)
854
+ .regex(/\S/),
855
+ statementDescriptor: z
856
+ .string()
857
+ .refine((text) => Array.from(text).length >= 1)
858
+ .refine((text) => Array.from(text).length <= 22)
859
+ .regex(/\S/),
860
+ permanentAddress: z.strictObject({
861
+ line1: z
862
+ .string()
863
+ .refine((text) => Array.from(text).length >= 1)
864
+ .refine((text) => Array.from(text).length <= 160)
865
+ .regex(/\S/),
866
+ line2: z
867
+ .string()
868
+ .refine((text) => Array.from(text).length >= 1)
869
+ .refine((text) => Array.from(text).length <= 160)
870
+ .regex(/\S/)
871
+ .optional(),
872
+ city: z
873
+ .string()
874
+ .refine((text) => Array.from(text).length >= 1)
875
+ .refine((text) => Array.from(text).length <= 80)
876
+ .regex(/\S/),
877
+ province: z
878
+ .string()
879
+ .refine((text) => Array.from(text).length >= 1)
880
+ .refine((text) => Array.from(text).length <= 80)
881
+ .regex(/\S/)
882
+ .optional(),
883
+ postalCode: z
884
+ .string()
885
+ .refine((text) => Array.from(text).length >= 1)
886
+ .refine((text) => Array.from(text).length <= 20)
887
+ .regex(/\S/)
888
+ .optional(),
889
+ countryCode: z.string().regex(/^[A-Z]{2}$/),
890
+ }),
891
+ supportEmail: z.email().refine((text) => Array.from(text).length <= 254),
892
+ supportPhone: z.string().regex(/^\+[1-9][0-9]{7,14}$/),
893
+ deliveryPolicy: z.union([
894
+ z.strictObject({
895
+ kind: z.literal("not_offered"),
896
+ }),
897
+ z.strictObject({
898
+ kind: z.literal("merchant_managed"),
899
+ summary: z
900
+ .string()
901
+ .refine((text) => Array.from(text).length >= 1)
902
+ .refine((text) => Array.from(text).length <= 160)
903
+ .regex(/\S/),
904
+ url: z
905
+ .url()
906
+ .refine((text) => Array.from(text).length <= 2048)
907
+ .regex(/^https?:\/\//)
908
+ .optional(),
909
+ }),
910
+ ]),
911
+ })
912
+ .optional(),
913
+ });
914
+ /**
915
+ * MerchantBusiness
916
+ *
917
+ * The business the credential selects, its capabilities, and the requirements that remain.
918
+ */
919
+ export const zUpdateBusinessResponse = z.strictObject({
920
+ object: z.literal("merchant_business"),
921
+ id: z.string().regex(/^mbiz_[0-9a-hjkmnp-tv-z]{24,}$/),
922
+ rnc: z.string().regex(/^[0-9]{9}$/),
923
+ legalName: z.string().refine((text) => Array.from(text).length >= 1),
924
+ revision: z.int().gte(0),
925
+ capabilities: z.strictObject({
926
+ payments: z.strictObject({
927
+ requested: z.boolean(),
928
+ test: z.strictObject({
929
+ status: z.union([
930
+ z.literal("active"),
931
+ z.literal("pending"),
932
+ z.literal("inactive"),
933
+ z.literal("unavailable"),
934
+ ]),
935
+ }),
936
+ live: z.strictObject({
937
+ status: z.union([
938
+ z.literal("active"),
939
+ z.literal("pending"),
940
+ z.literal("inactive"),
941
+ z.literal("unavailable"),
942
+ ]),
943
+ }),
944
+ }),
945
+ invoices: z.strictObject({
946
+ requested: z.boolean(),
947
+ test: z.strictObject({
948
+ status: z.union([
949
+ z.literal("active"),
950
+ z.literal("pending"),
951
+ z.literal("inactive"),
952
+ z.literal("unavailable"),
953
+ ]),
954
+ }),
955
+ live: z.strictObject({
956
+ status: z.union([
957
+ z.literal("active"),
958
+ z.literal("pending"),
959
+ z.literal("inactive"),
960
+ z.literal("unavailable"),
961
+ ]),
962
+ }),
963
+ }),
964
+ }),
965
+ fiscalDetails: z.strictObject({
966
+ commercialName: z.string().nullable(),
967
+ address: z.string().nullable(),
968
+ location: z
969
+ .strictObject({
970
+ placeId: z
971
+ .string()
972
+ .regex(/^place_[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
973
+ catalogReleaseId: z.string().regex(/^dr_[A-Za-z0-9._-]+$/),
974
+ municipalityCode: z
975
+ .string()
976
+ .regex(/^[0-9]{6}$/)
977
+ .nullable(),
978
+ name: z
979
+ .string()
980
+ .refine((text) => Array.from(text).length >= 1)
981
+ .refine((text) => Array.from(text).length <= 160),
982
+ kind: z.union([
983
+ z.literal("country"),
984
+ z.literal("region"),
985
+ z.literal("national_district"),
986
+ z.literal("province"),
987
+ z.literal("municipality"),
988
+ z.literal("municipal_district"),
989
+ z.literal("urban_zone"),
990
+ z.literal("section"),
991
+ z.literal("barrio"),
992
+ z.literal("paraje"),
993
+ z.literal("subbarrio"),
994
+ ]),
995
+ qualityStatus: z.union([
996
+ z.literal("verified"),
997
+ z.literal("provisional"),
998
+ z.literal("conflicted"),
999
+ ]),
1000
+ ancestors: z
1001
+ .array(z.strictObject({
1002
+ placeId: z
1003
+ .string()
1004
+ .regex(/^place_[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
1005
+ name: z
1006
+ .string()
1007
+ .refine((text) => Array.from(text).length >= 1)
1008
+ .refine((text) => Array.from(text).length <= 160),
1009
+ kind: z.union([
1010
+ z.literal("country"),
1011
+ z.literal("region"),
1012
+ z.literal("national_district"),
1013
+ z.literal("province"),
1014
+ z.literal("municipality"),
1015
+ z.literal("municipal_district"),
1016
+ z.literal("urban_zone"),
1017
+ z.literal("section"),
1018
+ z.literal("barrio"),
1019
+ z.literal("paraje"),
1020
+ z.literal("subbarrio"),
1021
+ ]),
1022
+ qualityStatus: z.union([
1023
+ z.literal("verified"),
1024
+ z.literal("provisional"),
1025
+ z.literal("conflicted"),
1026
+ ]),
1027
+ }))
1028
+ .max(32),
1029
+ })
1030
+ .nullable(),
1031
+ phone: z.string().nullable(),
1032
+ email: z.string().nullable(),
1033
+ defaultIncomeType: z.string().nullable(),
1034
+ }),
1035
+ paymentsProfile: z
1036
+ .strictObject({
1037
+ displayName: z
1038
+ .string()
1039
+ .refine((text) => Array.from(text).length >= 1)
1040
+ .refine((text) => Array.from(text).length <= 80)
1041
+ .regex(/\S/),
1042
+ statementDescriptor: z
1043
+ .string()
1044
+ .refine((text) => Array.from(text).length >= 1)
1045
+ .refine((text) => Array.from(text).length <= 22)
1046
+ .regex(/\S/),
1047
+ permanentAddress: z.strictObject({
1048
+ line1: z
1049
+ .string()
1050
+ .refine((text) => Array.from(text).length >= 1)
1051
+ .refine((text) => Array.from(text).length <= 160)
1052
+ .regex(/\S/),
1053
+ line2: z
1054
+ .string()
1055
+ .refine((text) => Array.from(text).length >= 1)
1056
+ .refine((text) => Array.from(text).length <= 160)
1057
+ .regex(/\S/)
1058
+ .optional(),
1059
+ city: z
1060
+ .string()
1061
+ .refine((text) => Array.from(text).length >= 1)
1062
+ .refine((text) => Array.from(text).length <= 80)
1063
+ .regex(/\S/),
1064
+ province: z
1065
+ .string()
1066
+ .refine((text) => Array.from(text).length >= 1)
1067
+ .refine((text) => Array.from(text).length <= 80)
1068
+ .regex(/\S/)
1069
+ .optional(),
1070
+ postalCode: z
1071
+ .string()
1072
+ .refine((text) => Array.from(text).length >= 1)
1073
+ .refine((text) => Array.from(text).length <= 20)
1074
+ .regex(/\S/)
1075
+ .optional(),
1076
+ countryCode: z.string().regex(/^[A-Z]{2}$/),
1077
+ }),
1078
+ supportEmail: z.email().refine((text) => Array.from(text).length <= 254),
1079
+ supportPhone: z.string().regex(/^\+[1-9][0-9]{7,14}$/),
1080
+ deliveryPolicy: z.union([
1081
+ z.strictObject({
1082
+ kind: z.literal("not_offered"),
1083
+ }),
1084
+ z.strictObject({
1085
+ kind: z.literal("merchant_managed"),
1086
+ summary: z
1087
+ .string()
1088
+ .refine((text) => Array.from(text).length >= 1)
1089
+ .refine((text) => Array.from(text).length <= 160)
1090
+ .regex(/\S/),
1091
+ url: z
1092
+ .url()
1093
+ .refine((text) => Array.from(text).length <= 2048)
1094
+ .regex(/^https?:\/\//)
1095
+ .optional(),
1096
+ }),
1097
+ ]),
1098
+ })
1099
+ .nullable(),
1100
+ invoicing: z.strictObject({
1101
+ test: zMerchantBusinessFiscalSetup,
1102
+ live: zMerchantBusinessLiveFiscalSetup,
1103
+ }),
1104
+ requirements: z.array(z.strictObject({
1105
+ code: z.union([
1106
+ z.literal("capabilities_required"),
1107
+ z.literal("commercial_name_required"),
1108
+ z.literal("address_required"),
1109
+ z.literal("location_required"),
1110
+ z.literal("phone_required"),
1111
+ z.literal("default_income_type_required"),
1112
+ z.literal("contact_email_verification_required"),
1113
+ z.literal("fiscal_details_rejected"),
1114
+ z.literal("taxpayer_registration_required"),
1115
+ z.literal("signing_certificate_required"),
1116
+ z.literal("signing_certificate_expiring"),
1117
+ z.literal("test_fiscal_document_rejected"),
1118
+ z.literal("test_fiscal_document_pending"),
1119
+ z.literal("test_fiscal_document_send_pending"),
1120
+ z.literal("fiscal_binding_pending"),
1121
+ z.literal("legal_issuer_sync_pending"),
1122
+ z.literal("fiscal_setup_unavailable"),
1123
+ z.literal("fiscal_binding_conflict"),
1124
+ z.literal("fiscal_issuer_rejected"),
1125
+ z.literal("test_fiscal_document_operator_required"),
1126
+ z.literal("payments_profile_required"),
1127
+ z.literal("test_payments_unavailable"),
1128
+ z.literal("merchant_account_required"),
1129
+ z.literal("merchant_account_disabled"),
1130
+ z.literal("active_credential_required"),
1131
+ z.literal("credential_material_invalid"),
1132
+ z.literal("test_live_mode_mismatch"),
1133
+ z.literal("callback_configuration_failed"),
1134
+ z.literal("callback_configuration_required"),
1135
+ z.literal("connectivity_check_failed"),
1136
+ z.literal("connectivity_check_required"),
1137
+ z.literal("provider_qualification_failed"),
1138
+ z.literal("provider_qualification_required"),
1139
+ z.literal("provider_adapter_unavailable"),
1140
+ ]),
1141
+ owner: z.union([
1142
+ z.literal("merchant"),
1143
+ z.literal("dgii"),
1144
+ z.literal("timbro"),
1145
+ z.literal("provider"),
1146
+ z.literal("operator"),
1147
+ ]),
1148
+ blocks: z.array(z.union([z.literal("payments"), z.literal("invoices")])).max(2),
1149
+ mode: z.union([z.literal("test"), z.literal("live")]).optional(),
1150
+ field: z.string().optional(),
1151
+ errors: z
1152
+ .array(z.strictObject({
1153
+ code: z.string(),
1154
+ message: z.string(),
1155
+ }))
1156
+ .min(1)
1157
+ .optional(),
1158
+ })),
1159
+ onboardingUrl: z.url(),
1160
+ });
1161
+ /**
1162
+ * MerchantBusinessConfigureInvoicingRequest
1163
+ */
1164
+ export const zConfigureInvoicingBody = z.strictObject({
1165
+ mode: z.union([z.literal("test"), z.literal("live")]),
1166
+ });
1167
+ export const zConfigureInvoicingHeaders = z.object({
1168
+ "idempotency-key": z
1169
+ .string()
1170
+ .refine((text) => Array.from(text).length >= 1)
1171
+ .refine((text) => Array.from(text).length <= 255)
1172
+ .regex(/^[\x20-\x7e]+$/),
1173
+ });
1174
+ /**
1175
+ * MerchantBusinessConfigureInvoicingResponse
1176
+ *
1177
+ * Default Response
1178
+ */
1179
+ export const zConfigureInvoicingResponse = z.strictObject({
1180
+ object: z.literal("merchant_business_invoicing_setup"),
1181
+ mode: z.union([z.literal("test"), z.literal("live")]),
1182
+ });
1183
+ /**
1184
+ * MerchantBusinessSigningCertificateRequest
1185
+ */
1186
+ export const zImportSigningCertificateBody = z.strictObject({
1187
+ mode: z.union([z.literal("test"), z.literal("live")]),
1188
+ certificateP12Base64: z
1189
+ .string()
1190
+ .refine((text) => Array.from(text).length >= 24)
1191
+ .refine((text) => Array.from(text).length <= 200000),
1192
+ password: z
1193
+ .string()
1194
+ .refine((text) => Array.from(text).length >= 1)
1195
+ .refine((text) => Array.from(text).length <= 256),
1196
+ });
1197
+ /**
1198
+ * MerchantBusiness
1199
+ *
1200
+ * The business the credential selects, its capabilities, and the requirements that remain.
1201
+ */
1202
+ export const zImportSigningCertificateResponse = z.strictObject({
1203
+ object: z.literal("merchant_business"),
1204
+ id: z.string().regex(/^mbiz_[0-9a-hjkmnp-tv-z]{24,}$/),
1205
+ rnc: z.string().regex(/^[0-9]{9}$/),
1206
+ legalName: z.string().refine((text) => Array.from(text).length >= 1),
1207
+ revision: z.int().gte(0),
1208
+ capabilities: z.strictObject({
1209
+ payments: z.strictObject({
1210
+ requested: z.boolean(),
1211
+ test: z.strictObject({
1212
+ status: z.union([
1213
+ z.literal("active"),
1214
+ z.literal("pending"),
1215
+ z.literal("inactive"),
1216
+ z.literal("unavailable"),
1217
+ ]),
1218
+ }),
1219
+ live: z.strictObject({
1220
+ status: z.union([
1221
+ z.literal("active"),
1222
+ z.literal("pending"),
1223
+ z.literal("inactive"),
1224
+ z.literal("unavailable"),
1225
+ ]),
1226
+ }),
1227
+ }),
1228
+ invoices: z.strictObject({
1229
+ requested: z.boolean(),
1230
+ test: z.strictObject({
1231
+ status: z.union([
1232
+ z.literal("active"),
1233
+ z.literal("pending"),
1234
+ z.literal("inactive"),
1235
+ z.literal("unavailable"),
1236
+ ]),
1237
+ }),
1238
+ live: z.strictObject({
1239
+ status: z.union([
1240
+ z.literal("active"),
1241
+ z.literal("pending"),
1242
+ z.literal("inactive"),
1243
+ z.literal("unavailable"),
1244
+ ]),
1245
+ }),
1246
+ }),
1247
+ }),
1248
+ fiscalDetails: z.strictObject({
1249
+ commercialName: z.string().nullable(),
1250
+ address: z.string().nullable(),
1251
+ location: z
1252
+ .strictObject({
1253
+ placeId: z
1254
+ .string()
1255
+ .regex(/^place_[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
1256
+ catalogReleaseId: z.string().regex(/^dr_[A-Za-z0-9._-]+$/),
1257
+ municipalityCode: z
1258
+ .string()
1259
+ .regex(/^[0-9]{6}$/)
1260
+ .nullable(),
1261
+ name: z
1262
+ .string()
1263
+ .refine((text) => Array.from(text).length >= 1)
1264
+ .refine((text) => Array.from(text).length <= 160),
1265
+ kind: z.union([
1266
+ z.literal("country"),
1267
+ z.literal("region"),
1268
+ z.literal("national_district"),
1269
+ z.literal("province"),
1270
+ z.literal("municipality"),
1271
+ z.literal("municipal_district"),
1272
+ z.literal("urban_zone"),
1273
+ z.literal("section"),
1274
+ z.literal("barrio"),
1275
+ z.literal("paraje"),
1276
+ z.literal("subbarrio"),
1277
+ ]),
1278
+ qualityStatus: z.union([
1279
+ z.literal("verified"),
1280
+ z.literal("provisional"),
1281
+ z.literal("conflicted"),
1282
+ ]),
1283
+ ancestors: z
1284
+ .array(z.strictObject({
1285
+ placeId: z
1286
+ .string()
1287
+ .regex(/^place_[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
1288
+ name: z
1289
+ .string()
1290
+ .refine((text) => Array.from(text).length >= 1)
1291
+ .refine((text) => Array.from(text).length <= 160),
1292
+ kind: z.union([
1293
+ z.literal("country"),
1294
+ z.literal("region"),
1295
+ z.literal("national_district"),
1296
+ z.literal("province"),
1297
+ z.literal("municipality"),
1298
+ z.literal("municipal_district"),
1299
+ z.literal("urban_zone"),
1300
+ z.literal("section"),
1301
+ z.literal("barrio"),
1302
+ z.literal("paraje"),
1303
+ z.literal("subbarrio"),
1304
+ ]),
1305
+ qualityStatus: z.union([
1306
+ z.literal("verified"),
1307
+ z.literal("provisional"),
1308
+ z.literal("conflicted"),
1309
+ ]),
1310
+ }))
1311
+ .max(32),
1312
+ })
1313
+ .nullable(),
1314
+ phone: z.string().nullable(),
1315
+ email: z.string().nullable(),
1316
+ defaultIncomeType: z.string().nullable(),
1317
+ }),
1318
+ paymentsProfile: z
1319
+ .strictObject({
1320
+ displayName: z
1321
+ .string()
1322
+ .refine((text) => Array.from(text).length >= 1)
1323
+ .refine((text) => Array.from(text).length <= 80)
1324
+ .regex(/\S/),
1325
+ statementDescriptor: z
1326
+ .string()
1327
+ .refine((text) => Array.from(text).length >= 1)
1328
+ .refine((text) => Array.from(text).length <= 22)
1329
+ .regex(/\S/),
1330
+ permanentAddress: z.strictObject({
1331
+ line1: z
1332
+ .string()
1333
+ .refine((text) => Array.from(text).length >= 1)
1334
+ .refine((text) => Array.from(text).length <= 160)
1335
+ .regex(/\S/),
1336
+ line2: z
1337
+ .string()
1338
+ .refine((text) => Array.from(text).length >= 1)
1339
+ .refine((text) => Array.from(text).length <= 160)
1340
+ .regex(/\S/)
1341
+ .optional(),
1342
+ city: z
1343
+ .string()
1344
+ .refine((text) => Array.from(text).length >= 1)
1345
+ .refine((text) => Array.from(text).length <= 80)
1346
+ .regex(/\S/),
1347
+ province: z
1348
+ .string()
1349
+ .refine((text) => Array.from(text).length >= 1)
1350
+ .refine((text) => Array.from(text).length <= 80)
1351
+ .regex(/\S/)
1352
+ .optional(),
1353
+ postalCode: z
1354
+ .string()
1355
+ .refine((text) => Array.from(text).length >= 1)
1356
+ .refine((text) => Array.from(text).length <= 20)
1357
+ .regex(/\S/)
1358
+ .optional(),
1359
+ countryCode: z.string().regex(/^[A-Z]{2}$/),
1360
+ }),
1361
+ supportEmail: z.email().refine((text) => Array.from(text).length <= 254),
1362
+ supportPhone: z.string().regex(/^\+[1-9][0-9]{7,14}$/),
1363
+ deliveryPolicy: z.union([
1364
+ z.strictObject({
1365
+ kind: z.literal("not_offered"),
1366
+ }),
1367
+ z.strictObject({
1368
+ kind: z.literal("merchant_managed"),
1369
+ summary: z
1370
+ .string()
1371
+ .refine((text) => Array.from(text).length >= 1)
1372
+ .refine((text) => Array.from(text).length <= 160)
1373
+ .regex(/\S/),
1374
+ url: z
1375
+ .url()
1376
+ .refine((text) => Array.from(text).length <= 2048)
1377
+ .regex(/^https?:\/\//)
1378
+ .optional(),
1379
+ }),
1380
+ ]),
1381
+ })
1382
+ .nullable(),
1383
+ invoicing: z.strictObject({
1384
+ test: zMerchantBusinessFiscalSetup,
1385
+ live: zMerchantBusinessLiveFiscalSetup,
1386
+ }),
1387
+ requirements: z.array(z.strictObject({
1388
+ code: z.union([
1389
+ z.literal("capabilities_required"),
1390
+ z.literal("commercial_name_required"),
1391
+ z.literal("address_required"),
1392
+ z.literal("location_required"),
1393
+ z.literal("phone_required"),
1394
+ z.literal("default_income_type_required"),
1395
+ z.literal("contact_email_verification_required"),
1396
+ z.literal("fiscal_details_rejected"),
1397
+ z.literal("taxpayer_registration_required"),
1398
+ z.literal("signing_certificate_required"),
1399
+ z.literal("signing_certificate_expiring"),
1400
+ z.literal("test_fiscal_document_rejected"),
1401
+ z.literal("test_fiscal_document_pending"),
1402
+ z.literal("test_fiscal_document_send_pending"),
1403
+ z.literal("fiscal_binding_pending"),
1404
+ z.literal("legal_issuer_sync_pending"),
1405
+ z.literal("fiscal_setup_unavailable"),
1406
+ z.literal("fiscal_binding_conflict"),
1407
+ z.literal("fiscal_issuer_rejected"),
1408
+ z.literal("test_fiscal_document_operator_required"),
1409
+ z.literal("payments_profile_required"),
1410
+ z.literal("test_payments_unavailable"),
1411
+ z.literal("merchant_account_required"),
1412
+ z.literal("merchant_account_disabled"),
1413
+ z.literal("active_credential_required"),
1414
+ z.literal("credential_material_invalid"),
1415
+ z.literal("test_live_mode_mismatch"),
1416
+ z.literal("callback_configuration_failed"),
1417
+ z.literal("callback_configuration_required"),
1418
+ z.literal("connectivity_check_failed"),
1419
+ z.literal("connectivity_check_required"),
1420
+ z.literal("provider_qualification_failed"),
1421
+ z.literal("provider_qualification_required"),
1422
+ z.literal("provider_adapter_unavailable"),
1423
+ ]),
1424
+ owner: z.union([
1425
+ z.literal("merchant"),
1426
+ z.literal("dgii"),
1427
+ z.literal("timbro"),
1428
+ z.literal("provider"),
1429
+ z.literal("operator"),
1430
+ ]),
1431
+ blocks: z.array(z.union([z.literal("payments"), z.literal("invoices")])).max(2),
1432
+ mode: z.union([z.literal("test"), z.literal("live")]).optional(),
1433
+ field: z.string().optional(),
1434
+ errors: z
1435
+ .array(z.strictObject({
1436
+ code: z.string(),
1437
+ message: z.string(),
1438
+ }))
1439
+ .min(1)
1440
+ .optional(),
1441
+ })),
1442
+ onboardingUrl: z.url(),
1443
+ });
1444
+ /**
1445
+ * MerchantBusinessTestFiscalDocumentRequest
1446
+ */
1447
+ export const zIssueTestInvoiceBody = z.strictObject({
1448
+ documentType: z
1449
+ .union([
1450
+ z.literal("31"),
1451
+ z.literal("32"),
1452
+ z.literal("41"),
1453
+ z.literal("43"),
1454
+ z.literal("44"),
1455
+ z.literal("45"),
1456
+ z.literal("46"),
1457
+ z.literal("47"),
1458
+ ])
1459
+ .optional(),
1460
+ });
1461
+ export const zIssueTestInvoiceResponse = z.union([
1462
+ z.strictObject({
1463
+ object: z.literal("merchant_business"),
1464
+ id: z.string().regex(/^mbiz_[0-9a-hjkmnp-tv-z]{24,}$/),
1465
+ rnc: z.string().regex(/^[0-9]{9}$/),
1466
+ legalName: z.string().refine((text) => Array.from(text).length >= 1),
1467
+ revision: z.int().gte(0),
1468
+ capabilities: z.strictObject({
1469
+ payments: z.strictObject({
1470
+ requested: z.boolean(),
1471
+ test: z.strictObject({
1472
+ status: z.union([
1473
+ z.literal("active"),
1474
+ z.literal("pending"),
1475
+ z.literal("inactive"),
1476
+ z.literal("unavailable"),
1477
+ ]),
1478
+ }),
1479
+ live: z.strictObject({
1480
+ status: z.union([
1481
+ z.literal("active"),
1482
+ z.literal("pending"),
1483
+ z.literal("inactive"),
1484
+ z.literal("unavailable"),
1485
+ ]),
1486
+ }),
1487
+ }),
1488
+ invoices: z.strictObject({
1489
+ requested: z.boolean(),
1490
+ test: z.strictObject({
1491
+ status: z.union([
1492
+ z.literal("active"),
1493
+ z.literal("pending"),
1494
+ z.literal("inactive"),
1495
+ z.literal("unavailable"),
1496
+ ]),
1497
+ }),
1498
+ live: z.strictObject({
1499
+ status: z.union([
1500
+ z.literal("active"),
1501
+ z.literal("pending"),
1502
+ z.literal("inactive"),
1503
+ z.literal("unavailable"),
1504
+ ]),
1505
+ }),
1506
+ }),
1507
+ }),
1508
+ fiscalDetails: z.strictObject({
1509
+ commercialName: z.string().nullable(),
1510
+ address: z.string().nullable(),
1511
+ location: z
1512
+ .strictObject({
1513
+ placeId: z
1514
+ .string()
1515
+ .regex(/^place_[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
1516
+ catalogReleaseId: z.string().regex(/^dr_[A-Za-z0-9._-]+$/),
1517
+ municipalityCode: z
1518
+ .string()
1519
+ .regex(/^[0-9]{6}$/)
1520
+ .nullable(),
1521
+ name: z
1522
+ .string()
1523
+ .refine((text) => Array.from(text).length >= 1)
1524
+ .refine((text) => Array.from(text).length <= 160),
1525
+ kind: z.union([
1526
+ z.literal("country"),
1527
+ z.literal("region"),
1528
+ z.literal("national_district"),
1529
+ z.literal("province"),
1530
+ z.literal("municipality"),
1531
+ z.literal("municipal_district"),
1532
+ z.literal("urban_zone"),
1533
+ z.literal("section"),
1534
+ z.literal("barrio"),
1535
+ z.literal("paraje"),
1536
+ z.literal("subbarrio"),
1537
+ ]),
1538
+ qualityStatus: z.union([
1539
+ z.literal("verified"),
1540
+ z.literal("provisional"),
1541
+ z.literal("conflicted"),
1542
+ ]),
1543
+ ancestors: z
1544
+ .array(z.strictObject({
1545
+ placeId: z
1546
+ .string()
1547
+ .regex(/^place_[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
1548
+ name: z
1549
+ .string()
1550
+ .refine((text) => Array.from(text).length >= 1)
1551
+ .refine((text) => Array.from(text).length <= 160),
1552
+ kind: z.union([
1553
+ z.literal("country"),
1554
+ z.literal("region"),
1555
+ z.literal("national_district"),
1556
+ z.literal("province"),
1557
+ z.literal("municipality"),
1558
+ z.literal("municipal_district"),
1559
+ z.literal("urban_zone"),
1560
+ z.literal("section"),
1561
+ z.literal("barrio"),
1562
+ z.literal("paraje"),
1563
+ z.literal("subbarrio"),
1564
+ ]),
1565
+ qualityStatus: z.union([
1566
+ z.literal("verified"),
1567
+ z.literal("provisional"),
1568
+ z.literal("conflicted"),
1569
+ ]),
1570
+ }))
1571
+ .max(32),
1572
+ })
1573
+ .nullable(),
1574
+ phone: z.string().nullable(),
1575
+ email: z.string().nullable(),
1576
+ defaultIncomeType: z.string().nullable(),
1577
+ }),
1578
+ paymentsProfile: z
1579
+ .strictObject({
1580
+ displayName: z
1581
+ .string()
1582
+ .refine((text) => Array.from(text).length >= 1)
1583
+ .refine((text) => Array.from(text).length <= 80)
1584
+ .regex(/\S/),
1585
+ statementDescriptor: z
1586
+ .string()
1587
+ .refine((text) => Array.from(text).length >= 1)
1588
+ .refine((text) => Array.from(text).length <= 22)
1589
+ .regex(/\S/),
1590
+ permanentAddress: z.strictObject({
1591
+ line1: z
1592
+ .string()
1593
+ .refine((text) => Array.from(text).length >= 1)
1594
+ .refine((text) => Array.from(text).length <= 160)
1595
+ .regex(/\S/),
1596
+ line2: z
1597
+ .string()
1598
+ .refine((text) => Array.from(text).length >= 1)
1599
+ .refine((text) => Array.from(text).length <= 160)
1600
+ .regex(/\S/)
1601
+ .optional(),
1602
+ city: z
1603
+ .string()
1604
+ .refine((text) => Array.from(text).length >= 1)
1605
+ .refine((text) => Array.from(text).length <= 80)
1606
+ .regex(/\S/),
1607
+ province: z
1608
+ .string()
1609
+ .refine((text) => Array.from(text).length >= 1)
1610
+ .refine((text) => Array.from(text).length <= 80)
1611
+ .regex(/\S/)
1612
+ .optional(),
1613
+ postalCode: z
1614
+ .string()
1615
+ .refine((text) => Array.from(text).length >= 1)
1616
+ .refine((text) => Array.from(text).length <= 20)
1617
+ .regex(/\S/)
1618
+ .optional(),
1619
+ countryCode: z.string().regex(/^[A-Z]{2}$/),
1620
+ }),
1621
+ supportEmail: z.email().refine((text) => Array.from(text).length <= 254),
1622
+ supportPhone: z.string().regex(/^\+[1-9][0-9]{7,14}$/),
1623
+ deliveryPolicy: z.union([
1624
+ z.strictObject({
1625
+ kind: z.literal("not_offered"),
1626
+ }),
1627
+ z.strictObject({
1628
+ kind: z.literal("merchant_managed"),
1629
+ summary: z
1630
+ .string()
1631
+ .refine((text) => Array.from(text).length >= 1)
1632
+ .refine((text) => Array.from(text).length <= 160)
1633
+ .regex(/\S/),
1634
+ url: z
1635
+ .url()
1636
+ .refine((text) => Array.from(text).length <= 2048)
1637
+ .regex(/^https?:\/\//)
1638
+ .optional(),
1639
+ }),
1640
+ ]),
1641
+ })
1642
+ .nullable(),
1643
+ invoicing: z.strictObject({
1644
+ test: zMerchantBusinessFiscalSetup,
1645
+ live: zMerchantBusinessLiveFiscalSetup,
1646
+ }),
1647
+ requirements: z.array(z.strictObject({
1648
+ code: z.union([
1649
+ z.literal("capabilities_required"),
1650
+ z.literal("commercial_name_required"),
1651
+ z.literal("address_required"),
1652
+ z.literal("location_required"),
1653
+ z.literal("phone_required"),
1654
+ z.literal("default_income_type_required"),
1655
+ z.literal("contact_email_verification_required"),
1656
+ z.literal("fiscal_details_rejected"),
1657
+ z.literal("taxpayer_registration_required"),
1658
+ z.literal("signing_certificate_required"),
1659
+ z.literal("signing_certificate_expiring"),
1660
+ z.literal("test_fiscal_document_rejected"),
1661
+ z.literal("test_fiscal_document_pending"),
1662
+ z.literal("test_fiscal_document_send_pending"),
1663
+ z.literal("fiscal_binding_pending"),
1664
+ z.literal("legal_issuer_sync_pending"),
1665
+ z.literal("fiscal_setup_unavailable"),
1666
+ z.literal("fiscal_binding_conflict"),
1667
+ z.literal("fiscal_issuer_rejected"),
1668
+ z.literal("test_fiscal_document_operator_required"),
1669
+ z.literal("payments_profile_required"),
1670
+ z.literal("test_payments_unavailable"),
1671
+ z.literal("merchant_account_required"),
1672
+ z.literal("merchant_account_disabled"),
1673
+ z.literal("active_credential_required"),
1674
+ z.literal("credential_material_invalid"),
1675
+ z.literal("test_live_mode_mismatch"),
1676
+ z.literal("callback_configuration_failed"),
1677
+ z.literal("callback_configuration_required"),
1678
+ z.literal("connectivity_check_failed"),
1679
+ z.literal("connectivity_check_required"),
1680
+ z.literal("provider_qualification_failed"),
1681
+ z.literal("provider_qualification_required"),
1682
+ z.literal("provider_adapter_unavailable"),
1683
+ ]),
1684
+ owner: z.union([
1685
+ z.literal("merchant"),
1686
+ z.literal("dgii"),
1687
+ z.literal("timbro"),
1688
+ z.literal("provider"),
1689
+ z.literal("operator"),
1690
+ ]),
1691
+ blocks: z.array(z.union([z.literal("payments"), z.literal("invoices")])).max(2),
1692
+ mode: z.union([z.literal("test"), z.literal("live")]).optional(),
1693
+ field: z.string().optional(),
1694
+ errors: z
1695
+ .array(z.strictObject({
1696
+ code: z.string(),
1697
+ message: z.string(),
1698
+ }))
1699
+ .min(1)
1700
+ .optional(),
1701
+ })),
1702
+ onboardingUrl: z.url(),
1703
+ }),
1704
+ z.strictObject({
1705
+ object: z.literal("merchant_business"),
1706
+ id: z.string().regex(/^mbiz_[0-9a-hjkmnp-tv-z]{24,}$/),
1707
+ rnc: z.string().regex(/^[0-9]{9}$/),
1708
+ legalName: z.string().refine((text) => Array.from(text).length >= 1),
1709
+ revision: z.int().gte(0),
1710
+ capabilities: z.strictObject({
1711
+ payments: z.strictObject({
1712
+ requested: z.boolean(),
1713
+ test: z.strictObject({
1714
+ status: z.union([
1715
+ z.literal("active"),
1716
+ z.literal("pending"),
1717
+ z.literal("inactive"),
1718
+ z.literal("unavailable"),
1719
+ ]),
1720
+ }),
1721
+ live: z.strictObject({
1722
+ status: z.union([
1723
+ z.literal("active"),
1724
+ z.literal("pending"),
1725
+ z.literal("inactive"),
1726
+ z.literal("unavailable"),
1727
+ ]),
1728
+ }),
1729
+ }),
1730
+ invoices: z.strictObject({
1731
+ requested: z.boolean(),
1732
+ test: z.strictObject({
1733
+ status: z.union([
1734
+ z.literal("active"),
1735
+ z.literal("pending"),
1736
+ z.literal("inactive"),
1737
+ z.literal("unavailable"),
1738
+ ]),
1739
+ }),
1740
+ live: z.strictObject({
1741
+ status: z.union([
1742
+ z.literal("active"),
1743
+ z.literal("pending"),
1744
+ z.literal("inactive"),
1745
+ z.literal("unavailable"),
1746
+ ]),
1747
+ }),
1748
+ }),
1749
+ }),
1750
+ fiscalDetails: z.strictObject({
1751
+ commercialName: z.string().nullable(),
1752
+ address: z.string().nullable(),
1753
+ location: z
1754
+ .strictObject({
1755
+ placeId: z
1756
+ .string()
1757
+ .regex(/^place_[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
1758
+ catalogReleaseId: z.string().regex(/^dr_[A-Za-z0-9._-]+$/),
1759
+ municipalityCode: z
1760
+ .string()
1761
+ .regex(/^[0-9]{6}$/)
1762
+ .nullable(),
1763
+ name: z
1764
+ .string()
1765
+ .refine((text) => Array.from(text).length >= 1)
1766
+ .refine((text) => Array.from(text).length <= 160),
1767
+ kind: z.union([
1768
+ z.literal("country"),
1769
+ z.literal("region"),
1770
+ z.literal("national_district"),
1771
+ z.literal("province"),
1772
+ z.literal("municipality"),
1773
+ z.literal("municipal_district"),
1774
+ z.literal("urban_zone"),
1775
+ z.literal("section"),
1776
+ z.literal("barrio"),
1777
+ z.literal("paraje"),
1778
+ z.literal("subbarrio"),
1779
+ ]),
1780
+ qualityStatus: z.union([
1781
+ z.literal("verified"),
1782
+ z.literal("provisional"),
1783
+ z.literal("conflicted"),
1784
+ ]),
1785
+ ancestors: z
1786
+ .array(z.strictObject({
1787
+ placeId: z
1788
+ .string()
1789
+ .regex(/^place_[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
1790
+ name: z
1791
+ .string()
1792
+ .refine((text) => Array.from(text).length >= 1)
1793
+ .refine((text) => Array.from(text).length <= 160),
1794
+ kind: z.union([
1795
+ z.literal("country"),
1796
+ z.literal("region"),
1797
+ z.literal("national_district"),
1798
+ z.literal("province"),
1799
+ z.literal("municipality"),
1800
+ z.literal("municipal_district"),
1801
+ z.literal("urban_zone"),
1802
+ z.literal("section"),
1803
+ z.literal("barrio"),
1804
+ z.literal("paraje"),
1805
+ z.literal("subbarrio"),
1806
+ ]),
1807
+ qualityStatus: z.union([
1808
+ z.literal("verified"),
1809
+ z.literal("provisional"),
1810
+ z.literal("conflicted"),
1811
+ ]),
1812
+ }))
1813
+ .max(32),
1814
+ })
1815
+ .nullable(),
1816
+ phone: z.string().nullable(),
1817
+ email: z.string().nullable(),
1818
+ defaultIncomeType: z.string().nullable(),
1819
+ }),
1820
+ paymentsProfile: z
1821
+ .strictObject({
1822
+ displayName: z
1823
+ .string()
1824
+ .refine((text) => Array.from(text).length >= 1)
1825
+ .refine((text) => Array.from(text).length <= 80)
1826
+ .regex(/\S/),
1827
+ statementDescriptor: z
1828
+ .string()
1829
+ .refine((text) => Array.from(text).length >= 1)
1830
+ .refine((text) => Array.from(text).length <= 22)
1831
+ .regex(/\S/),
1832
+ permanentAddress: z.strictObject({
1833
+ line1: z
1834
+ .string()
1835
+ .refine((text) => Array.from(text).length >= 1)
1836
+ .refine((text) => Array.from(text).length <= 160)
1837
+ .regex(/\S/),
1838
+ line2: z
1839
+ .string()
1840
+ .refine((text) => Array.from(text).length >= 1)
1841
+ .refine((text) => Array.from(text).length <= 160)
1842
+ .regex(/\S/)
1843
+ .optional(),
1844
+ city: z
1845
+ .string()
1846
+ .refine((text) => Array.from(text).length >= 1)
1847
+ .refine((text) => Array.from(text).length <= 80)
1848
+ .regex(/\S/),
1849
+ province: z
1850
+ .string()
1851
+ .refine((text) => Array.from(text).length >= 1)
1852
+ .refine((text) => Array.from(text).length <= 80)
1853
+ .regex(/\S/)
1854
+ .optional(),
1855
+ postalCode: z
1856
+ .string()
1857
+ .refine((text) => Array.from(text).length >= 1)
1858
+ .refine((text) => Array.from(text).length <= 20)
1859
+ .regex(/\S/)
1860
+ .optional(),
1861
+ countryCode: z.string().regex(/^[A-Z]{2}$/),
1862
+ }),
1863
+ supportEmail: z.email().refine((text) => Array.from(text).length <= 254),
1864
+ supportPhone: z.string().regex(/^\+[1-9][0-9]{7,14}$/),
1865
+ deliveryPolicy: z.union([
1866
+ z.strictObject({
1867
+ kind: z.literal("not_offered"),
1868
+ }),
1869
+ z.strictObject({
1870
+ kind: z.literal("merchant_managed"),
1871
+ summary: z
1872
+ .string()
1873
+ .refine((text) => Array.from(text).length >= 1)
1874
+ .refine((text) => Array.from(text).length <= 160)
1875
+ .regex(/\S/),
1876
+ url: z
1877
+ .url()
1878
+ .refine((text) => Array.from(text).length <= 2048)
1879
+ .regex(/^https?:\/\//)
1880
+ .optional(),
1881
+ }),
1882
+ ]),
1883
+ })
1884
+ .nullable(),
1885
+ invoicing: z.strictObject({
1886
+ test: zMerchantBusinessFiscalSetup,
1887
+ live: zMerchantBusinessLiveFiscalSetup,
1888
+ }),
1889
+ requirements: z.array(z.strictObject({
1890
+ code: z.union([
1891
+ z.literal("capabilities_required"),
1892
+ z.literal("commercial_name_required"),
1893
+ z.literal("address_required"),
1894
+ z.literal("location_required"),
1895
+ z.literal("phone_required"),
1896
+ z.literal("default_income_type_required"),
1897
+ z.literal("contact_email_verification_required"),
1898
+ z.literal("fiscal_details_rejected"),
1899
+ z.literal("taxpayer_registration_required"),
1900
+ z.literal("signing_certificate_required"),
1901
+ z.literal("signing_certificate_expiring"),
1902
+ z.literal("test_fiscal_document_rejected"),
1903
+ z.literal("test_fiscal_document_pending"),
1904
+ z.literal("test_fiscal_document_send_pending"),
1905
+ z.literal("fiscal_binding_pending"),
1906
+ z.literal("legal_issuer_sync_pending"),
1907
+ z.literal("fiscal_setup_unavailable"),
1908
+ z.literal("fiscal_binding_conflict"),
1909
+ z.literal("fiscal_issuer_rejected"),
1910
+ z.literal("test_fiscal_document_operator_required"),
1911
+ z.literal("payments_profile_required"),
1912
+ z.literal("test_payments_unavailable"),
1913
+ z.literal("merchant_account_required"),
1914
+ z.literal("merchant_account_disabled"),
1915
+ z.literal("active_credential_required"),
1916
+ z.literal("credential_material_invalid"),
1917
+ z.literal("test_live_mode_mismatch"),
1918
+ z.literal("callback_configuration_failed"),
1919
+ z.literal("callback_configuration_required"),
1920
+ z.literal("connectivity_check_failed"),
1921
+ z.literal("connectivity_check_required"),
1922
+ z.literal("provider_qualification_failed"),
1923
+ z.literal("provider_qualification_required"),
1924
+ z.literal("provider_adapter_unavailable"),
1925
+ ]),
1926
+ owner: z.union([
1927
+ z.literal("merchant"),
1928
+ z.literal("dgii"),
1929
+ z.literal("timbro"),
1930
+ z.literal("provider"),
1931
+ z.literal("operator"),
1932
+ ]),
1933
+ blocks: z.array(z.union([z.literal("payments"), z.literal("invoices")])).max(2),
1934
+ mode: z.union([z.literal("test"), z.literal("live")]).optional(),
1935
+ field: z.string().optional(),
1936
+ errors: z
1937
+ .array(z.strictObject({
1938
+ code: z.string(),
1939
+ message: z.string(),
1940
+ }))
1941
+ .min(1)
1942
+ .optional(),
1943
+ })),
1944
+ onboardingUrl: z.url(),
1945
+ }),
1946
+ ]);
1947
+ /**
1948
+ * MerchantBusinessInvoiceKeyRequest
1949
+ */
1950
+ export const zIssueInvoiceKeyBody = z.strictObject({
1951
+ mode: z.union([z.literal("test"), z.literal("live")]),
1952
+ });
1953
+ export const zIssueInvoiceKeyHeaders = z.object({
1954
+ "idempotency-key": z
1955
+ .string()
1956
+ .refine((text) => Array.from(text).length >= 1)
1957
+ .refine((text) => Array.from(text).length <= 255)
1958
+ .regex(/^[\x20-\x7e]+$/),
1959
+ });
1960
+ /**
1961
+ * MerchantBusinessInvoiceKey
1962
+ *
1963
+ * The ERP Source key, returned once and replayed only through the same idempotency key.
1964
+ */
1965
+ export const zIssueInvoiceKeyResponse = z.strictObject({
1966
+ object: z.literal("merchant_business_invoice_key"),
1967
+ key: z
1968
+ .string()
1969
+ .refine((text) => Array.from(text).length >= 1)
1970
+ .refine((text) => Array.from(text).length <= 512),
1971
+ invoiceOrigin: z.url(),
1972
+ });
1973
+ export const zListWebhookEndpointsQuery = z.object({
1974
+ limit: z.int().gte(1).lte(100).optional().default(20),
1975
+ cursor: z
1976
+ .string()
1977
+ .refine((text) => Array.from(text).length >= 1)
1978
+ .refine((text) => Array.from(text).length <= 512)
1979
+ .optional(),
1980
+ });
1981
+ /**
1982
+ * WebhookEndpointListPage
1983
+ *
1984
+ * One page of webhook endpoints, newest first.
1985
+ */
1986
+ export const zListWebhookEndpointsResponse = z.strictObject({
1987
+ object: z.literal("list"),
1988
+ data: z.array(z.strictObject({
1989
+ id: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
1990
+ object: z.literal("webhook_endpoint"),
1991
+ url: z.url(),
1992
+ enabledEvents: z
1993
+ .array(z
1994
+ .string()
1995
+ .refine((text) => Array.from(text).length >= 1)
1996
+ .refine((text) => Array.from(text).length <= 128))
1997
+ .min(1),
1998
+ status: z.union([z.literal("active"), z.literal("suspended"), z.literal("deleted")]),
1999
+ secretCreatedAt: z.iso.datetime(),
2000
+ previousSecretExpiresAt: z.iso.datetime().nullable(),
2001
+ createdAt: z.iso.datetime(),
2002
+ })),
2003
+ hasMore: z.boolean(),
2004
+ nextCursor: z
2005
+ .string()
2006
+ .refine((text) => Array.from(text).length >= 1)
2007
+ .nullable(),
2008
+ });
2009
+ /**
2010
+ * CreateWebhookEndpointRequest
2011
+ */
2012
+ export const zCreateWebhookEndpointBody = z.strictObject({
2013
+ url: z.url(),
2014
+ enabledEvents: z
2015
+ .array(z.union([
2016
+ z.literal("payment.succeeded"),
2017
+ z.literal("payment.canceled"),
2018
+ z.literal("payment.expired"),
2019
+ z.literal("payment.operator_required"),
2020
+ z.literal("refund.operator_required"),
2021
+ z.literal("refund.invoiceAttached"),
2022
+ z.literal("invoice.accepted"),
2023
+ z.literal("invoice.rejected"),
2024
+ z.literal("invoice.operatorRequired"),
2025
+ z.literal("invoice.ready"),
2026
+ ]))
2027
+ .min(1)
2028
+ .max(10),
2029
+ });
2030
+ export const zCreateWebhookEndpointHeaders = z.object({
2031
+ "idempotency-key": z
2032
+ .string()
2033
+ .refine((text) => Array.from(text).length >= 1)
2034
+ .refine((text) => Array.from(text).length <= 255)
2035
+ .regex(/^[\x20-\x7e]+$/),
2036
+ });
2037
+ /**
2038
+ * WebhookEndpointWithSecret
2039
+ *
2040
+ * The endpoint and its new signing secret. Store the secret securely.
2041
+ */
2042
+ export const zCreateWebhookEndpointResponse = z.strictObject({
2043
+ id: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
2044
+ object: z.literal("webhook_endpoint"),
2045
+ url: z.url(),
2046
+ enabledEvents: z
2047
+ .array(z
2048
+ .string()
2049
+ .refine((text) => Array.from(text).length >= 1)
2050
+ .refine((text) => Array.from(text).length <= 128))
2051
+ .min(1),
2052
+ status: z.union([z.literal("active"), z.literal("suspended"), z.literal("deleted")]),
2053
+ secretCreatedAt: z.iso.datetime(),
2054
+ previousSecretExpiresAt: z.iso.datetime().nullable(),
2055
+ createdAt: z.iso.datetime(),
2056
+ secret: z.string().regex(/^whsec_[A-Za-z0-9+/]+={0,2}$/),
2057
+ });
2058
+ export const zDeleteWebhookEndpointPath = z.object({
2059
+ webhookEndpointId: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
2060
+ });
2061
+ /**
2062
+ * Default Response
2063
+ */
2064
+ export const zDeleteWebhookEndpointResponse = z.void();
2065
+ export const zRetrieveWebhookEndpointPath = z.object({
2066
+ webhookEndpointId: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
2067
+ });
2068
+ /**
2069
+ * WebhookEndpoint
2070
+ *
2071
+ * A merchant endpoint configured to receive authenticated domain events.
2072
+ */
2073
+ export const zRetrieveWebhookEndpointResponse = z.strictObject({
2074
+ id: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
2075
+ object: z.literal("webhook_endpoint"),
2076
+ url: z.url(),
2077
+ enabledEvents: z
2078
+ .array(z
2079
+ .string()
2080
+ .refine((text) => Array.from(text).length >= 1)
2081
+ .refine((text) => Array.from(text).length <= 128))
2082
+ .min(1),
2083
+ status: z.union([z.literal("active"), z.literal("suspended"), z.literal("deleted")]),
2084
+ secretCreatedAt: z.iso.datetime(),
2085
+ previousSecretExpiresAt: z.iso.datetime().nullable(),
2086
+ createdAt: z.iso.datetime(),
2087
+ });
2088
+ export const zListWebhookDeliveriesPath = z.object({
2089
+ webhookEndpointId: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
2090
+ });
2091
+ export const zListWebhookDeliveriesQuery = z.object({
2092
+ limit: z.int().gte(1).lte(100).optional().default(20),
2093
+ cursor: z
2094
+ .string()
2095
+ .refine((text) => Array.from(text).length >= 1)
2096
+ .refine((text) => Array.from(text).length <= 512)
2097
+ .optional(),
2098
+ state: z
2099
+ .array(z.union([
2100
+ z.literal("pending"),
2101
+ z.literal("processing"),
2102
+ z.literal("delivered"),
2103
+ z.literal("dead_lettered"),
2104
+ ]))
2105
+ .optional(),
2106
+ occurredAfter: z.iso.datetime().optional(),
2107
+ occurredBefore: z.iso.datetime().optional(),
2108
+ });
2109
+ /**
2110
+ * WebhookDeliveryListPage
2111
+ *
2112
+ * One page of deliveries for one webhook endpoint, newest first.
2113
+ */
2114
+ export const zListWebhookDeliveriesResponse = z.strictObject({
2115
+ object: z.literal("list"),
2116
+ data: z.array(z.strictObject({
2117
+ id: z.string().regex(/^webhook_delivery_[0-9a-hjkmnp-tv-z]{24,}$/),
2118
+ object: z.literal("webhook_delivery"),
2119
+ eventId: z.union([z.string().regex(/^event_[0-9a-hjkmnp-tv-z]{24,}$/), z.uuid()]),
2120
+ eventType: z
2121
+ .string()
2122
+ .refine((text) => Array.from(text).length >= 1)
2123
+ .refine((text) => Array.from(text).length <= 128),
2124
+ state: z.union([
2125
+ z.literal("pending"),
2126
+ z.literal("processing"),
2127
+ z.literal("delivered"),
2128
+ z.literal("dead_lettered"),
2129
+ ]),
2130
+ attemptCount: z.int().gte(0),
2131
+ nextAttemptAt: z.iso.datetime(),
2132
+ lastStatusCode: z.int().nullable(),
2133
+ resultCode: z
2134
+ .union([
2135
+ z.literal("delivered"),
2136
+ z.literal("attempt_budget_exhausted"),
2137
+ z.literal("delivery_deadline_exceeded"),
2138
+ ])
2139
+ .nullable(),
2140
+ lastResponseExcerpt: z
2141
+ .string()
2142
+ .refine((text) => Array.from(text).length <= 256)
2143
+ .nullable(),
2144
+ replayId: z
2145
+ .string()
2146
+ .regex(/^webhook_replay_[0-9a-hjkmnp-tv-z]{24,}$/)
2147
+ .nullable(),
2148
+ occurredAt: z.iso.datetime(),
2149
+ createdAt: z.iso.datetime(),
2150
+ })),
2151
+ hasMore: z.boolean(),
2152
+ nextCursor: z
2153
+ .string()
2154
+ .refine((text) => Array.from(text).length >= 1)
2155
+ .nullable(),
2156
+ });
2157
+ /**
2158
+ * ReplayWebhookEventsRequest
2159
+ *
2160
+ * The events to send again: either up to 100 event ids, or an occurredAfter and occurredBefore window of at most seven days that selects at most 100 events. A body naming both, or an incomplete window, answers webhook_replay_scope_invalid with a pointer at the property at fault.
2161
+ */
2162
+ export const zReplayWebhookEventsBody = z.strictObject({
2163
+ eventIds: z
2164
+ .array(z.union([z.string().regex(/^event_[0-9a-hjkmnp-tv-z]{24,}$/), z.uuid()]))
2165
+ .min(1)
2166
+ .max(100)
2167
+ .optional(),
2168
+ occurredAfter: z.iso.datetime().optional(),
2169
+ occurredBefore: z.iso.datetime().optional(),
2170
+ });
2171
+ export const zReplayWebhookEventsHeaders = z.object({
2172
+ "idempotency-key": z
2173
+ .string()
2174
+ .refine((text) => Array.from(text).length >= 1)
2175
+ .refine((text) => Array.from(text).length <= 255)
2176
+ .regex(/^[\x20-\x7e]+$/),
2177
+ });
2178
+ export const zReplayWebhookEventsPath = z.object({
2179
+ webhookEndpointId: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
2180
+ });
2181
+ /**
2182
+ * WebhookReplay
2183
+ *
2184
+ * A request to send stored events to one endpoint again. Each queued delivery repeats the original event id and is signed with a fresh webhook-timestamp.
2185
+ */
2186
+ export const zReplayWebhookEventsResponse = z.strictObject({
2187
+ id: z.string().regex(/^webhook_replay_[0-9a-hjkmnp-tv-z]{24,}$/),
2188
+ object: z.literal("webhook_replay"),
2189
+ webhookEndpointId: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
2190
+ deliveryCount: z.int().gte(0).lte(100),
2191
+ createdAt: z.iso.datetime(),
2192
+ });
2193
+ export const zRotateWebhookEndpointSecretHeaders = z.object({
2194
+ "idempotency-key": z
2195
+ .string()
2196
+ .refine((text) => Array.from(text).length >= 1)
2197
+ .refine((text) => Array.from(text).length <= 255)
2198
+ .regex(/^[\x20-\x7e]+$/),
2199
+ });
2200
+ export const zRotateWebhookEndpointSecretPath = z.object({
2201
+ webhookEndpointId: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
2202
+ });
2203
+ /**
2204
+ * WebhookEndpointWithSecret
2205
+ *
2206
+ * The endpoint and its new signing secret. Store the secret securely.
2207
+ */
2208
+ export const zRotateWebhookEndpointSecretResponse = z.strictObject({
2209
+ id: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
2210
+ object: z.literal("webhook_endpoint"),
2211
+ url: z.url(),
2212
+ enabledEvents: z
2213
+ .array(z
2214
+ .string()
2215
+ .refine((text) => Array.from(text).length >= 1)
2216
+ .refine((text) => Array.from(text).length <= 128))
2217
+ .min(1),
2218
+ status: z.union([z.literal("active"), z.literal("suspended"), z.literal("deleted")]),
2219
+ secretCreatedAt: z.iso.datetime(),
2220
+ previousSecretExpiresAt: z.iso.datetime().nullable(),
2221
+ createdAt: z.iso.datetime(),
2222
+ secret: z.string().regex(/^whsec_[A-Za-z0-9+/]+={0,2}$/),
2223
+ });
2224
+ export const zSuspendWebhookEndpointPath = z.object({
2225
+ webhookEndpointId: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
2226
+ });
2227
+ /**
2228
+ * WebhookEndpoint
2229
+ *
2230
+ * A merchant endpoint configured to receive authenticated domain events.
2231
+ */
2232
+ export const zSuspendWebhookEndpointResponse = z.strictObject({
2233
+ id: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
2234
+ object: z.literal("webhook_endpoint"),
2235
+ url: z.url(),
2236
+ enabledEvents: z
2237
+ .array(z
2238
+ .string()
2239
+ .refine((text) => Array.from(text).length >= 1)
2240
+ .refine((text) => Array.from(text).length <= 128))
2241
+ .min(1),
2242
+ status: z.union([z.literal("active"), z.literal("suspended"), z.literal("deleted")]),
2243
+ secretCreatedAt: z.iso.datetime(),
2244
+ previousSecretExpiresAt: z.iso.datetime().nullable(),
2245
+ createdAt: z.iso.datetime(),
2246
+ });
2247
+ export const zReactivateWebhookEndpointPath = z.object({
2248
+ webhookEndpointId: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
2249
+ });
2250
+ /**
2251
+ * WebhookEndpoint
2252
+ *
2253
+ * A merchant endpoint configured to receive authenticated domain events.
2254
+ */
2255
+ export const zReactivateWebhookEndpointResponse = z.strictObject({
2256
+ id: z.string().regex(/^webhook_endpoint_[0-9a-hjkmnp-tv-z]{24,}$/),
2257
+ object: z.literal("webhook_endpoint"),
2258
+ url: z.url(),
2259
+ enabledEvents: z
2260
+ .array(z
2261
+ .string()
2262
+ .refine((text) => Array.from(text).length >= 1)
2263
+ .refine((text) => Array.from(text).length <= 128))
2264
+ .min(1),
2265
+ status: z.union([z.literal("active"), z.literal("suspended"), z.literal("deleted")]),
2266
+ secretCreatedAt: z.iso.datetime(),
2267
+ previousSecretExpiresAt: z.iso.datetime().nullable(),
2268
+ createdAt: z.iso.datetime(),
2269
+ });