@itzenata/efact-node 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +154 -0
  3. package/dist/_generated/api/invoices-api.d.ts +367 -0
  4. package/dist/_generated/api/invoices-api.d.ts.map +1 -0
  5. package/dist/_generated/api/invoices-api.js +485 -0
  6. package/dist/_generated/api/invoices-api.js.map +1 -0
  7. package/dist/_generated/api.d.ts +13 -0
  8. package/dist/_generated/api.d.ts.map +1 -0
  9. package/dist/_generated/api.js +16 -0
  10. package/dist/_generated/api.js.map +1 -0
  11. package/dist/_generated/base.d.ts +67 -0
  12. package/dist/_generated/base.d.ts.map +1 -0
  13. package/dist/_generated/base.js +65 -0
  14. package/dist/_generated/base.js.map +1 -0
  15. package/dist/_generated/common.d.ts +66 -0
  16. package/dist/_generated/common.d.ts.map +1 -0
  17. package/dist/_generated/common.js +135 -0
  18. package/dist/_generated/common.js.map +1 -0
  19. package/dist/_generated/configuration.d.ts +92 -0
  20. package/dist/_generated/configuration.d.ts.map +1 -0
  21. package/dist/_generated/configuration.js +97 -0
  22. package/dist/_generated/configuration.js.map +1 -0
  23. package/dist/_generated/index.d.ts +15 -0
  24. package/dist/_generated/index.d.ts.map +1 -0
  25. package/dist/_generated/index.js +18 -0
  26. package/dist/_generated/index.js.map +1 -0
  27. package/dist/_generated/models/api-response-invoice-response.d.ts +45 -0
  28. package/dist/_generated/models/api-response-invoice-response.d.ts.map +1 -0
  29. package/dist/_generated/models/api-response-invoice-response.js +16 -0
  30. package/dist/_generated/models/api-response-invoice-response.js.map +1 -0
  31. package/dist/_generated/models/api-response-invoice-status-response.d.ts +45 -0
  32. package/dist/_generated/models/api-response-invoice-status-response.d.ts.map +1 -0
  33. package/dist/_generated/models/api-response-invoice-status-response.js +16 -0
  34. package/dist/_generated/models/api-response-invoice-status-response.js.map +1 -0
  35. package/dist/_generated/models/api-response-page-response-invoice-response.d.ts +45 -0
  36. package/dist/_generated/models/api-response-page-response-invoice-response.d.ts.map +1 -0
  37. package/dist/_generated/models/api-response-page-response-invoice-response.js +16 -0
  38. package/dist/_generated/models/api-response-page-response-invoice-response.js.map +1 -0
  39. package/dist/_generated/models/create-invoice-line-request.d.ts +55 -0
  40. package/dist/_generated/models/create-invoice-line-request.d.ts.map +1 -0
  41. package/dist/_generated/models/create-invoice-line-request.js +16 -0
  42. package/dist/_generated/models/create-invoice-line-request.js.map +1 -0
  43. package/dist/_generated/models/create-invoice-request.d.ts +82 -0
  44. package/dist/_generated/models/create-invoice-request.d.ts.map +1 -0
  45. package/dist/_generated/models/create-invoice-request.js +22 -0
  46. package/dist/_generated/models/create-invoice-request.js.map +1 -0
  47. package/dist/_generated/models/field-error.d.ts +31 -0
  48. package/dist/_generated/models/field-error.d.ts.map +1 -0
  49. package/dist/_generated/models/field-error.js +16 -0
  50. package/dist/_generated/models/field-error.js.map +1 -0
  51. package/dist/_generated/models/index.d.ts +11 -0
  52. package/dist/_generated/models/index.d.ts.map +1 -0
  53. package/dist/_generated/models/index.js +12 -0
  54. package/dist/_generated/models/index.js.map +1 -0
  55. package/dist/_generated/models/invoice-response.d.ts +221 -0
  56. package/dist/_generated/models/invoice-response.d.ts.map +1 -0
  57. package/dist/_generated/models/invoice-response.js +24 -0
  58. package/dist/_generated/models/invoice-response.js.map +1 -0
  59. package/dist/_generated/models/invoice-status-response.d.ts +83 -0
  60. package/dist/_generated/models/invoice-status-response.d.ts.map +1 -0
  61. package/dist/_generated/models/invoice-status-response.js +24 -0
  62. package/dist/_generated/models/invoice-status-response.js.map +1 -0
  63. package/dist/_generated/models/page-response-invoice-response.d.ts +62 -0
  64. package/dist/_generated/models/page-response-invoice-response.d.ts.map +1 -0
  65. package/dist/_generated/models/page-response-invoice-response.js +16 -0
  66. package/dist/_generated/models/page-response-invoice-response.js.map +1 -0
  67. package/dist/_generated/models/update-invoice-request.d.ts +121 -0
  68. package/dist/_generated/models/update-invoice-request.d.ts.map +1 -0
  69. package/dist/_generated/models/update-invoice-request.js +31 -0
  70. package/dist/_generated/models/update-invoice-request.js.map +1 -0
  71. package/dist/client.d.ts +73 -0
  72. package/dist/client.d.ts.map +1 -0
  73. package/dist/client.js +155 -0
  74. package/dist/client.js.map +1 -0
  75. package/dist/errors.d.ts +100 -0
  76. package/dist/errors.d.ts.map +1 -0
  77. package/dist/errors.js +129 -0
  78. package/dist/errors.js.map +1 -0
  79. package/dist/index.d.ts +7 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +9 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/invoices.d.ts +36 -0
  84. package/dist/invoices.d.ts.map +1 -0
  85. package/dist/invoices.js +53 -0
  86. package/dist/invoices.js.map +1 -0
  87. package/dist/runtime.d.ts +34 -0
  88. package/dist/runtime.d.ts.map +1 -0
  89. package/dist/runtime.js +105 -0
  90. package/dist/runtime.js.map +1 -0
  91. package/package.json +66 -0
  92. package/src/_generated/.openapi-generator/FILES +21 -0
  93. package/src/_generated/.openapi-generator/VERSION +1 -0
  94. package/src/_generated/.openapi-generator-ignore +23 -0
  95. package/src/_generated/api/invoices-api.ts +662 -0
  96. package/src/_generated/api.ts +19 -0
  97. package/src/_generated/base.ts +87 -0
  98. package/src/_generated/common.ts +151 -0
  99. package/src/_generated/configuration.ts +111 -0
  100. package/src/_generated/git_push.sh +57 -0
  101. package/src/_generated/index.ts +19 -0
  102. package/src/_generated/models/api-response-invoice-response.ts +55 -0
  103. package/src/_generated/models/api-response-invoice-status-response.ts +55 -0
  104. package/src/_generated/models/api-response-page-response-invoice-response.ts +55 -0
  105. package/src/_generated/models/create-invoice-line-request.ts +61 -0
  106. package/src/_generated/models/create-invoice-request.ts +93 -0
  107. package/src/_generated/models/field-error.ts +37 -0
  108. package/src/_generated/models/index.ts +11 -0
  109. package/src/_generated/models/invoice-response.ts +230 -0
  110. package/src/_generated/models/invoice-status-response.ts +92 -0
  111. package/src/_generated/models/page-response-invoice-response.ts +70 -0
  112. package/src/_generated/models/update-invoice-request.ts +131 -0
  113. package/src/client.ts +215 -0
  114. package/src/errors.ts +166 -0
  115. package/src/index.ts +35 -0
  116. package/src/invoices.ts +80 -0
  117. package/src/runtime.ts +179 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Itzenata
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,154 @@
1
+ # @itzenata/efact-node
2
+
3
+ SDK Node.js officiel **EFact** pour l'e-facturation au Maroc (mandat DGI).
4
+
5
+ EFact est une API de conformité (« le Stripe de la facturation électronique »).
6
+ Ce SDK est une fine couche typée au-dessus de l'API REST EFact :
7
+ authentification par clé, nouveaux essais, délais, et erreurs typées.
8
+
9
+ - ✅ TypeScript natif (types inclus)
10
+ - ✅ ESM
11
+ - ✅ Timeouts, retries avec back-off, erreurs typées
12
+ - ✅ Généré depuis le contrat OpenAPI - toujours aligné sur l'API
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @itzenata/efact-node
18
+ ```
19
+
20
+ Prérequis : **Node.js ≥ 18**.
21
+
22
+ ## Démarrage rapide
23
+
24
+ ```ts
25
+ import { EFact } from "@itzenata/efact-node";
26
+
27
+ // La clé secrète identifie ET authentifie votre organisation (modèle Stripe).
28
+ // Ne la committez jamais : chargez-la depuis l'environnement.
29
+ const efact = new EFact(process.env.EFACT_SECRET_KEY!);
30
+
31
+ const invoice = await efact.invoices.create({
32
+ invoiceNumber: "INV-2026-001",
33
+ invoiceDate: "2026-06-24",
34
+ currency: "MAD",
35
+ paymentMethod: "BANK_TRANSFER",
36
+ // Acheteur (optionnel) - format plat, aligné sur l'API.
37
+ buyerIce: "001234567890123", // 15 chiffres si fourni
38
+ buyerName: "Client SARL",
39
+ buyerAddress: "Casablanca",
40
+ lines: [
41
+ {
42
+ lineNumber: 1,
43
+ description: "Prestation de service",
44
+ quantity: 1,
45
+ unitPrice: 1000,
46
+ vatRate: 20,
47
+ },
48
+ ],
49
+ });
50
+
51
+ console.log(invoice.id, invoice.status);
52
+ ```
53
+
54
+ ## Configuration
55
+
56
+ **Aucune configuration n'est requise.** `new EFact(secretKey)` cible la
57
+ production et gère l'authentification, l'URL, les délais et les nouveaux essais
58
+ pour vous.
59
+
60
+ Deux options facultatives permettent d'ajuster le comportement réseau (valeurs
61
+ par défaut sûres) :
62
+
63
+ ```ts
64
+ new EFact(secretKey, {
65
+ timeout: 30_000, // délai max par requête (ms) — défaut 30000
66
+ maxRetries: 2, // rejeux sur erreurs transitoires (méthodes sûres) — défaut 2
67
+ });
68
+ ```
69
+
70
+ ## Opérations sur les factures
71
+
72
+ | Méthode | Description |
73
+ | --- | --- |
74
+ | `efact.invoices.create(input)` | Crée une facture |
75
+ | `efact.invoices.list(params?)` | Liste paginée (filtre par statut optionnel) |
76
+ | `efact.invoices.retrieve(id)` | Récupère une facture |
77
+ | `efact.invoices.retrieveStatus(id)` | Statut de clairance DGI |
78
+ | `efact.invoices.update(id, patch)` | Met à jour une facture (PENDING uniquement) |
79
+ | `efact.invoices.cancel(id)` | Annule une facture (PENDING uniquement) |
80
+
81
+ L'organisation est résolue côté serveur à partir de la clé API : aucun
82
+ `organizationId` n'est transmis. La modification et l'annulation ne sont
83
+ possibles que tant que la facture est au statut `PENDING`.
84
+
85
+ ```ts
86
+ // Lister (pagination + filtre optionnels)
87
+ const page = await efact.invoices.list({ page: 0, size: 20, status: "ACCEPTED" });
88
+ for (const inv of page.content) console.log(inv.invoiceNumber, inv.status);
89
+
90
+ // Suivre la clairance DGI
91
+ const status = await efact.invoices.retrieveStatus(invoice.id);
92
+ console.log(status.status, status.dgiReference);
93
+ ```
94
+
95
+ ## Gestion des erreurs
96
+
97
+ Toutes les erreurs héritent de `EFactError`. Les réponses non-OK de l'API
98
+ sont converties en erreurs typées portant `code`, `httpStatus` et `errors[]`.
99
+
100
+ ```ts
101
+ import {
102
+ EFact,
103
+ EFactApiError,
104
+ EFactAuthError,
105
+ EFactValidationError,
106
+ EFactNotFoundError,
107
+ EFactConflictError,
108
+ EFactConnectionError,
109
+ EFactTimeoutError,
110
+ } from "@itzenata/efact-node";
111
+
112
+ try {
113
+ await efact.invoices.create(input);
114
+ } catch (err) {
115
+ if (err instanceof EFactValidationError) {
116
+ console.error("Champs invalides :", err.errors);
117
+ } else if (err instanceof EFactAuthError) {
118
+ console.error("Clé API manquante ou invalide.");
119
+ } else if (err instanceof EFactConflictError) {
120
+ console.error("Facture non modifiable (statut ≠ PENDING).");
121
+ } else if (err instanceof EFactApiError) {
122
+ console.error(err.code, err.httpStatus, err.message);
123
+ } else if (err instanceof EFactTimeoutError) {
124
+ console.error("Délai dépassé.");
125
+ } else if (err instanceof EFactConnectionError) {
126
+ console.error("Échec réseau.");
127
+ }
128
+ }
129
+ ```
130
+
131
+ | Erreur | Cas |
132
+ | --- | --- |
133
+ | `EFactConfigError` | Mauvaise configuration (avant tout appel réseau) |
134
+ | `EFactAuthError` | 401/403 - clé manquante/invalide |
135
+ | `EFactValidationError` | 400/422 - champs invalides (`errors[]`) |
136
+ | `EFactNotFoundError` | 404 - introuvable (inclut cross-tenant) |
137
+ | `EFactConflictError` | 409 - facture non modifiable/annulable |
138
+ | `EFactApiError` | autre erreur API |
139
+ | `EFactTimeoutError` | délai dépassé |
140
+ | `EFactConnectionError` | échec réseau |
141
+
142
+ Les méthodes sûres (`GET`/`PUT`/`DELETE`) sont automatiquement rejouées sur
143
+ les erreurs transitoires (408, 425, 429, 5xx, coupures réseau) avec back-off
144
+ exponentiel et respect de `Retry-After`. `POST` (création) n'est jamais rejoué.
145
+
146
+ ## Sécurité
147
+
148
+ - La clé n'est attachée qu'en `Authorization: Bearer <clé>`, jamais dans l'URL.
149
+ - `efact.getConfig()` ne renvoie qu'une version masquée de la clé.
150
+ - Les messages d'erreur n'incluent jamais la clé ni le corps brut de la réponse.
151
+
152
+ ## Licence
153
+
154
+ [MIT](./LICENSE)
@@ -0,0 +1,367 @@
1
+ /**
2
+ * EFact API
3
+ * Compliance-as-a-service backend for Moroccan DGI electronic invoicing
4
+ *
5
+ * The version of the OpenAPI document: v0.0.1-SNAPSHOT
6
+ * Contact: contact@itzenata.com
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import type { Configuration } from '../configuration.js';
13
+ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
14
+ import { type RequestArgs, BaseAPI } from '../base.js';
15
+ import type { ApiResponseInvoiceResponse } from '../models/index.js';
16
+ import type { ApiResponseInvoiceStatusResponse } from '../models/index.js';
17
+ import type { ApiResponsePageResponseInvoiceResponse } from '../models/index.js';
18
+ import type { CreateInvoiceRequest } from '../models/index.js';
19
+ import type { UpdateInvoiceRequest } from '../models/index.js';
20
+ /**
21
+ * InvoicesApi - axios parameter creator
22
+ * @export
23
+ */
24
+ export declare const InvoicesApiAxiosParamCreator: (configuration?: Configuration) => {
25
+ /**
26
+ * Cancels a DRAFT invoice. Submitted or accepted invoices cannot be cancelled.
27
+ * @summary Cancel an invoice
28
+ * @param {string} id Invoice UUID
29
+ * @param {*} [options] Override http request option.
30
+ * @throws {RequiredError}
31
+ */
32
+ cancel: (id: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
33
+ /**
34
+ * Creates a new invoice in DRAFT status for the organization associated with the API key. The invoice is queued for UBL 2.1 generation, XAdES-B-B signing, and DGI clearance.
35
+ * @summary Create an invoice
36
+ * @param {CreateInvoiceRequest} createInvoiceRequest
37
+ * @param {*} [options] Override http request option.
38
+ * @throws {RequiredError}
39
+ */
40
+ create: (createInvoiceRequest: CreateInvoiceRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
41
+ /**
42
+ * Returns the full invoice by ID. Returns 404 if the invoice does not exist or belongs to a different organization.
43
+ * @summary Get an invoice
44
+ * @param {string} id Invoice UUID
45
+ * @param {*} [options] Override http request option.
46
+ * @throws {RequiredError}
47
+ */
48
+ getById: (id: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
49
+ /**
50
+ * Returns a lightweight status object for polling DGI clearance progress. Includes DGI reference, QR payload, and any error details.
51
+ * @summary Get invoice status
52
+ * @param {string} id Invoice UUID
53
+ * @param {*} [options] Override http request option.
54
+ * @throws {RequiredError}
55
+ */
56
+ getStatus: (id: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
57
+ /**
58
+ * Returns a paginated list of invoices belonging to the organization associated with the API key. Optionally filter by status.
59
+ * @summary List invoices
60
+ * @param {ListStatusEnum} [status] Filter by invoice status
61
+ * @param {number} [page] Zero-based page index (0..N)
62
+ * @param {number} [size] The size of the page to be returned
63
+ * @param {Array<string>} [sort] Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported.
64
+ * @param {*} [options] Override http request option.
65
+ * @throws {RequiredError}
66
+ */
67
+ list: (status?: ListStatusEnum, page?: number, size?: number, sort?: Array<string>, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
68
+ /**
69
+ * Updates a DRAFT invoice. Once an invoice has been submitted to DGI it is immutable — update attempts on non-DRAFT invoices return 409.
70
+ * @summary Update an invoice
71
+ * @param {string} id Invoice UUID
72
+ * @param {UpdateInvoiceRequest} updateInvoiceRequest
73
+ * @param {*} [options] Override http request option.
74
+ * @throws {RequiredError}
75
+ */
76
+ update: (id: string, updateInvoiceRequest: UpdateInvoiceRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
77
+ };
78
+ /**
79
+ * InvoicesApi - functional programming interface
80
+ * @export
81
+ */
82
+ export declare const InvoicesApiFp: (configuration?: Configuration) => {
83
+ /**
84
+ * Cancels a DRAFT invoice. Submitted or accepted invoices cannot be cancelled.
85
+ * @summary Cancel an invoice
86
+ * @param {string} id Invoice UUID
87
+ * @param {*} [options] Override http request option.
88
+ * @throws {RequiredError}
89
+ */
90
+ cancel(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponseInvoiceResponse>>;
91
+ /**
92
+ * Creates a new invoice in DRAFT status for the organization associated with the API key. The invoice is queued for UBL 2.1 generation, XAdES-B-B signing, and DGI clearance.
93
+ * @summary Create an invoice
94
+ * @param {CreateInvoiceRequest} createInvoiceRequest
95
+ * @param {*} [options] Override http request option.
96
+ * @throws {RequiredError}
97
+ */
98
+ create(createInvoiceRequest: CreateInvoiceRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponseInvoiceResponse>>;
99
+ /**
100
+ * Returns the full invoice by ID. Returns 404 if the invoice does not exist or belongs to a different organization.
101
+ * @summary Get an invoice
102
+ * @param {string} id Invoice UUID
103
+ * @param {*} [options] Override http request option.
104
+ * @throws {RequiredError}
105
+ */
106
+ getById(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponseInvoiceResponse>>;
107
+ /**
108
+ * Returns a lightweight status object for polling DGI clearance progress. Includes DGI reference, QR payload, and any error details.
109
+ * @summary Get invoice status
110
+ * @param {string} id Invoice UUID
111
+ * @param {*} [options] Override http request option.
112
+ * @throws {RequiredError}
113
+ */
114
+ getStatus(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponseInvoiceStatusResponse>>;
115
+ /**
116
+ * Returns a paginated list of invoices belonging to the organization associated with the API key. Optionally filter by status.
117
+ * @summary List invoices
118
+ * @param {ListStatusEnum} [status] Filter by invoice status
119
+ * @param {number} [page] Zero-based page index (0..N)
120
+ * @param {number} [size] The size of the page to be returned
121
+ * @param {Array<string>} [sort] Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported.
122
+ * @param {*} [options] Override http request option.
123
+ * @throws {RequiredError}
124
+ */
125
+ list(status?: ListStatusEnum, page?: number, size?: number, sort?: Array<string>, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponsePageResponseInvoiceResponse>>;
126
+ /**
127
+ * Updates a DRAFT invoice. Once an invoice has been submitted to DGI it is immutable — update attempts on non-DRAFT invoices return 409.
128
+ * @summary Update an invoice
129
+ * @param {string} id Invoice UUID
130
+ * @param {UpdateInvoiceRequest} updateInvoiceRequest
131
+ * @param {*} [options] Override http request option.
132
+ * @throws {RequiredError}
133
+ */
134
+ update(id: string, updateInvoiceRequest: UpdateInvoiceRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ApiResponseInvoiceResponse>>;
135
+ };
136
+ /**
137
+ * InvoicesApi - factory interface
138
+ * @export
139
+ */
140
+ export declare const InvoicesApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
141
+ /**
142
+ * Cancels a DRAFT invoice. Submitted or accepted invoices cannot be cancelled.
143
+ * @summary Cancel an invoice
144
+ * @param {InvoicesApiCancelRequest} requestParameters Request parameters.
145
+ * @param {*} [options] Override http request option.
146
+ * @throws {RequiredError}
147
+ */
148
+ cancel(requestParameters: InvoicesApiCancelRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiResponseInvoiceResponse>;
149
+ /**
150
+ * Creates a new invoice in DRAFT status for the organization associated with the API key. The invoice is queued for UBL 2.1 generation, XAdES-B-B signing, and DGI clearance.
151
+ * @summary Create an invoice
152
+ * @param {InvoicesApiCreateRequest} requestParameters Request parameters.
153
+ * @param {*} [options] Override http request option.
154
+ * @throws {RequiredError}
155
+ */
156
+ create(requestParameters: InvoicesApiCreateRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiResponseInvoiceResponse>;
157
+ /**
158
+ * Returns the full invoice by ID. Returns 404 if the invoice does not exist or belongs to a different organization.
159
+ * @summary Get an invoice
160
+ * @param {InvoicesApiGetByIdRequest} requestParameters Request parameters.
161
+ * @param {*} [options] Override http request option.
162
+ * @throws {RequiredError}
163
+ */
164
+ getById(requestParameters: InvoicesApiGetByIdRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiResponseInvoiceResponse>;
165
+ /**
166
+ * Returns a lightweight status object for polling DGI clearance progress. Includes DGI reference, QR payload, and any error details.
167
+ * @summary Get invoice status
168
+ * @param {InvoicesApiGetStatusRequest} requestParameters Request parameters.
169
+ * @param {*} [options] Override http request option.
170
+ * @throws {RequiredError}
171
+ */
172
+ getStatus(requestParameters: InvoicesApiGetStatusRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiResponseInvoiceStatusResponse>;
173
+ /**
174
+ * Returns a paginated list of invoices belonging to the organization associated with the API key. Optionally filter by status.
175
+ * @summary List invoices
176
+ * @param {InvoicesApiListRequest} requestParameters Request parameters.
177
+ * @param {*} [options] Override http request option.
178
+ * @throws {RequiredError}
179
+ */
180
+ list(requestParameters?: InvoicesApiListRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiResponsePageResponseInvoiceResponse>;
181
+ /**
182
+ * Updates a DRAFT invoice. Once an invoice has been submitted to DGI it is immutable — update attempts on non-DRAFT invoices return 409.
183
+ * @summary Update an invoice
184
+ * @param {InvoicesApiUpdateRequest} requestParameters Request parameters.
185
+ * @param {*} [options] Override http request option.
186
+ * @throws {RequiredError}
187
+ */
188
+ update(requestParameters: InvoicesApiUpdateRequest, options?: RawAxiosRequestConfig): AxiosPromise<ApiResponseInvoiceResponse>;
189
+ };
190
+ /**
191
+ * Request parameters for cancel operation in InvoicesApi.
192
+ * @export
193
+ * @interface InvoicesApiCancelRequest
194
+ */
195
+ export interface InvoicesApiCancelRequest {
196
+ /**
197
+ * Invoice UUID
198
+ * @type {string}
199
+ * @memberof InvoicesApiCancel
200
+ */
201
+ readonly id: string;
202
+ }
203
+ /**
204
+ * Request parameters for create operation in InvoicesApi.
205
+ * @export
206
+ * @interface InvoicesApiCreateRequest
207
+ */
208
+ export interface InvoicesApiCreateRequest {
209
+ /**
210
+ *
211
+ * @type {CreateInvoiceRequest}
212
+ * @memberof InvoicesApiCreate
213
+ */
214
+ readonly createInvoiceRequest: CreateInvoiceRequest;
215
+ }
216
+ /**
217
+ * Request parameters for getById operation in InvoicesApi.
218
+ * @export
219
+ * @interface InvoicesApiGetByIdRequest
220
+ */
221
+ export interface InvoicesApiGetByIdRequest {
222
+ /**
223
+ * Invoice UUID
224
+ * @type {string}
225
+ * @memberof InvoicesApiGetById
226
+ */
227
+ readonly id: string;
228
+ }
229
+ /**
230
+ * Request parameters for getStatus operation in InvoicesApi.
231
+ * @export
232
+ * @interface InvoicesApiGetStatusRequest
233
+ */
234
+ export interface InvoicesApiGetStatusRequest {
235
+ /**
236
+ * Invoice UUID
237
+ * @type {string}
238
+ * @memberof InvoicesApiGetStatus
239
+ */
240
+ readonly id: string;
241
+ }
242
+ /**
243
+ * Request parameters for list operation in InvoicesApi.
244
+ * @export
245
+ * @interface InvoicesApiListRequest
246
+ */
247
+ export interface InvoicesApiListRequest {
248
+ /**
249
+ * Filter by invoice status
250
+ * @type {'PENDING' | 'SIGNED' | 'TRANSMITTED' | 'ACCEPTED' | 'REJECTED' | 'FAILED' | 'CANCELLED'}
251
+ * @memberof InvoicesApiList
252
+ */
253
+ readonly status?: ListStatusEnum;
254
+ /**
255
+ * Zero-based page index (0..N)
256
+ * @type {number}
257
+ * @memberof InvoicesApiList
258
+ */
259
+ readonly page?: number;
260
+ /**
261
+ * The size of the page to be returned
262
+ * @type {number}
263
+ * @memberof InvoicesApiList
264
+ */
265
+ readonly size?: number;
266
+ /**
267
+ * Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported.
268
+ * @type {Array<string>}
269
+ * @memberof InvoicesApiList
270
+ */
271
+ readonly sort?: Array<string>;
272
+ }
273
+ /**
274
+ * Request parameters for update operation in InvoicesApi.
275
+ * @export
276
+ * @interface InvoicesApiUpdateRequest
277
+ */
278
+ export interface InvoicesApiUpdateRequest {
279
+ /**
280
+ * Invoice UUID
281
+ * @type {string}
282
+ * @memberof InvoicesApiUpdate
283
+ */
284
+ readonly id: string;
285
+ /**
286
+ *
287
+ * @type {UpdateInvoiceRequest}
288
+ * @memberof InvoicesApiUpdate
289
+ */
290
+ readonly updateInvoiceRequest: UpdateInvoiceRequest;
291
+ }
292
+ /**
293
+ * InvoicesApi - object-oriented interface
294
+ * @export
295
+ * @class InvoicesApi
296
+ * @extends {BaseAPI}
297
+ */
298
+ export declare class InvoicesApi extends BaseAPI {
299
+ /**
300
+ * Cancels a DRAFT invoice. Submitted or accepted invoices cannot be cancelled.
301
+ * @summary Cancel an invoice
302
+ * @param {InvoicesApiCancelRequest} requestParameters Request parameters.
303
+ * @param {*} [options] Override http request option.
304
+ * @throws {RequiredError}
305
+ * @memberof InvoicesApi
306
+ */
307
+ cancel(requestParameters: InvoicesApiCancelRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<ApiResponseInvoiceResponse, any, {}>>;
308
+ /**
309
+ * Creates a new invoice in DRAFT status for the organization associated with the API key. The invoice is queued for UBL 2.1 generation, XAdES-B-B signing, and DGI clearance.
310
+ * @summary Create an invoice
311
+ * @param {InvoicesApiCreateRequest} requestParameters Request parameters.
312
+ * @param {*} [options] Override http request option.
313
+ * @throws {RequiredError}
314
+ * @memberof InvoicesApi
315
+ */
316
+ create(requestParameters: InvoicesApiCreateRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<ApiResponseInvoiceResponse, any, {}>>;
317
+ /**
318
+ * Returns the full invoice by ID. Returns 404 if the invoice does not exist or belongs to a different organization.
319
+ * @summary Get an invoice
320
+ * @param {InvoicesApiGetByIdRequest} requestParameters Request parameters.
321
+ * @param {*} [options] Override http request option.
322
+ * @throws {RequiredError}
323
+ * @memberof InvoicesApi
324
+ */
325
+ getById(requestParameters: InvoicesApiGetByIdRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<ApiResponseInvoiceResponse, any, {}>>;
326
+ /**
327
+ * Returns a lightweight status object for polling DGI clearance progress. Includes DGI reference, QR payload, and any error details.
328
+ * @summary Get invoice status
329
+ * @param {InvoicesApiGetStatusRequest} requestParameters Request parameters.
330
+ * @param {*} [options] Override http request option.
331
+ * @throws {RequiredError}
332
+ * @memberof InvoicesApi
333
+ */
334
+ getStatus(requestParameters: InvoicesApiGetStatusRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<ApiResponseInvoiceStatusResponse, any, {}>>;
335
+ /**
336
+ * Returns a paginated list of invoices belonging to the organization associated with the API key. Optionally filter by status.
337
+ * @summary List invoices
338
+ * @param {InvoicesApiListRequest} requestParameters Request parameters.
339
+ * @param {*} [options] Override http request option.
340
+ * @throws {RequiredError}
341
+ * @memberof InvoicesApi
342
+ */
343
+ list(requestParameters?: InvoicesApiListRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<ApiResponsePageResponseInvoiceResponse, any, {}>>;
344
+ /**
345
+ * Updates a DRAFT invoice. Once an invoice has been submitted to DGI it is immutable — update attempts on non-DRAFT invoices return 409.
346
+ * @summary Update an invoice
347
+ * @param {InvoicesApiUpdateRequest} requestParameters Request parameters.
348
+ * @param {*} [options] Override http request option.
349
+ * @throws {RequiredError}
350
+ * @memberof InvoicesApi
351
+ */
352
+ update(requestParameters: InvoicesApiUpdateRequest, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<ApiResponseInvoiceResponse, any, {}>>;
353
+ }
354
+ /**
355
+ * @export
356
+ */
357
+ export declare const ListStatusEnum: {
358
+ readonly Pending: "PENDING";
359
+ readonly Signed: "SIGNED";
360
+ readonly Transmitted: "TRANSMITTED";
361
+ readonly Accepted: "ACCEPTED";
362
+ readonly Rejected: "REJECTED";
363
+ readonly Failed: "FAILED";
364
+ readonly Cancelled: "CANCELLED";
365
+ };
366
+ export type ListStatusEnum = typeof ListStatusEnum[keyof typeof ListStatusEnum];
367
+ //# sourceMappingURL=invoices-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoices-api.d.ts","sourceRoot":"","sources":["../../../src/_generated/api/invoices-api.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAMhF,OAAO,EAAiC,KAAK,WAAW,EAAE,OAAO,EAAqC,MAAM,YAAY,CAAC;AAEzH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAErE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D;;;GAGG;AACH,eAAO,MAAM,4BAA4B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