@timbro/invoices 0.11.0 → 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 (37) hide show
  1. package/README.md +20 -0
  2. package/dist/admin.d.ts +1 -1
  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 +544 -4
  11. package/dist/generated/hosted/types.gen.d.ts.map +1 -1
  12. package/dist/generated/hosted/zod-response.gen.d.ts +5734 -223
  13. package/dist/generated/hosted/zod-response.gen.d.ts.map +1 -1
  14. package/dist/generated/hosted/zod-response.gen.js +628 -201
  15. package/dist/generated/hosted/zod.gen.d.ts +1406 -7
  16. package/dist/generated/hosted/zod.gen.d.ts.map +1 -1
  17. package/dist/generated/hosted/zod.gen.js +724 -237
  18. package/dist/generated/index.d.ts +2 -2
  19. package/dist/generated/index.d.ts.map +1 -1
  20. package/dist/generated/index.js +1 -1
  21. package/dist/generated/types.gen.d.ts +11 -2
  22. package/dist/generated/types.gen.d.ts.map +1 -1
  23. package/dist/generated/zod-response.gen.d.ts +18 -0
  24. package/dist/generated/zod-response.gen.d.ts.map +1 -1
  25. package/dist/generated/zod-response.gen.js +11 -1
  26. package/dist/generated/zod.gen.d.ts +23 -0
  27. package/dist/generated/zod.gen.d.ts.map +1 -1
  28. package/dist/generated/zod.gen.js +16 -2
  29. package/dist/hosted-tenant.d.ts +9 -0
  30. package/dist/hosted-tenant.d.ts.map +1 -1
  31. package/dist/hosted-tenant.js +7 -0
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/invoice-hosted-controls.d.ts +22 -3
  35. package/dist/invoice-hosted-controls.d.ts.map +1 -1
  36. package/dist/invoice-hosted-controls.js +48 -12
  37. package/package.json +2 -2
