@timbro/invoices 0.10.3 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +58 -2
  2. package/dist/admin.d.ts +2 -3
  3. package/dist/admin.d.ts.map +1 -1
  4. package/dist/generated/hosted/index.d.ts +3 -3
  5. package/dist/generated/hosted/index.d.ts.map +1 -1
  6. package/dist/generated/hosted/index.js +2 -2
  7. package/dist/generated/hosted/sdk.gen.d.ts +19 -1
  8. package/dist/generated/hosted/sdk.gen.d.ts.map +1 -1
  9. package/dist/generated/hosted/sdk.gen.js +225 -1
  10. package/dist/generated/hosted/types.gen.d.ts +583 -5
  11. package/dist/generated/hosted/types.gen.d.ts.map +1 -1
  12. package/dist/generated/hosted/zod-response.gen.d.ts +6678 -208
  13. package/dist/generated/hosted/zod-response.gen.d.ts.map +1 -1
  14. package/dist/generated/hosted/zod-response.gen.js +694 -207
  15. package/dist/generated/hosted/zod.gen.d.ts +1661 -14
  16. package/dist/generated/hosted/zod.gen.d.ts.map +1 -1
  17. package/dist/generated/hosted/zod.gen.js +772 -222
  18. package/dist/generated/index.d.ts +3 -3
  19. package/dist/generated/index.d.ts.map +1 -1
  20. package/dist/generated/index.js +2 -2
  21. package/dist/generated/invoice-api-contract.d.ts +186 -2
  22. package/dist/generated/invoice-api-contract.d.ts.map +1 -1
  23. package/dist/generated/invoice-api-contract.js +211 -1
  24. package/dist/generated/sdk.gen.d.ts +5 -5
  25. package/dist/generated/sdk.gen.d.ts.map +1 -1
  26. package/dist/generated/sdk.gen.js +93 -93
  27. package/dist/generated/types.gen.d.ts +288 -139
  28. package/dist/generated/types.gen.d.ts.map +1 -1
  29. package/dist/generated/zod-response.gen.d.ts +2304 -2548
  30. package/dist/generated/zod-response.gen.d.ts.map +1 -1
  31. package/dist/generated/zod-response.gen.js +179 -109
  32. package/dist/generated/zod.gen.d.ts +1252 -2188
  33. package/dist/generated/zod.gen.d.ts.map +1 -1
  34. package/dist/generated/zod.gen.js +215 -115
  35. package/dist/hosted-tenant.d.ts +9 -0
  36. package/dist/hosted-tenant.d.ts.map +1 -1
  37. package/dist/hosted-tenant.js +7 -0
  38. package/dist/index.d.ts +1 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/invoice-hosted-controls.d.ts +22 -3
  41. package/dist/invoice-hosted-controls.d.ts.map +1 -1
  42. package/dist/invoice-hosted-controls.js +48 -12
  43. package/dist/invoice.d.ts +5 -0
  44. package/dist/invoice.d.ts.map +1 -1
  45. package/dist/invoice.js +1 -0
  46. package/dist/issuance-readiness.d.ts +9 -0
  47. package/dist/issuance-readiness.d.ts.map +1 -0
  48. package/dist/issuance-readiness.js +19 -0
  49. package/dist/timbro-client.d.ts +6 -8
  50. package/dist/timbro-client.d.ts.map +1 -1
  51. package/dist/timbro-client.js +3 -5
  52. package/dist/webhook-event.d.ts +392 -0
  53. package/dist/webhook-event.d.ts.map +1 -1
  54. package/package.json +3 -3
  55. package/dist/certificate-custody-readiness.d.ts +0 -6
  56. package/dist/certificate-custody-readiness.d.ts.map +0 -1
  57. package/dist/certificate-custody-readiness.js +0 -13
  58. package/dist/fiscal-numbering-readiness.d.ts +0 -6
  59. package/dist/fiscal-numbering-readiness.d.ts.map +0 -1
  60. package/dist/fiscal-numbering-readiness.js +0 -13
@@ -88,6 +88,70 @@ export const zMerchantBusinessSigningCertificate = lenientUnion([
88
88
  notAfter: z.iso.datetime(),
89
89
  }),
90
90
  ]);
91
+ /**
92
+ * NumberingRange
93
+ *
94
+ * The range Timbro assigns the next fiscal number of this type from.
95
+ */
96
+ export const zNumberingRange = z.object({
97
+ remaining: z.int().gte(1).lte(9999999999),
98
+ expiresOn: z.iso.date().nullable(),
99
+ });
100
+ /**
101
+ * DocumentTypeIssuanceReadiness
102
+ *
103
+ * Whether Timbro can issue one e-CF type now, as Timbro reports it.
104
+ */
105
+ export const zDocumentTypeIssuanceReadiness = lenientUnion([
106
+ z.object({
107
+ type: lenientUnion([
108
+ z.literal("E31"),
109
+ z.literal("E32"),
110
+ z.literal("E33"),
111
+ z.literal("E34"),
112
+ z.literal("E41"),
113
+ z.literal("E43"),
114
+ z.literal("E44"),
115
+ z.literal("E45"),
116
+ z.literal("E46"),
117
+ z.literal("E47"),
118
+ ]),
119
+ status: z.literal("ready"),
120
+ numbering: zNumberingRange,
121
+ }),
122
+ z.object({
123
+ type: lenientUnion([
124
+ z.literal("E31"),
125
+ z.literal("E32"),
126
+ z.literal("E33"),
127
+ z.literal("E34"),
128
+ z.literal("E41"),
129
+ z.literal("E43"),
130
+ z.literal("E44"),
131
+ z.literal("E45"),
132
+ z.literal("E46"),
133
+ z.literal("E47"),
134
+ ]),
135
+ status: z.literal("actionRequired"),
136
+ reasons: z
137
+ .array(lenientUnion([
138
+ z.literal("legal_issuer_profile_incomplete"),
139
+ z.literal("signing_certificate_missing"),
140
+ z.literal("signing_certificate_expired"),
141
+ z.literal("signing_certificate_not_yet_valid"),
142
+ z.literal("authorization_missing"),
143
+ z.literal("authorization_not_active"),
144
+ z.literal("authorization_not_verified"),
145
+ z.literal("authorization_not_observed"),
146
+ z.literal("range_exhausted"),
147
+ z.literal("authorization_expiration_invalid"),
148
+ z.literal("authorization_expired"),
149
+ z.literal("authorization_range_overlap"),
150
+ ]))
151
+ .min(1),
152
+ numbering: zNumberingRange.nullable(),
153
+ }),
154
+ ]);
91
155
  /**
92
156
  * MerchantBusinessFiscalSetupAvailable
93
157
  */
