@timbro/invoices 0.11.0 → 0.13.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 (59) hide show
  1. package/README.md +46 -0
  2. package/dist/admin.d.ts +2 -1
  3. package/dist/admin.d.ts.map +1 -1
  4. package/dist/admin.js +1 -0
  5. package/dist/certification-workbook.d.ts +9 -0
  6. package/dist/certification-workbook.d.ts.map +1 -0
  7. package/dist/certification-workbook.js +13 -0
  8. package/dist/fiscal-engine-runtime.manifest.json +117 -112
  9. package/dist/fiscal-engine-runtime.provenance.json +194 -189
  10. package/dist/generated/certification-api-contract.d.ts +430 -0
  11. package/dist/generated/certification-api-contract.d.ts.map +1 -0
  12. package/dist/generated/certification-api-contract.js +483 -0
  13. package/dist/generated/hosted/index.d.ts +3 -3
  14. package/dist/generated/hosted/index.d.ts.map +1 -1
  15. package/dist/generated/hosted/index.js +2 -2
  16. package/dist/generated/hosted/sdk.gen.d.ts +31 -1
  17. package/dist/generated/hosted/sdk.gen.d.ts.map +1 -1
  18. package/dist/generated/hosted/sdk.gen.js +389 -1
  19. package/dist/generated/hosted/types.gen.d.ts +878 -36
  20. package/dist/generated/hosted/types.gen.d.ts.map +1 -1
  21. package/dist/generated/hosted/zod-response.gen.d.ts +6005 -192
  22. package/dist/generated/hosted/zod-response.gen.d.ts.map +1 -1
  23. package/dist/generated/hosted/zod-response.gen.js +766 -231
  24. package/dist/generated/hosted/zod.gen.d.ts +1622 -7
  25. package/dist/generated/hosted/zod.gen.d.ts.map +1 -1
  26. package/dist/generated/hosted/zod.gen.js +830 -215
  27. package/dist/generated/index.d.ts +3 -3
  28. package/dist/generated/index.d.ts.map +1 -1
  29. package/dist/generated/index.js +2 -2
  30. package/dist/generated/invoice-api-contract.d.ts +1345 -105
  31. package/dist/generated/invoice-api-contract.d.ts.map +1 -1
  32. package/dist/generated/invoice-api-contract.js +1755 -163
  33. package/dist/generated/problem-catalog.d.ts.map +1 -1
  34. package/dist/generated/problem-catalog.js +2 -0
  35. package/dist/generated/sdk.gen.d.ts +5 -1
  36. package/dist/generated/sdk.gen.d.ts.map +1 -1
  37. package/dist/generated/sdk.gen.js +109 -1
  38. package/dist/generated/types.gen.d.ts +534 -51
  39. package/dist/generated/types.gen.d.ts.map +1 -1
  40. package/dist/generated/zod-response.gen.d.ts +21272 -4130
  41. package/dist/generated/zod-response.gen.d.ts.map +1 -1
  42. package/dist/generated/zod-response.gen.js +230 -4
  43. package/dist/generated/zod.gen.d.ts +17458 -2747
  44. package/dist/generated/zod.gen.d.ts.map +1 -1
  45. package/dist/generated/zod.gen.js +2333 -1441
  46. package/dist/generated-operation-client.d.ts +2 -2
  47. package/dist/generated-operation-client.d.ts.map +1 -1
  48. package/dist/hosted-tenant.d.ts +9 -0
  49. package/dist/hosted-tenant.d.ts.map +1 -1
  50. package/dist/hosted-tenant.js +7 -0
  51. package/dist/index.d.ts +2 -1
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/invoice-hosted-controls.d.ts +31 -3
  54. package/dist/invoice-hosted-controls.d.ts.map +1 -1
  55. package/dist/invoice-hosted-controls.js +73 -12
  56. package/dist/problem-contract.d.ts +2 -0
  57. package/dist/problem-contract.d.ts.map +1 -1
  58. package/dist/timbro_fiscal_engine_bg.wasm +0 -0
  59. package/package.json +3 -3
