@timbro/invoices 0.13.0 → 0.14.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 (42) hide show
  1. package/README.md +26 -2
  2. package/dist/admin.d.ts +1 -1
  3. package/dist/admin.d.ts.map +1 -1
  4. package/dist/fiscal-engine-runtime.manifest.json +21 -16
  5. package/dist/fiscal-engine-runtime.provenance.json +22 -17
  6. package/dist/generated/certification-api-contract.d.ts +1 -1
  7. package/dist/generated/certification-api-contract.d.ts.map +1 -1
  8. package/dist/generated/certification-api-contract.js +1 -1
  9. package/dist/generated/hosted/types.gen.d.ts +40 -5
  10. package/dist/generated/hosted/types.gen.d.ts.map +1 -1
  11. package/dist/generated/hosted/zod-response.gen.d.ts +28 -14
  12. package/dist/generated/hosted/zod-response.gen.d.ts.map +1 -1
  13. package/dist/generated/hosted/zod-response.gen.js +90 -0
  14. package/dist/generated/hosted/zod.gen.d.ts +10 -5
  15. package/dist/generated/hosted/zod.gen.d.ts.map +1 -1
  16. package/dist/generated/hosted/zod.gen.js +90 -0
  17. package/dist/generated/index.d.ts +3 -3
  18. package/dist/generated/index.d.ts.map +1 -1
  19. package/dist/generated/index.js +2 -2
  20. package/dist/generated/invoice-api-contract.d.ts +242 -13
  21. package/dist/generated/invoice-api-contract.d.ts.map +1 -1
  22. package/dist/generated/invoice-api-contract.js +370 -13
  23. package/dist/generated/problem-catalog.d.ts.map +1 -1
  24. package/dist/generated/problem-catalog.js +13 -0
  25. package/dist/generated/sdk.gen.d.ts +4 -2
  26. package/dist/generated/sdk.gen.d.ts.map +1 -1
  27. package/dist/generated/sdk.gen.js +70 -2
  28. package/dist/generated/types.gen.d.ts +200 -15
  29. package/dist/generated/types.gen.d.ts.map +1 -1
  30. package/dist/generated/zod-response.gen.d.ts +668 -305
  31. package/dist/generated/zod-response.gen.d.ts.map +1 -1
  32. package/dist/generated/zod-response.gen.js +95 -7
  33. package/dist/generated/zod.gen.d.ts +15673 -591
  34. package/dist/generated/zod.gen.d.ts.map +1 -1
  35. package/dist/generated/zod.gen.js +329 -22
  36. package/dist/hosted-tenant.d.ts +12 -1
  37. package/dist/hosted-tenant.d.ts.map +1 -1
  38. package/dist/hosted-tenant.js +13 -1
  39. package/dist/problem-contract.d.ts +5 -1
  40. package/dist/problem-contract.d.ts.map +1 -1
  41. package/dist/timbro_fiscal_engine_bg.wasm +0 -0
  42. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