@@ -167,6 +231,7 @@ export const zMerchantBusinessFiscalSetupAvailable = z.object({
167
231
  ]),
168
232
  }),
169
233
  ]),
234
+ documentTypes: z.array(zDocumentTypeIssuanceReadiness).nullable(),
170
235
  });
171
236
  /**
172
237
  * MerchantBusinessFiscalSetup
@@ -185,6 +250,7 @@ export const zMerchantBusinessLiveFiscalSetupAvailable = z.object({
185
250
  binding: zMerchantBusinessFiscalBinding,
186
251
  legalIssuer: zMerchantBusinessLegalIssuer,
187
252
  signingCertificate: zMerchantBusinessSigningCertificate,
253
+ documentTypes: z.array(zDocumentTypeIssuanceReadiness).nullable(),
188
254
  });
189
255
  /**
190
256
  * MerchantBusinessLiveFiscalSetup
@@ -202,6 +268,20 @@ export const zMerchantBusinessLiveFiscalSetup = lenientUnion([
202
268
  */
203
269
  export const zProblem = z.object({
204
270
  code: z.enum([
271
+ "authorization_not_found",
272
+ "authorization_checkout_reference_invalid",
273
+ "authorization_reference_conflict",
274
+ "authorization_capture_conflict",
275
+ "authorization_capture_exceeds_hold",
276
+ "authorization_not_capturable",
277
+ "authorization_not_cancelable",
278
+ "authorization_not_editable",
279
+ "authorization_submission_invalid",
280
+ "authorization_authentication_pending",
281
+ "authorization_credentials_unavailable",
282
+ "authorization_dispatch_refused",
283
+ "authorization_hold_evidence_missing",
284
+ "provider_qualification_required",
205
285
  "merchant_authentication_unavailable",
206
286
  "platform_test_profile_unavailable",
207
287
  "merchant_fiscal_binding_unavailable",
@@ -242,6 +322,10 @@ export const zProblem = z.object({
242
322
  "merchant_business_not_member",
243
323
  "merchant_business_revision_conflict",
244
324
  "merchant_business_capabilities_required",
325
+ "merchant_business_certification_path_unavailable",
326
+ "merchant_business_certification_requirements_unmet",
327
+ "merchant_business_certification_revision_conflict",
328
+ "merchant_business_certification_evidence_not_found",
245
329
  "merchant_fiscal_setup_incomplete",
246
330
  "merchant_payment_setup_assessment_incomplete",
247
331
  "merchant_certificate_conflict",
@@ -320,15 +404,12 @@ export const zProblem = z.object({
320
404
  "api_key_retired",
321
405
  "payment_method_already_in_progress",
322
406
  "payment_not_payable",
323
- "refund_not_allowed",
324
- "refund_already_exists",
325
407
  "payment_awaiting_verification",
326
408
  "payment_attempt_invalid",
327
409
  "payment_attempt_mismatch",
328
410
  "payment_attempt_stale",
329
411
  "payment_method_mismatch",
330
412
  "provider_response_invalid",
331
- "decline_not_retryable",
332
413
  "checkout_window_closed",
333
414
  "payment_not_editable",
334
415
  "payment_cancel_not_allowed",
@@ -378,9 +459,6 @@ export const zProblem = z.object({
378
459
  "payment_description_required",
379
460
  "sale_amount_invalid",
380
461
  "credential_storage_unavailable",
381
- "refund_credentials_unavailable",
382
- "refund_provider_unavailable",
383
- "refund_provider_reference_unavailable",
384
462
  "provider_not_eligible",
385
463
  "no_eligible_provider",
386
464
  "currency_not_supported_by_provider",
@@ -407,6 +485,9 @@ export const zProblem = z.object({
407
485
  "refund_tip_amount_invalid",
408
486
  "refund_tip_allocation_unknown",
409
487
  "refund_amount_invalid",
488
+ "refund_tax_amount_invalid",
489
+ "refund_tax_amount_required",
490
+ "refund_tax_allocation_unknown",
410
491
  "refund_currency_mismatch",
411
492
  "payer_fiscal_profile_invalid",
412
493
  "rate_limit_exceeded",
@@ -562,6 +643,97 @@ export const zProblem = z.object({
562
643
  title: z.string(),
563
644
  type: z.enum(["about:blank"]),
564
645
  });
646
+ /**
647
+ * MerchantBusinessCertificationRequirement
648
+ */
649
+ export const zMerchantBusinessCertificationRequirement = z.object({
650
+ code: lenientUnion([
651
+ z.literal("invoices_not_requested"),
652
+ z.literal("fiscal_details_incomplete"),
653
+ z.literal("certification_binding_required"),
654
+ z.literal("certification_certificate_required"),
655
+ z.literal("provider_eligibility_unverified"),
656
+ z.literal("certification_receiver_urls_pending"),
657
+ z.literal("certification_test_set_processing_unavailable"),
658
+ ]),
659
+ owner: lenientUnion([
660
+ z.literal("merchant"),
661
+ z.literal("dgii"),
662
+ z.literal("timbro"),
663
+ z.literal("operator"),
664
+ ]),
665
+ blocks: z
666
+ .array(lenientUnion([
667
+ z.literal("start"),
668
+ z.literal("step_1"),
669
+ z.literal("step_2"),
670
+ z.literal("step_7"),
671
+ ]))
672
+ .max(4),
673
+ field: z.string().optional(),
674
+ });
675
+ /**
676
+ * MerchantBusinessCertificationEvidence
677
+ *
678
+ * A business-reported DGII outcome. It remains unverified until an authorized evidence review confirms it.
679
+ */
680
+ export const zMerchantBusinessCertificationEvidence = z.object({
681
+ id: z.string().refine((text) => Array.from(text).length >= 1),
682
+ outcome: lenientUnion([
683
+ z.literal("submitted"),
684
+ z.literal("approved"),
685
+ z.literal("rejected"),
686
+ z.literal("needs_correction"),
687
+ ]),
688
+ verification: lenientUnion([
689
+ z.literal("user_reported"),
690
+ z.literal("operator_verified"),
691
+ z.literal("operator_rejected"),
692
+ ]),
693
+ reference: z
694
+ .string()
695
+ .refine((text) => Array.from(text).length <= 255)
696
+ .nullable(),
697
+ createdAt: z.iso.datetime(),
698
+ reviewedAt: z.iso.datetime().optional(),
699
+ reviewReference: z
700
+ .string()
701
+ .refine((text) => Array.from(text).length <= 512)
702
+ .optional(),
703
+ });
704
+ /**
705
+ * MerchantBusinessCertificationStep
706
+ */
707
+ export const zMerchantBusinessCertificationStep = z.object({
708
+ number: lenientUnion([
709
+ z.literal(1),
710
+ z.literal(2),
711
+ z.literal(3),
712
+ z.literal(4),
713
+ z.literal(5),
714
+ z.literal(6),
715
+ z.literal(7),
716
+ z.literal(8),
717
+ z.literal(9),
718
+ z.literal(10),
719
+ z.literal(11),
720
+ z.literal(12),
721
+ z.literal(13),
722
+ z.literal(14),
723
+ z.literal(15),
724
+ ]),
725
+ code: z.string().refine((text) => Array.from(text).length >= 1),
726
+ title: z.string().refine((text) => Array.from(text).length >= 1),
727
+ actor: lenientUnion([z.literal("merchant"), z.literal("dgii"), z.literal("timbro")]),
728
+ status: lenientUnion([
729
+ z.literal("blocked"),
730
+ z.literal("action_required"),
731
+ z.literal("awaiting_dgii"),
732
+ z.literal("reported"),
733
+ z.literal("verified"),
734
+ ]),
735
+ evidence: z.array(zMerchantBusinessCertificationEvidence),
736
+ });
565
737
  /**
566
738
  * MerchantBusiness
567
739
  *
@@ -1056,6 +1228,259 @@ export const zUpdateBusinessResponse = z.object({
1056
1228
  })),
1057
1229
  onboardingUrl: z.url(),
1058
1230
  });
1231
+ /**
1232
+ * MerchantBusinessCertification
1233
+ *
1234
+ * Durable certification preparation and user-reported DGII progress for the authenticated business.
1235
+ */
1236
+ export const zRetrieveMerchantBusinessCertificationResponse = lenientUnion([
1237
+ z.object({
1238
+ object: z.literal("merchant_business_certification"),
1239
+ status: z.literal("not_started"),
1240
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1241
+ availablePaths: z
1242
+ .array(lenientUnion([z.literal("own_software"), z.literal("external_software")]))
1243
+ .min(1),
1244
+ recommendedPath: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1245
+ actions: z.array(z.literal("start")).max(1),
1246
+ }),
1247
+ z.object({
1248
+ object: z.literal("merchant_business_certification"),
1249
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1250
+ revision: z.int().gte(1),
1251
+ status: z.literal("in_progress"),
1252
+ path: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1253
+ software: z.object({
1254
+ name: z
1255
+ .string()
1256
+ .refine((text) => Array.from(text).length >= 1)
1257
+ .refine((text) => Array.from(text).length <= 128),
1258
+ version: z
1259
+ .string()
1260
+ .refine((text) => Array.from(text).length >= 1)
1261
+ .refine((text) => Array.from(text).length <= 64),
1262
+ }),
1263
+ phase: lenientUnion([
1264
+ z.literal("preparation"),
1265
+ z.literal("application"),
1266
+ z.literal("tests"),
1267
+ z.literal("authorization"),
1268
+ ]),
1269
+ serviceUrls: z
1270
+ .object({
1271
+ reception: z.url(),
1272
+ commercialApproval: z.url(),
1273
+ })
1274
+ .nullable(),
1275
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1276
+ actions: z.array(lenientUnion([z.literal("report_evidence"), z.literal("import_certificate")])),
1277
+ steps: z.tuple([
1278
+ zMerchantBusinessCertificationStep,
1279
+ zMerchantBusinessCertificationStep,
1280
+ zMerchantBusinessCertificationStep,
1281
+ zMerchantBusinessCertificationStep,
1282
+ zMerchantBusinessCertificationStep,
1283
+ zMerchantBusinessCertificationStep,
1284
+ zMerchantBusinessCertificationStep,
1285
+ zMerchantBusinessCertificationStep,
1286
+ zMerchantBusinessCertificationStep,
1287
+ zMerchantBusinessCertificationStep,
1288
+ zMerchantBusinessCertificationStep,
1289
+ zMerchantBusinessCertificationStep,
1290
+ zMerchantBusinessCertificationStep,
1291
+ zMerchantBusinessCertificationStep,
1292
+ zMerchantBusinessCertificationStep,
1293
+ ]),
1294
+ }),
1295
+ ]);
1296
+ /**
1297
+ * MerchantBusinessCertificationStartRequest
1298
+ */
1299
+ export const zStartMerchantBusinessCertificationResponse = lenientUnion([
1300
+ lenientUnion([
1301
+ z.object({
1302
+ object: z.literal("merchant_business_certification"),
1303
+ status: z.literal("not_started"),
1304
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1305
+ availablePaths: z
1306
+ .array(lenientUnion([z.literal("own_software"), z.literal("external_software")]))
1307
+ .min(1),
1308
+ recommendedPath: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1309
+ actions: z.array(z.literal("start")).max(1),
1310
+ }),
1311
+ z.object({
1312
+ object: z.literal("merchant_business_certification"),
1313
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1314
+ revision: z.int().gte(1),
1315
+ status: z.literal("in_progress"),
1316
+ path: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1317
+ software: z.object({
1318
+ name: z
1319
+ .string()
1320
+ .refine((text) => Array.from(text).length >= 1)
1321
+ .refine((text) => Array.from(text).length <= 128),
1322
+ version: z
1323
+ .string()
1324
+ .refine((text) => Array.from(text).length >= 1)
1325
+ .refine((text) => Array.from(text).length <= 64),
1326
+ }),
1327
+ phase: lenientUnion([
1328
+ z.literal("preparation"),
1329
+ z.literal("application"),
1330
+ z.literal("tests"),
1331
+ z.literal("authorization"),
1332
+ ]),
1333
+ serviceUrls: z
1334
+ .object({
1335
+ reception: z.url(),
1336
+ commercialApproval: z.url(),
1337
+ })
1338
+ .nullable(),
1339
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1340
+ actions: z.array(lenientUnion([z.literal("report_evidence"), z.literal("import_certificate")])),
1341
+ steps: z.tuple([
1342
+ zMerchantBusinessCertificationStep,
1343
+ zMerchantBusinessCertificationStep,
1344
+ zMerchantBusinessCertificationStep,
1345
+ zMerchantBusinessCertificationStep,
1346
+ zMerchantBusinessCertificationStep,
1347
+ zMerchantBusinessCertificationStep,
1348
+ zMerchantBusinessCertificationStep,
1349
+ zMerchantBusinessCertificationStep,
1350
+ zMerchantBusinessCertificationStep,
1351
+ zMerchantBusinessCertificationStep,
1352
+ zMerchantBusinessCertificationStep,
1353
+ zMerchantBusinessCertificationStep,
1354
+ zMerchantBusinessCertificationStep,
1355
+ zMerchantBusinessCertificationStep,
1356
+ zMerchantBusinessCertificationStep,
1357
+ ]),
1358
+ }),
1359
+ ]),
1360
+ lenientUnion([
1361
+ z.object({
1362
+ object: z.literal("merchant_business_certification"),
1363
+ status: z.literal("not_started"),
1364
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1365
+ availablePaths: z
1366
+ .array(lenientUnion([z.literal("own_software"), z.literal("external_software")]))
1367
+ .min(1),
1368
+ recommendedPath: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1369
+ actions: z.array(z.literal("start")).max(1),
1370
+ }),
1371
+ z.object({
1372
+ object: z.literal("merchant_business_certification"),
1373
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1374
+ revision: z.int().gte(1),
1375
+ status: z.literal("in_progress"),
1376
+ path: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1377
+ software: z.object({
1378
+ name: z
1379
+ .string()
1380
+ .refine((text) => Array.from(text).length >= 1)
1381
+ .refine((text) => Array.from(text).length <= 128),
1382
+ version: z
1383
+ .string()
1384
+ .refine((text) => Array.from(text).length >= 1)
1385
+ .refine((text) => Array.from(text).length <= 64),
1386
+ }),
1387
+ phase: lenientUnion([
1388
+ z.literal("preparation"),
1389
+ z.literal("application"),
1390
+ z.literal("tests"),
1391
+ z.literal("authorization"),
1392
+ ]),
1393
+ serviceUrls: z
1394
+ .object({
1395
+ reception: z.url(),
1396
+ commercialApproval: z.url(),
1397
+ })
1398
+ .nullable(),
1399
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1400
+ actions: z.array(lenientUnion([z.literal("report_evidence"), z.literal("import_certificate")])),
1401
+ steps: z.tuple([
1402
+ zMerchantBusinessCertificationStep,
1403
+ zMerchantBusinessCertificationStep,
1404
+ zMerchantBusinessCertificationStep,
1405
+ zMerchantBusinessCertificationStep,
1406
+ zMerchantBusinessCertificationStep,
1407
+ zMerchantBusinessCertificationStep,
1408
+ zMerchantBusinessCertificationStep,
1409
+ zMerchantBusinessCertificationStep,
1410
+ zMerchantBusinessCertificationStep,
1411
+ zMerchantBusinessCertificationStep,
1412
+ zMerchantBusinessCertificationStep,
1413
+ zMerchantBusinessCertificationStep,
1414
+ zMerchantBusinessCertificationStep,
1415
+ zMerchantBusinessCertificationStep,
1416
+ zMerchantBusinessCertificationStep,
1417
+ ]),
1418
+ }),
1419
+ ]),
1420
+ ]);
1421
+ /**
1422
+ * MerchantBusinessCertificationEvidenceRequest
1423
+ */
1424
+ export const zSubmitMerchantBusinessCertificationEvidenceResponse = lenientUnion([
1425
+ z.object({
1426
+ object: z.literal("merchant_business_certification"),
1427
+ status: z.literal("not_started"),
1428
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1429
+ availablePaths: z
1430
+ .array(lenientUnion([z.literal("own_software"), z.literal("external_software")]))
1431
+ .min(1),
1432
+ recommendedPath: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1433
+ actions: z.array(z.literal("start")).max(1),
1434
+ }),
1435
+ z.object({
1436
+ object: z.literal("merchant_business_certification"),
1437
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1438
+ revision: z.int().gte(1),
1439
+ status: z.literal("in_progress"),
1440
+ path: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1441
+ software: z.object({
1442
+ name: z
1443
+ .string()
1444
+ .refine((text) => Array.from(text).length >= 1)
1445
+ .refine((text) => Array.from(text).length <= 128),
1446
+ version: z
1447
+ .string()
1448
+ .refine((text) => Array.from(text).length >= 1)
1449
+ .refine((text) => Array.from(text).length <= 64),
1450
+ }),
1451
+ phase: lenientUnion([
1452
+ z.literal("preparation"),
1453
+ z.literal("application"),
1454
+ z.literal("tests"),
1455
+ z.literal("authorization"),
1456
+ ]),
1457
+ serviceUrls: z
1458
+ .object({
1459
+ reception: z.url(),
1460
+ commercialApproval: z.url(),
1461
+ })
1462
+ .nullable(),
1463
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1464
+ actions: z.array(lenientUnion([z.literal("report_evidence"), z.literal("import_certificate")])),
1465
+ steps: z.tuple([
1466
+ zMerchantBusinessCertificationStep,
1467
+ zMerchantBusinessCertificationStep,
1468
+ zMerchantBusinessCertificationStep,
1469
+ zMerchantBusinessCertificationStep,
1470
+ zMerchantBusinessCertificationStep,
1471
+ zMerchantBusinessCertificationStep,
1472
+ zMerchantBusinessCertificationStep,
1473
+ zMerchantBusinessCertificationStep,
1474
+ zMerchantBusinessCertificationStep,
1475
+ zMerchantBusinessCertificationStep,
1476
+ zMerchantBusinessCertificationStep,
1477
+ zMerchantBusinessCertificationStep,
1478
+ zMerchantBusinessCertificationStep,
1479
+ zMerchantBusinessCertificationStep,
1480
+ zMerchantBusinessCertificationStep,
1481
+ ]),
1482
+ }),
1483
+ ]);
1059
1484
  /**
1060
1485
  * MerchantBusinessConfigureInvoicingRequest
1061
1486
  */
@@ -1066,92 +1491,66 @@ export const zConfigureInvoicingResponse = z.object({
1066
1491
  /**
1067
1492
  * MerchantBusinessSigningCertificateRequest
1068
1493
  */
1069
- export const zImportSigningCertificateResponse = z.object({
1070
- object: z.literal("merchant_business"),
1071
- id: z.string().regex(/^mbiz_[0-9a-hjkmnp-tv-z]{24,}$/),
1072
- rnc: z.string().regex(/^[0-9]{9}$/),
1073
- legalName: z.string().refine((text) => Array.from(text).length >= 1),
1074
- revision: z.int().gte(0),
1075
- capabilities: z.object({
1076
- payments: z.object({
1077
- requested: z.boolean(),
1078
- test: z.object({
1079
- status: lenientUnion([
1080
- z.literal("active"),
1081
- z.literal("pending"),
1082
- z.literal("inactive"),
1083
- z.literal("unavailable"),
1084
- ]),
1085
- }),
1086
- live: z.object({
1087
- status: lenientUnion([
1088
- z.literal("active"),
1089
- z.literal("pending"),
1090
- z.literal("inactive"),
1091
- z.literal("unavailable"),
1092
- ]),
1093
- }),
1094
- }),
1095
- invoices: z.object({
1096
- requested: z.boolean(),
1097
- test: z.object({
1098
- status: lenientUnion([
1099
- z.literal("active"),
1100
- z.literal("pending"),
1101
- z.literal("inactive"),
1102
- z.literal("unavailable"),
1103
- ]),
1494
+ export const zImportSigningCertificateResponse = lenientUnion([
1495
+ z.object({
1496
+ object: z.literal("merchant_business"),
1497
+ id: z.string().regex(/^mbiz_[0-9a-hjkmnp-tv-z]{24,}$/),
1498
+ rnc: z.string().regex(/^[0-9]{9}$/),
1499
+ legalName: z.string().refine((text) => Array.from(text).length >= 1),
1500
+ revision: z.int().gte(0),
1501
+ capabilities: z.object({
1502
+ payments: z.object({
1503
+ requested: z.boolean(),
1504
+ test: z.object({
1505
+ status: lenientUnion([
1506
+ z.literal("active"),
1507
+ z.literal("pending"),
1508
+ z.literal("inactive"),
1509
+ z.literal("unavailable"),
1510
+ ]),
1511
+ }),
1512
+ live: z.object({
1513
+ status: lenientUnion([
1514
+ z.literal("active"),
1515
+ z.literal("pending"),
1516
+ z.literal("inactive"),
1517
+ z.literal("unavailable"),
1518
+ ]),
1519
+ }),
1104
1520
  }),
1105
- live: z.object({
1106
- status: lenientUnion([
1107
- z.literal("active"),
1108
- z.literal("pending"),
1109
- z.literal("inactive"),
1110
- z.literal("unavailable"),
1111
- ]),
1521
+ invoices: z.object({
1522
+ requested: z.boolean(),
1523
+ test: z.object({
1524
+ status: lenientUnion([
1525
+ z.literal("active"),
1526
+ z.literal("pending"),
1527
+ z.literal("inactive"),
1528
+ z.literal("unavailable"),
1529
+ ]),
1530
+ }),
1531
+ live: z.object({
1532
+ status: lenientUnion([
1533
+ z.literal("active"),
1534
+ z.literal("pending"),
1535
+ z.literal("inactive"),
1536
+ z.literal("unavailable"),
1537
+ ]),
1538
+ }),
1112
1539
  }),
1113
1540
  }),
1114
- }),
1115
- fiscalDetails: z.object({
1116
- commercialName: z.string().nullable(),
1117
- address: z.string().nullable(),
1118
- location: z
1119
- .object({
1120
- placeId: z
1121
- .string()
1122
- .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}$/),
1123
- catalogReleaseId: z.string().regex(/^dr_[A-Za-z0-9._-]+$/),
1124
- municipalityCode: z
1125
- .string()
1126
- .regex(/^[0-9]{6}$/)
1127
- .nullable(),
1128
- name: z
1129
- .string()
1130
- .refine((text) => Array.from(text).length >= 1)
1131
- .refine((text) => Array.from(text).length <= 160),
1132
- kind: lenientUnion([
1133
- z.literal("country"),
1134
- z.literal("region"),
1135
- z.literal("national_district"),
1136
- z.literal("province"),
1137
- z.literal("municipality"),
1138
- z.literal("municipal_district"),
1139
- z.literal("urban_zone"),
1140
- z.literal("section"),
1141
- z.literal("barrio"),
1142
- z.literal("paraje"),
1143
- z.literal("subbarrio"),
1144
- ]),
1145
- qualityStatus: lenientUnion([
1146
- z.literal("verified"),
1147
- z.literal("provisional"),
1148
- z.literal("conflicted"),
1149
- ]),
1150
- ancestors: z
1151
- .array(z.object({
1541
+ fiscalDetails: z.object({
1542
+ commercialName: z.string().nullable(),
1543
+ address: z.string().nullable(),
1544
+ location: z
1545
+ .object({
1152
1546
  placeId: z
1153
1547
  .string()
1154
1548
  .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}$/),
1549
+ catalogReleaseId: z.string().regex(/^dr_[A-Za-z0-9._-]+$/),
1550
+ municipalityCode: z
1551
+ .string()
1552
+ .regex(/^[0-9]{6}$/)
1553
+ .nullable(),
1155
1554
  name: z
1156
1555
  .string()
1157
1556
  .refine((text) => Array.from(text).length >= 1)
@@ -1174,140 +1573,228 @@ export const zImportSigningCertificateResponse = z.object({
1174
1573
  z.literal("provisional"),
1175
1574
  z.literal("conflicted"),
1176
1575
  ]),
1177
- }))
1178
- .max(32),
1179
- })
1180
- .nullable(),
1181
- phone: z.string().nullable(),
1182
- email: z.string().nullable(),
1183
- defaultIncomeType: z.string().nullable(),
1184
- }),
1185
- paymentsProfile: z
1186
- .object({
1187
- displayName: z
1188
- .string()
1189
- .refine((text) => Array.from(text).length >= 1)
1190
- .refine((text) => Array.from(text).length <= 80)
1191
- .regex(/\S/),
1192
- statementDescriptor: z
1193
- .string()
1194
- .refine((text) => Array.from(text).length >= 1)
1195
- .refine((text) => Array.from(text).length <= 22)
1196
- .regex(/\S/),
1197
- permanentAddress: z.object({
1198
- line1: z
1199
- .string()
1200
- .refine((text) => Array.from(text).length >= 1)
1201
- .refine((text) => Array.from(text).length <= 160)
1202
- .regex(/\S/),
1203
- line2: z
1204
- .string()
1205
- .refine((text) => Array.from(text).length >= 1)
1206
- .refine((text) => Array.from(text).length <= 160)
1207
- .regex(/\S/)
1208
- .optional(),
1209
- city: z
1576
+ ancestors: z
1577
+ .array(z.object({
1578
+ placeId: z
1579
+ .string()
1580
+ .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}$/),
1581
+ name: z
1582
+ .string()
1583
+ .refine((text) => Array.from(text).length >= 1)
1584
+ .refine((text) => Array.from(text).length <= 160),
1585
+ kind: lenientUnion([
1586
+ z.literal("country"),
1587
+ z.literal("region"),
1588
+ z.literal("national_district"),
1589
+ z.literal("province"),
1590
+ z.literal("municipality"),
1591
+ z.literal("municipal_district"),
1592
+ z.literal("urban_zone"),
1593
+ z.literal("section"),
1594
+ z.literal("barrio"),
1595
+ z.literal("paraje"),
1596
+ z.literal("subbarrio"),
1597
+ ]),
1598
+ qualityStatus: lenientUnion([
1599
+ z.literal("verified"),
1600
+ z.literal("provisional"),
1601
+ z.literal("conflicted"),
1602
+ ]),
1603
+ }))
1604
+ .max(32),
1605
+ })
1606
+ .nullable(),
1607
+ phone: z.string().nullable(),
1608
+ email: z.string().nullable(),
1609
+ defaultIncomeType: z.string().nullable(),
1610
+ }),
1611
+ paymentsProfile: z
1612
+ .object({
1613
+ displayName: z
1210
1614
  .string()
1211
1615
  .refine((text) => Array.from(text).length >= 1)
1212
1616
  .refine((text) => Array.from(text).length <= 80)
1213
1617
  .regex(/\S/),
1214
- province: z
1215
- .string()
1216
- .refine((text) => Array.from(text).length >= 1)
1217
- .refine((text) => Array.from(text).length <= 80)
1218
- .regex(/\S/)
1219
- .optional(),
1220
- postalCode: z
1618
+ statementDescriptor: z
1221
1619
  .string()
1222
1620
  .refine((text) => Array.from(text).length >= 1)
1223
- .refine((text) => Array.from(text).length <= 20)
1224
- .regex(/\S/)
1225
- .optional(),
1226
- countryCode: z.string().regex(/^[A-Z]{2}$/),
1227
- }),
1228
- supportEmail: z.email().refine((text) => Array.from(text).length <= 254),
1229
- supportPhone: z.string().regex(/^\+[1-9][0-9]{7,14}$/),
1230
- deliveryPolicy: lenientUnion([
1231
- z.object({
1232
- kind: z.literal("not_offered"),
1233
- }),
1234
- z.object({
1235
- kind: z.literal("merchant_managed"),
1236
- summary: z
1621
+ .refine((text) => Array.from(text).length <= 22)
1622
+ .regex(/\S/),
1623
+ permanentAddress: z.object({
1624
+ line1: z
1237
1625
  .string()
1238
1626
  .refine((text) => Array.from(text).length >= 1)
1239
1627
  .refine((text) => Array.from(text).length <= 160)
1240
1628
  .regex(/\S/),
1241
- url: z
1242
- .url()
1243
- .refine((text) => Array.from(text).length <= 2048)
1244
- .regex(/^https?:\/\//)
1629
+ line2: z
1630
+ .string()
1631
+ .refine((text) => Array.from(text).length >= 1)
1632
+ .refine((text) => Array.from(text).length <= 160)
1633
+ .regex(/\S/)
1634
+ .optional(),
1635
+ city: z
1636
+ .string()
1637
+ .refine((text) => Array.from(text).length >= 1)
1638
+ .refine((text) => Array.from(text).length <= 80)
1639
+ .regex(/\S/),
1640
+ province: z
1641
+ .string()
1642
+ .refine((text) => Array.from(text).length >= 1)
1643
+ .refine((text) => Array.from(text).length <= 80)
1644
+ .regex(/\S/)
1245
1645
  .optional(),
1646
+ postalCode: z
1647
+ .string()
1648
+ .refine((text) => Array.from(text).length >= 1)
1649
+ .refine((text) => Array.from(text).length <= 20)
1650
+ .regex(/\S/)
1651
+ .optional(),
1652
+ countryCode: z.string().regex(/^[A-Z]{2}$/),
1246
1653
  }),
1247
- ]),
1248
- })
1249
- .nullable(),
1250
- invoicing: z.object({
1251
- test: zMerchantBusinessFiscalSetup,
1252
- live: zMerchantBusinessLiveFiscalSetup,
1654
+ supportEmail: z.email().refine((text) => Array.from(text).length <= 254),
1655
+ supportPhone: z.string().regex(/^\+[1-9][0-9]{7,14}$/),
1656
+ deliveryPolicy: lenientUnion([
1657
+ z.object({
1658
+ kind: z.literal("not_offered"),
1659
+ }),
1660
+ z.object({
1661
+ kind: z.literal("merchant_managed"),
1662
+ summary: z
1663
+ .string()
1664
+ .refine((text) => Array.from(text).length >= 1)
1665
+ .refine((text) => Array.from(text).length <= 160)
1666
+ .regex(/\S/),
1667
+ url: z
1668
+ .url()
1669
+ .refine((text) => Array.from(text).length <= 2048)
1670
+ .regex(/^https?:\/\//)
1671
+ .optional(),
1672
+ }),
1673
+ ]),
1674
+ })
1675
+ .nullable(),
1676
+ invoicing: z.object({
1677
+ test: zMerchantBusinessFiscalSetup,
1678
+ live: zMerchantBusinessLiveFiscalSetup,
1679
+ }),
1680
+ requirements: z.array(z.object({
1681
+ code: lenientUnion([
1682
+ z.literal("capabilities_required"),
1683
+ z.literal("commercial_name_required"),
1684
+ z.literal("address_required"),
1685
+ z.literal("location_required"),
1686
+ z.literal("phone_required"),
1687
+ z.literal("default_income_type_required"),
1688
+ z.literal("contact_email_verification_required"),
1689
+ z.literal("fiscal_details_rejected"),
1690
+ z.literal("taxpayer_registration_required"),
1691
+ z.literal("signing_certificate_required"),
1692
+ z.literal("signing_certificate_expiring"),
1693
+ z.literal("test_fiscal_document_rejected"),
1694
+ z.literal("test_fiscal_document_pending"),
1695
+ z.literal("test_fiscal_document_send_pending"),
1696
+ z.literal("fiscal_binding_pending"),
1697
+ z.literal("legal_issuer_sync_pending"),
1698
+ z.literal("fiscal_setup_unavailable"),
1699
+ z.literal("fiscal_binding_conflict"),
1700
+ z.literal("fiscal_issuer_rejected"),
1701
+ z.literal("test_fiscal_document_operator_required"),
1702
+ z.literal("payments_profile_required"),
1703
+ z.literal("test_payments_unavailable"),
1704
+ z.literal("merchant_account_required"),
1705
+ z.literal("merchant_account_disabled"),
1706
+ z.literal("active_credential_required"),
1707
+ z.literal("credential_material_invalid"),
1708
+ z.literal("test_live_mode_mismatch"),
1709
+ z.literal("callback_configuration_failed"),
1710
+ z.literal("callback_configuration_required"),
1711
+ z.literal("connectivity_check_failed"),
1712
+ z.literal("connectivity_check_required"),
1713
+ z.literal("provider_qualification_failed"),
1714
+ z.literal("provider_qualification_required"),
1715
+ z.literal("provider_adapter_unavailable"),
1716
+ ]),
1717
+ owner: lenientUnion([
1718
+ z.literal("merchant"),
1719
+ z.literal("dgii"),
1720
+ z.literal("timbro"),
1721
+ z.literal("provider"),
1722
+ z.literal("operator"),
1723
+ ]),
1724
+ blocks: z.array(lenientUnion([z.literal("payments"), z.literal("invoices")])).max(2),
1725
+ mode: lenientUnion([z.literal("test"), z.literal("live")]).optional(),
1726
+ field: z.string().optional(),
1727
+ errors: z
1728
+ .array(z.object({
1729
+ code: z.string(),
1730
+ message: z.string(),
1731
+ }))
1732
+ .min(1)
1733
+ .optional(),
1734
+ })),
1735
+ onboardingUrl: z.url(),
1253
1736
  }),
1254
- requirements: z.array(z.object({
1255
- code: lenientUnion([
1256
- z.literal("capabilities_required"),
1257
- z.literal("commercial_name_required"),
1258
- z.literal("address_required"),
1259
- z.literal("location_required"),
1260
- z.literal("phone_required"),
1261
- z.literal("default_income_type_required"),
1262
- z.literal("contact_email_verification_required"),
1263
- z.literal("fiscal_details_rejected"),
1264
- z.literal("taxpayer_registration_required"),
1265
- z.literal("signing_certificate_required"),
1266
- z.literal("signing_certificate_expiring"),
1267
- z.literal("test_fiscal_document_rejected"),
1268
- z.literal("test_fiscal_document_pending"),
1269
- z.literal("test_fiscal_document_send_pending"),
1270
- z.literal("fiscal_binding_pending"),
1271
- z.literal("legal_issuer_sync_pending"),
1272
- z.literal("fiscal_setup_unavailable"),
1273
- z.literal("fiscal_binding_conflict"),
1274
- z.literal("fiscal_issuer_rejected"),
1275
- z.literal("test_fiscal_document_operator_required"),
1276
- z.literal("payments_profile_required"),
1277
- z.literal("test_payments_unavailable"),
1278
- z.literal("merchant_account_required"),
1279
- z.literal("merchant_account_disabled"),
1280
- z.literal("active_credential_required"),
1281
- z.literal("credential_material_invalid"),
1282
- z.literal("test_live_mode_mismatch"),
1283
- z.literal("callback_configuration_failed"),
1284
- z.literal("callback_configuration_required"),
1285
- z.literal("connectivity_check_failed"),
1286
- z.literal("connectivity_check_required"),
1287
- z.literal("provider_qualification_failed"),
1288
- z.literal("provider_qualification_required"),
1289
- z.literal("provider_adapter_unavailable"),
1290
- ]),
1291
- owner: lenientUnion([
1292
- z.literal("merchant"),
1293
- z.literal("dgii"),
1294
- z.literal("timbro"),
1295
- z.literal("provider"),
1296
- z.literal("operator"),
1297
- ]),
1298
- blocks: z.array(lenientUnion([z.literal("payments"), z.literal("invoices")])).max(2),
1299
- mode: lenientUnion([z.literal("test"), z.literal("live")]).optional(),
1300
- field: z.string().optional(),
1301
- errors: z
1302
- .array(z.object({
1303
- code: z.string(),
1304
- message: z.string(),
1305
- }))
1306
- .min(1)
1307
- .optional(),
1308
- })),
1309
- onboardingUrl: z.url(),
1310
- });
1737
+ lenientUnion([
1738
+ z.object({
1739
+ object: z.literal("merchant_business_certification"),
1740
+ status: z.literal("not_started"),
1741
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1742
+ availablePaths: z
1743
+ .array(lenientUnion([z.literal("own_software"), z.literal("external_software")]))
1744
+ .min(1),
1745
+ recommendedPath: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1746
+ actions: z.array(z.literal("start")).max(1),
1747
+ }),
1748
+ z.object({
1749
+ object: z.literal("merchant_business_certification"),
1750
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1751
+ revision: z.int().gte(1),
1752
+ status: z.literal("in_progress"),
1753
+ path: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1754
+ software: z.object({
1755
+ name: z
1756
+ .string()
1757
+ .refine((text) => Array.from(text).length >= 1)
1758
+ .refine((text) => Array.from(text).length <= 128),
1759
+ version: z
1760
+ .string()
1761
+ .refine((text) => Array.from(text).length >= 1)
1762
+ .refine((text) => Array.from(text).length <= 64),
1763
+ }),
1764
+ phase: lenientUnion([
1765
+ z.literal("preparation"),
1766
+ z.literal("application"),
1767
+ z.literal("tests"),
1768
+ z.literal("authorization"),
1769
+ ]),
1770
+ serviceUrls: z
1771
+ .object({
1772
+ reception: z.url(),
1773
+ commercialApproval: z.url(),
1774
+ })
1775
+ .nullable(),
1776
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1777
+ actions: z.array(lenientUnion([z.literal("report_evidence"), z.literal("import_certificate")])),
1778
+ steps: z.tuple([
1779
+ zMerchantBusinessCertificationStep,
1780
+ zMerchantBusinessCertificationStep,
1781
+ zMerchantBusinessCertificationStep,
1782
+ zMerchantBusinessCertificationStep,
1783
+ zMerchantBusinessCertificationStep,
1784
+ zMerchantBusinessCertificationStep,
1785
+ zMerchantBusinessCertificationStep,
1786
+ zMerchantBusinessCertificationStep,
1787
+ zMerchantBusinessCertificationStep,
1788
+ zMerchantBusinessCertificationStep,
1789
+ zMerchantBusinessCertificationStep,
1790
+ zMerchantBusinessCertificationStep,
1791
+ zMerchantBusinessCertificationStep,
1792
+ zMerchantBusinessCertificationStep,
1793
+ zMerchantBusinessCertificationStep,
1794
+ ]),
1795
+ }),
1796
+ ]),
1797
+ ]);
1311
1798
  /**
1312
1799
  * MerchantBusinessTestFiscalDocumentRequest
1313
1800
  */