@@ -268,6 +268,20 @@ export const zMerchantBusinessLiveFiscalSetup = lenientUnion([
268
268
  */
269
269
  export const zProblem = z.object({
270
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",
271
285
  "merchant_authentication_unavailable",
272
286
  "platform_test_profile_unavailable",
273
287
  "merchant_fiscal_binding_unavailable",
@@ -308,6 +322,11 @@ export const zProblem = z.object({
308
322
  "merchant_business_not_member",
309
323
  "merchant_business_revision_conflict",
310
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_unavailable",
329
+ "merchant_business_certification_evidence_not_found",
311
330
  "merchant_fiscal_setup_incomplete",
312
331
  "merchant_payment_setup_assessment_incomplete",
313
332
  "merchant_certificate_conflict",
@@ -467,6 +486,9 @@ export const zProblem = z.object({
467
486
  "refund_tip_amount_invalid",
468
487
  "refund_tip_allocation_unknown",
469
488
  "refund_amount_invalid",
489
+ "refund_tax_amount_invalid",
490
+ "refund_tax_amount_required",
491
+ "refund_tax_allocation_unknown",
470
492
  "refund_currency_mismatch",
471
493
  "payer_fiscal_profile_invalid",
472
494
  "rate_limit_exceeded",
@@ -535,6 +557,8 @@ export const zProblem = z.object({
535
557
  "request_body_timeout",
536
558
  "malformed_json",
537
559
  "invalid_request",
560
+ "certification_environment_required",
561
+ "certification_test_set_invalid",
538
562
  "invalid_collection_query",
539
563
  "invalid_collection_cursor",
540
564
  "document_type_not_enabled",
@@ -622,6 +646,149 @@ export const zProblem = z.object({
622
646
  title: z.string(),
623
647
  type: z.enum(["about:blank"]),
624
648
  });
649
+ /**
650
+ * MerchantBusinessCertificationRequirement
651
+ */
652
+ export const zMerchantBusinessCertificationRequirement = z.object({
653
+ code: lenientUnion([
654
+ z.literal("invoices_not_requested"),
655
+ z.literal("fiscal_details_incomplete"),
656
+ z.literal("certification_binding_required"),
657
+ z.literal("certification_certificate_required"),
658
+ z.literal("provider_eligibility_unverified"),
659
+ z.literal("certification_receiver_urls_pending"),
660
+ z.literal("certification_test_set_processing_unavailable"),
661
+ ]),
662
+ owner: lenientUnion([
663
+ z.literal("merchant"),
664
+ z.literal("dgii"),
665
+ z.literal("timbro"),
666
+ z.literal("operator"),
667
+ ]),
668
+ blocks: z
669
+ .array(lenientUnion([
670
+ z.literal("start"),
671
+ z.literal("step_1"),
672
+ z.literal("step_2"),
673
+ z.literal("step_7"),
674
+ ]))
675
+ .max(4),
676
+ field: z.string().optional(),
677
+ });
678
+ /**
679
+ * MerchantBusinessCertificationEvidence
680
+ *
681
+ * A business-reported DGII outcome. It remains unverified until an authorized evidence review confirms it.
682
+ */
683
+ export const zMerchantBusinessCertificationEvidence = z.object({
684
+ id: z.string().refine((text) => Array.from(text).length >= 1),
685
+ outcome: lenientUnion([
686
+ z.literal("submitted"),
687
+ z.literal("approved"),
688
+ z.literal("rejected"),
689
+ z.literal("needs_correction"),
690
+ ]),
691
+ verification: lenientUnion([
692
+ z.literal("user_reported"),
693
+ z.literal("operator_verified"),
694
+ z.literal("operator_rejected"),
695
+ ]),
696
+ reference: z
697
+ .string()
698
+ .refine((text) => Array.from(text).length <= 255)
699
+ .nullable(),
700
+ createdAt: z.iso.datetime(),
701
+ reviewedAt: z.iso.datetime().optional(),
702
+ reviewReference: z
703
+ .string()
704
+ .refine((text) => Array.from(text).length <= 512)
705
+ .optional(),
706
+ });
707
+ /**
708
+ * MerchantBusinessCertificationStep
709
+ */
710
+ export const zMerchantBusinessCertificationStep = z.object({
711
+ number: lenientUnion([
712
+ z.literal(1),
713
+ z.literal(2),
714
+ z.literal(3),
715
+ z.literal(4),
716
+ z.literal(5),
717
+ z.literal(6),
718
+ z.literal(7),
719
+ z.literal(8),
720
+ z.literal(9),
721
+ z.literal(10),
722
+ z.literal(11),
723
+ z.literal(12),
724
+ z.literal(13),
725
+ z.literal(14),
726
+ z.literal(15),
727
+ ]),
728
+ code: z.string().refine((text) => Array.from(text).length >= 1),
729
+ title: z.string().refine((text) => Array.from(text).length >= 1),
730
+ actor: lenientUnion([z.literal("merchant"), z.literal("dgii"), z.literal("timbro")]),
731
+ status: lenientUnion([
732
+ z.literal("blocked"),
733
+ z.literal("action_required"),
734
+ z.literal("awaiting_dgii"),
735
+ z.literal("reported"),
736
+ z.literal("verified"),
737
+ ]),
738
+ evidence: z.array(zMerchantBusinessCertificationEvidence),
739
+ });
740
+ /**
741
+ * RetainedCertificationWorkbook
742
+ */
743
+ export const zRetainedCertificationWorkbook = z.object({
744
+ name: z.string(),
745
+ sha256: z.string().regex(/^[0-9a-f]{64}$/),
746
+ sizeBytes: z.int().gte(1).lte(3145728),
747
+ });
748
+ /**
749
+ * CertificationTestSetKind
750
+ */
751
+ export const zCertificationTestSetKind = z.enum(["ecf"]);
752
+ /**
753
+ * CertificationTestSetObject
754
+ */
755
+ export const zCertificationTestSetObject = z.enum(["certification_test_set"]);
756
+ /**
757
+ * CertificationTestSetRequirement
758
+ */
759
+ export const zCertificationTestSetRequirement = z.enum(["case_mapping_pending"]);
760
+ /**
761
+ * CertificationWorksheetName
762
+ */
763
+ export const zCertificationWorksheetName = z.enum(["ECF", "RFCE"]);
764
+ /**
765
+ * CertificationWorksheetSummary
766
+ */
767
+ export const zCertificationWorksheetSummary = z.object({
768
+ caseCount: z.int().gte(1).lte(1000),
769
+ name: zCertificationWorksheetName,
770
+ });
771
+ /**
772
+ * CertificationTestSetReview
773
+ */
774
+ export const zCertificationTestSetReview = z.object({
775
+ requirements: z.array(zCertificationTestSetRequirement),
776
+ status: z.enum(["review_required"]),
777
+ worksheets: z.array(zCertificationWorksheetSummary),
778
+ });
779
+ /**
780
+ * CertificationTestSetResource
781
+ */
782
+ export const zCertificationTestSetResource = z.object({
783
+ attemptReference: z.string(),
784
+ createdAt: z.iso.datetime(),
785
+ file: zRetainedCertificationWorkbook,
786
+ generation: z.string().regex(/^[1-9][0-9]*$/),
787
+ id: z.uuid(),
788
+ kind: zCertificationTestSetKind,
789
+ object: zCertificationTestSetObject,
790
+ review: zCertificationTestSetReview,
791
+ });
625
792
  /**
626
793
  * MerchantBusiness
627
794
  *
@@ -1117,257 +1284,625 @@ export const zUpdateBusinessResponse = z.object({
1117
1284
  onboardingUrl: z.url(),
1118
1285
  });
1119
1286
  /**
1120
- * MerchantBusinessConfigureInvoicingRequest
1121
- */
1122
- export const zConfigureInvoicingResponse = z.object({
1123
- object: z.literal("merchant_business_invoicing_setup"),
1124
- mode: lenientUnion([z.literal("test"), z.literal("live")]),
1125
- });
1126
- /**
1127
- * MerchantBusinessSigningCertificateRequest
1287
+ * MerchantBusinessCertification
1288
+ *
1289
+ * Durable certification preparation and user-reported DGII progress for the authenticated business.
1128
1290
  */
1129
- export const zImportSigningCertificateResponse = z.object({
1130
- object: z.literal("merchant_business"),
1131
- id: z.string().regex(/^mbiz_[0-9a-hjkmnp-tv-z]{24,}$/),
1132
- rnc: z.string().regex(/^[0-9]{9}$/),
1133
- legalName: z.string().refine((text) => Array.from(text).length >= 1),
1134
- revision: z.int().gte(0),
1135
- capabilities: z.object({
1136
- payments: z.object({
1137
- requested: z.boolean(),
1138
- test: z.object({
1139
- status: lenientUnion([
1140
- z.literal("active"),
1141
- z.literal("pending"),
1142
- z.literal("inactive"),
1143
- z.literal("unavailable"),
1144
- ]),
1145
- }),
1146
- live: z.object({
1147
- status: lenientUnion([
1148
- z.literal("active"),
1149
- z.literal("pending"),
1150
- z.literal("inactive"),
1151
- z.literal("unavailable"),
1152
- ]),
1153
- }),
1154
- }),
1155
- invoices: z.object({
1156
- requested: z.boolean(),
1157
- test: z.object({
1158
- status: lenientUnion([
1159
- z.literal("active"),
1160
- z.literal("pending"),
1161
- z.literal("inactive"),
1162
- z.literal("unavailable"),
1163
- ]),
1164
- }),
1165
- live: z.object({
1166
- status: lenientUnion([
1167
- z.literal("active"),
1168
- z.literal("pending"),
1169
- z.literal("inactive"),
1170
- z.literal("unavailable"),
1171
- ]),
1172
- }),
1173
- }),
1291
+ export const zRetrieveMerchantBusinessCertificationResponse = lenientUnion([
1292
+ z.object({
1293
+ object: z.literal("merchant_business_certification"),
1294
+ status: z.literal("not_started"),
1295
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1296
+ availablePaths: z
1297
+ .array(lenientUnion([z.literal("own_software"), z.literal("external_software")]))
1298
+ .min(1),
1299
+ recommendedPath: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1300
+ actions: z.array(z.literal("start")).max(1),
1174
1301
  }),
1175
- fiscalDetails: z.object({
1176
- commercialName: z.string().nullable(),
1177
- address: z.string().nullable(),
1178
- location: z
1179
- .object({
1180
- placeId: z
1181
- .string()
1182
- .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}$/),
1183
- catalogReleaseId: z.string().regex(/^dr_[A-Za-z0-9._-]+$/),
1184
- municipalityCode: z
1185
- .string()
1186
- .regex(/^[0-9]{6}$/)
1187
- .nullable(),
1302
+ z.object({
1303
+ object: z.literal("merchant_business_certification"),
1304
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1305
+ revision: z.int().gte(1),
1306
+ status: z.literal("in_progress"),
1307
+ path: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1308
+ software: z.object({
1188
1309
  name: z
1189
1310
  .string()
1190
1311
  .refine((text) => Array.from(text).length >= 1)
1191
- .refine((text) => Array.from(text).length <= 160),
1192
- kind: lenientUnion([
1193
- z.literal("country"),
1194
- z.literal("region"),
1195
- z.literal("national_district"),
1196
- z.literal("province"),
1197
- z.literal("municipality"),
1198
- z.literal("municipal_district"),
1199
- z.literal("urban_zone"),
1200
- z.literal("section"),
1201
- z.literal("barrio"),
1202
- z.literal("paraje"),
1203
- z.literal("subbarrio"),
1312
+ .refine((text) => Array.from(text).length <= 128),
1313
+ version: z
1314
+ .string()
1315
+ .refine((text) => Array.from(text).length >= 1)
1316
+ .refine((text) => Array.from(text).length <= 64),
1317
+ }),
1318
+ phase: lenientUnion([
1319
+ z.literal("preparation"),
1320
+ z.literal("application"),
1321
+ z.literal("tests"),
1322
+ z.literal("authorization"),
1323
+ ]),
1324
+ serviceUrls: z
1325
+ .object({
1326
+ reception: z.url(),
1327
+ commercialApproval: z.url(),
1328
+ })
1329
+ .nullable(),
1330
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1331
+ actions: z.array(lenientUnion([
1332
+ z.literal("report_evidence"),
1333
+ z.literal("import_certificate"),
1334
+ z.literal("upload_test_set"),
1335
+ ])),
1336
+ steps: z.tuple([
1337
+ zMerchantBusinessCertificationStep,
1338
+ zMerchantBusinessCertificationStep,
1339
+ zMerchantBusinessCertificationStep,
1340
+ zMerchantBusinessCertificationStep,
1341
+ zMerchantBusinessCertificationStep,
1342
+ zMerchantBusinessCertificationStep,
1343
+ zMerchantBusinessCertificationStep,
1344
+ zMerchantBusinessCertificationStep,
1345
+ zMerchantBusinessCertificationStep,
1346
+ zMerchantBusinessCertificationStep,
1347
+ zMerchantBusinessCertificationStep,
1348
+ zMerchantBusinessCertificationStep,
1349
+ zMerchantBusinessCertificationStep,
1350
+ zMerchantBusinessCertificationStep,
1351
+ zMerchantBusinessCertificationStep,
1352
+ ]),
1353
+ }),
1354
+ ]);
1355
+ /**
1356
+ * MerchantBusinessCertificationStartRequest
1357
+ */
1358
+ export const zStartMerchantBusinessCertificationResponse = lenientUnion([
1359
+ lenientUnion([
1360
+ z.object({
1361
+ object: z.literal("merchant_business_certification"),
1362
+ status: z.literal("not_started"),
1363
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1364
+ availablePaths: z
1365
+ .array(lenientUnion([z.literal("own_software"), z.literal("external_software")]))
1366
+ .min(1),
1367
+ recommendedPath: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1368
+ actions: z.array(z.literal("start")).max(1),
1369
+ }),
1370
+ z.object({
1371
+ object: z.literal("merchant_business_certification"),
1372
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1373
+ revision: z.int().gte(1),
1374
+ status: z.literal("in_progress"),
1375
+ path: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1376
+ software: z.object({
1377
+ name: z
1378
+ .string()
1379
+ .refine((text) => Array.from(text).length >= 1)
1380
+ .refine((text) => Array.from(text).length <= 128),
1381
+ version: z
1382
+ .string()
1383
+ .refine((text) => Array.from(text).length >= 1)
1384
+ .refine((text) => Array.from(text).length <= 64),
1385
+ }),
1386
+ phase: lenientUnion([
1387
+ z.literal("preparation"),
1388
+ z.literal("application"),
1389
+ z.literal("tests"),
1390
+ z.literal("authorization"),
1204
1391
  ]),
1205
- qualityStatus: lenientUnion([
1206
- z.literal("verified"),
1207
- z.literal("provisional"),
1208
- z.literal("conflicted"),
1392
+ serviceUrls: z
1393
+ .object({
1394
+ reception: z.url(),
1395
+ commercialApproval: z.url(),
1396
+ })
1397
+ .nullable(),
1398
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1399
+ actions: z.array(lenientUnion([
1400
+ z.literal("report_evidence"),
1401
+ z.literal("import_certificate"),
1402
+ z.literal("upload_test_set"),
1403
+ ])),
1404
+ steps: z.tuple([
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
+ zMerchantBusinessCertificationStep,
1418
+ zMerchantBusinessCertificationStep,
1419
+ zMerchantBusinessCertificationStep,
1209
1420
  ]),
1210
- ancestors: z
1211
- .array(z.object({
1212
- placeId: z
1213
- .string()
1214
- .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}$/),
1421
+ }),
1422
+ ]),
1423
+ lenientUnion([
1424
+ z.object({
1425
+ object: z.literal("merchant_business_certification"),
1426
+ status: z.literal("not_started"),
1427
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1428
+ availablePaths: z
1429
+ .array(lenientUnion([z.literal("own_software"), z.literal("external_software")]))
1430
+ .min(1),
1431
+ recommendedPath: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1432
+ actions: z.array(z.literal("start")).max(1),
1433
+ }),
1434
+ z.object({
1435
+ object: z.literal("merchant_business_certification"),
1436
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1437
+ revision: z.int().gte(1),
1438
+ status: z.literal("in_progress"),
1439
+ path: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1440
+ software: z.object({
1215
1441
  name: z
1216
1442
  .string()
1217
1443
  .refine((text) => Array.from(text).length >= 1)
1218
- .refine((text) => Array.from(text).length <= 160),
1219
- kind: lenientUnion([
1220
- z.literal("country"),
1221
- z.literal("region"),
1222
- z.literal("national_district"),
1223
- z.literal("province"),
1224
- z.literal("municipality"),
1225
- z.literal("municipal_district"),
1226
- z.literal("urban_zone"),
1227
- z.literal("section"),
1228
- z.literal("barrio"),
1229
- z.literal("paraje"),
1230
- z.literal("subbarrio"),
1231
- ]),
1232
- qualityStatus: lenientUnion([
1233
- z.literal("verified"),
1234
- z.literal("provisional"),
1235
- z.literal("conflicted"),
1236
- ]),
1237
- }))
1238
- .max(32),
1239
- })
1240
- .nullable(),
1241
- phone: z.string().nullable(),
1242
- email: z.string().nullable(),
1243
- defaultIncomeType: z.string().nullable(),
1444
+ .refine((text) => Array.from(text).length <= 128),
1445
+ version: z
1446
+ .string()
1447
+ .refine((text) => Array.from(text).length >= 1)
1448
+ .refine((text) => Array.from(text).length <= 64),
1449
+ }),
1450
+ phase: lenientUnion([
1451
+ z.literal("preparation"),
1452
+ z.literal("application"),
1453
+ z.literal("tests"),
1454
+ z.literal("authorization"),
1455
+ ]),
1456
+ serviceUrls: z
1457
+ .object({
1458
+ reception: z.url(),
1459
+ commercialApproval: z.url(),
1460
+ })
1461
+ .nullable(),
1462
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1463
+ actions: z.array(lenientUnion([
1464
+ z.literal("report_evidence"),
1465
+ z.literal("import_certificate"),
1466
+ z.literal("upload_test_set"),
1467
+ ])),
1468
+ steps: z.tuple([
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
+ zMerchantBusinessCertificationStep,
1482
+ zMerchantBusinessCertificationStep,
1483
+ zMerchantBusinessCertificationStep,
1484
+ ]),
1485
+ }),
1486
+ ]),
1487
+ ]);
1488
+ /**
1489
+ * MerchantBusinessCertificationEvidenceRequest
1490
+ */
1491
+ export const zSubmitMerchantBusinessCertificationEvidenceResponse = lenientUnion([
1492
+ z.object({
1493
+ object: z.literal("merchant_business_certification"),
1494
+ status: z.literal("not_started"),
1495
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1496
+ availablePaths: z
1497
+ .array(lenientUnion([z.literal("own_software"), z.literal("external_software")]))
1498
+ .min(1),
1499
+ recommendedPath: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1500
+ actions: z.array(z.literal("start")).max(1),
1244
1501
  }),
1245
- paymentsProfile: z
1246
- .object({
1247
- displayName: z
1248
- .string()
1249
- .refine((text) => Array.from(text).length >= 1)
1250
- .refine((text) => Array.from(text).length <= 80)
1251
- .regex(/\S/),
1252
- statementDescriptor: z
1253
- .string()
1254
- .refine((text) => Array.from(text).length >= 1)
1255
- .refine((text) => Array.from(text).length <= 22)
1256
- .regex(/\S/),
1257
- permanentAddress: z.object({
1258
- line1: z
1259
- .string()
1260
- .refine((text) => Array.from(text).length >= 1)
1261
- .refine((text) => Array.from(text).length <= 160)
1262
- .regex(/\S/),
1263
- line2: z
1264
- .string()
1265
- .refine((text) => Array.from(text).length >= 1)
1266
- .refine((text) => Array.from(text).length <= 160)
1267
- .regex(/\S/)
1268
- .optional(),
1269
- city: z
1270
- .string()
1271
- .refine((text) => Array.from(text).length >= 1)
1272
- .refine((text) => Array.from(text).length <= 80)
1273
- .regex(/\S/),
1274
- province: z
1502
+ z.object({
1503
+ object: z.literal("merchant_business_certification"),
1504
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1505
+ revision: z.int().gte(1),
1506
+ status: z.literal("in_progress"),
1507
+ path: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1508
+ software: z.object({
1509
+ name: z
1275
1510
  .string()
1276
1511
  .refine((text) => Array.from(text).length >= 1)
1277
- .refine((text) => Array.from(text).length <= 80)
1278
- .regex(/\S/)
1279
- .optional(),
1280
- postalCode: z
1512
+ .refine((text) => Array.from(text).length <= 128),
1513
+ version: z
1281
1514
  .string()
1282
1515
  .refine((text) => Array.from(text).length >= 1)
1283
- .refine((text) => Array.from(text).length <= 20)
1284
- .regex(/\S/)
1285
- .optional(),
1286
- countryCode: z.string().regex(/^[A-Z]{2}$/),
1516
+ .refine((text) => Array.from(text).length <= 64),
1287
1517
  }),
1288
- supportEmail: z.email().refine((text) => Array.from(text).length <= 254),
1289
- supportPhone: z.string().regex(/^\+[1-9][0-9]{7,14}$/),
1290
- deliveryPolicy: lenientUnion([
1291
- z.object({
1292
- kind: z.literal("not_offered"),
1293
- }),
1294
- z.object({
1295
- kind: z.literal("merchant_managed"),
1296
- summary: z
1297
- .string()
1298
- .refine((text) => Array.from(text).length >= 1)
1299
- .refine((text) => Array.from(text).length <= 160)
1518
+ phase: lenientUnion([
1519
+ z.literal("preparation"),
1520
+ z.literal("application"),
1521
+ z.literal("tests"),
1522
+ z.literal("authorization"),
1523
+ ]),
1524
+ serviceUrls: z
1525
+ .object({
1526
+ reception: z.url(),
1527
+ commercialApproval: z.url(),
1528
+ })
1529
+ .nullable(),
1530
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1531
+ actions: z.array(lenientUnion([
1532
+ z.literal("report_evidence"),
1533
+ z.literal("import_certificate"),
1534
+ z.literal("upload_test_set"),
1535
+ ])),
1536
+ steps: z.tuple([
1537
+ zMerchantBusinessCertificationStep,
1538
+ zMerchantBusinessCertificationStep,
1539
+ zMerchantBusinessCertificationStep,
1540
+ zMerchantBusinessCertificationStep,
1541
+ zMerchantBusinessCertificationStep,
1542
+ zMerchantBusinessCertificationStep,
1543
+ zMerchantBusinessCertificationStep,
1544
+ zMerchantBusinessCertificationStep,
1545
+ zMerchantBusinessCertificationStep,
1546
+ zMerchantBusinessCertificationStep,
1547
+ zMerchantBusinessCertificationStep,
1548
+ zMerchantBusinessCertificationStep,
1549
+ zMerchantBusinessCertificationStep,
1550
+ zMerchantBusinessCertificationStep,
1551
+ zMerchantBusinessCertificationStep,
1552
+ ]),
1553
+ }),
1554
+ ]);
1555
+ /**
1556
+ * CertificationTestSetUploadRequest
1557
+ */
1558
+ export const zUploadMerchantBusinessCertificationTestSetResponse = lenientUnion([
1559
+ z.object({
1560
+ attemptReference: z.string(),
1561
+ createdAt: z.iso.datetime(),
1562
+ file: zRetainedCertificationWorkbook,
1563
+ generation: z.string().regex(/^[1-9][0-9]*$/),
1564
+ id: z.uuid(),
1565
+ kind: zCertificationTestSetKind,
1566
+ object: zCertificationTestSetObject,
1567
+ review: zCertificationTestSetReview,
1568
+ }),
1569
+ z.object({
1570
+ attemptReference: z.string(),
1571
+ createdAt: z.iso.datetime(),
1572
+ file: zRetainedCertificationWorkbook,
1573
+ generation: z.string().regex(/^[1-9][0-9]*$/),
1574
+ id: z.uuid(),
1575
+ kind: zCertificationTestSetKind,
1576
+ object: zCertificationTestSetObject,
1577
+ review: zCertificationTestSetReview,
1578
+ }),
1579
+ ]);
1580
+ /**
1581
+ * CurrentCertificationTestSet
1582
+ *
1583
+ * Default Response
1584
+ */
1585
+ export const zRetrieveMerchantBusinessCertificationTestSetResponse = z.object({
1586
+ current: zCertificationTestSetResource.nullable(),
1587
+ });
1588
+ /**
1589
+ * MerchantBusinessConfigureInvoicingRequest
1590
+ */
1591
+ export const zConfigureInvoicingResponse = z.object({
1592
+ object: z.literal("merchant_business_invoicing_setup"),
1593
+ mode: lenientUnion([z.literal("test"), z.literal("live")]),
1594
+ });
1595
+ /**
1596
+ * MerchantBusinessSigningCertificateRequest
1597
+ */
1598
+ export const zImportSigningCertificateResponse = lenientUnion([
1599
+ z.object({
1600
+ object: z.literal("merchant_business"),
1601
+ id: z.string().regex(/^mbiz_[0-9a-hjkmnp-tv-z]{24,}$/),
1602
+ rnc: z.string().regex(/^[0-9]{9}$/),
1603
+ legalName: z.string().refine((text) => Array.from(text).length >= 1),
1604
+ revision: z.int().gte(0),
1605
+ capabilities: z.object({
1606
+ payments: z.object({
1607
+ requested: z.boolean(),
1608
+ test: z.object({
1609
+ status: lenientUnion([
1610
+ z.literal("active"),
1611
+ z.literal("pending"),
1612
+ z.literal("inactive"),
1613
+ z.literal("unavailable"),
1614
+ ]),
1615
+ }),
1616
+ live: z.object({
1617
+ status: lenientUnion([
1618
+ z.literal("active"),
1619
+ z.literal("pending"),
1620
+ z.literal("inactive"),
1621
+ z.literal("unavailable"),
1622
+ ]),
1623
+ }),
1624
+ }),
1625
+ invoices: z.object({
1626
+ requested: z.boolean(),
1627
+ test: z.object({
1628
+ status: lenientUnion([
1629
+ z.literal("active"),
1630
+ z.literal("pending"),
1631
+ z.literal("inactive"),
1632
+ z.literal("unavailable"),
1633
+ ]),
1634
+ }),
1635
+ live: z.object({
1636
+ status: lenientUnion([
1637
+ z.literal("active"),
1638
+ z.literal("pending"),
1639
+ z.literal("inactive"),
1640
+ z.literal("unavailable"),
1641
+ ]),
1642
+ }),
1643
+ }),
1644
+ }),
1645
+ fiscalDetails: z.object({
1646
+ commercialName: z.string().nullable(),
1647
+ address: z.string().nullable(),
1648
+ location: z
1649
+ .object({
1650
+ placeId: z
1651
+ .string()
1652
+ .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}$/),
1653
+ catalogReleaseId: z.string().regex(/^dr_[A-Za-z0-9._-]+$/),
1654
+ municipalityCode: z
1655
+ .string()
1656
+ .regex(/^[0-9]{6}$/)
1657
+ .nullable(),
1658
+ name: z
1659
+ .string()
1660
+ .refine((text) => Array.from(text).length >= 1)
1661
+ .refine((text) => Array.from(text).length <= 160),
1662
+ kind: lenientUnion([
1663
+ z.literal("country"),
1664
+ z.literal("region"),
1665
+ z.literal("national_district"),
1666
+ z.literal("province"),
1667
+ z.literal("municipality"),
1668
+ z.literal("municipal_district"),
1669
+ z.literal("urban_zone"),
1670
+ z.literal("section"),
1671
+ z.literal("barrio"),
1672
+ z.literal("paraje"),
1673
+ z.literal("subbarrio"),
1674
+ ]),
1675
+ qualityStatus: lenientUnion([
1676
+ z.literal("verified"),
1677
+ z.literal("provisional"),
1678
+ z.literal("conflicted"),
1679
+ ]),
1680
+ ancestors: z
1681
+ .array(z.object({
1682
+ placeId: z
1683
+ .string()
1684
+ .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}$/),
1685
+ name: z
1686
+ .string()
1687
+ .refine((text) => Array.from(text).length >= 1)
1688
+ .refine((text) => Array.from(text).length <= 160),
1689
+ kind: lenientUnion([
1690
+ z.literal("country"),
1691
+ z.literal("region"),
1692
+ z.literal("national_district"),
1693
+ z.literal("province"),
1694
+ z.literal("municipality"),
1695
+ z.literal("municipal_district"),
1696
+ z.literal("urban_zone"),
1697
+ z.literal("section"),
1698
+ z.literal("barrio"),
1699
+ z.literal("paraje"),
1700
+ z.literal("subbarrio"),
1701
+ ]),
1702
+ qualityStatus: lenientUnion([
1703
+ z.literal("verified"),
1704
+ z.literal("provisional"),
1705
+ z.literal("conflicted"),
1706
+ ]),
1707
+ }))
1708
+ .max(32),
1709
+ })
1710
+ .nullable(),
1711
+ phone: z.string().nullable(),
1712
+ email: z.string().nullable(),
1713
+ defaultIncomeType: z.string().nullable(),
1714
+ }),
1715
+ paymentsProfile: z
1716
+ .object({
1717
+ displayName: z
1718
+ .string()
1719
+ .refine((text) => Array.from(text).length >= 1)
1720
+ .refine((text) => Array.from(text).length <= 80)
1721
+ .regex(/\S/),
1722
+ statementDescriptor: z
1723
+ .string()
1724
+ .refine((text) => Array.from(text).length >= 1)
1725
+ .refine((text) => Array.from(text).length <= 22)
1726
+ .regex(/\S/),
1727
+ permanentAddress: z.object({
1728
+ line1: z
1729
+ .string()
1730
+ .refine((text) => Array.from(text).length >= 1)
1731
+ .refine((text) => Array.from(text).length <= 160)
1300
1732
  .regex(/\S/),
1301
- url: z
1302
- .url()
1303
- .refine((text) => Array.from(text).length <= 2048)
1304
- .regex(/^https?:\/\//)
1733
+ line2: z
1734
+ .string()
1735
+ .refine((text) => Array.from(text).length >= 1)
1736
+ .refine((text) => Array.from(text).length <= 160)
1737
+ .regex(/\S/)
1738
+ .optional(),
1739
+ city: z
1740
+ .string()
1741
+ .refine((text) => Array.from(text).length >= 1)
1742
+ .refine((text) => Array.from(text).length <= 80)
1743
+ .regex(/\S/),
1744
+ province: z
1745
+ .string()
1746
+ .refine((text) => Array.from(text).length >= 1)
1747
+ .refine((text) => Array.from(text).length <= 80)
1748
+ .regex(/\S/)
1749
+ .optional(),
1750
+ postalCode: z
1751
+ .string()
1752
+ .refine((text) => Array.from(text).length >= 1)
1753
+ .refine((text) => Array.from(text).length <= 20)
1754
+ .regex(/\S/)
1305
1755
  .optional(),
1756
+ countryCode: z.string().regex(/^[A-Z]{2}$/),
1306
1757
  }),
1307
- ]),
1308
- })
1309
- .nullable(),
1310
- invoicing: z.object({
1311
- test: zMerchantBusinessFiscalSetup,
1312
- live: zMerchantBusinessLiveFiscalSetup,
1758
+ supportEmail: z.email().refine((text) => Array.from(text).length <= 254),
1759
+ supportPhone: z.string().regex(/^\+[1-9][0-9]{7,14}$/),
1760
+ deliveryPolicy: lenientUnion([
1761
+ z.object({
1762
+ kind: z.literal("not_offered"),
1763
+ }),
1764
+ z.object({
1765
+ kind: z.literal("merchant_managed"),
1766
+ summary: z
1767
+ .string()
1768
+ .refine((text) => Array.from(text).length >= 1)
1769
+ .refine((text) => Array.from(text).length <= 160)
1770
+ .regex(/\S/),
1771
+ url: z
1772
+ .url()
1773
+ .refine((text) => Array.from(text).length <= 2048)
1774
+ .regex(/^https?:\/\//)
1775
+ .optional(),
1776
+ }),
1777
+ ]),
1778
+ })
1779
+ .nullable(),
1780
+ invoicing: z.object({
1781
+ test: zMerchantBusinessFiscalSetup,
1782
+ live: zMerchantBusinessLiveFiscalSetup,
1783
+ }),
1784
+ requirements: z.array(z.object({
1785
+ code: lenientUnion([
1786
+ z.literal("capabilities_required"),
1787
+ z.literal("commercial_name_required"),
1788
+ z.literal("address_required"),
1789
+ z.literal("location_required"),
1790
+ z.literal("phone_required"),
1791
+ z.literal("default_income_type_required"),
1792
+ z.literal("contact_email_verification_required"),
1793
+ z.literal("fiscal_details_rejected"),
1794
+ z.literal("taxpayer_registration_required"),
1795
+ z.literal("signing_certificate_required"),
1796
+ z.literal("signing_certificate_expiring"),
1797
+ z.literal("test_fiscal_document_rejected"),
1798
+ z.literal("test_fiscal_document_pending"),
1799
+ z.literal("test_fiscal_document_send_pending"),
1800
+ z.literal("fiscal_binding_pending"),
1801
+ z.literal("legal_issuer_sync_pending"),
1802
+ z.literal("fiscal_setup_unavailable"),
1803
+ z.literal("fiscal_binding_conflict"),
1804
+ z.literal("fiscal_issuer_rejected"),
1805
+ z.literal("test_fiscal_document_operator_required"),
1806
+ z.literal("payments_profile_required"),
1807
+ z.literal("test_payments_unavailable"),
1808
+ z.literal("merchant_account_required"),
1809
+ z.literal("merchant_account_disabled"),
1810
+ z.literal("active_credential_required"),
1811
+ z.literal("credential_material_invalid"),
1812
+ z.literal("test_live_mode_mismatch"),
1813
+ z.literal("callback_configuration_failed"),
1814
+ z.literal("callback_configuration_required"),
1815
+ z.literal("connectivity_check_failed"),
1816
+ z.literal("connectivity_check_required"),
1817
+ z.literal("provider_qualification_failed"),
1818
+ z.literal("provider_qualification_required"),
1819
+ z.literal("provider_adapter_unavailable"),
1820
+ ]),
1821
+ owner: lenientUnion([
1822
+ z.literal("merchant"),
1823
+ z.literal("dgii"),
1824
+ z.literal("timbro"),
1825
+ z.literal("provider"),
1826
+ z.literal("operator"),
1827
+ ]),
1828
+ blocks: z.array(lenientUnion([z.literal("payments"), z.literal("invoices")])).max(2),
1829
+ mode: lenientUnion([z.literal("test"), z.literal("live")]).optional(),
1830
+ field: z.string().optional(),
1831
+ errors: z
1832
+ .array(z.object({
1833
+ code: z.string(),
1834
+ message: z.string(),
1835
+ }))
1836
+ .min(1)
1837
+ .optional(),
1838
+ })),
1839
+ onboardingUrl: z.url(),
1313
1840
  }),
1314
- requirements: z.array(z.object({
1315
- code: lenientUnion([
1316
- z.literal("capabilities_required"),
1317
- z.literal("commercial_name_required"),
1318
- z.literal("address_required"),
1319
- z.literal("location_required"),
1320
- z.literal("phone_required"),
1321
- z.literal("default_income_type_required"),
1322
- z.literal("contact_email_verification_required"),
1323
- z.literal("fiscal_details_rejected"),
1324
- z.literal("taxpayer_registration_required"),
1325
- z.literal("signing_certificate_required"),
1326
- z.literal("signing_certificate_expiring"),
1327
- z.literal("test_fiscal_document_rejected"),
1328
- z.literal("test_fiscal_document_pending"),
1329
- z.literal("test_fiscal_document_send_pending"),
1330
- z.literal("fiscal_binding_pending"),
1331
- z.literal("legal_issuer_sync_pending"),
1332
- z.literal("fiscal_setup_unavailable"),
1333
- z.literal("fiscal_binding_conflict"),
1334
- z.literal("fiscal_issuer_rejected"),
1335
- z.literal("test_fiscal_document_operator_required"),
1336
- z.literal("payments_profile_required"),
1337
- z.literal("test_payments_unavailable"),
1338
- z.literal("merchant_account_required"),
1339
- z.literal("merchant_account_disabled"),
1340
- z.literal("active_credential_required"),
1341
- z.literal("credential_material_invalid"),
1342
- z.literal("test_live_mode_mismatch"),
1343
- z.literal("callback_configuration_failed"),
1344
- z.literal("callback_configuration_required"),
1345
- z.literal("connectivity_check_failed"),
1346
- z.literal("connectivity_check_required"),
1347
- z.literal("provider_qualification_failed"),
1348
- z.literal("provider_qualification_required"),
1349
- z.literal("provider_adapter_unavailable"),
1350
- ]),
1351
- owner: lenientUnion([
1352
- z.literal("merchant"),
1353
- z.literal("dgii"),
1354
- z.literal("timbro"),
1355
- z.literal("provider"),
1356
- z.literal("operator"),
1357
- ]),
1358
- blocks: z.array(lenientUnion([z.literal("payments"), z.literal("invoices")])).max(2),
1359
- mode: lenientUnion([z.literal("test"), z.literal("live")]).optional(),
1360
- field: z.string().optional(),
1361
- errors: z
1362
- .array(z.object({
1363
- code: z.string(),
1364
- message: z.string(),
1365
- }))
1366
- .min(1)
1367
- .optional(),
1368
- })),
1369
- onboardingUrl: z.url(),
1370
- });
1841
+ lenientUnion([
1842
+ z.object({
1843
+ object: z.literal("merchant_business_certification"),
1844
+ status: z.literal("not_started"),
1845
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1846
+ availablePaths: z
1847
+ .array(lenientUnion([z.literal("own_software"), z.literal("external_software")]))
1848
+ .min(1),
1849
+ recommendedPath: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1850
+ actions: z.array(z.literal("start")).max(1),
1851
+ }),
1852
+ z.object({
1853
+ object: z.literal("merchant_business_certification"),
1854
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1855
+ revision: z.int().gte(1),
1856
+ status: z.literal("in_progress"),
1857
+ path: lenientUnion([z.literal("own_software"), z.literal("external_software")]),
1858
+ software: z.object({
1859
+ name: z
1860
+ .string()
1861
+ .refine((text) => Array.from(text).length >= 1)
1862
+ .refine((text) => Array.from(text).length <= 128),
1863
+ version: z
1864
+ .string()
1865
+ .refine((text) => Array.from(text).length >= 1)
1866
+ .refine((text) => Array.from(text).length <= 64),
1867
+ }),
1868
+ phase: lenientUnion([
1869
+ z.literal("preparation"),
1870
+ z.literal("application"),
1871
+ z.literal("tests"),
1872
+ z.literal("authorization"),
1873
+ ]),
1874
+ serviceUrls: z
1875
+ .object({
1876
+ reception: z.url(),
1877
+ commercialApproval: z.url(),
1878
+ })
1879
+ .nullable(),
1880
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1881
+ actions: z.array(lenientUnion([
1882
+ z.literal("report_evidence"),
1883
+ z.literal("import_certificate"),
1884
+ z.literal("upload_test_set"),
1885
+ ])),
1886
+ steps: z.tuple([
1887
+ zMerchantBusinessCertificationStep,
1888
+ zMerchantBusinessCertificationStep,
1889
+ zMerchantBusinessCertificationStep,
1890
+ zMerchantBusinessCertificationStep,
1891
+ zMerchantBusinessCertificationStep,
1892
+ zMerchantBusinessCertificationStep,
1893
+ zMerchantBusinessCertificationStep,
1894
+ zMerchantBusinessCertificationStep,
1895
+ zMerchantBusinessCertificationStep,
1896
+ zMerchantBusinessCertificationStep,
1897
+ zMerchantBusinessCertificationStep,
1898
+ zMerchantBusinessCertificationStep,
1899
+ zMerchantBusinessCertificationStep,
1900
+ zMerchantBusinessCertificationStep,
1901
+ zMerchantBusinessCertificationStep,
1902
+ ]),
1903
+ }),
1904
+ ]),
1905
+ ]);
1371
1906
  /**
1372
1907
  * MerchantBusinessTestFiscalDocumentRequest
1373
1908
  */