@beel_es/sdk 1.0.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.
- package/README.md +131 -0
- package/dist/client.d.ts +54 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +94 -0
- package/dist/client.js.map +1 -0
- package/dist/generated/client/client.gen.d.ts +3 -0
- package/dist/generated/client/client.gen.d.ts.map +1 -0
- package/dist/generated/client/client.gen.js +240 -0
- package/dist/generated/client/client.gen.js.map +1 -0
- package/dist/generated/client/index.d.ts +9 -0
- package/dist/generated/client/index.d.ts.map +1 -0
- package/dist/generated/client/index.js +18 -0
- package/dist/generated/client/index.js.map +1 -0
- package/dist/generated/client/types.gen.d.ts +118 -0
- package/dist/generated/client/types.gen.d.ts.map +1 -0
- package/dist/generated/client/types.gen.js +4 -0
- package/dist/generated/client/types.gen.js.map +1 -0
- package/dist/generated/client/utils.gen.d.ts +34 -0
- package/dist/generated/client/utils.gen.d.ts.map +1 -0
- package/dist/generated/client/utils.gen.js +242 -0
- package/dist/generated/client/utils.gen.js.map +1 -0
- package/dist/generated/client.gen.d.ts +13 -0
- package/dist/generated/client.gen.d.ts.map +1 -0
- package/dist/generated/client.gen.js +7 -0
- package/dist/generated/client.gen.js.map +1 -0
- package/dist/generated/core/auth.gen.d.ts +19 -0
- package/dist/generated/core/auth.gen.d.ts.map +1 -0
- package/dist/generated/core/auth.gen.js +19 -0
- package/dist/generated/core/auth.gen.js.map +1 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +26 -0
- package/dist/generated/core/bodySerializer.gen.d.ts.map +1 -0
- package/dist/generated/core/bodySerializer.gen.js +61 -0
- package/dist/generated/core/bodySerializer.gen.js.map +1 -0
- package/dist/generated/core/params.gen.d.ts +44 -0
- package/dist/generated/core/params.gen.d.ts.map +1 -0
- package/dist/generated/core/params.gen.js +105 -0
- package/dist/generated/core/params.gen.js.map +1 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +34 -0
- package/dist/generated/core/pathSerializer.gen.d.ts.map +1 -0
- package/dist/generated/core/pathSerializer.gen.js +116 -0
- package/dist/generated/core/pathSerializer.gen.js.map +1 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +19 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts.map +1 -0
- package/dist/generated/core/queryKeySerializer.gen.js +99 -0
- package/dist/generated/core/queryKeySerializer.gen.js.map +1 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +72 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts.map +1 -0
- package/dist/generated/core/serverSentEvents.gen.js +138 -0
- package/dist/generated/core/serverSentEvents.gen.js.map +1 -0
- package/dist/generated/core/types.gen.d.ts +79 -0
- package/dist/generated/core/types.gen.d.ts.map +1 -0
- package/dist/generated/core/types.gen.js +4 -0
- package/dist/generated/core/types.gen.js.map +1 -0
- package/dist/generated/core/utils.gen.d.ts +20 -0
- package/dist/generated/core/utils.gen.d.ts.map +1 -0
- package/dist/generated/core/utils.gen.js +94 -0
- package/dist/generated/core/utils.gen.js.map +1 -0
- package/dist/generated/index.d.ts +3 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +84 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/sdk.gen.d.ts +966 -0
- package/dist/generated/sdk.gen.d.ts.map +1 -0
- package/dist/generated/sdk.gen.js +1490 -0
- package/dist/generated/sdk.gen.js.map +1 -0
- package/dist/generated/types.gen.d.ts +5646 -0
- package/dist/generated/types.gen.d.ts.map +1 -0
- package/dist/generated/types.gen.js +4 -0
- package/dist/generated/types.gen.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/companies.d.ts +75 -0
- package/dist/resources/companies.d.ts.map +1 -0
- package/dist/resources/companies.js +77 -0
- package/dist/resources/companies.js.map +1 -0
- package/dist/resources/config.d.ts +106 -0
- package/dist/resources/config.d.ts.map +1 -0
- package/dist/resources/config.js +86 -0
- package/dist/resources/config.js.map +1 -0
- package/dist/resources/customers.d.ts +172 -0
- package/dist/resources/customers.d.ts.map +1 -0
- package/dist/resources/customers.js +96 -0
- package/dist/resources/customers.js.map +1 -0
- package/dist/resources/invoices.d.ts +370 -0
- package/dist/resources/invoices.d.ts.map +1 -0
- package/dist/resources/invoices.js +174 -0
- package/dist/resources/invoices.js.map +1 -0
- package/dist/resources/products.d.ts +155 -0
- package/dist/resources/products.d.ts.map +1 -0
- package/dist/resources/products.js +96 -0
- package/dist/resources/products.js.map +1 -0
- package/dist/resources/series.d.ts +98 -0
- package/dist/resources/series.d.ts.map +1 -0
- package/dist/resources/series.js +83 -0
- package/dist/resources/series.js.map +1 -0
- package/dist/webhooks/index.d.ts +20 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/index.js +70 -0
- package/dist/webhooks/index.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,1490 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.deleteSeries = exports.createSeries = exports.listSeries = exports.updateTaxConfiguration = exports.getTaxConfiguration = exports.getTaxTypes = exports.updateVeriFactuConfiguration = exports.getVeriFactuConfiguration = exports.createProductsBulk = exports.deleteProductsBulk = exports.searchProducts = exports.updateProduct = exports.getProduct = exports.deleteProduct = exports.createProduct = exports.listProducts = exports.downloadCustomerTemplateCsv = exports.importHoldedContacts = exports.importCustomersCsvPreview = exports.createCustomersBulk = exports.deactivateCustomersBulk = exports.updateCustomer = exports.getCustomer = exports.deactivateCustomer = exports.createCustomer = exports.listCustomers = exports.exportInvoicesExcel = exports.duplicateInvoice = exports.rescheduleInvoice = exports.unscheduleInvoice = exports.scheduleInvoice = exports.revertInvoiceToIssued = exports.markInvoiceSent = exports.issueInvoice = exports.createCorrectiveInvoice = exports.voidInvoice = exports.markInvoicePaid = exports.submitInvoiceVeriFactu = exports.sendInvoiceEmail = exports.previewDraftInvoicePdf = exports.generateInvoicePdf = exports.changeInvoicesStatusBulk = exports.sendInvoicesBulkEmail = exports.downloadInvoicesPdfBulk = exports.createInvoicesBulk = exports.updateInvoice = exports.getInvoice = exports.deleteInvoice = exports.createInvoice = exports.listInvoices = void 0;
|
|
5
|
+
exports.getPublicMetrics = exports.rotateWebhookSecret = exports.retryWebhookDelivery = exports.listWebhookDeliveries = exports.updateWebhookSubscription = exports.deleteWebhookSubscription = exports.createWebhookSubscription = exports.listWebhookSubscriptions = exports.revokeCompanyApiKey = exports.createCompanyApiKey = exports.listCompanyApiKeys = exports.cancelRepresentation = exports.getRepresentationStatus = exports.submitRepresentation = exports.downloadRepresentation = exports.generateRepresentation = exports.updateCompany = exports.getCompany = exports.deleteCompany = exports.createCompany = exports.listCompanies = exports.validateNif = exports.getInvoiceCustomizationOptions = exports.updateLanguage = exports.setDefaultSeries = exports.updateSeries = exports.getSeries = void 0;
|
|
6
|
+
const client_1 = require("./client");
|
|
7
|
+
const client_gen_1 = require("./client.gen");
|
|
8
|
+
/**
|
|
9
|
+
* List invoices
|
|
10
|
+
*
|
|
11
|
+
* Returns a paginated list of invoices with optional filters
|
|
12
|
+
*/
|
|
13
|
+
const listInvoices = (options) => (options?.client ?? client_gen_1.client).get({
|
|
14
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
15
|
+
url: '/v1/invoices',
|
|
16
|
+
...options
|
|
17
|
+
});
|
|
18
|
+
exports.listInvoices = listInvoices;
|
|
19
|
+
/**
|
|
20
|
+
* Create invoice
|
|
21
|
+
*
|
|
22
|
+
* Creates a new invoice.
|
|
23
|
+
*
|
|
24
|
+
* **Idempotency:** Supports `Idempotency-Key` header to prevent duplicates.
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
const createInvoice = (options) => (options.client ?? client_gen_1.client).post({
|
|
28
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
29
|
+
url: '/v1/invoices',
|
|
30
|
+
...options,
|
|
31
|
+
headers: {
|
|
32
|
+
'Content-Type': 'application/json',
|
|
33
|
+
...options.headers
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
exports.createInvoice = createInvoice;
|
|
37
|
+
/**
|
|
38
|
+
* Delete invoice
|
|
39
|
+
*
|
|
40
|
+
* Deletes (marks as deleted) an invoice.
|
|
41
|
+
*
|
|
42
|
+
* **Soft delete:** The invoice is not physically deleted, only marked as deleted.
|
|
43
|
+
*
|
|
44
|
+
* **Restriction:** Only invoices in `DRAFT` status can be deleted.
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
const deleteInvoice = (options) => (options.client ?? client_gen_1.client).delete({
|
|
48
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
49
|
+
url: '/v1/invoices/{invoice_id}',
|
|
50
|
+
...options
|
|
51
|
+
});
|
|
52
|
+
exports.deleteInvoice = deleteInvoice;
|
|
53
|
+
/**
|
|
54
|
+
* Get invoice by ID
|
|
55
|
+
*
|
|
56
|
+
* Retrieves complete details of a specific invoice
|
|
57
|
+
*/
|
|
58
|
+
const getInvoice = (options) => (options.client ?? client_gen_1.client).get({
|
|
59
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
60
|
+
url: '/v1/invoices/{invoice_id}',
|
|
61
|
+
...options
|
|
62
|
+
});
|
|
63
|
+
exports.getInvoice = getInvoice;
|
|
64
|
+
/**
|
|
65
|
+
* Update invoice
|
|
66
|
+
*
|
|
67
|
+
* Updates an existing draft invoice.
|
|
68
|
+
*
|
|
69
|
+
* **Restriction:** Only invoices in `DRAFT` status can be modified.
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
const updateInvoice = (options) => (options.client ?? client_gen_1.client).put({
|
|
73
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
74
|
+
url: '/v1/invoices/{invoice_id}',
|
|
75
|
+
...options,
|
|
76
|
+
headers: {
|
|
77
|
+
'Content-Type': 'application/json',
|
|
78
|
+
...options.headers
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
exports.updateInvoice = updateInvoice;
|
|
82
|
+
/**
|
|
83
|
+
* Create multiple invoices
|
|
84
|
+
*
|
|
85
|
+
* Creates multiple invoices in a single operation.
|
|
86
|
+
*
|
|
87
|
+
* **Idempotency:** Each invoice can have its own `idempotency_key`.
|
|
88
|
+
*
|
|
89
|
+
* **Atomicity:** If any invoice fails, ALL invoices are rejected.
|
|
90
|
+
*
|
|
91
|
+
*/
|
|
92
|
+
const createInvoicesBulk = (options) => (options.client ?? client_gen_1.client).post({
|
|
93
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
94
|
+
url: '/v1/invoices/bulk',
|
|
95
|
+
...options,
|
|
96
|
+
headers: {
|
|
97
|
+
'Content-Type': 'application/json',
|
|
98
|
+
...options.headers
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
exports.createInvoicesBulk = createInvoicesBulk;
|
|
102
|
+
/**
|
|
103
|
+
* Download multiple invoice PDFs as ZIP
|
|
104
|
+
*
|
|
105
|
+
* Downloads multiple invoice PDFs as a single ZIP file.
|
|
106
|
+
*
|
|
107
|
+
* **Limits:**
|
|
108
|
+
* - Maximum 20 invoices per request
|
|
109
|
+
* - Maximum 50MB total ZIP size
|
|
110
|
+
*
|
|
111
|
+
* **Partial success:** If some PDFs are not available (not generated, not found),
|
|
112
|
+
* the response will include a `failures` array with details. The ZIP will still
|
|
113
|
+
* be generated with the available PDFs.
|
|
114
|
+
*
|
|
115
|
+
* **Error handling:**
|
|
116
|
+
* - If NO PDFs are available, returns 400 Bad Request
|
|
117
|
+
* - If some PDFs are unavailable, returns 200 with partial ZIP + failures list
|
|
118
|
+
*
|
|
119
|
+
*/
|
|
120
|
+
const downloadInvoicesPdfBulk = (options) => (options.client ?? client_gen_1.client).post({
|
|
121
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
122
|
+
url: '/v1/invoices/bulk/pdf',
|
|
123
|
+
...options,
|
|
124
|
+
headers: {
|
|
125
|
+
'Content-Type': 'application/json',
|
|
126
|
+
...options.headers
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
exports.downloadInvoicesPdfBulk = downloadInvoicesPdfBulk;
|
|
130
|
+
/**
|
|
131
|
+
* Send multiple invoices by email
|
|
132
|
+
*
|
|
133
|
+
* Sends multiple invoices by email to the specified recipients.
|
|
134
|
+
*
|
|
135
|
+
* **Limits:**
|
|
136
|
+
* - Maximum 20 invoices per request
|
|
137
|
+
* - Maximum 25MB total attachment size
|
|
138
|
+
*
|
|
139
|
+
* **Email behavior:**
|
|
140
|
+
* - Single email with all PDFs as attachments
|
|
141
|
+
* - Uses BULK_INVOICES template
|
|
142
|
+
*
|
|
143
|
+
* **Validations:**
|
|
144
|
+
* - Invoices must have status ISSUED, PAID, SENT or OVERDUE (not DRAFT or VOIDED)
|
|
145
|
+
* - At least one recipient required (from request or user's accountant email)
|
|
146
|
+
*
|
|
147
|
+
* **Partial success:** If some invoices cannot be attached, the email will
|
|
148
|
+
* still be sent with available PDFs. Response includes `failures` array.
|
|
149
|
+
*
|
|
150
|
+
*/
|
|
151
|
+
const sendInvoicesBulkEmail = (options) => (options.client ?? client_gen_1.client).post({
|
|
152
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
153
|
+
url: '/v1/invoices/bulk/send',
|
|
154
|
+
...options,
|
|
155
|
+
headers: {
|
|
156
|
+
'Content-Type': 'application/json',
|
|
157
|
+
...options.headers
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
exports.sendInvoicesBulkEmail = sendInvoicesBulkEmail;
|
|
161
|
+
/**
|
|
162
|
+
* Change status of multiple invoices
|
|
163
|
+
*
|
|
164
|
+
* Changes the status of multiple invoices in a single operation.
|
|
165
|
+
*
|
|
166
|
+
* **Supported status changes:**
|
|
167
|
+
* - **SENT:** Mark multiple invoices as sent (from ISSUED)
|
|
168
|
+
* - **PAID:** Mark multiple invoices as paid (from ISSUED, SENT, or OVERDUE)
|
|
169
|
+
*
|
|
170
|
+
* **Partial success:** If some invoices cannot be updated, the operation
|
|
171
|
+
* continues with the others. The response includes details of failures.
|
|
172
|
+
*
|
|
173
|
+
* **Limits:**
|
|
174
|
+
* - Maximum 50 invoices per request
|
|
175
|
+
*
|
|
176
|
+
* **Validations:**
|
|
177
|
+
* - All invoices must belong to the authenticated user
|
|
178
|
+
* - Each invoice must be in a valid status for the requested transition
|
|
179
|
+
* - For PAID: payment_date is required
|
|
180
|
+
*
|
|
181
|
+
*/
|
|
182
|
+
const changeInvoicesStatusBulk = (options) => (options.client ?? client_gen_1.client).post({
|
|
183
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
184
|
+
url: '/v1/invoices/bulk/status',
|
|
185
|
+
...options,
|
|
186
|
+
headers: {
|
|
187
|
+
'Content-Type': 'application/json',
|
|
188
|
+
...options.headers
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
exports.changeInvoicesStatusBulk = changeInvoicesStatusBulk;
|
|
192
|
+
/**
|
|
193
|
+
* Get invoice PDF download URL
|
|
194
|
+
*
|
|
195
|
+
* Generates a temporary pre-signed URL to download the invoice PDF.
|
|
196
|
+
*
|
|
197
|
+
* **Security:**
|
|
198
|
+
* - URL expires automatically in 5 minutes
|
|
199
|
+
* - HMAC signature prevents tampering
|
|
200
|
+
* - Only allows download (GET), no modification
|
|
201
|
+
*
|
|
202
|
+
* **Benefits:**
|
|
203
|
+
* - Direct download from storage (bypasses backend)
|
|
204
|
+
* - Better performance and lower server load
|
|
205
|
+
* - Compatible with browser cache and CDN
|
|
206
|
+
* - Ideal for large files
|
|
207
|
+
*
|
|
208
|
+
* **Frontend usage:**
|
|
209
|
+
* ```javascript
|
|
210
|
+
* const response = await fetch('/v1/invoices/{id}/pdf');
|
|
211
|
+
* const { download_url } = await response.json();
|
|
212
|
+
* window.open(download_url, '_blank'); // Direct download
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* **Format:** PDF is generated according to Spanish tax regulations.
|
|
216
|
+
*
|
|
217
|
+
*/
|
|
218
|
+
const generateInvoicePdf = (options) => (options.client ?? client_gen_1.client).get({
|
|
219
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
220
|
+
url: '/v1/invoices/{invoice_id}/pdf',
|
|
221
|
+
...options
|
|
222
|
+
});
|
|
223
|
+
exports.generateInvoicePdf = generateInvoicePdf;
|
|
224
|
+
/**
|
|
225
|
+
* Preview draft invoice PDF
|
|
226
|
+
*
|
|
227
|
+
* Generates a PDF preview for a draft invoice and returns the binary content directly.
|
|
228
|
+
*
|
|
229
|
+
* **Requirements:**
|
|
230
|
+
* - Invoice must be in BORRADOR (draft) status
|
|
231
|
+
* - The PDF shows "BORRADOR" as the invoice number
|
|
232
|
+
* - No VeriFactu QR code is included
|
|
233
|
+
*
|
|
234
|
+
* **Behavior:**
|
|
235
|
+
* - PDF is generated on-the-fly (not stored)
|
|
236
|
+
* - Each request regenerates the PDF (reflects latest draft changes)
|
|
237
|
+
* - Response is `application/pdf` for direct browser preview
|
|
238
|
+
*
|
|
239
|
+
*/
|
|
240
|
+
const previewDraftInvoicePdf = (options) => (options.client ?? client_gen_1.client).get({
|
|
241
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
242
|
+
url: '/v1/invoices/{invoice_id}/pdf/preview',
|
|
243
|
+
...options
|
|
244
|
+
});
|
|
245
|
+
exports.previewDraftInvoicePdf = previewDraftInvoicePdf;
|
|
246
|
+
/**
|
|
247
|
+
* Send invoice by email
|
|
248
|
+
*
|
|
249
|
+
* Sends the invoice by email to the customer.
|
|
250
|
+
*
|
|
251
|
+
* **Email:** Sent to the billing emails configured for the client.
|
|
252
|
+
*
|
|
253
|
+
* **Attachments:** Includes the invoice PDF.
|
|
254
|
+
*
|
|
255
|
+
*/
|
|
256
|
+
const sendInvoiceEmail = (options) => (options.client ?? client_gen_1.client).post({
|
|
257
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
258
|
+
url: '/v1/invoices/{invoice_id}/send',
|
|
259
|
+
...options,
|
|
260
|
+
headers: {
|
|
261
|
+
'Content-Type': 'application/json',
|
|
262
|
+
...options.headers
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
exports.sendInvoiceEmail = sendInvoiceEmail;
|
|
266
|
+
/**
|
|
267
|
+
* Submit invoice to VeriFactu (AEAT)
|
|
268
|
+
*
|
|
269
|
+
* Submits the invoice to the Spanish Tax Agency's VeriFactu system.
|
|
270
|
+
*
|
|
271
|
+
* **Requirements:**
|
|
272
|
+
* - VeriFactu must be enabled in settings
|
|
273
|
+
* - Invoice must have all required data
|
|
274
|
+
* - Only invoices NOT previously submitted
|
|
275
|
+
*
|
|
276
|
+
* **Process:**
|
|
277
|
+
* 1. Validates invoice data
|
|
278
|
+
* 2. Generates electronic fingerprint
|
|
279
|
+
* 3. Digitally signs
|
|
280
|
+
* 4. Sends to AEAT
|
|
281
|
+
* 5. Stores response and CSV
|
|
282
|
+
*
|
|
283
|
+
*/
|
|
284
|
+
const submitInvoiceVeriFactu = (options) => (options.client ?? client_gen_1.client).post({
|
|
285
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
286
|
+
url: '/v1/invoices/{invoice_id}/verifactu',
|
|
287
|
+
...options
|
|
288
|
+
});
|
|
289
|
+
exports.submitInvoiceVeriFactu = submitInvoiceVeriFactu;
|
|
290
|
+
/**
|
|
291
|
+
* Mark invoice as paid
|
|
292
|
+
*
|
|
293
|
+
* Marks an invoice as paid.
|
|
294
|
+
*
|
|
295
|
+
* **Status change:** `SENT` → `PAID`
|
|
296
|
+
*
|
|
297
|
+
*/
|
|
298
|
+
const markInvoicePaid = (options) => (options.client ?? client_gen_1.client).post({
|
|
299
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
300
|
+
url: '/v1/invoices/{invoice_id}/mark-paid',
|
|
301
|
+
...options,
|
|
302
|
+
headers: {
|
|
303
|
+
'Content-Type': 'application/json',
|
|
304
|
+
...options.headers
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
exports.markInvoicePaid = markInvoicePaid;
|
|
308
|
+
/**
|
|
309
|
+
* Void invoice
|
|
310
|
+
*
|
|
311
|
+
* Voids an invoice by changing its status to `VOIDED`.
|
|
312
|
+
*
|
|
313
|
+
* **Status change:** `ISSUED`, `SENT`, `OVERDUE`, `PAID` or `RECTIFIED` → `VOIDED`
|
|
314
|
+
*
|
|
315
|
+
* **Use when:** The operation never took place (invoice issued by mistake, duplicate, etc.)
|
|
316
|
+
* For invoices already submitted to VeriFactu, the cancellation is sent to AEAT automatically.
|
|
317
|
+
*
|
|
318
|
+
* **Note:** If the operation did take place but with errors, use the corrective invoice endpoint instead.
|
|
319
|
+
*
|
|
320
|
+
*/
|
|
321
|
+
const voidInvoice = (options) => (options.client ?? client_gen_1.client).post({
|
|
322
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
323
|
+
url: '/v1/invoices/{invoice_id}/void',
|
|
324
|
+
...options,
|
|
325
|
+
headers: {
|
|
326
|
+
'Content-Type': 'application/json',
|
|
327
|
+
...options.headers
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
exports.voidInvoice = voidInvoice;
|
|
331
|
+
/**
|
|
332
|
+
* Create corrective invoice
|
|
333
|
+
*
|
|
334
|
+
* Creates a corrective invoice to correct or void an issued invoice.
|
|
335
|
+
*
|
|
336
|
+
* **Rectification types:**
|
|
337
|
+
* - **TOTAL**: Completely voids the original invoice (original status → VOIDED)
|
|
338
|
+
* - **PARTIAL**: Partially corrects the original invoice (original status → RECTIFIED)
|
|
339
|
+
*
|
|
340
|
+
* **VeriFactu codes:**
|
|
341
|
+
* - R1: Legal error and Art. 80 One, Two and Six LIVA
|
|
342
|
+
* - R2: Article 80 Three LIVA (Bankruptcy)
|
|
343
|
+
* - R3: Article 80 Four LIVA (Bad debts)
|
|
344
|
+
* - R4: Other causes
|
|
345
|
+
* - R5: Simplified invoices (only for simplified)
|
|
346
|
+
*
|
|
347
|
+
* **Validations:**
|
|
348
|
+
* - Original invoice must be in status ISSUED, SENT, PAID, OVERDUE or RECTIFIED
|
|
349
|
+
* - Cannot rectify a DRAFT invoice (must be issued first)
|
|
350
|
+
* - Cannot rectify a VOIDED invoice (final status)
|
|
351
|
+
* - For TOTAL rectification: Another total corrective cannot already exist
|
|
352
|
+
* - For PARTIAL rectification: Multiple partial correctives are allowed
|
|
353
|
+
*
|
|
354
|
+
* **Lines:**
|
|
355
|
+
* - TOTAL: Optional (if not provided, original lines are copied with negated amounts)
|
|
356
|
+
* - PARTIAL: REQUIRED (adjustment lines with positive or negative amounts)
|
|
357
|
+
*
|
|
358
|
+
*/
|
|
359
|
+
const createCorrectiveInvoice = (options) => (options.client ?? client_gen_1.client).post({
|
|
360
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
361
|
+
url: '/v1/invoices/{invoice_id}/corrective',
|
|
362
|
+
...options,
|
|
363
|
+
headers: {
|
|
364
|
+
'Content-Type': 'application/json',
|
|
365
|
+
...options.headers
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
exports.createCorrectiveInvoice = createCorrectiveInvoice;
|
|
369
|
+
/**
|
|
370
|
+
* Issue invoice (DRAFT → ISSUED)
|
|
371
|
+
*
|
|
372
|
+
* Finalizes a draft invoice and marks it as issued.
|
|
373
|
+
*
|
|
374
|
+
* **Status change:** `DRAFT` → `ISSUED`
|
|
375
|
+
*
|
|
376
|
+
* **Actions performed:**
|
|
377
|
+
* - Assigns definitive invoice number according to configured series
|
|
378
|
+
* - Marks invoice as finalized (not modifiable)
|
|
379
|
+
* - Prepares invoice for sending to customer
|
|
380
|
+
*
|
|
381
|
+
* **Validations:**
|
|
382
|
+
* - Invoice must be in DRAFT status
|
|
383
|
+
* - All invoice data must be complete and valid
|
|
384
|
+
*
|
|
385
|
+
* **Note:** After issuing, the invoice can be sent to the customer via
|
|
386
|
+
* the `/invoices/{id}/send` endpoint
|
|
387
|
+
*
|
|
388
|
+
*/
|
|
389
|
+
const issueInvoice = (options) => (options.client ?? client_gen_1.client).post({
|
|
390
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
391
|
+
url: '/v1/invoices/{invoice_id}/issue',
|
|
392
|
+
...options
|
|
393
|
+
});
|
|
394
|
+
exports.issueInvoice = issueInvoice;
|
|
395
|
+
/**
|
|
396
|
+
* Mark invoice as sent
|
|
397
|
+
*
|
|
398
|
+
* Marks an invoice as sent manually.
|
|
399
|
+
*
|
|
400
|
+
* **Use case:** When the invoice was sent via WhatsApp, paper, or any other
|
|
401
|
+
* channel outside of the email system.
|
|
402
|
+
*
|
|
403
|
+
* **Status change:** `ISSUED` → `SENT`
|
|
404
|
+
*
|
|
405
|
+
* **Records:** Sets `sent_at` timestamp for tracking.
|
|
406
|
+
*
|
|
407
|
+
*/
|
|
408
|
+
const markInvoiceSent = (options) => (options.client ?? client_gen_1.client).post({
|
|
409
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
410
|
+
url: '/v1/invoices/{invoice_id}/mark-sent',
|
|
411
|
+
...options,
|
|
412
|
+
headers: {
|
|
413
|
+
'Content-Type': 'application/json',
|
|
414
|
+
...options.headers
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
exports.markInvoiceSent = markInvoiceSent;
|
|
418
|
+
/**
|
|
419
|
+
* Revert invoice to issued status
|
|
420
|
+
*
|
|
421
|
+
* Reverts an invoice from SENT to ISSUED status.
|
|
422
|
+
*
|
|
423
|
+
* **Use case:** To correct errors when an invoice was marked as sent by mistake.
|
|
424
|
+
*
|
|
425
|
+
* **Status change:** `SENT` → `ISSUED`
|
|
426
|
+
*
|
|
427
|
+
* **Side effects:** Clears the `sent_at` timestamp.
|
|
428
|
+
*
|
|
429
|
+
*/
|
|
430
|
+
const revertInvoiceToIssued = (options) => (options.client ?? client_gen_1.client).post({
|
|
431
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
432
|
+
url: '/v1/invoices/{invoice_id}/revert-to-issued',
|
|
433
|
+
...options
|
|
434
|
+
});
|
|
435
|
+
exports.revertInvoiceToIssued = revertInvoiceToIssued;
|
|
436
|
+
/**
|
|
437
|
+
* Schedule invoice for future processing
|
|
438
|
+
*
|
|
439
|
+
* Schedules a draft invoice to be automatically processed on a future date.
|
|
440
|
+
*
|
|
441
|
+
* **Status change:** `DRAFT` → `SCHEDULED`
|
|
442
|
+
*
|
|
443
|
+
* **Actions available:**
|
|
444
|
+
* - `DRAFT`: Convert to draft for manual review on the scheduled date
|
|
445
|
+
* - `ISSUE_AND_SEND`: Issue and send automatically on the scheduled date
|
|
446
|
+
*
|
|
447
|
+
*/
|
|
448
|
+
const scheduleInvoice = (options) => (options.client ?? client_gen_1.client).post({
|
|
449
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
450
|
+
url: '/v1/invoices/{invoice_id}/schedule',
|
|
451
|
+
...options,
|
|
452
|
+
headers: {
|
|
453
|
+
'Content-Type': 'application/json',
|
|
454
|
+
...options.headers
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
exports.scheduleInvoice = scheduleInvoice;
|
|
458
|
+
/**
|
|
459
|
+
* Cancel scheduled invoice
|
|
460
|
+
*
|
|
461
|
+
* Cancels a scheduled invoice and converts it back to draft.
|
|
462
|
+
*
|
|
463
|
+
* **Status change:** `SCHEDULED` → `DRAFT`
|
|
464
|
+
*
|
|
465
|
+
* The invoice can then be edited or manually issued.
|
|
466
|
+
*
|
|
467
|
+
*/
|
|
468
|
+
const unscheduleInvoice = (options) => (options.client ?? client_gen_1.client).post({
|
|
469
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
470
|
+
url: '/v1/invoices/{invoice_id}/unschedule',
|
|
471
|
+
...options
|
|
472
|
+
});
|
|
473
|
+
exports.unscheduleInvoice = unscheduleInvoice;
|
|
474
|
+
/**
|
|
475
|
+
* Reschedule invoice
|
|
476
|
+
*
|
|
477
|
+
* Changes the scheduled date for a scheduled invoice.
|
|
478
|
+
*
|
|
479
|
+
* **Status:** Remains `SCHEDULED`
|
|
480
|
+
*
|
|
481
|
+
* The new date must be today or in the future.
|
|
482
|
+
*
|
|
483
|
+
*/
|
|
484
|
+
const rescheduleInvoice = (options) => (options.client ?? client_gen_1.client).patch({
|
|
485
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
486
|
+
url: '/v1/invoices/{invoice_id}/reschedule',
|
|
487
|
+
...options,
|
|
488
|
+
headers: {
|
|
489
|
+
'Content-Type': 'application/json',
|
|
490
|
+
...options.headers
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
exports.rescheduleInvoice = rescheduleInvoice;
|
|
494
|
+
/**
|
|
495
|
+
* Duplicate invoice as draft
|
|
496
|
+
*
|
|
497
|
+
* Creates a copy of an existing invoice as a new draft.
|
|
498
|
+
*
|
|
499
|
+
* **Use case:** Quickly create a new invoice based on an existing one,
|
|
500
|
+
* useful for recurring invoices to the same client.
|
|
501
|
+
*
|
|
502
|
+
* **What is copied:**
|
|
503
|
+
* - Client data (recipient)
|
|
504
|
+
* - Invoice lines (descriptions, quantities, prices, taxes)
|
|
505
|
+
* - Payment method
|
|
506
|
+
* - Series (if specified, otherwise uses default)
|
|
507
|
+
* - Observations
|
|
508
|
+
*
|
|
509
|
+
* **What is NOT copied (reset to defaults):**
|
|
510
|
+
* - Invoice number (null - assigned when issued)
|
|
511
|
+
* - Status (always DRAFT)
|
|
512
|
+
* - Issue date (defaults to today, can be overridden)
|
|
513
|
+
* - Due date (recalculated based on new issue date)
|
|
514
|
+
* - VeriFactu data
|
|
515
|
+
* - PDF
|
|
516
|
+
* - Payment date
|
|
517
|
+
* - Sent date
|
|
518
|
+
*
|
|
519
|
+
* **Result:** A new draft invoice ready for review and emission.
|
|
520
|
+
*
|
|
521
|
+
*/
|
|
522
|
+
const duplicateInvoice = (options) => (options.client ?? client_gen_1.client).post({
|
|
523
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
524
|
+
url: '/v1/invoices/{invoice_id}/duplicate',
|
|
525
|
+
...options,
|
|
526
|
+
headers: {
|
|
527
|
+
'Content-Type': 'application/json',
|
|
528
|
+
...options.headers
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
exports.duplicateInvoice = duplicateInvoice;
|
|
532
|
+
/**
|
|
533
|
+
* Export invoices to Excel
|
|
534
|
+
*
|
|
535
|
+
* Exports invoices to an Excel file (XLSX format).
|
|
536
|
+
*
|
|
537
|
+
* **Two modes of operation:**
|
|
538
|
+
* - **By IDs:** Export specific invoices by providing `invoice_ids`
|
|
539
|
+
* - **By filters:** Export all invoices matching filter criteria
|
|
540
|
+
*
|
|
541
|
+
* **Two export formats (like Holded):**
|
|
542
|
+
* - **SUMMARY:** One row per invoice with aggregated totals (default)
|
|
543
|
+
* - **ITEMS:** One row per invoice line item, ideal for import compatibility
|
|
544
|
+
*
|
|
545
|
+
* **Columns for SUMMARY format:**
|
|
546
|
+
* - Date, Number, Due Date, Client, NIF
|
|
547
|
+
* - Description, Subtotal, IVA, Withholding, Equivalence Surcharge
|
|
548
|
+
* - Total, Collected, Pending, Status, Payment Method
|
|
549
|
+
*
|
|
550
|
+
* **Columns for ITEMS format:**
|
|
551
|
+
* - Invoice Number, Date, Due Date, Draft, Contact, Contact NIF
|
|
552
|
+
* - Address, Postal Code, City, Province, Country
|
|
553
|
+
* - SKU, Item, Units, Unit Price, Discount %
|
|
554
|
+
* - Subtotal, Tax Type, Tax %, Tax Amount
|
|
555
|
+
* - Surcharge %, Surcharge Amount, IRPF %, IRPF Amount, Total
|
|
556
|
+
*
|
|
557
|
+
* **Limits:**
|
|
558
|
+
* - Maximum 5000 invoices per export
|
|
559
|
+
* - All invoices must belong to the authenticated user (RLS enforced)
|
|
560
|
+
*
|
|
561
|
+
* **Usage example (Frontend):**
|
|
562
|
+
* ```javascript
|
|
563
|
+
* const response = await fetch('/v1/invoices/export/excel', {
|
|
564
|
+
* method: 'POST',
|
|
565
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
566
|
+
* body: JSON.stringify({ invoice_ids: [...], format: 'ITEMS' })
|
|
567
|
+
* });
|
|
568
|
+
* const blob = await response.blob();
|
|
569
|
+
* // Download the blob as file
|
|
570
|
+
* ```
|
|
571
|
+
*
|
|
572
|
+
*/
|
|
573
|
+
const exportInvoicesExcel = (options) => (options.client ?? client_gen_1.client).post({
|
|
574
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
575
|
+
url: '/v1/invoices/export/excel',
|
|
576
|
+
...options,
|
|
577
|
+
headers: {
|
|
578
|
+
'Content-Type': 'application/json',
|
|
579
|
+
...options.headers
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
exports.exportInvoicesExcel = exportInvoicesExcel;
|
|
583
|
+
/**
|
|
584
|
+
* List clients
|
|
585
|
+
*
|
|
586
|
+
* Returns a paginated list of clients with optional filters
|
|
587
|
+
*/
|
|
588
|
+
const listCustomers = (options) => (options?.client ?? client_gen_1.client).get({
|
|
589
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
590
|
+
url: '/v1/customers',
|
|
591
|
+
...options
|
|
592
|
+
});
|
|
593
|
+
exports.listCustomers = listCustomers;
|
|
594
|
+
/**
|
|
595
|
+
* Create client
|
|
596
|
+
*
|
|
597
|
+
* Creates a new client
|
|
598
|
+
*/
|
|
599
|
+
const createCustomer = (options) => (options.client ?? client_gen_1.client).post({
|
|
600
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
601
|
+
url: '/v1/customers',
|
|
602
|
+
...options,
|
|
603
|
+
headers: {
|
|
604
|
+
'Content-Type': 'application/json',
|
|
605
|
+
...options.headers
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
exports.createCustomer = createCustomer;
|
|
609
|
+
/**
|
|
610
|
+
* Deactivate client
|
|
611
|
+
*
|
|
612
|
+
* Deactivates (marks as deleted) a client.
|
|
613
|
+
*
|
|
614
|
+
* **Soft delete:** The client is not physically deleted, only marked as inactive.
|
|
615
|
+
*
|
|
616
|
+
* **Restriction:** Cannot deactivate a client with associated invoices.
|
|
617
|
+
*
|
|
618
|
+
*/
|
|
619
|
+
const deactivateCustomer = (options) => (options.client ?? client_gen_1.client).delete({
|
|
620
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
621
|
+
url: '/v1/customers/{customer_id}',
|
|
622
|
+
...options
|
|
623
|
+
});
|
|
624
|
+
exports.deactivateCustomer = deactivateCustomer;
|
|
625
|
+
/**
|
|
626
|
+
* Get client by ID
|
|
627
|
+
*
|
|
628
|
+
* Retrieves complete details of a specific client
|
|
629
|
+
*/
|
|
630
|
+
const getCustomer = (options) => (options.client ?? client_gen_1.client).get({
|
|
631
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
632
|
+
url: '/v1/customers/{customer_id}',
|
|
633
|
+
...options
|
|
634
|
+
});
|
|
635
|
+
exports.getCustomer = getCustomer;
|
|
636
|
+
/**
|
|
637
|
+
* Update client
|
|
638
|
+
*
|
|
639
|
+
* Updates an existing client
|
|
640
|
+
*/
|
|
641
|
+
const updateCustomer = (options) => (options.client ?? client_gen_1.client).put({
|
|
642
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
643
|
+
url: '/v1/customers/{customer_id}',
|
|
644
|
+
...options,
|
|
645
|
+
headers: {
|
|
646
|
+
'Content-Type': 'application/json',
|
|
647
|
+
...options.headers
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
exports.updateCustomer = updateCustomer;
|
|
651
|
+
/**
|
|
652
|
+
* Delete multiple clients
|
|
653
|
+
*
|
|
654
|
+
* Deactivates (marks as deleted) multiple clients in a single operation.
|
|
655
|
+
*
|
|
656
|
+
* **Soft delete:** Clients are not physically deleted, only marked as inactive.
|
|
657
|
+
*
|
|
658
|
+
* **Partial behavior:** Valid clients will be deactivated, failures are reported in the errors array.
|
|
659
|
+
*
|
|
660
|
+
*/
|
|
661
|
+
const deactivateCustomersBulk = (options) => (options.client ?? client_gen_1.client).delete({
|
|
662
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
663
|
+
url: '/v1/customers/bulk',
|
|
664
|
+
...options
|
|
665
|
+
});
|
|
666
|
+
exports.deactivateCustomersBulk = deactivateCustomersBulk;
|
|
667
|
+
/**
|
|
668
|
+
* Create or validate multiple clients
|
|
669
|
+
*
|
|
670
|
+
* Creates multiple clients in a single operation or validates data without persisting.
|
|
671
|
+
*
|
|
672
|
+
* **Validation flow:**
|
|
673
|
+
* 1. `dry_run=true`: Full validation only (NIFs, duplicates, format) without persistence
|
|
674
|
+
* 2. `dry_run=false`: Validation + actual creation
|
|
675
|
+
*
|
|
676
|
+
* **Validations performed:**
|
|
677
|
+
* - Individual validation of each client (same rules as single client creation)
|
|
678
|
+
* - Detection of duplicate NIFs within the batch
|
|
679
|
+
* - Detection of duplicate NIFs against existing database
|
|
680
|
+
* - Parallel NIF validation against AEAT registry (VeriFactu)
|
|
681
|
+
* - Field format verification (email, phone, etc.)
|
|
682
|
+
*
|
|
683
|
+
* **Result statuses:**
|
|
684
|
+
* - `VALID`: Client valid, ready to create
|
|
685
|
+
* - `WARNING`: Client valid but with warnings (e.g., missing email)
|
|
686
|
+
* - `ERROR`: Client invalid, cannot process
|
|
687
|
+
* - `DUPLICATE`: Duplicate NIF (in batch or existing DB)
|
|
688
|
+
* - `NIF_INVALID`: NIF not valid in AEAT registry
|
|
689
|
+
*
|
|
690
|
+
* **Atomicity:**
|
|
691
|
+
* - `dry_run=true`: Validation only, no persistence
|
|
692
|
+
* - `dry_run=false`: If any client fails, ALL clients are rejected (full atomicity)
|
|
693
|
+
*
|
|
694
|
+
*/
|
|
695
|
+
const createCustomersBulk = (options) => (options.client ?? client_gen_1.client).post({
|
|
696
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
697
|
+
url: '/v1/customers/bulk',
|
|
698
|
+
...options,
|
|
699
|
+
headers: {
|
|
700
|
+
'Content-Type': 'application/json',
|
|
701
|
+
...options.headers
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
exports.createCustomersBulk = createCustomersBulk;
|
|
705
|
+
/**
|
|
706
|
+
* Import clients from CSV with structured preview
|
|
707
|
+
*
|
|
708
|
+
* Imports multiple clients from a CSV file with full preview of all records.
|
|
709
|
+
*
|
|
710
|
+
* **Key features**:
|
|
711
|
+
* - **Structured preview**: Returns all parsed records (valid and with errors)
|
|
712
|
+
* - **Parallel validation**: NIFs validated concurrently against VeriFactu
|
|
713
|
+
* - **Granular feedback**: Client-specific errors and warnings
|
|
714
|
+
* - **Editable data**: Structured JSON for editable table in frontend
|
|
715
|
+
*
|
|
716
|
+
* **Recommended flow**:
|
|
717
|
+
* 1. **Initial upload**: Call with `dry_run=true` to get preview
|
|
718
|
+
* 2. **Display table**: Frontend shows parsed data with errors/warnings
|
|
719
|
+
* 3. **Inline editing**: User corrects data directly in the table
|
|
720
|
+
* 4. **Final import**: Send corrected data with `dry_run=false`
|
|
721
|
+
*
|
|
722
|
+
* **Format**: Must follow CSV template format (downloadable from `/customers/template-csv`).
|
|
723
|
+
*
|
|
724
|
+
* **Security limits**:
|
|
725
|
+
* - Max size: 5MB
|
|
726
|
+
* - Max 1,000 records per file
|
|
727
|
+
* - Rate limiting: 3 imports per hour
|
|
728
|
+
*
|
|
729
|
+
* **Validation**:
|
|
730
|
+
* - Required headers per template
|
|
731
|
+
* - Full validation of each row with business rules
|
|
732
|
+
* - Parallel NIF validation against AEAT registry (VeriFactu)
|
|
733
|
+
* - Duplicate detection in CSV and database
|
|
734
|
+
*
|
|
735
|
+
* **Validation statuses**:
|
|
736
|
+
* - `VALID`: Client valid, ready to import
|
|
737
|
+
* - `WARNING`: Client valid but with warnings (eg: missing email)
|
|
738
|
+
* - `ERROR`: Client invalid, cannot process
|
|
739
|
+
* - `DUPLICATE`: Duplicate client (in CSV or DB)
|
|
740
|
+
* - `NIF_INVALID`: NIF invalid in AEAT registry
|
|
741
|
+
*
|
|
742
|
+
*/
|
|
743
|
+
const importCustomersCsvPreview = (options) => (options.client ?? client_gen_1.client).post({
|
|
744
|
+
...client_1.formDataBodySerializer,
|
|
745
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
746
|
+
url: '/v1/customers/import-csv-preview',
|
|
747
|
+
...options,
|
|
748
|
+
headers: {
|
|
749
|
+
'Content-Type': null,
|
|
750
|
+
...options.headers
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
exports.importCustomersCsvPreview = importCustomersCsvPreview;
|
|
754
|
+
/**
|
|
755
|
+
* Import contacts from Holded Excel
|
|
756
|
+
*
|
|
757
|
+
* Imports multiple clients from an Excel file exported from Holded.
|
|
758
|
+
*
|
|
759
|
+
* **Key features**:
|
|
760
|
+
* - **Specific parsing**: Reads exact structure of Holded contacts Excel (29 columns)
|
|
761
|
+
* - **Automatic mapping**: Converts Holded contacts to Client entities automatically
|
|
762
|
+
* - **Full validation**: Validates NIFs, addresses and required data
|
|
763
|
+
* - **Preview mode**: Allows viewing parsed data before importing
|
|
764
|
+
*
|
|
765
|
+
* **Recommended flow**:
|
|
766
|
+
* 1. **Initial upload**: Call with `preview=true` to get preview
|
|
767
|
+
* 2. **Display data**: Frontend shows parsed Holded contacts
|
|
768
|
+
* 3. **Final import**: Call with `preview=false` to import definitively
|
|
769
|
+
*
|
|
770
|
+
* **Expected Excel structure** (contacts exported from Holded):
|
|
771
|
+
* - Sheet: "Holded"
|
|
772
|
+
* - Rows to skip: 2 (header + empty)
|
|
773
|
+
* - Headers in row 2: Created, Name, ID, Email, Phone, Mobile, etc. (29 columns)
|
|
774
|
+
* - Footer: "Report created automatically with Holded..."
|
|
775
|
+
*
|
|
776
|
+
* **Security limits**:
|
|
777
|
+
* - Max size: 10MB
|
|
778
|
+
* - Max 5,000 records per file
|
|
779
|
+
* - Rate limiting: 5 imports per hour
|
|
780
|
+
*
|
|
781
|
+
* **Automatic Holded → Client mapping**:
|
|
782
|
+
* - Name → legal_name
|
|
783
|
+
* - ID → identifier (NIF/CIF)
|
|
784
|
+
* - Email → email
|
|
785
|
+
* - Phone/Mobile → phone (prioritizes mobile)
|
|
786
|
+
* - Full address → address
|
|
787
|
+
* - Tags → notes
|
|
788
|
+
*
|
|
789
|
+
*/
|
|
790
|
+
const importHoldedContacts = (options) => (options.client ?? client_gen_1.client).post({
|
|
791
|
+
...client_1.formDataBodySerializer,
|
|
792
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
793
|
+
url: '/v1/customers/import-holded-contacts',
|
|
794
|
+
...options,
|
|
795
|
+
headers: {
|
|
796
|
+
'Content-Type': null,
|
|
797
|
+
...options.headers
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
exports.importHoldedContacts = importHoldedContacts;
|
|
801
|
+
/**
|
|
802
|
+
* Download CSV template for customers
|
|
803
|
+
*
|
|
804
|
+
* Downloads a sample CSV file for customer import.
|
|
805
|
+
*
|
|
806
|
+
* **Format**: The file includes the required headers and example rows
|
|
807
|
+
* with UTF-8 BOM for Excel compatibility.
|
|
808
|
+
*
|
|
809
|
+
*/
|
|
810
|
+
const downloadCustomerTemplateCsv = (options) => (options?.client ?? client_gen_1.client).post({
|
|
811
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
812
|
+
url: '/v1/customers/templates/csv',
|
|
813
|
+
...options
|
|
814
|
+
});
|
|
815
|
+
exports.downloadCustomerTemplateCsv = downloadCustomerTemplateCsv;
|
|
816
|
+
/**
|
|
817
|
+
* List products/services from catalog
|
|
818
|
+
*
|
|
819
|
+
* Returns a paginated list of products/services with optional filters
|
|
820
|
+
*/
|
|
821
|
+
const listProducts = (options) => (options?.client ?? client_gen_1.client).get({
|
|
822
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
823
|
+
url: '/v1/products',
|
|
824
|
+
...options
|
|
825
|
+
});
|
|
826
|
+
exports.listProducts = listProducts;
|
|
827
|
+
/**
|
|
828
|
+
* Create new product/service
|
|
829
|
+
*
|
|
830
|
+
* Creates a new product or service in the catalog
|
|
831
|
+
*/
|
|
832
|
+
const createProduct = (options) => (options.client ?? client_gen_1.client).post({
|
|
833
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
834
|
+
url: '/v1/products',
|
|
835
|
+
...options,
|
|
836
|
+
headers: {
|
|
837
|
+
'Content-Type': 'application/json',
|
|
838
|
+
...options.headers
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
exports.createProduct = createProduct;
|
|
842
|
+
/**
|
|
843
|
+
* Delete product
|
|
844
|
+
*
|
|
845
|
+
* Deletes a product from catalog
|
|
846
|
+
*/
|
|
847
|
+
const deleteProduct = (options) => (options.client ?? client_gen_1.client).delete({
|
|
848
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
849
|
+
url: '/v1/products/{product_id}',
|
|
850
|
+
...options
|
|
851
|
+
});
|
|
852
|
+
exports.deleteProduct = deleteProduct;
|
|
853
|
+
/**
|
|
854
|
+
* Get product by ID
|
|
855
|
+
*
|
|
856
|
+
* Retrieves details of a specific product
|
|
857
|
+
*/
|
|
858
|
+
const getProduct = (options) => (options.client ?? client_gen_1.client).get({
|
|
859
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
860
|
+
url: '/v1/products/{product_id}',
|
|
861
|
+
...options
|
|
862
|
+
});
|
|
863
|
+
exports.getProduct = getProduct;
|
|
864
|
+
/**
|
|
865
|
+
* Update product
|
|
866
|
+
*
|
|
867
|
+
* Updates an existing product
|
|
868
|
+
*/
|
|
869
|
+
const updateProduct = (options) => (options.client ?? client_gen_1.client).put({
|
|
870
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
871
|
+
url: '/v1/products/{product_id}',
|
|
872
|
+
...options,
|
|
873
|
+
headers: {
|
|
874
|
+
'Content-Type': 'application/json',
|
|
875
|
+
...options.headers
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
exports.updateProduct = updateProduct;
|
|
879
|
+
/**
|
|
880
|
+
* Search and autocomplete
|
|
881
|
+
*
|
|
882
|
+
* Optimized endpoint for active product autocomplete
|
|
883
|
+
*/
|
|
884
|
+
const searchProducts = (options) => (options?.client ?? client_gen_1.client).get({
|
|
885
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
886
|
+
url: '/v1/products/search',
|
|
887
|
+
...options
|
|
888
|
+
});
|
|
889
|
+
exports.searchProducts = searchProducts;
|
|
890
|
+
/**
|
|
891
|
+
* Delete multiple products
|
|
892
|
+
*
|
|
893
|
+
* Deletes multiple products from catalog (max 100)
|
|
894
|
+
*/
|
|
895
|
+
const deleteProductsBulk = (options) => (options.client ?? client_gen_1.client).delete({
|
|
896
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
897
|
+
url: '/v1/products/bulk',
|
|
898
|
+
...options,
|
|
899
|
+
headers: {
|
|
900
|
+
'Content-Type': 'application/json',
|
|
901
|
+
...options.headers
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
exports.deleteProductsBulk = deleteProductsBulk;
|
|
905
|
+
/**
|
|
906
|
+
* Create multiple products
|
|
907
|
+
*
|
|
908
|
+
* Creates multiple products in one operation (max 100)
|
|
909
|
+
*/
|
|
910
|
+
const createProductsBulk = (options) => (options.client ?? client_gen_1.client).post({
|
|
911
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
912
|
+
url: '/v1/products/bulk',
|
|
913
|
+
...options,
|
|
914
|
+
headers: {
|
|
915
|
+
'Content-Type': 'application/json',
|
|
916
|
+
...options.headers
|
|
917
|
+
}
|
|
918
|
+
});
|
|
919
|
+
exports.createProductsBulk = createProductsBulk;
|
|
920
|
+
/**
|
|
921
|
+
* Get VeriFactu configuration
|
|
922
|
+
*
|
|
923
|
+
* Retrieves the current VeriFactu configuration
|
|
924
|
+
*/
|
|
925
|
+
const getVeriFactuConfiguration = (options) => (options?.client ?? client_gen_1.client).get({
|
|
926
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
927
|
+
url: '/v1/configuration/verifactu',
|
|
928
|
+
...options
|
|
929
|
+
});
|
|
930
|
+
exports.getVeriFactuConfiguration = getVeriFactuConfiguration;
|
|
931
|
+
/**
|
|
932
|
+
* Update VeriFactu configuration
|
|
933
|
+
*
|
|
934
|
+
* Updates the user's VeriFactu configuration.
|
|
935
|
+
*
|
|
936
|
+
* **Business rules:**
|
|
937
|
+
* - If `enabled` is false, `apply_by_default` must also be false
|
|
938
|
+
* - If `apply_by_default` is true, `enabled` must be true
|
|
939
|
+
*
|
|
940
|
+
*/
|
|
941
|
+
const updateVeriFactuConfiguration = (options) => (options.client ?? client_gen_1.client).put({
|
|
942
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
943
|
+
url: '/v1/configuration/verifactu',
|
|
944
|
+
...options,
|
|
945
|
+
headers: {
|
|
946
|
+
'Content-Type': 'application/json',
|
|
947
|
+
...options.headers
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
exports.updateVeriFactuConfiguration = updateVeriFactuConfiguration;
|
|
951
|
+
/**
|
|
952
|
+
* Get complete tax types catalog
|
|
953
|
+
*
|
|
954
|
+
* Retrieves the complete catalog of available tax types with structured information
|
|
955
|
+
* for tax configuration in Spain:
|
|
956
|
+
*
|
|
957
|
+
* - **Tax regimes**: VAT (Peninsula), IGIC (Canary Islands), IPSI (Ceuta/Melilla), OTHERS
|
|
958
|
+
* - **Percentages per regime**: Valid percentages for each tax type
|
|
959
|
+
* - **Regime codes**: VeriFactu codes for each tax type
|
|
960
|
+
* - **IRPF**: Available withholding percentages
|
|
961
|
+
* - **Equivalence surcharge**: Automatic mappings based on VAT percentage
|
|
962
|
+
* - **Utilities**: Validation functions and geographic auto-detection
|
|
963
|
+
*
|
|
964
|
+
* This endpoint provides all necessary information for the frontend
|
|
965
|
+
* without duplicating tax validation logic.
|
|
966
|
+
*
|
|
967
|
+
*/
|
|
968
|
+
const getTaxTypes = (options) => (options?.client ?? client_gen_1.client).get({
|
|
969
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
970
|
+
url: '/v1/configuration/tax-types',
|
|
971
|
+
...options
|
|
972
|
+
});
|
|
973
|
+
exports.getTaxTypes = getTaxTypes;
|
|
974
|
+
/**
|
|
975
|
+
* Get user tax configuration
|
|
976
|
+
*
|
|
977
|
+
* Retrieves the user's tax configuration, including:
|
|
978
|
+
* - Default tax regime (VAT, IGIC, IPSI, OTHERS)
|
|
979
|
+
* - Default main tax percentage
|
|
980
|
+
* - IRPF and equivalence surcharge configuration
|
|
981
|
+
*
|
|
982
|
+
*/
|
|
983
|
+
const getTaxConfiguration = (options) => (options?.client ?? client_gen_1.client).get({
|
|
984
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
985
|
+
url: '/v1/configuration/taxes',
|
|
986
|
+
...options
|
|
987
|
+
});
|
|
988
|
+
exports.getTaxConfiguration = getTaxConfiguration;
|
|
989
|
+
/**
|
|
990
|
+
* Update tax configuration
|
|
991
|
+
*
|
|
992
|
+
* Updates the user's tax configuration
|
|
993
|
+
*/
|
|
994
|
+
const updateTaxConfiguration = (options) => (options.client ?? client_gen_1.client).put({
|
|
995
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
996
|
+
url: '/v1/configuration/taxes',
|
|
997
|
+
...options,
|
|
998
|
+
headers: {
|
|
999
|
+
'Content-Type': 'application/json',
|
|
1000
|
+
...options.headers
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
exports.updateTaxConfiguration = updateTaxConfiguration;
|
|
1004
|
+
/**
|
|
1005
|
+
* List invoice series
|
|
1006
|
+
*
|
|
1007
|
+
* Retrieves all invoice series for the user
|
|
1008
|
+
*/
|
|
1009
|
+
const listSeries = (options) => (options?.client ?? client_gen_1.client).get({
|
|
1010
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1011
|
+
url: '/v1/configuration/series',
|
|
1012
|
+
...options
|
|
1013
|
+
});
|
|
1014
|
+
exports.listSeries = listSeries;
|
|
1015
|
+
/**
|
|
1016
|
+
* Create invoice series
|
|
1017
|
+
*
|
|
1018
|
+
* Creates a new invoice series.
|
|
1019
|
+
*
|
|
1020
|
+
* **Note:** The first series created by a user is automatically marked as default.
|
|
1021
|
+
*
|
|
1022
|
+
*/
|
|
1023
|
+
const createSeries = (options) => (options.client ?? client_gen_1.client).post({
|
|
1024
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1025
|
+
url: '/v1/configuration/series',
|
|
1026
|
+
...options,
|
|
1027
|
+
headers: {
|
|
1028
|
+
'Content-Type': 'application/json',
|
|
1029
|
+
...options.headers
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
exports.createSeries = createSeries;
|
|
1033
|
+
/**
|
|
1034
|
+
* Delete series
|
|
1035
|
+
*
|
|
1036
|
+
* Deactivates an invoice series.
|
|
1037
|
+
*
|
|
1038
|
+
* **Soft delete:** The series is marked as inactive, not physically deleted.
|
|
1039
|
+
*
|
|
1040
|
+
* **Restriction:** Cannot delete the default series or series with invoices.
|
|
1041
|
+
*
|
|
1042
|
+
*/
|
|
1043
|
+
const deleteSeries = (options) => (options.client ?? client_gen_1.client).delete({
|
|
1044
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1045
|
+
url: '/v1/configuration/series/{series_id}',
|
|
1046
|
+
...options
|
|
1047
|
+
});
|
|
1048
|
+
exports.deleteSeries = deleteSeries;
|
|
1049
|
+
/**
|
|
1050
|
+
* Get series by ID
|
|
1051
|
+
*
|
|
1052
|
+
* Retrieves details of a specific series
|
|
1053
|
+
*/
|
|
1054
|
+
const getSeries = (options) => (options.client ?? client_gen_1.client).get({
|
|
1055
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1056
|
+
url: '/v1/configuration/series/{series_id}',
|
|
1057
|
+
...options
|
|
1058
|
+
});
|
|
1059
|
+
exports.getSeries = getSeries;
|
|
1060
|
+
/**
|
|
1061
|
+
* Update invoice series
|
|
1062
|
+
*
|
|
1063
|
+
* Updates an existing invoice series.
|
|
1064
|
+
*
|
|
1065
|
+
* Can only update:
|
|
1066
|
+
* - Description
|
|
1067
|
+
* - Active/inactive status
|
|
1068
|
+
* - Whether it is default
|
|
1069
|
+
*
|
|
1070
|
+
* Cannot modify: code, prefix, number_format (to maintain consistency with existing invoices).
|
|
1071
|
+
*
|
|
1072
|
+
* Business rules:
|
|
1073
|
+
* - Cannot deactivate a default series (must set another as default first)
|
|
1074
|
+
* - Cannot mark an inactive series as default
|
|
1075
|
+
*
|
|
1076
|
+
*/
|
|
1077
|
+
const updateSeries = (options) => (options.client ?? client_gen_1.client).put({
|
|
1078
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1079
|
+
url: '/v1/configuration/series/{series_id}',
|
|
1080
|
+
...options,
|
|
1081
|
+
headers: {
|
|
1082
|
+
'Content-Type': 'application/json',
|
|
1083
|
+
...options.headers
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
exports.updateSeries = updateSeries;
|
|
1087
|
+
/**
|
|
1088
|
+
* Mark series as default
|
|
1089
|
+
*
|
|
1090
|
+
* Marks an invoice series as the user's default.
|
|
1091
|
+
*
|
|
1092
|
+
* **Business rules:**
|
|
1093
|
+
* - Only one series can be default per user
|
|
1094
|
+
* - The series must be active (cannot mark an inactive series)
|
|
1095
|
+
* - The previous default series is automatically unmarked
|
|
1096
|
+
*
|
|
1097
|
+
* **Note:** This operation is idempotent - calling it multiple times
|
|
1098
|
+
* with the same series has no additional effects.
|
|
1099
|
+
*
|
|
1100
|
+
*/
|
|
1101
|
+
const setDefaultSeries = (options) => (options.client ?? client_gen_1.client).post({
|
|
1102
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1103
|
+
url: '/v1/configuration/series/{series_id}/default',
|
|
1104
|
+
...options
|
|
1105
|
+
});
|
|
1106
|
+
exports.setDefaultSeries = setDefaultSeries;
|
|
1107
|
+
/**
|
|
1108
|
+
* Update user preferred language
|
|
1109
|
+
*
|
|
1110
|
+
* Updates the authenticated user's preferred language.
|
|
1111
|
+
*
|
|
1112
|
+
* This language is used for:
|
|
1113
|
+
* - UI translations
|
|
1114
|
+
* - Template names and colors in invoice customization
|
|
1115
|
+
* - Emails sent to the user
|
|
1116
|
+
*
|
|
1117
|
+
* **Supported languages:**
|
|
1118
|
+
* - `es` - Spanish (default)
|
|
1119
|
+
* - `en` - English
|
|
1120
|
+
* - `ca` - Catalan
|
|
1121
|
+
*
|
|
1122
|
+
*/
|
|
1123
|
+
const updateLanguage = (options) => (options.client ?? client_gen_1.client).put({
|
|
1124
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1125
|
+
url: '/v1/configuration/language',
|
|
1126
|
+
...options,
|
|
1127
|
+
headers: {
|
|
1128
|
+
'Content-Type': 'application/json',
|
|
1129
|
+
...options.headers
|
|
1130
|
+
}
|
|
1131
|
+
});
|
|
1132
|
+
exports.updateLanguage = updateLanguage;
|
|
1133
|
+
/**
|
|
1134
|
+
* Get invoice customization options
|
|
1135
|
+
*
|
|
1136
|
+
* Retrieves available option catalogs to customize invoices:
|
|
1137
|
+
*
|
|
1138
|
+
* **Template types:**
|
|
1139
|
+
* - MODERN_TABLE: Structured table design, ideal for standard products/services
|
|
1140
|
+
* - PROFESSIONAL_SERVICE: Text-based design, ideal for notaries/consultancies
|
|
1141
|
+
*
|
|
1142
|
+
* **Suggested color palette:**
|
|
1143
|
+
* - BeeL default colors (orange, blue)
|
|
1144
|
+
* - Professional palette (dark grays)
|
|
1145
|
+
* - Creative palette (violet, pink, amber, emerald green)
|
|
1146
|
+
* - Classic palette (blue, red, green, purple)
|
|
1147
|
+
*
|
|
1148
|
+
* **Usage:**
|
|
1149
|
+
* User can choose a template and accent color to customize
|
|
1150
|
+
* their invoices. These values are saved in their profile and automatically applied
|
|
1151
|
+
* when generating new invoice PDFs.
|
|
1152
|
+
*
|
|
1153
|
+
* This endpoint doesn't require authentication as the data is static and public.
|
|
1154
|
+
*
|
|
1155
|
+
*/
|
|
1156
|
+
const getInvoiceCustomizationOptions = (options) => (options?.client ?? client_gen_1.client).get({
|
|
1157
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1158
|
+
url: '/v1/configuration/invoice-customization-options',
|
|
1159
|
+
...options
|
|
1160
|
+
});
|
|
1161
|
+
exports.getInvoiceCustomizationOptions = getInvoiceCustomizationOptions;
|
|
1162
|
+
/**
|
|
1163
|
+
* Validate NIF against AEAT registry
|
|
1164
|
+
*
|
|
1165
|
+
* **Public endpoint** to validate a NIF/CIF against the AEAT registry using VeriFactu.
|
|
1166
|
+
*
|
|
1167
|
+
* This endpoint is useful for:
|
|
1168
|
+
* - Pre-validation before registration (proactive feedback)
|
|
1169
|
+
* - Validating client NIFs before creating invoices
|
|
1170
|
+
* - Verifying that a NIF exists in the registry
|
|
1171
|
+
*
|
|
1172
|
+
* **Behavior:**
|
|
1173
|
+
* - **VALID**: The NIF exists in the AEAT registry. Returns the fiscal name.
|
|
1174
|
+
* - **INVALID**: The NIF has correct format but doesn't exist in the registry.
|
|
1175
|
+
* - **PENDING**: VeriFactu API is temporarily unavailable. The NIF has valid syntax but couldn't be verified against the registry.
|
|
1176
|
+
* - **ERROR**: Technical error during validation (invalid syntax, timeout, etc.)
|
|
1177
|
+
*
|
|
1178
|
+
* **Note about PENDING:**
|
|
1179
|
+
* If you use this endpoint for pre-validation during registration, a PENDING status
|
|
1180
|
+
* indicates that the NIF has valid format and the user can continue. The system
|
|
1181
|
+
* will validate the NIF automatically when the service becomes available.
|
|
1182
|
+
*
|
|
1183
|
+
* **Rate limiting:**
|
|
1184
|
+
* - With API Key: 100 requests/hour
|
|
1185
|
+
* - With Session Cookie: 1000 requests/hour
|
|
1186
|
+
*
|
|
1187
|
+
* **Authentication:**
|
|
1188
|
+
* This endpoint accepts both API Keys and Session Cookies.
|
|
1189
|
+
*
|
|
1190
|
+
*/
|
|
1191
|
+
const validateNif = (options) => (options.client ?? client_gen_1.client).post({
|
|
1192
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1193
|
+
in: 'cookie',
|
|
1194
|
+
name: 'BEEL_SESSION',
|
|
1195
|
+
type: 'apiKey'
|
|
1196
|
+
}],
|
|
1197
|
+
url: '/v1/nif/validate',
|
|
1198
|
+
...options,
|
|
1199
|
+
headers: {
|
|
1200
|
+
'Content-Type': 'application/json',
|
|
1201
|
+
...options.headers
|
|
1202
|
+
}
|
|
1203
|
+
});
|
|
1204
|
+
exports.validateNif = validateNif;
|
|
1205
|
+
/**
|
|
1206
|
+
* List all companies
|
|
1207
|
+
*
|
|
1208
|
+
* Returns all companies (sub-accounts) under the authenticated account.
|
|
1209
|
+
*/
|
|
1210
|
+
const listCompanies = (options) => (options?.client ?? client_gen_1.client).get({
|
|
1211
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1212
|
+
url: '/v1/companies',
|
|
1213
|
+
...options
|
|
1214
|
+
});
|
|
1215
|
+
exports.listCompanies = listCompanies;
|
|
1216
|
+
/**
|
|
1217
|
+
* Create a company (sub-account)
|
|
1218
|
+
*
|
|
1219
|
+
* Creates a new NIF/company under the authenticated account.
|
|
1220
|
+
* Invoice series are created automatically with default values.
|
|
1221
|
+
*
|
|
1222
|
+
*/
|
|
1223
|
+
const createCompany = (options) => (options.client ?? client_gen_1.client).post({
|
|
1224
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1225
|
+
url: '/v1/companies',
|
|
1226
|
+
...options,
|
|
1227
|
+
headers: {
|
|
1228
|
+
'Content-Type': 'application/json',
|
|
1229
|
+
...options.headers
|
|
1230
|
+
}
|
|
1231
|
+
});
|
|
1232
|
+
exports.createCompany = createCompany;
|
|
1233
|
+
/**
|
|
1234
|
+
* Delete a company
|
|
1235
|
+
*
|
|
1236
|
+
* Deletes a company (sub-account). Cannot delete the primary profile.
|
|
1237
|
+
*
|
|
1238
|
+
*/
|
|
1239
|
+
const deleteCompany = (options) => (options.client ?? client_gen_1.client).delete({
|
|
1240
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1241
|
+
url: '/v1/companies/{company_id}',
|
|
1242
|
+
...options
|
|
1243
|
+
});
|
|
1244
|
+
exports.deleteCompany = deleteCompany;
|
|
1245
|
+
/**
|
|
1246
|
+
* Get company details
|
|
1247
|
+
*
|
|
1248
|
+
* Returns details of a specific company including VeriFactu status.
|
|
1249
|
+
*/
|
|
1250
|
+
const getCompany = (options) => (options.client ?? client_gen_1.client).get({
|
|
1251
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1252
|
+
url: '/v1/companies/{company_id}',
|
|
1253
|
+
...options
|
|
1254
|
+
});
|
|
1255
|
+
exports.getCompany = getCompany;
|
|
1256
|
+
/**
|
|
1257
|
+
* Update company details
|
|
1258
|
+
*
|
|
1259
|
+
* Updates editable fields of a company.
|
|
1260
|
+
* NIF, legal name, and entity type are immutable after creation.
|
|
1261
|
+
*
|
|
1262
|
+
*/
|
|
1263
|
+
const updateCompany = (options) => (options.client ?? client_gen_1.client).patch({
|
|
1264
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1265
|
+
url: '/v1/companies/{company_id}',
|
|
1266
|
+
...options,
|
|
1267
|
+
headers: {
|
|
1268
|
+
'Content-Type': 'application/json',
|
|
1269
|
+
...options.headers
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
exports.updateCompany = updateCompany;
|
|
1273
|
+
/**
|
|
1274
|
+
* Generate unsigned representation PDF
|
|
1275
|
+
*
|
|
1276
|
+
* Generates the VeriFactu representation PDF for digital signature.
|
|
1277
|
+
*/
|
|
1278
|
+
const generateRepresentation = (options) => (options.client ?? client_gen_1.client).post({
|
|
1279
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1280
|
+
url: '/v1/companies/{company_id}/representation/generate',
|
|
1281
|
+
...options
|
|
1282
|
+
});
|
|
1283
|
+
exports.generateRepresentation = generateRepresentation;
|
|
1284
|
+
/**
|
|
1285
|
+
* Download representation PDF
|
|
1286
|
+
*
|
|
1287
|
+
* Returns a presigned URL (5min) to download the representation PDF.
|
|
1288
|
+
*/
|
|
1289
|
+
const downloadRepresentation = (options) => (options.client ?? client_gen_1.client).get({
|
|
1290
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1291
|
+
url: '/v1/companies/{company_id}/representation/download',
|
|
1292
|
+
...options
|
|
1293
|
+
});
|
|
1294
|
+
exports.downloadRepresentation = downloadRepresentation;
|
|
1295
|
+
/**
|
|
1296
|
+
* Submit signed representation PDF
|
|
1297
|
+
*
|
|
1298
|
+
* Uploads the digitally signed representation PDF.
|
|
1299
|
+
* VeriFactu will validate the signature asynchronously.
|
|
1300
|
+
*
|
|
1301
|
+
*/
|
|
1302
|
+
const submitRepresentation = (options) => (options.client ?? client_gen_1.client).post({
|
|
1303
|
+
...client_1.formDataBodySerializer,
|
|
1304
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1305
|
+
url: '/v1/companies/{company_id}/representation/submit',
|
|
1306
|
+
...options,
|
|
1307
|
+
headers: {
|
|
1308
|
+
'Content-Type': null,
|
|
1309
|
+
...options.headers
|
|
1310
|
+
}
|
|
1311
|
+
});
|
|
1312
|
+
exports.submitRepresentation = submitRepresentation;
|
|
1313
|
+
/**
|
|
1314
|
+
* Get representation status
|
|
1315
|
+
*
|
|
1316
|
+
* Returns the current status of the VeriFactu representation process.
|
|
1317
|
+
*/
|
|
1318
|
+
const getRepresentationStatus = (options) => (options.client ?? client_gen_1.client).get({
|
|
1319
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1320
|
+
url: '/v1/companies/{company_id}/representation/status',
|
|
1321
|
+
...options
|
|
1322
|
+
});
|
|
1323
|
+
exports.getRepresentationStatus = getRepresentationStatus;
|
|
1324
|
+
/**
|
|
1325
|
+
* Cancel representation
|
|
1326
|
+
*
|
|
1327
|
+
* Cancels the current representation process.
|
|
1328
|
+
*/
|
|
1329
|
+
const cancelRepresentation = (options) => (options.client ?? client_gen_1.client).delete({
|
|
1330
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1331
|
+
url: '/v1/companies/{company_id}/representation/cancel',
|
|
1332
|
+
...options
|
|
1333
|
+
});
|
|
1334
|
+
exports.cancelRepresentation = cancelRepresentation;
|
|
1335
|
+
/**
|
|
1336
|
+
* List API keys for a company
|
|
1337
|
+
*
|
|
1338
|
+
* Returns all API keys associated with this company.
|
|
1339
|
+
*/
|
|
1340
|
+
const listCompanyApiKeys = (options) => (options.client ?? client_gen_1.client).get({
|
|
1341
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1342
|
+
url: '/v1/companies/{company_id}/api-keys',
|
|
1343
|
+
...options
|
|
1344
|
+
});
|
|
1345
|
+
exports.listCompanyApiKeys = listCompanyApiKeys;
|
|
1346
|
+
/**
|
|
1347
|
+
* Create API key scoped to a company
|
|
1348
|
+
*
|
|
1349
|
+
* Creates an API key that authenticates directly as this company.
|
|
1350
|
+
* The created key cannot have more scopes than the parent key.
|
|
1351
|
+
*
|
|
1352
|
+
*/
|
|
1353
|
+
const createCompanyApiKey = (options) => (options.client ?? client_gen_1.client).post({
|
|
1354
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1355
|
+
url: '/v1/companies/{company_id}/api-keys',
|
|
1356
|
+
...options,
|
|
1357
|
+
headers: {
|
|
1358
|
+
'Content-Type': 'application/json',
|
|
1359
|
+
...options.headers
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
exports.createCompanyApiKey = createCompanyApiKey;
|
|
1363
|
+
/**
|
|
1364
|
+
* Revoke an API key
|
|
1365
|
+
*
|
|
1366
|
+
* Revokes (deletes) an API key associated with this company.
|
|
1367
|
+
*/
|
|
1368
|
+
const revokeCompanyApiKey = (options) => (options.client ?? client_gen_1.client).delete({
|
|
1369
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1370
|
+
url: '/v1/companies/{company_id}/api-keys/{key_id}',
|
|
1371
|
+
...options
|
|
1372
|
+
});
|
|
1373
|
+
exports.revokeCompanyApiKey = revokeCompanyApiKey;
|
|
1374
|
+
/**
|
|
1375
|
+
* List webhook subscriptions
|
|
1376
|
+
*
|
|
1377
|
+
* Returns all webhook subscriptions for the authenticated account.
|
|
1378
|
+
*/
|
|
1379
|
+
const listWebhookSubscriptions = (options) => (options?.client ?? client_gen_1.client).get({
|
|
1380
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1381
|
+
url: '/v1/webhooks',
|
|
1382
|
+
...options
|
|
1383
|
+
});
|
|
1384
|
+
exports.listWebhookSubscriptions = listWebhookSubscriptions;
|
|
1385
|
+
/**
|
|
1386
|
+
* Create webhook subscription
|
|
1387
|
+
*
|
|
1388
|
+
* Register an HTTPS endpoint to receive real-time event notifications. Every delivery is signed with BeeL-Signature (HMAC-SHA256). The secret is returned once on creation — store it securely. Maximum 10 active webhook subscriptions per account.
|
|
1389
|
+
*/
|
|
1390
|
+
const createWebhookSubscription = (options) => (options.client ?? client_gen_1.client).post({
|
|
1391
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1392
|
+
url: '/v1/webhooks',
|
|
1393
|
+
...options,
|
|
1394
|
+
headers: {
|
|
1395
|
+
'Content-Type': 'application/json',
|
|
1396
|
+
...options.headers
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1399
|
+
exports.createWebhookSubscription = createWebhookSubscription;
|
|
1400
|
+
/**
|
|
1401
|
+
* Delete webhook subscription
|
|
1402
|
+
*
|
|
1403
|
+
* Permanently deletes a webhook subscription. No further events will be delivered.
|
|
1404
|
+
*/
|
|
1405
|
+
const deleteWebhookSubscription = (options) => (options.client ?? client_gen_1.client).delete({
|
|
1406
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1407
|
+
url: '/v1/webhooks/{webhook_id}',
|
|
1408
|
+
...options
|
|
1409
|
+
});
|
|
1410
|
+
exports.deleteWebhookSubscription = deleteWebhookSubscription;
|
|
1411
|
+
/**
|
|
1412
|
+
* Update webhook subscription
|
|
1413
|
+
*
|
|
1414
|
+
* Partially updates a webhook subscription. Only provided fields are updated.
|
|
1415
|
+
*
|
|
1416
|
+
* Use this endpoint to:
|
|
1417
|
+
* - **Change the endpoint URL** (`url`)
|
|
1418
|
+
* - **Change subscribed events** (`events`)
|
|
1419
|
+
* - **Enable or disable** the subscription (`active`)
|
|
1420
|
+
*
|
|
1421
|
+
*/
|
|
1422
|
+
const updateWebhookSubscription = (options) => (options.client ?? client_gen_1.client).patch({
|
|
1423
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1424
|
+
url: '/v1/webhooks/{webhook_id}',
|
|
1425
|
+
...options,
|
|
1426
|
+
headers: {
|
|
1427
|
+
'Content-Type': 'application/json',
|
|
1428
|
+
...options.headers
|
|
1429
|
+
}
|
|
1430
|
+
});
|
|
1431
|
+
exports.updateWebhookSubscription = updateWebhookSubscription;
|
|
1432
|
+
/**
|
|
1433
|
+
* List webhook delivery logs
|
|
1434
|
+
*
|
|
1435
|
+
* Returns the last 50 delivery attempts for a webhook subscription.
|
|
1436
|
+
*/
|
|
1437
|
+
const listWebhookDeliveries = (options) => (options.client ?? client_gen_1.client).get({
|
|
1438
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1439
|
+
url: '/v1/webhooks/{webhook_id}/deliveries',
|
|
1440
|
+
...options
|
|
1441
|
+
});
|
|
1442
|
+
exports.listWebhookDeliveries = listWebhookDeliveries;
|
|
1443
|
+
/**
|
|
1444
|
+
* Retry a failed webhook delivery
|
|
1445
|
+
*
|
|
1446
|
+
* Immediately retries a webhook delivery using the original payload.
|
|
1447
|
+
* Creates a new delivery log entry with the result.
|
|
1448
|
+
*
|
|
1449
|
+
*/
|
|
1450
|
+
const retryWebhookDelivery = (options) => (options.client ?? client_gen_1.client).post({
|
|
1451
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1452
|
+
url: '/v1/webhooks/{webhook_id}/deliveries/{delivery_id}/retry',
|
|
1453
|
+
...options
|
|
1454
|
+
});
|
|
1455
|
+
exports.retryWebhookDelivery = retryWebhookDelivery;
|
|
1456
|
+
/**
|
|
1457
|
+
* Rotate webhook secret
|
|
1458
|
+
*
|
|
1459
|
+
* Generates a new HMAC secret for a webhook subscription.
|
|
1460
|
+
* The old secret is **immediately invalidated** — update your signature verification
|
|
1461
|
+
* logic before rotating to avoid missing events during the transition.
|
|
1462
|
+
* The new secret is only returned **once** in this response.
|
|
1463
|
+
*
|
|
1464
|
+
*/
|
|
1465
|
+
const rotateWebhookSecret = (options) => (options.client ?? client_gen_1.client).post({
|
|
1466
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
1467
|
+
url: '/v1/webhooks/{webhook_id}/secret',
|
|
1468
|
+
...options
|
|
1469
|
+
});
|
|
1470
|
+
exports.rotateWebhookSecret = rotateWebhookSecret;
|
|
1471
|
+
/**
|
|
1472
|
+
* Get public platform metrics
|
|
1473
|
+
*
|
|
1474
|
+
* Retrieves sanitized platform metrics safe for public display on landing page.
|
|
1475
|
+
*
|
|
1476
|
+
* **No authentication required**
|
|
1477
|
+
*
|
|
1478
|
+
* **Data is:**
|
|
1479
|
+
* - Rounded to avoid exposing exact figures
|
|
1480
|
+
* - Cached for 15 minutes
|
|
1481
|
+
* - Safe for public consumption
|
|
1482
|
+
*
|
|
1483
|
+
* **Use case:**
|
|
1484
|
+
* - Landing page social proof
|
|
1485
|
+
* - Marketing materials
|
|
1486
|
+
*
|
|
1487
|
+
*/
|
|
1488
|
+
const getPublicMetrics = (options) => (options?.client ?? client_gen_1.client).get({ url: '/v1/public/metrics', ...options });
|
|
1489
|
+
exports.getPublicMetrics = getPublicMetrics;
|
|
1490
|
+
//# sourceMappingURL=sdk.gen.js.map
|