- import { zAcceptInvitationResponse, zApproveDirectConnectionRequestResponse, zAuthorizeAuthorityRejectedReplacementResponse, zBeginVercelSourceProviderInstallationResponse, zCancelDirectConnectionRequestResponse, zCloseWorkspaceSessionResponse, zCompleteLegalIssuerProfileResponse, zCompleteSourceConnectionActivationVerificationResponse, zCompleteVercelSourceProviderInstallationResponse, zConfirmDirectConnectionResponse, zCreateCertificateCustodyBindingResponse, zCreateDirectConnectionRequestResponse, zCreateFiscalOperationResponse, zCreateHostedInvoiceResponse, zCreateHostedTenantResponse, zCreateHostedTenantWebhookSecretRotationResponse, zCreateInvoiceDeliveryResponse, zCreateInvoiceResponse, zCreateOrganizationResponse, zCreateSourceConnectionResponse, zDeclareReceptionMountResponse, zDownloadHostedInvoicePdfResponse, zDownloadHostedInvoiceXmlResponse, zDownloadInvoicePdfResponse, zDownloadInvoiceReceiptPdfResponse, zDownloadInvoiceXmlResponse, zFindFiscalArtifactResponse, zFindFiscalOperationBySourceResponse, zFindFiscalOperationResponse, zGetSourceReceivedDocumentResponse, zHealthLiveResponse, zHealthReadyResponse, zImportHostedCertificateCustodyResponse, zInspectFiscalNumberAuthorizationHistoryResponse, zInviteMemberResponse, zIssueHostedInvoiceCredentialResponse, zListAuthorizedVercelProjectsResponse, zListCertificateCustodyBindingsResponse, zListFiscalOperationsResponse, zListHostedInvoicesResponse, zListInvitationsResponse, zListInvoicesResponse, zListLegalIssuersResponse, zListOrganizationFiscalOperationsResponse, zListReceivedDocumentsResponse, zListSourceConnectionsResponse, zListSourceProviderAuthorizationsResponse, zListSourceReceivedDocumentsResponse, zListWebhookDeliveriesResponse, zOpenWorkspaceSessionResponse, zPollDirectConnectionRequestResponse, zPreviewDirectConnectionRequestResponse, zPreviewHostedInvoiceResponse, zPreviewInvoiceResponse, zProblemBody, zReadAuditEventsResponse, zReadAuthorizedVercelProjectQualificationResponse, zReadCertificateCustodyBindingResponse, zReadCurrentUserAccountResponse, zReadElectronicFiscalDocumentEligibilityResponse, zReadFiscalOperationTimingResponse, zReadOnboardingLegalIssuerIdentityResponse, zReadOnboardingReadinessResponse, zReadOnboardingServiceScopeResponse, zReadOrganizationFiscalOperationResponse, zReadReceivedDocumentResponse, zReadSourceConnectionResponse, zReadSourceProviderAuthorizationResponse, zRecordCommercialResponseResponse, zRecoverSourceConnectionActivationResponse, zRegisterFiscalNumberAuthorizationResponse, zRegisterLegalIssuerResponse, zRegisterUserAccountResponse, zRegisterWebhookEndpointResponse, zReleaseHostedTenantResponse, zReplaceHostedInvoiceResponse, zReplaceInvoiceResponse, zReplayWebhookEventsResponse, zRespondToReceivedDocumentResponse, zRetrieveFiscalDeliveryPrintedRepresentationResponse, zRetrieveHostedCertificationTestSetResponse, zRetrieveHostedInvoiceResponse, zRetrieveHostedIssuanceReadinessResponse, zRetrieveInvoiceDeliveryResponse, zRetrieveInvoiceReceiptResponse, zRetrieveInvoiceResponse, zRetrieveIssuanceReadinessResponse, zRetrieveWorkspaceFiscalArtifactResponse, zRevokeCertificateCustodyCertificateVersionResponse, zShareHostedInvoiceReceiptResponse, zShareInvoiceReceiptResponse, zUpdateOnboardingLegalIssuerIdentityResponse, zUpdateOnboardingServiceScopeResponse, zUploadHostedCertificationTestSetResponse, } from "./zod-response.gen.js";
2
+ import { zAcceptInvitationResponse, zApproveDirectConnectionRequestResponse, zAuthorizeAuthorityRejectedReplacementResponse, zBeginVercelSourceProviderInstallationResponse, zCancelDirectConnectionRequestResponse, zCloseWorkspaceSessionResponse, zCompleteLegalIssuerProfileResponse, zCompleteSourceConnectionActivationVerificationResponse, zCompleteVercelSourceProviderInstallationResponse, zConfirmDirectConnectionResponse, zCreateCertificateCustodyBindingResponse, zCreateDirectConnectionRequestResponse, zCreateFiscalOperationResponse, zCreateHostedInvoiceResponse, zCreateHostedTenantResponse, zCreateHostedTenantWebhookSecretRotationResponse, zCreateInvoiceDeliveryResponse, zCreateInvoiceResponse, zCreateOrganizationResponse, zCreateSourceConnectionResponse, zDeclareReceptionMountResponse, zDownloadHostedInvoicePdfResponse, zDownloadHostedInvoiceXmlResponse, zDownloadInvoicePdfResponse, zDownloadInvoiceReceiptPdfResponse, zDownloadInvoiceXmlResponse, zFindFiscalArtifactResponse, zFindFiscalOperationBySourceResponse, zFindFiscalOperationResponse, zGetSourceReceivedDocumentResponse, zHealthLiveResponse, zHealthReadyResponse, zImportHostedCertificateCustodyResponse, zInspectFiscalNumberAuthorizationHistoryResponse, zInviteMemberResponse, zIssueHostedInvoiceCredentialResponse, zListAuthorizedVercelProjectsResponse, zListCertificateCustodyBindingsResponse, zListFiscalOperationsResponse, zListHostedInvoicesResponse, zListInvitationsResponse, zListInvoicesResponse, zListLegalIssuersResponse, zListOrganizationFiscalOperationsResponse, zListReceivedDocumentsResponse, zListSourceConnectionsResponse, zListSourceProviderAuthorizationsResponse, zListSourceReceivedDocumentsResponse, zListWebhookDeliveriesResponse, zOpenWorkspaceSessionResponse, zPollDirectConnectionRequestResponse, zPreviewDirectConnectionRequestResponse, zPreviewHostedInvoiceResponse, zPreviewInvoiceResponse, zProblemBody, zReadAuditEventsResponse, zReadAuthorizedVercelProjectQualificationResponse, zReadCertificateCustodyBindingResponse, zReadCurrentUserAccountResponse, zReadElectronicFiscalDocumentEligibilityResponse, zReadFiscalOperationTimingResponse, zReadOnboardingLegalIssuerIdentityResponse, zReadOnboardingReadinessResponse, zReadOnboardingServiceScopeResponse, zReadOrganizationFiscalOperationResponse, zReadReceivedDocumentResponse, zReadSourceConnectionResponse, zReadSourceProviderAuthorizationResponse, zRecordCommercialResponseResponse, zRecoverSourceConnectionActivationResponse, zRegisterFiscalNumberAuthorizationResponse, zRegisterLegalIssuerResponse, zRegisterUserAccountResponse, zRegisterWebhookEndpointResponse, zReleaseHostedTenantResponse, zRepairHostedTenantSourceConnectionResponse, zReplaceHostedInvoiceResponse, zReplaceInvoiceResponse, zReplayWebhookEventsResponse, zRespondToReceivedDocumentResponse, zRetrieveFiscalDeliveryPrintedRepresentationResponse, zRetrieveHostedCertificationTestSetResponse, zRetrieveHostedInvoiceResponse, zRetrieveHostedIssuanceReadinessResponse, zRetrieveInvoiceDeliveryResponse, zRetrieveInvoiceReceiptResponse, zRetrieveInvoiceResponse, zRetrieveIssuanceReadinessResponse, zRetrieveWorkspaceFiscalArtifactResponse, zRevokeCertificateCustodyCertificateVersionResponse, zShareHostedInvoiceReceiptResponse, zShareInvoiceReceiptResponse, zUpdateOnboardingLegalIssuerIdentityResponse, zUpdateOnboardingServiceScopeResponse, zUploadHostedCertificationTestSetResponse, } from "./zod-response.gen.js";
3
3
  export const healthLive = (options) => options.client.get({
4
4
  response_decoder: (response) => {
5
5
  switch (response.status) {
@@ -194,6 +194,73 @@ export const releaseHostedTenant = (options) => options.client.post({
194
194
  ...options.headers,
195
195
  },
196
196
  });
197
+ export const repairHostedTenantSourceConnection = (options) => options.client.post({
198
+ response_decoder: (response) => {
199
+ switch (response.status) {
200
+ case 200:
201
+ return {
202
+ status: 200,
203
+ headers: response.headers,
204
+ body: zRepairHostedTenantSourceConnectionResponse.parse(response.body),
205
+ };
206
+ case 400:
207
+ return {
208
+ status: 400,
209
+ headers: response.headers,
210
+ body: zProblemBody.parse(response.body),
211
+ };
212
+ case 401:
213
+ return {
214
+ status: 401,
215
+ headers: response.headers,
216
+ body: zProblemBody.parse(response.body),
217
+ };
218
+ case 403:
219
+ return {
220
+ status: 403,
221
+ headers: response.headers,
222
+ body: zProblemBody.parse(response.body),
223
+ };
224
+ case 404:
225
+ return {
226
+ status: 404,
227
+ headers: response.headers,
228
+ body: zProblemBody.parse(response.body),
229
+ };
230
+ case 413:
231
+ return {
232
+ status: 413,
233
+ headers: response.headers,
234
+ body: zProblemBody.parse(response.body),
235
+ };
236
+ case 415:
237
+ return {
238
+ status: 415,
239
+ headers: response.headers,
240
+ body: zProblemBody.parse(response.body),
241
+ };
242
+ case 500:
243
+ return {
244
+ status: 500,
245
+ headers: response.headers,
246
+ body: zProblemBody.parse(response.body),
247
+ };
248
+ default:
249
+ return {
250
+ status: "unexpected",
251
+ status_code: response.status,
252
+ headers: response.headers,
253
+ body: response.body,
254
+ };
255
+ }
256
+ },
257
+ url: "/hosted/tenants/source-connection-repairs",
258
+ ...options,
259
+ headers: {
260
+ "Content-Type": "application/json",
261
+ ...options.headers,
262
+ },
263
+ });
197
264
  export const createHostedTenantWebhookSecretRotation = (options) => options.client.post({
198
265
  response_decoder: (response) => {
199
266
  switch (response.status) {
@@ -1497,7 +1564,7 @@ export const retrieveFiscalDeliveryPrintedRepresentation = (options) => options.
1497
1564
  ...options,
1498
1565
  });
1499
1566
  /**
1500
- * Imports a hosted tenant's P12 into certificate custody for its exact environment binding. The environment defaults to sandbox; production is available when that tenant has a production binding. Timbro verifies the certificate identity, trust, validity, signer proof, and custody envelope.
1567
+ * Imports a hosted tenant's P12 into certificate custody once for its Legal issuer. The named environment (default sandbox) is the binding the import is made from, and the certificate then serves every environment the issuer is bound in. An environment bound later adopts it without another upload. Timbro verifies the certificate identity, trust, validity, signer proof, and custody envelope, and refuses the whole import with the environment that cannot use the certificate: it already uses a different certificate, its certificate was revoked, or it enrolled another signer.
1501
1568
  */
1502
1569
  export const importHostedCertificateCustody = (options) => options.client.post({
1503
1570
  response_decoder: (response) => {
@@ -5453,6 +5520,7 @@ export const healthLivePathTemplate = "/health/live";
5453
5520
  export const healthReadyPathTemplate = "/health/ready";
5454
5521
  export const createHostedTenantPathTemplate = "/hosted/tenants";
5455
5522
  export const releaseHostedTenantPathTemplate = "/hosted/tenants/releases";
5523
+ export const repairHostedTenantSourceConnectionPathTemplate = "/hosted/tenants/source-connection-repairs";
5456
5524
  export const createHostedTenantWebhookSecretRotationPathTemplate = "/hosted/tenants/{source_connection_id}/webhook-secret-rotations";
5457
5525
  export const uploadHostedCertificationTestSetPathTemplate = "/internal/hosted/certification/{attemptReference}/test-sets";
5458
5526
  export const retrieveHostedCertificationTestSetPathTemplate = "/internal/hosted/certification/{attemptReference}/test-sets/current";
@@ -681,7 +681,7 @@ export type FiscalNumberAuthorizationHistoryResource = {
681
681
  /**
682
682
  * Provenance strength of a fiscal-number authorization fact.
683
683
  */
684
- export type FiscalNumberAuthorizationKnowledge = "verified" | "reported";
684
+ export type FiscalNumberAuthorizationKnowledge = "verified" | "reported" | "disputed";
685
685
  export type FiscalNumberAuthorizationLineage = {
686
686
  current: FiscalNumberAuthorizationResource;
687
687
  generations: Array<FiscalNumberAuthorizationResource>;
@@ -721,7 +721,7 @@ export type FiscalNumberAuthorizationResource = {
721
721
  /**
722
722
  * Origin of a fiscal-number authorization fact.
723
723
  */
724
- export type FiscalNumberAuthorizationSourceKind = "official_source_manifest" | "operator_attested" | "caller_reported";
724
+ export type FiscalNumberAuthorizationSourceKind = "official_source_manifest" | "operator_attested" | "caller_reported" | "dgii_response";
725
725
  /**
726
726
  * Lifecycle state of a fiscal-number authorization fact.
727
727
  */
@@ -930,6 +930,11 @@ export type HostedImportRequest = {
930
930
  };
931
931
  export type HostedImportResponse = {
932
932
  certificate_subject_common_name: string | null;
933
+ /**
934
+ * The environments the Legal issuer's certificate now serves, in sandbox, certification, then
935
+ * production order. An environment bound later adopts the certificate when it is bound.
936
+ */
937
+ environments: Array<HostedCertificateImportEnvironment>;
933
938
  object: string;
934
939
  signer_subject_serial_number: string;
935
940
  };
@@ -959,6 +964,10 @@ export type HostedReceiverUrls = {
959
964
  commercial_approval_url: string;
960
965
  reception_url: string;
961
966
  };
967
+ /**
968
+ * What the repair did to the binding's Source connection.
969
+ */
970
+ export type HostedSourceConnectionRepairOutcome = "reconnected" | "already_connected";
962
971
  export type HostedTenantResource = {
963
972
  /**
964
973
  * The binding identity the Checkout host uses for an exact release request.
@@ -1132,6 +1141,10 @@ export type InvoiceCreditNotePaymentTerms = {
1132
1141
  } | {
1133
1142
  type: "free";
1134
1143
  };
1144
+ /**
1145
+ * A calendar date in the public API's ISO 8601 date form.
1146
+ */
1147
+ export type InvoiceDate = string;
1135
1148
  export type InvoiceDebitNoteModificationCode = "2" | "3";
1136
1149
  export type InvoiceDeliveryAttachmentSelection = {
1137
1150
  /**
@@ -1199,6 +1212,24 @@ export type InvoiceExportItem = {
1199
1212
  unit: SourceMeasurementUnit;
1200
1213
  unitPrice: string;
1201
1214
  };
1215
+ /**
1216
+ * A document issued outside Timbro that a legal note modifies.
1217
+ *
1218
+ * `fiscalNumber` is the original e-NCF (`E`, the two type digits, and ten digits) or paper NCF
1219
+ * (`B` and ten digits, or `A` or `P` and eighteen digits). `issuerTaxId` is DGII's RNC Otro
1220
+ * Contribuyente and applies only when the original was issued under a different RNC than the
1221
+ * note, for example after a merger or split. `buyer` is the original's buyer and may be omitted
1222
+ * for an anonymous consumer document. `total` is the original's total and is required when the
1223
+ * original is an e-CF type 32, because DGII requires the buyer's identity on a note against a
1224
+ * type 32 of DOP 250,000.00 or more.
1225
+ */
1226
+ export type InvoiceExternalOriginal = {
1227
+ buyer?: null | InvoiceConsumerBuyer | undefined;
1228
+ fiscalNumber: string;
1229
+ issuedOn: InvoiceDate;
1230
+ issuerTaxId?: null | string | undefined;
1231
+ total?: null | string | undefined;
1232
+ };
1202
1233
  export type InvoiceFiles = {
1203
1234
  pdf: InvoicePdfReadiness;
1204
1235
  xml: InvoiceXmlReadiness;
@@ -1319,10 +1350,7 @@ export type InvoiceItemResource = {
1319
1350
  legalTip: boolean;
1320
1351
  quantity: string;
1321
1352
  tax: InvoiceTax;
1322
- /**
1323
- * A named common unit, or the retained DGII code for another official unit.
1324
- */
1325
- unit: string;
1353
+ unit: SourceMeasurementUnit;
1326
1354
  unitPrice: string;
1327
1355
  withholding: null | InvoiceItemWithholding;
1328
1356
  };
@@ -1705,12 +1733,33 @@ export type InvoiceRequest = {
1705
1733
  items: Array<InvoiceItem>;
1706
1734
  modificationCode: InvoiceDebitNoteModificationCode;
1707
1735
  numbering?: null | InvoiceNumbering | undefined;
1736
+ /**
1737
+ * The Invoice Timbro issued that this note modifies. The note takes its buyer from that Invoice.
1738
+ */
1708
1739
  originalInvoiceId: string;
1709
1740
  paymentTerms: InvoicePaymentTerms;
1710
1741
  pdfLayout?: null | InvoicePdfLayout | undefined;
1711
1742
  reason: string;
1712
1743
  source?: null | InvoiceSourceInput | undefined;
1713
1744
  type: "E33";
1745
+ } | {
1746
+ additionalInformation?: null | InvoiceAdditionalInformation | undefined;
1747
+ currency: "DOP";
1748
+ expectedTotals?: null | InvoiceExpectedTotals | undefined;
1749
+ externalOriginal: InvoiceExternalOriginal;
1750
+ incomeType?: null | "01" | "02" | "03" | "04" | "05" | "06" | undefined;
1751
+ /**
1752
+ * The only field a source-system reference travels in, bounded at 128 characters.
1753
+ */
1754
+ invoiceReference: string;
1755
+ items: Array<InvoiceItem>;
1756
+ modificationCode: InvoiceDebitNoteModificationCode;
1757
+ numbering?: null | InvoiceNumbering | undefined;
1758
+ paymentTerms: InvoicePaymentTerms;
1759
+ pdfLayout?: null | InvoicePdfLayout | undefined;
1760
+ reason: string;
1761
+ source?: null | InvoiceSourceInput | undefined;
1762
+ type: "E33";
1714
1763
  } | {
1715
1764
  additionalInformation?: null | InvoiceAdditionalInformation | undefined;
1716
1765
  currency: "DOP";
@@ -1723,12 +1772,33 @@ export type InvoiceRequest = {
1723
1772
  items: Array<InvoiceItem>;
1724
1773
  modificationCode: InvoiceCreditNoteModificationCode;
1725
1774
  numbering?: null | InvoiceNumbering | undefined;
1775
+ /**
1776
+ * The Invoice Timbro issued that this note modifies. The note takes its buyer from that Invoice.
1777
+ */
1726
1778
  originalInvoiceId: string;
1727
1779
  paymentTerms: InvoiceCreditNotePaymentTerms;
1728
1780
  pdfLayout?: null | InvoicePdfLayout | undefined;
1729
1781
  reason: string;
1730
1782
  source?: null | InvoiceSourceInput | undefined;
1731
1783
  type: "E34";
1784
+ } | {
1785
+ additionalInformation?: null | InvoiceAdditionalInformation | undefined;
1786
+ currency: "DOP";
1787
+ expectedTotals?: null | InvoiceExpectedTotals | undefined;
1788
+ externalOriginal: InvoiceExternalOriginal;
1789
+ incomeType?: null | "01" | "02" | "03" | "04" | "05" | "06" | undefined;
1790
+ /**
1791
+ * The only field a source-system reference travels in, bounded at 128 characters.
1792
+ */
1793
+ invoiceReference: string;
1794
+ items: Array<InvoiceItem>;
1795
+ modificationCode: InvoiceCreditNoteModificationCode;
1796
+ numbering?: null | InvoiceNumbering | undefined;
1797
+ paymentTerms: InvoiceCreditNotePaymentTerms;
1798
+ pdfLayout?: null | InvoicePdfLayout | undefined;
1799
+ reason: string;
1800
+ source?: null | InvoiceSourceInput | undefined;
1801
+ type: "E34";
1732
1802
  };
1733
1803
  export type InvoiceResource = {
1734
1804
  acceptedAt: string | null;
@@ -2254,7 +2324,7 @@ export type InvoiceXmlReadiness = {
2254
2324
  /**
2255
2325
  * One stable reason the authoritative rules refuse to issue.
2256
2326
  */
2257
- export type IssuanceBlocker = "invalid_request" | "unsupported_protocol" | "unsupported_rules_version" | "invalid_resolved_facts" | "numbering_verifier_missing" | "numbering_mode_not_enabled" | "document_type_not_recognized" | "authorization_missing" | "authorization_not_observed_on_effective_date" | "authorization_suspended" | "authorization_cancelled" | "authorization_superseded" | "authorization_exhausted" | "authorization_conflicting" | "authorization_document_type_mismatch" | "central_assignment_requires_verified_authorization" | "authorization_expired" | "authorization_range_overlap" | "fiscal_number_capacity_exhausted" | "invalid_fiscal_number" | "fiscal_number_outside_authorized_range" | "fiscal_number_before_verified_floor" | "sequence_expiration_mismatch";
2327
+ export type IssuanceBlocker = "invalid_request" | "unsupported_protocol" | "unsupported_rules_version" | "invalid_resolved_facts" | "numbering_verifier_missing" | "numbering_mode_not_enabled" | "document_type_not_recognized" | "authorization_missing" | "authorization_not_observed_on_effective_date" | "authorization_suspended" | "authorization_cancelled" | "authorization_superseded" | "authorization_exhausted" | "authorization_conflicting" | "authorization_document_type_mismatch" | "sequence_rejected_by_dgii" | "authorization_expired" | "authorization_range_overlap" | "fiscal_number_capacity_exhausted" | "invalid_fiscal_number" | "fiscal_number_outside_authorized_range" | "fiscal_number_before_verified_floor" | "sequence_expiration_mismatch";
2258
2328
  /**
2259
2329
  * Whether the issuer can issue each e-CF type now in this environment.
2260
2330
  */
@@ -2267,7 +2337,7 @@ export type IssuanceReadiness = {
2267
2337
  environment: FiscalEnvironment;
2268
2338
  issuerTaxId: string;
2269
2339
  };
2270
- export type IssuanceReadinessReason = "legal_issuer_profile_incomplete" | "signing_certificate_missing" | "signing_certificate_expired" | "signing_certificate_not_yet_valid" | "authorization_missing" | "authorization_not_active" | "authorization_not_verified" | "authorization_not_observed" | "range_exhausted" | "authorization_expiration_invalid" | "authorization_expired" | "authorization_range_overlap";
2340
+ export type IssuanceReadinessReason = "legal_issuer_profile_incomplete" | "signing_certificate_missing" | "signing_certificate_expired" | "signing_certificate_not_yet_valid" | "authorization_missing" | "authorization_not_active" | "sequence_rejected_by_dgii" | "authorization_not_observed" | "range_exhausted" | "authorization_expiration_invalid" | "authorization_expired" | "authorization_range_overlap";
2271
2341
  export type LedgerCounter = string;
2272
2342
  export type LegalIssuer = {
2273
2343
  address: string | null;
@@ -2354,10 +2424,20 @@ export type NumberedFiscalDocument = {
2354
2424
  fiscal_number: string;
2355
2425
  sequence_expires_on: string | null;
2356
2426
  };
2427
+ /**
2428
+ * Whether DGII has accepted an e-CF numbered from the range Timbro would assign from. Either way
2429
+ * the range is issuable.
2430
+ */
2431
+ export type NumberingConfirmation = "confirmed" | "not_yet_confirmed";
2357
2432
  /**
2358
2433
  * The range Timbro assigns the next fiscal number of this type from.
2359
2434
  */
2360
2435
  export type NumberingRange = {
2436
+ /**
2437
+ * Whether DGII has accepted an e-CF numbered from this range. A range that is not yet
2438
+ * confirmed still issues; a range DGII rejected is blocked with `sequence_rejected_by_dgii`.
2439
+ */
2440
+ confirmation: NumberingConfirmation;
2361
2441
  /**
2362
2442
  * The sequence expiry, or `null` for a type without one (E32 and E34).
2363
2443
  */
@@ -2553,7 +2633,7 @@ export type ProblemType = "about:blank";
2553
2633
  /**
2554
2634
  * One stable public problem code returned on the `/v1` surface.
2555
2635
  */
2556
- export type PublicProblemCode = "unauthenticated" | "invalid_login" | "email_already_registered" | "organization_slug_taken" | "organization_not_found" | "hosted_tenant_conflict" | "insufficient_role" | "service_role_not_permitted" | "invalid_fiscal_identity" | "invalid_certificate_custody_signer_identity" | "certificate_p12_password_invalid" | "custody_certificate_malformed" | "custody_certificate_not_yet_valid" | "custody_certificate_expired" | "custody_p12_work_limit_exceeded" | "custody_signature_algorithm_unsupported" | "custody_certificate_trust_profile_unsupported" | "custody_certificate_chain_untrusted" | "custody_certificate_purpose_unsupported" | "legal_issuer_already_registered" | "onboarding_legal_issuer_identity_conflict" | "legal_issuer_profile_incomplete" | "legal_issuer_not_found" | "invitation_invalid" | "invitation_expired" | "already_a_member" | "environment_not_active" | "certificate_custody_binding_not_found" | "certificate_custody_binding_conflict" | "certificate_custody_certificate_version_not_active" | "source_connection_not_found" | "source_connection_not_connected" | "source_provider_unavailable" | "source_provider_authorization_required" | "source_provider_installation_disabled" | "source_provider_installation_removed" | "source_provider_scope_insufficient" | "source_provider_target_access_removed" | "source_provider_throttled" | "source_provider_outcome_unknown" | "source_provider_authorization_not_found" | "source_provider_authorization_conflict" | "source_provider_installation_request_invalid" | "source_provider_installation_request_expired" | "source_provider_installation_callback_replayed" | "source_connection_creation_conflict" | "source_connection_activation_conflict" | "source_connection_activation_verification_rejected" | "delegated_authorization_verifier_forbidden" | "invalid_credential" | "credential_revoked" | "issuer_not_authorized" | "missing_idempotency_key" | "invalid_idempotency_key" | "unsupported_media_type" | "request_too_large" | "request_body_timeout" | "malformed_json" | "invalid_request" | "certification_environment_required" | "certification_test_set_invalid" | "invalid_collection_query" | "invalid_collection_cursor" | "document_type_not_enabled" | "fiscal_intent_rejected" | "idempotency_key_conflict" | "fiscal_number_already_used" | "fiscal_number_authorization_changed" | "fiscal_number_authorization_source_record_conflict" | "source_version_stale" | "source_predecessor_conflict" | "source_history_requires_reconciliation" | "source_content_conflict" | "source_action_conflict" | "source_command_conflict" | "invoice_reference_conflict" | "invoice_totals_mismatch" | "printed_representation_profile_conflict" | "source_record_already_fiscalized" | "source_operation_pending" | "source_outcome_unknown" | "authority_rejected_replacement" | "correction_target_unsettled" | "unsupported_printed_representation_profile" | "affected_fiscal_operation_unsupported" | "fiscal_issuance_blocked" | "fiscal_operation_not_found" | "invoice_not_found" | "fiscal_artifact_not_found" | "fiscal_artifact_unverified" | "fiscal_artifact_unavailable" | "invoice_receipt_not_found" | "invoice_receipt_not_ready" | "invoice_receipt_unavailable" | "fiscal_delivery_not_found" | "fiscal_delivery_unavailable" | "fiscal_delivery_outcome_conflict" | "webhook_endpoint_not_found" | "webhook_endpoint_registration_conflict" | "webhook_endpoint_suspended" | "webhook_endpoint_deleted" | "webhook_event_not_found" | "invalid_replay_scope" | "webhook_destination_not_allowed" | "unsigned_document_schema_invalid" | "signed_document_schema_invalid" | "custody_unavailable" | "received_document_not_found" | "commercial_response_motive_invalid" | "commercial_response_decision_conflict" | "route_not_found" | "method_not_allowed" | "internal_error";
2636
+ export type PublicProblemCode = "unauthenticated" | "invalid_login" | "email_already_registered" | "organization_slug_taken" | "organization_not_found" | "hosted_tenant_conflict" | "insufficient_role" | "service_role_not_permitted" | "invalid_fiscal_identity" | "invalid_certificate_custody_signer_identity" | "certificate_p12_password_invalid" | "custody_certificate_malformed" | "custody_certificate_not_yet_valid" | "custody_certificate_expired" | "custody_p12_work_limit_exceeded" | "custody_signature_algorithm_unsupported" | "custody_certificate_trust_profile_unsupported" | "custody_certificate_chain_untrusted" | "custody_certificate_purpose_unsupported" | "legal_issuer_already_registered" | "onboarding_legal_issuer_identity_conflict" | "legal_issuer_profile_incomplete" | "legal_issuer_not_found" | "invitation_invalid" | "invitation_expired" | "already_a_member" | "environment_not_active" | "certificate_custody_binding_not_found" | "certificate_custody_binding_conflict" | "certificate_custody_environment_occupied" | "certificate_custody_environment_revoked" | "certificate_custody_environment_signer_mismatch" | "certificate_custody_certificate_version_not_active" | "source_connection_not_found" | "source_connection_not_connected" | "source_provider_unavailable" | "source_provider_authorization_required" | "source_provider_installation_disabled" | "source_provider_installation_removed" | "source_provider_scope_insufficient" | "source_provider_target_access_removed" | "source_provider_throttled" | "source_provider_outcome_unknown" | "source_provider_authorization_not_found" | "source_provider_authorization_conflict" | "source_provider_installation_request_invalid" | "source_provider_installation_request_expired" | "source_provider_installation_callback_replayed" | "source_connection_creation_conflict" | "source_connection_activation_conflict" | "source_connection_activation_verification_rejected" | "delegated_authorization_verifier_forbidden" | "invalid_credential" | "credential_revoked" | "issuer_not_authorized" | "missing_idempotency_key" | "invalid_idempotency_key" | "unsupported_media_type" | "request_too_large" | "request_body_timeout" | "malformed_json" | "invalid_request" | "invoice_original_invalid" | "certification_environment_required" | "certification_test_set_invalid" | "invalid_collection_query" | "invalid_collection_cursor" | "document_type_not_enabled" | "fiscal_intent_rejected" | "idempotency_key_conflict" | "fiscal_number_already_used" | "fiscal_number_authorization_changed" | "fiscal_number_authorization_source_record_conflict" | "source_version_stale" | "source_predecessor_conflict" | "source_history_requires_reconciliation" | "source_content_conflict" | "source_action_conflict" | "source_command_conflict" | "invoice_reference_conflict" | "invoice_totals_mismatch" | "printed_representation_profile_conflict" | "source_record_already_fiscalized" | "source_operation_pending" | "source_outcome_unknown" | "authority_rejected_replacement" | "correction_target_unsettled" | "unsupported_printed_representation_profile" | "affected_fiscal_operation_unsupported" | "fiscal_issuance_blocked" | "fiscal_operation_not_found" | "invoice_not_found" | "fiscal_artifact_not_found" | "fiscal_artifact_unverified" | "fiscal_artifact_unavailable" | "invoice_receipt_not_found" | "invoice_receipt_not_ready" | "invoice_receipt_unavailable" | "fiscal_delivery_not_found" | "fiscal_delivery_unavailable" | "fiscal_delivery_outcome_conflict" | "webhook_endpoint_not_found" | "webhook_endpoint_registration_conflict" | "webhook_endpoint_suspended" | "webhook_endpoint_deleted" | "webhook_event_not_found" | "invalid_replay_scope" | "webhook_destination_not_allowed" | "unsigned_document_schema_invalid" | "signed_document_schema_invalid" | "custody_unavailable" | "received_document_not_found" | "commercial_response_motive_invalid" | "commercial_response_decision_conflict" | "route_not_found" | "method_not_allowed" | "internal_error";
2557
2637
  export type QualifiedProductionOrigin = {
2558
2638
  domain: string;
2559
2639
  origin: string;
@@ -2669,19 +2749,24 @@ export type ReferenceInformation = {
2669
2749
  issued_on: string;
2670
2750
  modification_code: "4" | "5";
2671
2751
  };
2752
+ /**
2753
+ * The sequence a business records. Timbro, not the caller, decides how far DGII has confirmed it:
2754
+ * a recorded sequence is reported until DGII accepts an e-CF numbered from it. `knowledge` and
2755
+ * `source_kind` are deprecated, accepted so an older caller keeps working, and never trusted.
2756
+ */
2672
2757
  export type RegisterFiscalNumberAuthorizationRequest = {
2673
2758
  document_type: ElectronicFiscalDocumentType;
2674
2759
  ends_at: LedgerCounter;
2675
2760
  environment: FiscalEnvironment;
2676
2761
  expected_head: ExpectedAuthorizationHead;
2677
2762
  expires_on: string | null;
2678
- knowledge: FiscalNumberAuthorizationKnowledge;
2763
+ knowledge?: null | FiscalNumberAuthorizationKnowledge | undefined;
2679
2764
  legal_issuer_id: string;
2680
2765
  observed_at: string;
2681
2766
  provenance_sha256: string;
2682
2767
  series: ElectronicFiscalDocumentSeries;
2683
2768
  source_id: string;
2684
- source_kind: FiscalNumberAuthorizationSourceKind;
2769
+ source_kind?: null | FiscalNumberAuthorizationSourceKind | undefined;
2685
2770
  source_reference: string;
2686
2771
  starts_at: LedgerCounter;
2687
2772
  state: FiscalNumberAuthorizationState;
@@ -2751,6 +2836,26 @@ export type ReleasedHostedTenant = {
2751
2836
  release_id: string;
2752
2837
  state: string;
2753
2838
  };
2839
+ export type RepairHostedTenantSourceConnectionRequest = {
2840
+ /**
2841
+ * The Checkout tenant whose binding is repaired. It must match the tenant the token proves.
2842
+ */
2843
+ checkout_tenant_id: string;
2844
+ /**
2845
+ * The Fiscal environment of the binding.
2846
+ */
2847
+ environment: FiscalEnvironment;
2848
+ };
2849
+ export type RepairedHostedTenantSourceConnection = {
2850
+ environment: FiscalEnvironment;
2851
+ hosted_tenant_binding_id: string;
2852
+ outcome: HostedSourceConnectionRepairOutcome;
2853
+ /**
2854
+ * The binding's Source connection. Repair keeps its identity, so webhook addresses and Fiscal
2855
+ * operations that name it stay valid.
2856
+ */
2857
+ source_connection_id: string;
2858
+ };
2754
2859
  export type ReplayEventIdsScope = {
2755
2860
  eventIds: Array<string>;
2756
2861
  };
@@ -3021,6 +3126,40 @@ export type SourceFiscalActionCommand = {
3021
3126
  version: string;
3022
3127
  };
3023
3128
  reason: string;
3129
+ } | {
3130
+ /**
3131
+ * Document issued outside Timbro that a common-path note modifies.
3132
+ *
3133
+ * The original e-NCF or NCF is not in Timbro's ledger, so the caller states the facts DGII
3134
+ * validates on the note: the number, its issue date, and the other taxpayer's RNC when the
3135
+ * original was issued under a different RNC than the note.
3136
+ */
3137
+ affected_document: {
3138
+ consumer_invoice_total?: string | undefined;
3139
+ fiscal_number: string;
3140
+ issued_on: string;
3141
+ issuer_tax_id?: string | undefined;
3142
+ };
3143
+ correction: SourceCreditNoteCorrection;
3144
+ kind: "credit_note_of_external_document";
3145
+ reason: string;
3146
+ } | {
3147
+ /**
3148
+ * Document issued outside Timbro that a common-path note modifies.
3149
+ *
3150
+ * The original e-NCF or NCF is not in Timbro's ledger, so the caller states the facts DGII
3151
+ * validates on the note: the number, its issue date, and the other taxpayer's RNC when the
3152
+ * original was issued under a different RNC than the note.
3153
+ */
3154
+ affected_document: {
3155
+ consumer_invoice_total?: string | undefined;
3156
+ fiscal_number: string;
3157
+ issued_on: string;
3158
+ issuer_tax_id?: string | undefined;
3159
+ };
3160
+ correction: SourceDebitNoteCorrection;
3161
+ kind: "debit_note_of_external_document";
3162
+ reason: string;
3024
3163
  };
3025
3164
  export type SourceFiscalOperationPage = {
3026
3165
  data: Array<FiscalOperationResource>;
@@ -3070,9 +3209,10 @@ export type SourceGovernmentEligibility = {
3070
3209
  */
3071
3210
  export type SourceItemKind = "good" | "service";
3072
3211
  /**
3073
- * Common semantic measurement units mapped to official DGII catalog codes by fiscal-document.
3212
+ * A DGII e-CF unit of measure: a readable lowercase name on the Source and Invoice wire,
3213
+ * the official numeric catalog code in fiscal documents.
3074
3214
  */
3075
- export type SourceMeasurementUnit = "unit" | "kilogram" | "litre" | "metre" | "piece";
3215
+ export type SourceMeasurementUnit = "barrel" | "bag" | "jar" | "bundle" | "bottle" | "box" | "cigarette_pack" | "centimetre" | "cylinder" | "set" | "container" | "day" | "dozen" | "bale" | "gallon" | "degree" | "gram" | "bulk" | "hour" | "crate" | "kilogram" | "kilowatt_hour" | "pound" | "litre" | "lot" | "metre" | "square_metre" | "cubic_metre" | "million_btu" | "minute" | "package" | "pair" | "foot" | "piece" | "roll" | "envelope" | "second" | "tank" | "ton" | "tube" | "yard" | "square_yard" | "unit" | "element" | "thousand" | "sack" | "tin" | "display" | "drum" | "ration" | "quintal" | "gross_register_tonnage" | "square_foot" | "passenger" | "inch" | "boat_berth_stay" | "tray" | "hectare" | "millilitre" | "milligram" | "ounce" | "troy_ounce";
3076
3216
  /**
3077
3217
  * One exact decimal payment allocation declared by the Source system.
3078
3218
  */
@@ -3198,9 +3338,10 @@ export type SourceSalesLine = {
3198
3338
  item_codes?: Array<FiscalItemCode> | undefined;
3199
3339
  item_kind: SourceItemKind;
3200
3340
  /**
3201
- * Common semantic measurement units mapped to official DGII catalog codes by fiscal-document.
3341
+ * A DGII e-CF unit of measure: a readable lowercase name on the Source and Invoice wire,
3342
+ * the official numeric catalog code in fiscal documents.
3202
3343
  */
3203
- measurement_unit: "unit" | "kilogram" | "litre" | "metre" | "piece";
3344
+ measurement_unit: "barrel" | "bag" | "jar" | "bundle" | "bottle" | "box" | "cigarette_pack" | "centimetre" | "cylinder" | "set" | "container" | "day" | "dozen" | "bale" | "gallon" | "degree" | "gram" | "bulk" | "hour" | "crate" | "kilogram" | "kilowatt_hour" | "pound" | "litre" | "lot" | "metre" | "square_metre" | "cubic_metre" | "million_btu" | "minute" | "package" | "pair" | "foot" | "piece" | "roll" | "envelope" | "second" | "tank" | "ton" | "tube" | "yard" | "square_yard" | "unit" | "element" | "thousand" | "sack" | "tin" | "display" | "drum" | "ration" | "quintal" | "gross_register_tonnage" | "square_foot" | "passenger" | "inch" | "boat_berth_stay" | "tray" | "hectare" | "millilitre" | "milligram" | "ounce" | "troy_ounce";
3204
3345
  quantity: string;
3205
3346
  source_line_id: string;
3206
3347
  tax_treatment: SourceTaxTreatment;
@@ -5074,6 +5215,50 @@ export type ReleaseHostedTenantResponses = {
5074
5215
  200: ReleasedHostedTenant;
5075
5216
  };
5076
5217
  export type ReleaseHostedTenantResponse = ReleaseHostedTenantResponses[keyof ReleaseHostedTenantResponses];
5218
+ export type RepairHostedTenantSourceConnectionData = {
5219
+ body: RepairHostedTenantSourceConnectionRequest;
5220
+ path?: never | undefined;
5221
+ query?: never | undefined;
5222
+ url: "/hosted/tenants/source-connection-repairs";
5223
+ };
5224
+ export type RepairHostedTenantSourceConnectionErrors = {
5225
+ /**
5226
+ * The request body failed the contract.
5227
+ */
5228
+ 400: ProblemBody;
5229
+ /**
5230
+ * The bearer token is missing, expired, or not from a trusted issuer.
5231
+ */
5232
+ 401: ProblemBody;
5233
+ /**
5234
+ * The hosted user does not hold the owner role.
5235
+ */
5236
+ 403: ProblemBody;
5237
+ /**
5238
+ * The tenant in the body is not the tenant the token proves, or that tenant holds no active binding in the environment.
5239
+ */
5240
+ 404: ProblemBody;
5241
+ /**
5242
+ * The native stamp server returned a typed Problem.
5243
+ */
5244
+ 413: ProblemBody;
5245
+ /**
5246
+ * The native stamp server returned a typed Problem.
5247
+ */
5248
+ 415: ProblemBody;
5249
+ /**
5250
+ * The native stamp server returned a typed Problem.
5251
+ */
5252
+ 500: ProblemBody;
5253
+ };
5254
+ export type RepairHostedTenantSourceConnectionError = RepairHostedTenantSourceConnectionErrors[keyof RepairHostedTenantSourceConnectionErrors];
5255
+ export type RepairHostedTenantSourceConnectionResponses = {
5256
+ /**
5257
+ * The binding's Source connection is connected. A repeat on a connected Source connection answers `already_connected` and changes nothing.
5258
+ */
5259
+ 200: RepairedHostedTenantSourceConnection;
5260
+ };
5261
+ export type RepairHostedTenantSourceConnectionResponse = RepairHostedTenantSourceConnectionResponses[keyof RepairHostedTenantSourceConnectionResponses];
5077
5262
  export type CreateHostedTenantWebhookSecretRotationData = {
5078
5263
  body?: never | undefined;
5079
5264
  headers?: {