@@ -243,6 +243,20 @@ export const zMerchantBusinessLiveFiscalSetup = z.union([
243
243
  */
244
244
  export const zProblem = z.strictObject({
245
245
  code: z.enum([
246
+ "authorization_not_found",
247
+ "authorization_checkout_reference_invalid",
248
+ "authorization_reference_conflict",
249
+ "authorization_capture_conflict",
250
+ "authorization_capture_exceeds_hold",
251
+ "authorization_not_capturable",
252
+ "authorization_not_cancelable",
253
+ "authorization_not_editable",
254
+ "authorization_submission_invalid",
255
+ "authorization_authentication_pending",
256
+ "authorization_credentials_unavailable",
257
+ "authorization_dispatch_refused",
258
+ "authorization_hold_evidence_missing",
259
+ "provider_qualification_required",
246
260
  "merchant_authentication_unavailable",
247
261
  "platform_test_profile_unavailable",
248
262
  "merchant_fiscal_binding_unavailable",
@@ -283,6 +297,10 @@ export const zProblem = z.strictObject({
283
297
  "merchant_business_not_member",
284
298
  "merchant_business_revision_conflict",
285
299
  "merchant_business_capabilities_required",
300
+ "merchant_business_certification_path_unavailable",
301
+ "merchant_business_certification_requirements_unmet",
302
+ "merchant_business_certification_revision_conflict",
303
+ "merchant_business_certification_evidence_not_found",
286
304
  "merchant_fiscal_setup_incomplete",
287
305
  "merchant_payment_setup_assessment_incomplete",
288
306
  "merchant_certificate_conflict",
@@ -442,6 +460,9 @@ export const zProblem = z.strictObject({
442
460
  "refund_tip_amount_invalid",
443
461
  "refund_tip_allocation_unknown",
444
462
  "refund_amount_invalid",
463
+ "refund_tax_amount_invalid",
464
+ "refund_tax_amount_required",
465
+ "refund_tax_allocation_unknown",
445
466
  "refund_currency_mismatch",
446
467
  "payer_fiscal_profile_invalid",
447
468
  "rate_limit_exceeded",
@@ -597,6 +618,92 @@ export const zProblem = z.strictObject({
597
618
  title: z.string(),
598
619
  type: z.enum(["about:blank"]),
599
620
  });
621
+ /**
622
+ * MerchantBusinessCertificationRequirement
623
+ */
624
+ export const zMerchantBusinessCertificationRequirement = z.strictObject({
625
+ code: z.union([
626
+ z.literal("invoices_not_requested"),
627
+ z.literal("fiscal_details_incomplete"),
628
+ z.literal("certification_binding_required"),
629
+ z.literal("certification_certificate_required"),
630
+ z.literal("provider_eligibility_unverified"),
631
+ z.literal("certification_receiver_urls_pending"),
632
+ z.literal("certification_test_set_processing_unavailable"),
633
+ ]),
634
+ owner: z.union([
635
+ z.literal("merchant"),
636
+ z.literal("dgii"),
637
+ z.literal("timbro"),
638
+ z.literal("operator"),
639
+ ]),
640
+ blocks: z
641
+ .array(z.union([z.literal("start"), z.literal("step_1"), z.literal("step_2"), z.literal("step_7")]))
642
+ .max(4),
643
+ field: z.string().optional(),
644
+ });
645
+ /**
646
+ * MerchantBusinessCertificationEvidence
647
+ *
648
+ * A business-reported DGII outcome. It remains unverified until an authorized evidence review confirms it.
649
+ */
650
+ export const zMerchantBusinessCertificationEvidence = z.strictObject({
651
+ id: z.string().refine((text) => Array.from(text).length >= 1),
652
+ outcome: z.union([
653
+ z.literal("submitted"),
654
+ z.literal("approved"),
655
+ z.literal("rejected"),
656
+ z.literal("needs_correction"),
657
+ ]),
658
+ verification: z.union([
659
+ z.literal("user_reported"),
660
+ z.literal("operator_verified"),
661
+ z.literal("operator_rejected"),
662
+ ]),
663
+ reference: z
664
+ .string()
665
+ .refine((text) => Array.from(text).length <= 255)
666
+ .nullable(),
667
+ createdAt: z.iso.datetime(),
668
+ reviewedAt: z.iso.datetime().optional(),
669
+ reviewReference: z
670
+ .string()
671
+ .refine((text) => Array.from(text).length <= 512)
672
+ .optional(),
673
+ });
674
+ /**
675
+ * MerchantBusinessCertificationStep
676
+ */
677
+ export const zMerchantBusinessCertificationStep = z.strictObject({
678
+ number: z.union([
679
+ z.literal(1),
680
+ z.literal(2),
681
+ z.literal(3),
682
+ z.literal(4),
683
+ z.literal(5),
684
+ z.literal(6),
685
+ z.literal(7),
686
+ z.literal(8),
687
+ z.literal(9),
688
+ z.literal(10),
689
+ z.literal(11),
690
+ z.literal(12),
691
+ z.literal(13),
692
+ z.literal(14),
693
+ z.literal(15),
694
+ ]),
695
+ code: z.string().refine((text) => Array.from(text).length >= 1),
696
+ title: z.string().refine((text) => Array.from(text).length >= 1),
697
+ actor: z.union([z.literal("merchant"), z.literal("dgii"), z.literal("timbro")]),
698
+ status: z.union([
699
+ z.literal("blocked"),
700
+ z.literal("action_required"),
701
+ z.literal("awaiting_dgii"),
702
+ z.literal("reported"),
703
+ z.literal("verified"),
704
+ ]),
705
+ evidence: z.array(zMerchantBusinessCertificationEvidence),
706
+ });
600
707
  /**
601
708
  * MerchantBusiness
602
709
  *
@@ -1221,6 +1328,313 @@ export const zUpdateBusinessResponse = z.strictObject({
1221
1328
  })),
1222
1329
  onboardingUrl: z.url(),
1223
1330
  });
1331
+ /**
1332
+ * MerchantBusinessCertification
1333
+ *
1334
+ * Durable certification preparation and user-reported DGII progress for the authenticated business.
1335
+ */
1336
+ export const zRetrieveMerchantBusinessCertificationResponse = z.union([
1337
+ z.strictObject({
1338
+ object: z.literal("merchant_business_certification"),
1339
+ status: z.literal("not_started"),
1340
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1341
+ availablePaths: z
1342
+ .array(z.union([z.literal("own_software"), z.literal("external_software")]))
1343
+ .min(1),
1344
+ recommendedPath: z.union([z.literal("own_software"), z.literal("external_software")]),
1345
+ actions: z.array(z.literal("start")).max(1),
1346
+ }),
1347
+ z.strictObject({
1348
+ object: z.literal("merchant_business_certification"),
1349
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1350
+ revision: z.int().gte(1),
1351
+ status: z.literal("in_progress"),
1352
+ path: z.union([z.literal("own_software"), z.literal("external_software")]),
1353
+ software: z.strictObject({
1354
+ name: z
1355
+ .string()
1356
+ .refine((text) => Array.from(text).length >= 1)
1357
+ .refine((text) => Array.from(text).length <= 128),
1358
+ version: z
1359
+ .string()
1360
+ .refine((text) => Array.from(text).length >= 1)
1361
+ .refine((text) => Array.from(text).length <= 64),
1362
+ }),
1363
+ phase: z.union([
1364
+ z.literal("preparation"),
1365
+ z.literal("application"),
1366
+ z.literal("tests"),
1367
+ z.literal("authorization"),
1368
+ ]),
1369
+ serviceUrls: z
1370
+ .strictObject({
1371
+ reception: z.url(),
1372
+ commercialApproval: z.url(),
1373
+ })
1374
+ .nullable(),
1375
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1376
+ actions: z.array(z.union([z.literal("report_evidence"), z.literal("import_certificate")])),
1377
+ steps: z.tuple([
1378
+ zMerchantBusinessCertificationStep,
1379
+ zMerchantBusinessCertificationStep,
1380
+ zMerchantBusinessCertificationStep,
1381
+ zMerchantBusinessCertificationStep,
1382
+ zMerchantBusinessCertificationStep,
1383
+ zMerchantBusinessCertificationStep,
1384
+ zMerchantBusinessCertificationStep,
1385
+ zMerchantBusinessCertificationStep,
1386
+ zMerchantBusinessCertificationStep,
1387
+ zMerchantBusinessCertificationStep,
1388
+ zMerchantBusinessCertificationStep,
1389
+ zMerchantBusinessCertificationStep,
1390
+ zMerchantBusinessCertificationStep,
1391
+ zMerchantBusinessCertificationStep,
1392
+ zMerchantBusinessCertificationStep,
1393
+ ]),
1394
+ }),
1395
+ ]);
1396
+ /**
1397
+ * MerchantBusinessCertificationStartRequest
1398
+ */
1399
+ export const zStartMerchantBusinessCertificationBody = z.strictObject({
1400
+ path: z.union([z.literal("own_software"), z.literal("external_software")]),
1401
+ });
1402
+ export const zStartMerchantBusinessCertificationHeaders = z.object({
1403
+ "idempotency-key": z
1404
+ .string()
1405
+ .refine((text) => Array.from(text).length >= 1)
1406
+ .refine((text) => Array.from(text).length <= 255)
1407
+ .regex(/^[\x20-\x7e]+$/),
1408
+ });
1409
+ export const zStartMerchantBusinessCertificationResponse = z.union([
1410
+ z.union([
1411
+ z.strictObject({
1412
+ object: z.literal("merchant_business_certification"),
1413
+ status: z.literal("not_started"),
1414
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1415
+ availablePaths: z
1416
+ .array(z.union([z.literal("own_software"), z.literal("external_software")]))
1417
+ .min(1),
1418
+ recommendedPath: z.union([z.literal("own_software"), z.literal("external_software")]),
1419
+ actions: z.array(z.literal("start")).max(1),
1420
+ }),
1421
+ z.strictObject({
1422
+ object: z.literal("merchant_business_certification"),
1423
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1424
+ revision: z.int().gte(1),
1425
+ status: z.literal("in_progress"),
1426
+ path: z.union([z.literal("own_software"), z.literal("external_software")]),
1427
+ software: z.strictObject({
1428
+ name: z
1429
+ .string()
1430
+ .refine((text) => Array.from(text).length >= 1)
1431
+ .refine((text) => Array.from(text).length <= 128),
1432
+ version: z
1433
+ .string()
1434
+ .refine((text) => Array.from(text).length >= 1)
1435
+ .refine((text) => Array.from(text).length <= 64),
1436
+ }),
1437
+ phase: z.union([
1438
+ z.literal("preparation"),
1439
+ z.literal("application"),
1440
+ z.literal("tests"),
1441
+ z.literal("authorization"),
1442
+ ]),
1443
+ serviceUrls: z
1444
+ .strictObject({
1445
+ reception: z.url(),
1446
+ commercialApproval: z.url(),
1447
+ })
1448
+ .nullable(),
1449
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1450
+ actions: z.array(z.union([z.literal("report_evidence"), z.literal("import_certificate")])),
1451
+ steps: z.tuple([
1452
+ zMerchantBusinessCertificationStep,
1453
+ zMerchantBusinessCertificationStep,
1454
+ zMerchantBusinessCertificationStep,
1455
+ zMerchantBusinessCertificationStep,
1456
+ zMerchantBusinessCertificationStep,
1457
+ zMerchantBusinessCertificationStep,
1458
+ zMerchantBusinessCertificationStep,
1459
+ zMerchantBusinessCertificationStep,
1460
+ zMerchantBusinessCertificationStep,
1461
+ zMerchantBusinessCertificationStep,
1462
+ zMerchantBusinessCertificationStep,
1463
+ zMerchantBusinessCertificationStep,
1464
+ zMerchantBusinessCertificationStep,
1465
+ zMerchantBusinessCertificationStep,
1466
+ zMerchantBusinessCertificationStep,
1467
+ ]),
1468
+ }),
1469
+ ]),
1470
+ z.union([
1471
+ z.strictObject({
1472
+ object: z.literal("merchant_business_certification"),
1473
+ status: z.literal("not_started"),
1474
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1475
+ availablePaths: z
1476
+ .array(z.union([z.literal("own_software"), z.literal("external_software")]))
1477
+ .min(1),
1478
+ recommendedPath: z.union([z.literal("own_software"), z.literal("external_software")]),
1479
+ actions: z.array(z.literal("start")).max(1),
1480
+ }),
1481
+ z.strictObject({
1482
+ object: z.literal("merchant_business_certification"),
1483
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1484
+ revision: z.int().gte(1),
1485
+ status: z.literal("in_progress"),
1486
+ path: z.union([z.literal("own_software"), z.literal("external_software")]),
1487
+ software: z.strictObject({
1488
+ name: z
1489
+ .string()
1490
+ .refine((text) => Array.from(text).length >= 1)
1491
+ .refine((text) => Array.from(text).length <= 128),
1492
+ version: z
1493
+ .string()
1494
+ .refine((text) => Array.from(text).length >= 1)
1495
+ .refine((text) => Array.from(text).length <= 64),
1496
+ }),
1497
+ phase: z.union([
1498
+ z.literal("preparation"),
1499
+ z.literal("application"),
1500
+ z.literal("tests"),
1501
+ z.literal("authorization"),
1502
+ ]),
1503
+ serviceUrls: z
1504
+ .strictObject({
1505
+ reception: z.url(),
1506
+ commercialApproval: z.url(),
1507
+ })
1508
+ .nullable(),
1509
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1510
+ actions: z.array(z.union([z.literal("report_evidence"), z.literal("import_certificate")])),
1511
+ steps: z.tuple([
1512
+ zMerchantBusinessCertificationStep,
1513
+ zMerchantBusinessCertificationStep,
1514
+ zMerchantBusinessCertificationStep,
1515
+ zMerchantBusinessCertificationStep,
1516
+ zMerchantBusinessCertificationStep,
1517
+ zMerchantBusinessCertificationStep,
1518
+ zMerchantBusinessCertificationStep,
1519
+ zMerchantBusinessCertificationStep,
1520
+ zMerchantBusinessCertificationStep,
1521
+ zMerchantBusinessCertificationStep,
1522
+ zMerchantBusinessCertificationStep,
1523
+ zMerchantBusinessCertificationStep,
1524
+ zMerchantBusinessCertificationStep,
1525
+ zMerchantBusinessCertificationStep,
1526
+ zMerchantBusinessCertificationStep,
1527
+ ]),
1528
+ }),
1529
+ ]),
1530
+ ]);
1531
+ /**
1532
+ * MerchantBusinessCertificationEvidenceRequest
1533
+ */
1534
+ export const zSubmitMerchantBusinessCertificationEvidenceBody = z.strictObject({
1535
+ expectedRevision: z.int().gte(1),
1536
+ step: z.union([
1537
+ z.literal(1),
1538
+ z.literal(2),
1539
+ z.literal(3),
1540
+ z.literal(4),
1541
+ z.literal(5),
1542
+ z.literal(6),
1543
+ z.literal(7),
1544
+ z.literal(8),
1545
+ z.literal(9),
1546
+ z.literal(10),
1547
+ z.literal(11),
1548
+ z.literal(12),
1549
+ z.literal(13),
1550
+ z.literal(14),
1551
+ z.literal(15),
1552
+ ]),
1553
+ outcome: z.union([
1554
+ z.literal("submitted"),
1555
+ z.literal("approved"),
1556
+ z.literal("rejected"),
1557
+ z.literal("needs_correction"),
1558
+ ]),
1559
+ reference: z
1560
+ .string()
1561
+ .refine((text) => Array.from(text).length >= 1)
1562
+ .refine((text) => Array.from(text).length <= 255)
1563
+ .regex(/^[^\p{C}]*$/u)
1564
+ .optional(),
1565
+ });
1566
+ export const zSubmitMerchantBusinessCertificationEvidenceHeaders = z.object({
1567
+ "idempotency-key": z
1568
+ .string()
1569
+ .refine((text) => Array.from(text).length >= 1)
1570
+ .refine((text) => Array.from(text).length <= 255)
1571
+ .regex(/^[\x20-\x7e]+$/),
1572
+ });
1573
+ /**
1574
+ * MerchantBusinessCertification
1575
+ *
1576
+ * Durable certification preparation and user-reported DGII progress for the authenticated business.
1577
+ */
1578
+ export const zSubmitMerchantBusinessCertificationEvidenceResponse = z.union([
1579
+ z.strictObject({
1580
+ object: z.literal("merchant_business_certification"),
1581
+ status: z.literal("not_started"),
1582
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1583
+ availablePaths: z
1584
+ .array(z.union([z.literal("own_software"), z.literal("external_software")]))
1585
+ .min(1),
1586
+ recommendedPath: z.union([z.literal("own_software"), z.literal("external_software")]),
1587
+ actions: z.array(z.literal("start")).max(1),
1588
+ }),
1589
+ z.strictObject({
1590
+ object: z.literal("merchant_business_certification"),
1591
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1592
+ revision: z.int().gte(1),
1593
+ status: z.literal("in_progress"),
1594
+ path: z.union([z.literal("own_software"), z.literal("external_software")]),
1595
+ software: z.strictObject({
1596
+ name: z
1597
+ .string()
1598
+ .refine((text) => Array.from(text).length >= 1)
1599
+ .refine((text) => Array.from(text).length <= 128),
1600
+ version: z
1601
+ .string()
1602
+ .refine((text) => Array.from(text).length >= 1)
1603
+ .refine((text) => Array.from(text).length <= 64),
1604
+ }),
1605
+ phase: z.union([
1606
+ z.literal("preparation"),
1607
+ z.literal("application"),
1608
+ z.literal("tests"),
1609
+ z.literal("authorization"),
1610
+ ]),
1611
+ serviceUrls: z
1612
+ .strictObject({
1613
+ reception: z.url(),
1614
+ commercialApproval: z.url(),
1615
+ })
1616
+ .nullable(),
1617
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1618
+ actions: z.array(z.union([z.literal("report_evidence"), z.literal("import_certificate")])),
1619
+ steps: z.tuple([
1620
+ zMerchantBusinessCertificationStep,
1621
+ zMerchantBusinessCertificationStep,
1622
+ zMerchantBusinessCertificationStep,
1623
+ zMerchantBusinessCertificationStep,
1624
+ zMerchantBusinessCertificationStep,
1625
+ zMerchantBusinessCertificationStep,
1626
+ zMerchantBusinessCertificationStep,
1627
+ zMerchantBusinessCertificationStep,
1628
+ zMerchantBusinessCertificationStep,
1629
+ zMerchantBusinessCertificationStep,
1630
+ zMerchantBusinessCertificationStep,
1631
+ zMerchantBusinessCertificationStep,
1632
+ zMerchantBusinessCertificationStep,
1633
+ zMerchantBusinessCertificationStep,
1634
+ zMerchantBusinessCertificationStep,
1635
+ ]),
1636
+ }),
1637
+ ]);
1224
1638
  /**
1225
1639
  * MerchantBusinessConfigureInvoicingRequest
1226
1640
  */
@@ -1246,264 +1660,337 @@ export const zConfigureInvoicingResponse = z.strictObject({
1246
1660
  /**
1247
1661
  * MerchantBusinessSigningCertificateRequest
1248
1662
  */
1249
- export const zImportSigningCertificateBody = z.strictObject({
1250
- mode: z.union([z.literal("test"), z.literal("live")]),
1251
- certificateP12Base64: z
1252
- .string()
1253
- .refine((text) => Array.from(text).length >= 24)
1254
- .refine((text) => Array.from(text).length <= 200000),
1255
- password: z
1256
- .string()
1257
- .refine((text) => Array.from(text).length >= 1)
1258
- .refine((text) => Array.from(text).length <= 256),
1259
- });
1663
+ export const zImportSigningCertificateBody = z.union([
1664
+ z.strictObject({
1665
+ mode: z.union([z.literal("test"), z.literal("live")]),
1666
+ certificateP12Base64: z
1667
+ .string()
1668
+ .refine((text) => Array.from(text).length >= 24)
1669
+ .refine((text) => Array.from(text).length <= 200000),
1670
+ password: z
1671
+ .string()
1672
+ .refine((text) => Array.from(text).length >= 1)
1673
+ .refine((text) => Array.from(text).length <= 256),
1674
+ }),
1675
+ z.strictObject({
1676
+ purpose: z.literal("certification"),
1677
+ certificateP12Base64: z
1678
+ .string()
1679
+ .refine((text) => Array.from(text).length >= 24)
1680
+ .refine((text) => Array.from(text).length <= 200000),
1681
+ password: z
1682
+ .string()
1683
+ .refine((text) => Array.from(text).length >= 1)
1684
+ .refine((text) => Array.from(text).length <= 256),
1685
+ }),
1686
+ ]);
1260
1687
  /**
1261
- * MerchantBusiness
1262
- *
1263
- * The business the credential selects, its capabilities, and the requirements that remain.
1688
+ * Default Response
1264
1689
  */
1265
- export const zImportSigningCertificateResponse = z.strictObject({
1266
- object: z.literal("merchant_business"),
1267
- id: z.string().regex(/^mbiz_[0-9a-hjkmnp-tv-z]{24,}$/),
1268
- rnc: z.string().regex(/^[0-9]{9}$/),
1269
- legalName: z.string().refine((text) => Array.from(text).length >= 1),
1270
- revision: z.int().gte(0),
1271
- capabilities: z.strictObject({
1272
- payments: z.strictObject({
1273
- requested: z.boolean(),
1274
- test: z.strictObject({
1275
- status: z.union([
1276
- z.literal("active"),
1277
- z.literal("pending"),
1278
- z.literal("inactive"),
1279
- z.literal("unavailable"),
1280
- ]),
1690
+ export const zImportSigningCertificateResponse = z.union([
1691
+ z.strictObject({
1692
+ object: z.literal("merchant_business"),
1693
+ id: z.string().regex(/^mbiz_[0-9a-hjkmnp-tv-z]{24,}$/),
1694
+ rnc: z.string().regex(/^[0-9]{9}$/),
1695
+ legalName: z.string().refine((text) => Array.from(text).length >= 1),
1696
+ revision: z.int().gte(0),
1697
+ capabilities: z.strictObject({
1698
+ payments: z.strictObject({
1699
+ requested: z.boolean(),
1700
+ test: z.strictObject({
1701
+ status: z.union([
1702
+ z.literal("active"),
1703
+ z.literal("pending"),
1704
+ z.literal("inactive"),
1705
+ z.literal("unavailable"),
1706
+ ]),
1707
+ }),
1708
+ live: z.strictObject({
1709
+ status: z.union([
1710
+ z.literal("active"),
1711
+ z.literal("pending"),
1712
+ z.literal("inactive"),
1713
+ z.literal("unavailable"),
1714
+ ]),
1715
+ }),
1281
1716
  }),
1282
- live: z.strictObject({
1283
- status: z.union([
1284
- z.literal("active"),
1285
- z.literal("pending"),
1286
- z.literal("inactive"),
1287
- z.literal("unavailable"),
1288
- ]),
1717
+ invoices: z.strictObject({
1718
+ requested: z.boolean(),
1719
+ test: z.strictObject({
1720
+ status: z.union([
1721
+ z.literal("active"),
1722
+ z.literal("pending"),
1723
+ z.literal("inactive"),
1724
+ z.literal("unavailable"),
1725
+ ]),
1726
+ }),
1727
+ live: z.strictObject({
1728
+ status: z.union([
1729
+ z.literal("active"),
1730
+ z.literal("pending"),
1731
+ z.literal("inactive"),
1732
+ z.literal("unavailable"),
1733
+ ]),
1734
+ }),
1289
1735
  }),
1290
1736
  }),
1291
- invoices: z.strictObject({
1292
- requested: z.boolean(),
1293
- test: z.strictObject({
1294
- status: z.union([
1295
- z.literal("active"),
1296
- z.literal("pending"),
1297
- z.literal("inactive"),
1298
- z.literal("unavailable"),
1737
+ fiscalDetails: z.strictObject({
1738
+ commercialName: z.string().nullable(),
1739
+ address: z.string().nullable(),
1740
+ location: z
1741
+ .strictObject({
1742
+ placeId: z
1743
+ .string()
1744
+ .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}$/),
1745
+ catalogReleaseId: z.string().regex(/^dr_[A-Za-z0-9._-]+$/),
1746
+ municipalityCode: z
1747
+ .string()
1748
+ .regex(/^[0-9]{6}$/)
1749
+ .nullable(),
1750
+ name: z
1751
+ .string()
1752
+ .refine((text) => Array.from(text).length >= 1)
1753
+ .refine((text) => Array.from(text).length <= 160),
1754
+ kind: z.union([
1755
+ z.literal("country"),
1756
+ z.literal("region"),
1757
+ z.literal("national_district"),
1758
+ z.literal("province"),
1759
+ z.literal("municipality"),
1760
+ z.literal("municipal_district"),
1761
+ z.literal("urban_zone"),
1762
+ z.literal("section"),
1763
+ z.literal("barrio"),
1764
+ z.literal("paraje"),
1765
+ z.literal("subbarrio"),
1299
1766
  ]),
1300
- }),
1301
- live: z.strictObject({
1302
- status: z.union([
1303
- z.literal("active"),
1304
- z.literal("pending"),
1305
- z.literal("inactive"),
1306
- z.literal("unavailable"),
1767
+ qualityStatus: z.union([
1768
+ z.literal("verified"),
1769
+ z.literal("provisional"),
1770
+ z.literal("conflicted"),
1307
1771
  ]),
1308
- }),
1309
- }),
1310
- }),
1311
- fiscalDetails: z.strictObject({
1312
- commercialName: z.string().nullable(),
1313
- address: z.string().nullable(),
1314
- location: z
1315
- .strictObject({
1316
- placeId: z
1317
- .string()
1318
- .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}$/),
1319
- catalogReleaseId: z.string().regex(/^dr_[A-Za-z0-9._-]+$/),
1320
- municipalityCode: z
1321
- .string()
1322
- .regex(/^[0-9]{6}$/)
1772
+ ancestors: z
1773
+ .array(z.strictObject({
1774
+ placeId: z
1775
+ .string()
1776
+ .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}$/),
1777
+ name: z
1778
+ .string()
1779
+ .refine((text) => Array.from(text).length >= 1)
1780
+ .refine((text) => Array.from(text).length <= 160),
1781
+ kind: z.union([
1782
+ z.literal("country"),
1783
+ z.literal("region"),
1784
+ z.literal("national_district"),
1785
+ z.literal("province"),
1786
+ z.literal("municipality"),
1787
+ z.literal("municipal_district"),
1788
+ z.literal("urban_zone"),
1789
+ z.literal("section"),
1790
+ z.literal("barrio"),
1791
+ z.literal("paraje"),
1792
+ z.literal("subbarrio"),
1793
+ ]),
1794
+ qualityStatus: z.union([
1795
+ z.literal("verified"),
1796
+ z.literal("provisional"),
1797
+ z.literal("conflicted"),
1798
+ ]),
1799
+ }))
1800
+ .max(32),
1801
+ })
1323
1802
  .nullable(),
1324
- name: z
1325
- .string()
1326
- .refine((text) => Array.from(text).length >= 1)
1327
- .refine((text) => Array.from(text).length <= 160),
1328
- kind: z.union([
1329
- z.literal("country"),
1330
- z.literal("region"),
1331
- z.literal("national_district"),
1332
- z.literal("province"),
1333
- z.literal("municipality"),
1334
- z.literal("municipal_district"),
1335
- z.literal("urban_zone"),
1336
- z.literal("section"),
1337
- z.literal("barrio"),
1338
- z.literal("paraje"),
1339
- z.literal("subbarrio"),
1340
- ]),
1341
- qualityStatus: z.union([
1342
- z.literal("verified"),
1343
- z.literal("provisional"),
1344
- z.literal("conflicted"),
1345
- ]),
1346
- ancestors: z
1347
- .array(z.strictObject({
1348
- placeId: z
1349
- .string()
1350
- .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}$/),
1351
- name: z
1352
- .string()
1353
- .refine((text) => Array.from(text).length >= 1)
1354
- .refine((text) => Array.from(text).length <= 160),
1355
- kind: z.union([
1356
- z.literal("country"),
1357
- z.literal("region"),
1358
- z.literal("national_district"),
1359
- z.literal("province"),
1360
- z.literal("municipality"),
1361
- z.literal("municipal_district"),
1362
- z.literal("urban_zone"),
1363
- z.literal("section"),
1364
- z.literal("barrio"),
1365
- z.literal("paraje"),
1366
- z.literal("subbarrio"),
1367
- ]),
1368
- qualityStatus: z.union([
1369
- z.literal("verified"),
1370
- z.literal("provisional"),
1371
- z.literal("conflicted"),
1372
- ]),
1373
- }))
1374
- .max(32),
1375
- })
1376
- .nullable(),
1377
- phone: z.string().nullable(),
1378
- email: z.string().nullable(),
1379
- defaultIncomeType: z.string().nullable(),
1380
- }),
1381
- paymentsProfile: z
1382
- .strictObject({
1383
- displayName: z
1384
- .string()
1385
- .refine((text) => Array.from(text).length >= 1)
1386
- .refine((text) => Array.from(text).length <= 80)
1387
- .regex(/\S/),
1388
- statementDescriptor: z
1389
- .string()
1390
- .refine((text) => Array.from(text).length >= 1)
1391
- .refine((text) => Array.from(text).length <= 22)
1392
- .regex(/\S/),
1393
- permanentAddress: z.strictObject({
1394
- line1: z
1395
- .string()
1396
- .refine((text) => Array.from(text).length >= 1)
1397
- .refine((text) => Array.from(text).length <= 160)
1398
- .regex(/\S/),
1399
- line2: z
1400
- .string()
1401
- .refine((text) => Array.from(text).length >= 1)
1402
- .refine((text) => Array.from(text).length <= 160)
1403
- .regex(/\S/)
1404
- .optional(),
1405
- city: z
1803
+ phone: z.string().nullable(),
1804
+ email: z.string().nullable(),
1805
+ defaultIncomeType: z.string().nullable(),
1806
+ }),
1807
+ paymentsProfile: z
1808
+ .strictObject({
1809
+ displayName: z
1406
1810
  .string()
1407
1811
  .refine((text) => Array.from(text).length >= 1)
1408
1812
  .refine((text) => Array.from(text).length <= 80)
1409
1813
  .regex(/\S/),
1410
- province: z
1411
- .string()
1412
- .refine((text) => Array.from(text).length >= 1)
1413
- .refine((text) => Array.from(text).length <= 80)
1414
- .regex(/\S/)
1415
- .optional(),
1416
- postalCode: z
1814
+ statementDescriptor: z
1417
1815
  .string()
1418
1816
  .refine((text) => Array.from(text).length >= 1)
1419
- .refine((text) => Array.from(text).length <= 20)
1420
- .regex(/\S/)
1421
- .optional(),
1422
- countryCode: z.string().regex(/^[A-Z]{2}$/),
1423
- }),
1424
- supportEmail: z.email().refine((text) => Array.from(text).length <= 254),
1425
- supportPhone: z.string().regex(/^\+[1-9][0-9]{7,14}$/),
1426
- deliveryPolicy: z.union([
1427
- z.strictObject({
1428
- kind: z.literal("not_offered"),
1429
- }),
1430
- z.strictObject({
1431
- kind: z.literal("merchant_managed"),
1432
- summary: z
1817
+ .refine((text) => Array.from(text).length <= 22)
1818
+ .regex(/\S/),
1819
+ permanentAddress: z.strictObject({
1820
+ line1: z
1433
1821
  .string()
1434
1822
  .refine((text) => Array.from(text).length >= 1)
1435
1823
  .refine((text) => Array.from(text).length <= 160)
1436
1824
  .regex(/\S/),
1437
- url: z
1438
- .url()
1439
- .refine((text) => Array.from(text).length <= 2048)
1440
- .regex(/^https?:\/\//)
1825
+ line2: z
1826
+ .string()
1827
+ .refine((text) => Array.from(text).length >= 1)
1828
+ .refine((text) => Array.from(text).length <= 160)
1829
+ .regex(/\S/)
1830
+ .optional(),
1831
+ city: z
1832
+ .string()
1833
+ .refine((text) => Array.from(text).length >= 1)
1834
+ .refine((text) => Array.from(text).length <= 80)
1835
+ .regex(/\S/),
1836
+ province: z
1837
+ .string()
1838
+ .refine((text) => Array.from(text).length >= 1)
1839
+ .refine((text) => Array.from(text).length <= 80)
1840
+ .regex(/\S/)
1441
1841
  .optional(),
1842
+ postalCode: z
1843
+ .string()
1844
+ .refine((text) => Array.from(text).length >= 1)
1845
+ .refine((text) => Array.from(text).length <= 20)
1846
+ .regex(/\S/)
1847
+ .optional(),
1848
+ countryCode: z.string().regex(/^[A-Z]{2}$/),
1442
1849
  }),
1443
- ]),
1444
- })
1445
- .nullable(),
1446
- invoicing: z.strictObject({
1447
- test: zMerchantBusinessFiscalSetup,
1448
- live: zMerchantBusinessLiveFiscalSetup,
1850
+ supportEmail: z.email().refine((text) => Array.from(text).length <= 254),
1851
+ supportPhone: z.string().regex(/^\+[1-9][0-9]{7,14}$/),
1852
+ deliveryPolicy: z.union([
1853
+ z.strictObject({
1854
+ kind: z.literal("not_offered"),
1855
+ }),
1856
+ z.strictObject({
1857
+ kind: z.literal("merchant_managed"),
1858
+ summary: z
1859
+ .string()
1860
+ .refine((text) => Array.from(text).length >= 1)
1861
+ .refine((text) => Array.from(text).length <= 160)
1862
+ .regex(/\S/),
1863
+ url: z
1864
+ .url()
1865
+ .refine((text) => Array.from(text).length <= 2048)
1866
+ .regex(/^https?:\/\//)
1867
+ .optional(),
1868
+ }),
1869
+ ]),
1870
+ })
1871
+ .nullable(),
1872
+ invoicing: z.strictObject({
1873
+ test: zMerchantBusinessFiscalSetup,
1874
+ live: zMerchantBusinessLiveFiscalSetup,
1875
+ }),
1876
+ requirements: z.array(z.strictObject({
1877
+ code: z.union([
1878
+ z.literal("capabilities_required"),
1879
+ z.literal("commercial_name_required"),
1880
+ z.literal("address_required"),
1881
+ z.literal("location_required"),
1882
+ z.literal("phone_required"),
1883
+ z.literal("default_income_type_required"),
1884
+ z.literal("contact_email_verification_required"),
1885
+ z.literal("fiscal_details_rejected"),
1886
+ z.literal("taxpayer_registration_required"),
1887
+ z.literal("signing_certificate_required"),
1888
+ z.literal("signing_certificate_expiring"),
1889
+ z.literal("test_fiscal_document_rejected"),
1890
+ z.literal("test_fiscal_document_pending"),
1891
+ z.literal("test_fiscal_document_send_pending"),
1892
+ z.literal("fiscal_binding_pending"),
1893
+ z.literal("legal_issuer_sync_pending"),
1894
+ z.literal("fiscal_setup_unavailable"),
1895
+ z.literal("fiscal_binding_conflict"),
1896
+ z.literal("fiscal_issuer_rejected"),
1897
+ z.literal("test_fiscal_document_operator_required"),
1898
+ z.literal("payments_profile_required"),
1899
+ z.literal("test_payments_unavailable"),
1900
+ z.literal("merchant_account_required"),
1901
+ z.literal("merchant_account_disabled"),
1902
+ z.literal("active_credential_required"),
1903
+ z.literal("credential_material_invalid"),
1904
+ z.literal("test_live_mode_mismatch"),
1905
+ z.literal("callback_configuration_failed"),
1906
+ z.literal("callback_configuration_required"),
1907
+ z.literal("connectivity_check_failed"),
1908
+ z.literal("connectivity_check_required"),
1909
+ z.literal("provider_qualification_failed"),
1910
+ z.literal("provider_qualification_required"),
1911
+ z.literal("provider_adapter_unavailable"),
1912
+ ]),
1913
+ owner: z.union([
1914
+ z.literal("merchant"),
1915
+ z.literal("dgii"),
1916
+ z.literal("timbro"),
1917
+ z.literal("provider"),
1918
+ z.literal("operator"),
1919
+ ]),
1920
+ blocks: z.array(z.union([z.literal("payments"), z.literal("invoices")])).max(2),
1921
+ mode: z.union([z.literal("test"), z.literal("live")]).optional(),
1922
+ field: z.string().optional(),
1923
+ errors: z
1924
+ .array(z.strictObject({
1925
+ code: z.string(),
1926
+ message: z.string(),
1927
+ }))
1928
+ .min(1)
1929
+ .optional(),
1930
+ })),
1931
+ onboardingUrl: z.url(),
1449
1932
  }),
1450
- requirements: z.array(z.strictObject({
1451
- code: z.union([
1452
- z.literal("capabilities_required"),
1453
- z.literal("commercial_name_required"),
1454
- z.literal("address_required"),
1455
- z.literal("location_required"),
1456
- z.literal("phone_required"),
1457
- z.literal("default_income_type_required"),
1458
- z.literal("contact_email_verification_required"),
1459
- z.literal("fiscal_details_rejected"),
1460
- z.literal("taxpayer_registration_required"),
1461
- z.literal("signing_certificate_required"),
1462
- z.literal("signing_certificate_expiring"),
1463
- z.literal("test_fiscal_document_rejected"),
1464
- z.literal("test_fiscal_document_pending"),
1465
- z.literal("test_fiscal_document_send_pending"),
1466
- z.literal("fiscal_binding_pending"),
1467
- z.literal("legal_issuer_sync_pending"),
1468
- z.literal("fiscal_setup_unavailable"),
1469
- z.literal("fiscal_binding_conflict"),
1470
- z.literal("fiscal_issuer_rejected"),
1471
- z.literal("test_fiscal_document_operator_required"),
1472
- z.literal("payments_profile_required"),
1473
- z.literal("test_payments_unavailable"),
1474
- z.literal("merchant_account_required"),
1475
- z.literal("merchant_account_disabled"),
1476
- z.literal("active_credential_required"),
1477
- z.literal("credential_material_invalid"),
1478
- z.literal("test_live_mode_mismatch"),
1479
- z.literal("callback_configuration_failed"),
1480
- z.literal("callback_configuration_required"),
1481
- z.literal("connectivity_check_failed"),
1482
- z.literal("connectivity_check_required"),
1483
- z.literal("provider_qualification_failed"),
1484
- z.literal("provider_qualification_required"),
1485
- z.literal("provider_adapter_unavailable"),
1486
- ]),
1487
- owner: z.union([
1488
- z.literal("merchant"),
1489
- z.literal("dgii"),
1490
- z.literal("timbro"),
1491
- z.literal("provider"),
1492
- z.literal("operator"),
1493
- ]),
1494
- blocks: z.array(z.union([z.literal("payments"), z.literal("invoices")])).max(2),
1495
- mode: z.union([z.literal("test"), z.literal("live")]).optional(),
1496
- field: z.string().optional(),
1497
- errors: z
1498
- .array(z.strictObject({
1499
- code: z.string(),
1500
- message: z.string(),
1501
- }))
1502
- .min(1)
1503
- .optional(),
1504
- })),
1505
- onboardingUrl: z.url(),
1506
- });
1933
+ z.union([
1934
+ z.strictObject({
1935
+ object: z.literal("merchant_business_certification"),
1936
+ status: z.literal("not_started"),
1937
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1938
+ availablePaths: z
1939
+ .array(z.union([z.literal("own_software"), z.literal("external_software")]))
1940
+ .min(1),
1941
+ recommendedPath: z.union([z.literal("own_software"), z.literal("external_software")]),
1942
+ actions: z.array(z.literal("start")).max(1),
1943
+ }),
1944
+ z.strictObject({
1945
+ object: z.literal("merchant_business_certification"),
1946
+ id: z.string().regex(/^cert_[a-z0-9]{24,}$/),
1947
+ revision: z.int().gte(1),
1948
+ status: z.literal("in_progress"),
1949
+ path: z.union([z.literal("own_software"), z.literal("external_software")]),
1950
+ software: z.strictObject({
1951
+ name: z
1952
+ .string()
1953
+ .refine((text) => Array.from(text).length >= 1)
1954
+ .refine((text) => Array.from(text).length <= 128),
1955
+ version: z
1956
+ .string()
1957
+ .refine((text) => Array.from(text).length >= 1)
1958
+ .refine((text) => Array.from(text).length <= 64),
1959
+ }),
1960
+ phase: z.union([
1961
+ z.literal("preparation"),
1962
+ z.literal("application"),
1963
+ z.literal("tests"),
1964
+ z.literal("authorization"),
1965
+ ]),
1966
+ serviceUrls: z
1967
+ .strictObject({
1968
+ reception: z.url(),
1969
+ commercialApproval: z.url(),
1970
+ })
1971
+ .nullable(),
1972
+ requirements: z.array(zMerchantBusinessCertificationRequirement),
1973
+ actions: z.array(z.union([z.literal("report_evidence"), z.literal("import_certificate")])),
1974
+ steps: z.tuple([
1975
+ zMerchantBusinessCertificationStep,
1976
+ zMerchantBusinessCertificationStep,
1977
+ zMerchantBusinessCertificationStep,
1978
+ zMerchantBusinessCertificationStep,
1979
+ zMerchantBusinessCertificationStep,
1980
+ zMerchantBusinessCertificationStep,
1981
+ zMerchantBusinessCertificationStep,
1982
+ zMerchantBusinessCertificationStep,
1983
+ zMerchantBusinessCertificationStep,
1984
+ zMerchantBusinessCertificationStep,
1985
+ zMerchantBusinessCertificationStep,
1986
+ zMerchantBusinessCertificationStep,
1987
+ zMerchantBusinessCertificationStep,
1988
+ zMerchantBusinessCertificationStep,
1989
+ zMerchantBusinessCertificationStep,
1990
+ ]),
1991
+ }),
1992
+ ]),
1993
+ ]);
1507
1994
  /**
1508
1995
  * MerchantBusinessTestFiscalDocumentRequest
1509
1996
  */