@beel_es/sdk 2.0.0 → 2.2.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/CHANGELOG.md +244 -0
- package/README.md +216 -25
- package/dist/index.d.mts +1480 -185
- package/dist/index.d.ts +1480 -185
- package/dist/index.js +1419 -187
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1416 -187
- package/dist/index.mjs.map +1 -1
- package/docs/reference/README.md +233 -0
- package/docs/reference/account-companies.md +55 -0
- package/docs/reference/account-invitations.md +57 -0
- package/docs/reference/account-members.md +97 -0
- package/docs/reference/account-webhooks.md +123 -0
- package/docs/reference/account.md +94 -0
- package/docs/reference/accounts.md +72 -0
- package/docs/reference/catalogs.md +68 -0
- package/docs/reference/client.md +113 -0
- package/docs/reference/company-customers.md +85 -0
- package/docs/reference/company-invoices-schedule.md +52 -0
- package/docs/reference/company-invoices.md +316 -0
- package/docs/reference/company-payment-connections-events.md +103 -0
- package/docs/reference/company-payment-connections.md +87 -0
- package/docs/reference/company-products.md +72 -0
- package/docs/reference/company-recurring-invoices.md +136 -0
- package/docs/reference/company-series.md +94 -0
- package/docs/reference/company-tax-configuration.md +36 -0
- package/docs/reference/company-verifactu-configuration.md +41 -0
- package/docs/reference/company.md +94 -0
- package/docs/reference/configuration.md +90 -0
- package/docs/reference/customer-builder.md +107 -0
- package/docs/reference/customers.md +91 -0
- package/docs/reference/errors.md +72 -0
- package/docs/reference/invoice-builder.md +149 -0
- package/docs/reference/invoices.md +250 -0
- package/docs/reference/nif.md +31 -0
- package/docs/reference/products.md +111 -0
- package/docs/reference/series.md +81 -0
- package/docs/reference/types.md +222 -0
- package/docs/reference/webhook-verifier.md +95 -0
- package/llms.txt +52 -0
- package/package.json +10 -4
package/dist/index.d.mts
CHANGED
|
@@ -6482,10 +6482,12 @@ interface components {
|
|
|
6482
6482
|
*/
|
|
6483
6483
|
city: string;
|
|
6484
6484
|
/**
|
|
6485
|
-
* @description Province or state - Latin characters only
|
|
6485
|
+
* @description Province or state - Latin characters only. Required for an address in Spain
|
|
6486
|
+
* (`country_code` `ES`, or no country at all); optional elsewhere, where many addresses
|
|
6487
|
+
* have none. A Spanish address without it is rejected with a `422`.
|
|
6486
6488
|
* @example Madrid
|
|
6487
6489
|
*/
|
|
6488
|
-
province
|
|
6490
|
+
province?: string;
|
|
6489
6491
|
/**
|
|
6490
6492
|
* @description Country of the address, as its ISO 3166-1 alpha-2 code (`GB`) or its official name
|
|
6491
6493
|
* in Spanish, English or Catalan (`Reino Unido`, `United Kingdom`, `Regne Unit`;
|
|
@@ -6545,7 +6547,7 @@ interface components {
|
|
|
6545
6547
|
*/
|
|
6546
6548
|
city?: string;
|
|
6547
6549
|
/**
|
|
6548
|
-
* @description Province or state
|
|
6550
|
+
* @description Province or state. Outside Spain an address may have none.
|
|
6549
6551
|
* @example Madrid
|
|
6550
6552
|
*/
|
|
6551
6553
|
province?: string;
|
|
@@ -7378,7 +7380,7 @@ interface components {
|
|
|
7378
7380
|
* @default 0
|
|
7379
7381
|
* @example 10
|
|
7380
7382
|
*/
|
|
7381
|
-
discount_percentage
|
|
7383
|
+
discount_percentage?: number;
|
|
7382
7384
|
/**
|
|
7383
7385
|
* @description Main tax of the line: regime (IVA/IGIC/IPSI/OTHER), percentage and regime key.
|
|
7384
7386
|
*
|
|
@@ -7464,7 +7466,7 @@ interface components {
|
|
|
7464
7466
|
* (art. 78.Tres.3 LIVA). Requires `source_invoice_reference`.
|
|
7465
7467
|
* @default NORMAL
|
|
7466
7468
|
*/
|
|
7467
|
-
line_type
|
|
7469
|
+
line_type?: components["schemas"]["InvoiceLineType"];
|
|
7468
7470
|
/**
|
|
7469
7471
|
* @description Reference to the original invoice issued by the third party in the
|
|
7470
7472
|
* client's name. Required when `line_type=SUPLIDO`.
|
|
@@ -7515,21 +7517,21 @@ interface components {
|
|
|
7515
7517
|
* If `false` (default), creates as **DRAFT** without number (editable, no PDF).
|
|
7516
7518
|
* @default false
|
|
7517
7519
|
*/
|
|
7518
|
-
issue_directly
|
|
7520
|
+
issue_directly?: boolean;
|
|
7519
7521
|
/**
|
|
7520
7522
|
* @description Only applies when `issue_directly` is `true`.
|
|
7521
7523
|
* If `true`, waits for PDF generation before returning the response (~1-3s).
|
|
7522
7524
|
* If `false` (default), PDF is generated asynchronously in the background.
|
|
7523
7525
|
* @default false
|
|
7524
7526
|
*/
|
|
7525
|
-
wait_for_pdf
|
|
7527
|
+
wait_for_pdf?: boolean;
|
|
7526
7528
|
/**
|
|
7527
7529
|
* @description Only applies when `issue_directly` is `true`.
|
|
7528
7530
|
* If `true`, sends the invoice by email with PDF attachment after issuing.
|
|
7529
7531
|
* The email is sent asynchronously after the invoice is issued.
|
|
7530
7532
|
* @default false
|
|
7531
7533
|
*/
|
|
7532
|
-
send_automatically
|
|
7534
|
+
send_automatically?: boolean;
|
|
7533
7535
|
/**
|
|
7534
7536
|
* @description Only applies when `send_automatically` is `true`. If `true`, the email sent after
|
|
7535
7537
|
* issuing also attaches a ZIP (`suplidos_<invoice-number>.zip`) with the PDFs of the
|
|
@@ -7544,7 +7546,7 @@ interface components {
|
|
|
7544
7546
|
* stored on the invoice.
|
|
7545
7547
|
* @default false
|
|
7546
7548
|
*/
|
|
7547
|
-
attach_source_invoices
|
|
7549
|
+
attach_source_invoices?: boolean;
|
|
7548
7550
|
/**
|
|
7549
7551
|
* @description Only applies when `send_automatically` is `true`.
|
|
7550
7552
|
* Overrides default email settings. If it names no recipients, the email goes to the
|
|
@@ -7765,12 +7767,12 @@ interface components {
|
|
|
7765
7767
|
/** @description Custom message (optional, added before standard message) */
|
|
7766
7768
|
message?: string;
|
|
7767
7769
|
/** @default true */
|
|
7768
|
-
attach_pdf
|
|
7770
|
+
attach_pdf?: boolean;
|
|
7769
7771
|
/**
|
|
7770
7772
|
* @description Attach a ZIP archive (`suplidos_<invoice-number>.zip`) containing the PDFs of the source invoices referenced by the invoice's SUPLIDO consolidation lines (`source_invoice_ids`). Each PDF inside the ZIP is named `<invoice-number>_<issuer-tax-id>.pdf`. Requires `attach_pdf: true` (the ZIP accompanies the invoice PDF). Access to sources owned by managed accounts is re-checked at send time with the same rules as issuing; the request fails with an actionable error — never a partial ZIP — if the invoice has no consolidation sources (`ATTACH_SOURCE_INVOICES_NO_SOURCES`), a source is not reachable (`ATTACH_SOURCE_INVOICE_UNAVAILABLE`), a source has no generated PDF (`ATTACH_SOURCE_PDF_MISSING`), or the ZIP exceeds the size limit (`ATTACH_SOURCE_ZIP_TOO_LARGE`).
|
|
7771
7773
|
* @default false
|
|
7772
7774
|
*/
|
|
7773
|
-
attach_source_invoices
|
|
7775
|
+
attach_source_invoices?: boolean;
|
|
7774
7776
|
/** @description Language of the email. When omitted, the issuing company's `email_language` applies, and Spanish (`es`) when the company has none set. */
|
|
7775
7777
|
language?: components["schemas"]["Language"];
|
|
7776
7778
|
};
|
|
@@ -7873,7 +7875,7 @@ interface components {
|
|
|
7873
7875
|
*/
|
|
7874
7876
|
total_including_tax?: number;
|
|
7875
7877
|
/** @default 0 */
|
|
7876
|
-
discount_percentage
|
|
7878
|
+
discount_percentage?: number;
|
|
7877
7879
|
main_tax?: components["schemas"]["TaxInfo"];
|
|
7878
7880
|
/**
|
|
7879
7881
|
* @description Equivalence surcharge rate for this line of the corrective
|
|
@@ -9150,7 +9152,7 @@ interface components {
|
|
|
9150
9152
|
* without a year token must come with `counter_reset: NEVER`.
|
|
9151
9153
|
* @default ANNUAL
|
|
9152
9154
|
*/
|
|
9153
|
-
counter_reset
|
|
9155
|
+
counter_reset?: components["schemas"]["CounterReset"];
|
|
9154
9156
|
/**
|
|
9155
9157
|
* Format: int64
|
|
9156
9158
|
* @description Initial number for this series counter.
|
|
@@ -9163,12 +9165,12 @@ interface components {
|
|
|
9163
9165
|
* @default 1
|
|
9164
9166
|
* @example 1
|
|
9165
9167
|
*/
|
|
9166
|
-
initial_number
|
|
9168
|
+
initial_number?: number;
|
|
9167
9169
|
/**
|
|
9168
9170
|
* @description Whether the series is active
|
|
9169
9171
|
* @default true
|
|
9170
9172
|
*/
|
|
9171
|
-
active
|
|
9173
|
+
active?: boolean;
|
|
9172
9174
|
/**
|
|
9173
9175
|
* @description Whether this is the default series for its document_type.
|
|
9174
9176
|
*
|
|
@@ -9181,7 +9183,7 @@ interface components {
|
|
|
9181
9183
|
* the current default of that type.
|
|
9182
9184
|
* @default false
|
|
9183
9185
|
*/
|
|
9184
|
-
default_series
|
|
9186
|
+
default_series?: boolean;
|
|
9185
9187
|
};
|
|
9186
9188
|
/**
|
|
9187
9189
|
* @description Request to **update** an invoice series (`PUT`). Despite the verb, this is a merge
|
|
@@ -9880,6 +9882,10 @@ interface components {
|
|
|
9880
9882
|
/**
|
|
9881
9883
|
* @description Payment term, in days, of the template's own payment method. `null` when the template
|
|
9882
9884
|
* has no payment method, or when it has one without a declared term.
|
|
9885
|
+
*
|
|
9886
|
+
* Each generated invoice is due on its issue date plus this term. When it is `null`, the
|
|
9887
|
+
* company's default `payment_term_days` (tax configuration) applies, or 30 days if the
|
|
9888
|
+
* company has none.
|
|
9883
9889
|
*/
|
|
9884
9890
|
payment_term_days?: number | null;
|
|
9885
9891
|
notes?: string | null;
|
|
@@ -10192,7 +10198,7 @@ interface components {
|
|
|
10192
10198
|
payment_term_days?: number | null;
|
|
10193
10199
|
notes?: string | null;
|
|
10194
10200
|
/** @default false */
|
|
10195
|
-
send_automatically
|
|
10201
|
+
send_automatically?: boolean;
|
|
10196
10202
|
email_configuration?: components["schemas"]["RecurringEmailConfigRequest"];
|
|
10197
10203
|
};
|
|
10198
10204
|
CreateRecurringFromInvoiceRequest: {
|
|
@@ -10231,7 +10237,7 @@ interface components {
|
|
|
10231
10237
|
/** Format: date */
|
|
10232
10238
|
end_date?: string | null;
|
|
10233
10239
|
/** @default false */
|
|
10234
|
-
send_automatically
|
|
10240
|
+
send_automatically?: boolean;
|
|
10235
10241
|
email_configuration?: components["schemas"]["RecurringEmailConfigRequest"];
|
|
10236
10242
|
};
|
|
10237
10243
|
/**
|
|
@@ -10443,7 +10449,7 @@ interface components {
|
|
|
10443
10449
|
* send `aeat_environment`.
|
|
10444
10450
|
* @default TEST
|
|
10445
10451
|
*/
|
|
10446
|
-
aeat_environment
|
|
10452
|
+
aeat_environment?: components["schemas"]["Environment"];
|
|
10447
10453
|
/**
|
|
10448
10454
|
* @description Whether to **switch the company on** in `aeat_environment` as part of this call.
|
|
10449
10455
|
*
|
|
@@ -10465,7 +10471,7 @@ interface components {
|
|
|
10465
10471
|
* `numbering` block or activate a mode in the same call.
|
|
10466
10472
|
* @default true
|
|
10467
10473
|
*/
|
|
10468
|
-
activate
|
|
10474
|
+
activate?: boolean;
|
|
10469
10475
|
};
|
|
10470
10476
|
/**
|
|
10471
10477
|
* @description Editable fields of a company.
|
|
@@ -12289,7 +12295,7 @@ interface components {
|
|
|
12289
12295
|
* Without it such a void fails with `422 VOID_REQUIRES_ISSUED_IN_ERROR`.
|
|
12290
12296
|
* @default false
|
|
12291
12297
|
*/
|
|
12292
|
-
issued_in_error
|
|
12298
|
+
issued_in_error?: boolean;
|
|
12293
12299
|
/**
|
|
12294
12300
|
* Format: date
|
|
12295
12301
|
* @deprecated
|
|
@@ -12309,7 +12315,7 @@ interface components {
|
|
|
12309
12315
|
* @default false
|
|
12310
12316
|
* @example false
|
|
12311
12317
|
*/
|
|
12312
|
-
issue
|
|
12318
|
+
issue?: boolean;
|
|
12313
12319
|
};
|
|
12314
12320
|
/**
|
|
12315
12321
|
* @description How to derive the new invoice from `from_invoice_id`.
|
|
@@ -12444,7 +12450,7 @@ interface components {
|
|
|
12444
12450
|
* @default SUMMARY
|
|
12445
12451
|
* @enum {string}
|
|
12446
12452
|
*/
|
|
12447
|
-
format
|
|
12453
|
+
format?: "SUMMARY" | "ITEMS";
|
|
12448
12454
|
/** @description Specific invoices to export. When present, `filters` is ignored. */
|
|
12449
12455
|
invoice_ids?: components["schemas"]["UUID"][];
|
|
12450
12456
|
filters?: components["schemas"]["InvoiceExportFilters"];
|
|
@@ -12989,7 +12995,7 @@ interface components {
|
|
|
12989
12995
|
/** Format: date */
|
|
12990
12996
|
end_date?: string | null;
|
|
12991
12997
|
/** @default false */
|
|
12992
|
-
send_automatically
|
|
12998
|
+
send_automatically?: boolean;
|
|
12993
12999
|
email_configuration?: components["schemas"]["RecurringEmailConfigRequest"];
|
|
12994
13000
|
};
|
|
12995
13001
|
/**
|
|
@@ -13723,12 +13729,12 @@ interface components {
|
|
|
13723
13729
|
* @description If `true`, an invitation email with the acceptance link is sent to `invited_email` in addition to returning the token. Defaults to `false` (you deliver the token/link yourself).
|
|
13724
13730
|
* @default false
|
|
13725
13731
|
*/
|
|
13726
|
-
send_email
|
|
13732
|
+
send_email?: boolean;
|
|
13727
13733
|
/**
|
|
13728
13734
|
* @description Initial grants (only when `account_role` is `MEMBER`). Omit it, or send `[]`, to invite with no company access yet (granted later). An explicit `null` is rejected with `422` `VALIDATION_ERROR`.
|
|
13729
13735
|
* @default []
|
|
13730
13736
|
*/
|
|
13731
|
-
grants
|
|
13737
|
+
grants?: components["schemas"]["GrantAssignment"][];
|
|
13732
13738
|
};
|
|
13733
13739
|
/** @description A created invitation. `token` is the single-use acceptance secret, returned only once (never exposed again); deliver it to the invitee. `invitation_url` is the ready-to-deliver acceptance link BeeL builds for the current environment from that same token. */
|
|
13734
13740
|
Invitation: {
|
|
@@ -13842,7 +13848,7 @@ interface components {
|
|
|
13842
13848
|
* @description Optional. When `true`, BeeL emails the account holder a claim link (`/reclamar?token=...`) so they can set their password and take ownership. Defaults to `false`: by default you receive the `claim_token` in the response and deliver it yourself. Requires a deliverable `email`: sending `true` without one returns `422`.
|
|
13843
13849
|
* @default false
|
|
13844
13850
|
*/
|
|
13845
|
-
send_email
|
|
13851
|
+
send_email?: boolean;
|
|
13846
13852
|
};
|
|
13847
13853
|
/** @description Result of a successful account provision. `claim_token` is a single-use secret to deliver to the account holder so they can set their password and take ownership. It is returned only once; `null` if the account was already claimed, `null` when the account was provisioned without `email` (there is no holder to hand it to yet), and `null` when a repeated provision found a claim link still valid (`claim_link_already_issued: true`). `claim_url` is the ready-to-use claim link BeeL builds for the current environment; `status` disambiguates a `null` `claim_token` (already claimed) from an error. */
|
|
13848
13854
|
ProvisionAccountResult: {
|
|
@@ -13961,7 +13967,7 @@ interface components {
|
|
|
13961
13967
|
* What it did comes back in `own_company_customers`, apart from the per-account counters.
|
|
13962
13968
|
* @default false
|
|
13963
13969
|
*/
|
|
13964
|
-
apply_customers_to_own_company
|
|
13970
|
+
apply_customers_to_own_company?: boolean;
|
|
13965
13971
|
};
|
|
13966
13972
|
AccountImportUpload: {
|
|
13967
13973
|
/**
|
|
@@ -15206,7 +15212,7 @@ interface components {
|
|
|
15206
15212
|
* @description Which accounts this subscription receives events from. Defaults to `own`. Same field name and values as the `account_relationship` carried by every event envelope.
|
|
15207
15213
|
* @default own
|
|
15208
15214
|
*/
|
|
15209
|
-
account_relationship
|
|
15215
|
+
account_relationship?: components["schemas"]["WebhookAccountRelationship"];
|
|
15210
15216
|
};
|
|
15211
15217
|
WebhookTestResult: {
|
|
15212
15218
|
/** @description Whether your endpoint responded with HTTP 2xx. */
|
|
@@ -15348,6 +15354,12 @@ interface components {
|
|
|
15348
15354
|
invoice_number?: string | null;
|
|
15349
15355
|
/** Format: uuid */
|
|
15350
15356
|
verifactu_registration_id: string;
|
|
15357
|
+
/**
|
|
15358
|
+
* @description Which record changed status: the registration (`REGISTRATION`) or the cancellation of a
|
|
15359
|
+
* voided invoice (`VOID`). It is the record `verifactu_registration_id` identifies, the
|
|
15360
|
+
* same one `verifactu-records` lists with that `operation`.
|
|
15361
|
+
*/
|
|
15362
|
+
operation: components["schemas"]["VeriFactuRecordOperation"];
|
|
15351
15363
|
/**
|
|
15352
15364
|
* @description Status of this registration before the change. Omitted on the first notification of a
|
|
15353
15365
|
* registration, because there is no earlier status: the submission was just accepted for
|
|
@@ -30917,18 +30929,44 @@ interface operations {
|
|
|
30917
30929
|
};
|
|
30918
30930
|
}
|
|
30919
30931
|
|
|
30932
|
+
/**
|
|
30933
|
+
* Options of `new BeeL(config)`. Only `apiKey` is required.
|
|
30934
|
+
*
|
|
30935
|
+
* **Retries and idempotency.** A call is retried automatically, up to `maxRetries` times,
|
|
30936
|
+
* only when sending it again can never apply it twice:
|
|
30937
|
+
*
|
|
30938
|
+
* - `429` is always retried, after `Retry-After`: the API refused the request unprocessed.
|
|
30939
|
+
* - `409 IDEMPOTENCY_KEY_PROCESSING` is retried with the same key after `Retry-After`.
|
|
30940
|
+
* - `5xx` and network errors are retried for `GET` requests and for requests that carry an
|
|
30941
|
+
* `Idempotency-Key` — every `POST` does, unless `autoIdempotencyKey` is `false`. A `5xx`
|
|
30942
|
+
* the API marks `Idempotency-Replay: true` is the stored outcome of that key and is not
|
|
30943
|
+
* retried: the same key would return it again.
|
|
30944
|
+
* - `PUT`, `PATCH` and `DELETE` without a key are not retried after a `5xx` or network error.
|
|
30945
|
+
*
|
|
30946
|
+
* Every retry of a call reuses that call's `Idempotency-Key`, so an automatic retry never
|
|
30947
|
+
* creates a second invoice. Two separate calls get two keys: to retry a create yourself
|
|
30948
|
+
* after it failed with a `5xx` or a network error, use `invoices.createOnce`, or look the
|
|
30949
|
+
* invoice up by `external_ref` before creating it again.
|
|
30950
|
+
*/
|
|
30920
30951
|
interface BeeLConfig {
|
|
30921
|
-
/** API key
|
|
30952
|
+
/** API key: `beel_sk_live_*` (production) or `beel_sk_test_*` (sandbox). */
|
|
30922
30953
|
apiKey: string;
|
|
30923
|
-
/** Base URL.
|
|
30954
|
+
/** Base URL. Default: `https://app.beel.es/api`. */
|
|
30924
30955
|
baseUrl?: string;
|
|
30925
|
-
/**
|
|
30956
|
+
/**
|
|
30957
|
+
* Automatic retries after the first attempt, for the cases listed on {@link BeeLConfig}.
|
|
30958
|
+
* `0` disables them. Default: `3`.
|
|
30959
|
+
*/
|
|
30926
30960
|
maxRetries?: number;
|
|
30927
|
-
/**
|
|
30961
|
+
/** Base delay of the exponential backoff, in milliseconds. Default: `500`. */
|
|
30928
30962
|
retryDelayMs?: number;
|
|
30929
|
-
/**
|
|
30963
|
+
/** Upper bound of any single wait between attempts, `Retry-After` included, in ms. Default: `30000`. */
|
|
30930
30964
|
maxRetryDelayMs?: number;
|
|
30931
|
-
/**
|
|
30965
|
+
/**
|
|
30966
|
+
* Add one `Idempotency-Key` (a UUID) to every `POST` that does not carry its own, reused by
|
|
30967
|
+
* every automatic retry of that call. With `false`, a `POST` without a key is only retried
|
|
30968
|
+
* after a `429`. Default: `true`.
|
|
30969
|
+
*/
|
|
30932
30970
|
autoIdempotencyKey?: boolean;
|
|
30933
30971
|
}
|
|
30934
30972
|
declare function createBeeLClient(config: BeeLConfig): openapi_fetch.Client<paths, `${string}/${string}`>;
|
|
@@ -30937,12 +30975,20 @@ type BeeLClient = ReturnType<typeof createBeeLClient>;
|
|
|
30937
30975
|
type Invoice$1 = components['schemas']['Invoice'];
|
|
30938
30976
|
type Pagination$5 = components['schemas']['Pagination'];
|
|
30939
30977
|
type ListParams$2 = operations['listInvoices']['parameters']['query'];
|
|
30978
|
+
/**
|
|
30979
|
+
* Invoices of the focused company, on the flat `/v1/invoices` routes.
|
|
30980
|
+
*
|
|
30981
|
+
* @deprecated The contract deprecates the session-focus routes. Use `beel.company(companyId).invoices` instead.
|
|
30982
|
+
*/
|
|
30940
30983
|
declare class InvoicesResource {
|
|
30941
30984
|
private client;
|
|
30942
30985
|
constructor(client: BeeLClient);
|
|
30943
30986
|
/**
|
|
30944
30987
|
* List invoices with optional filters and pagination.
|
|
30945
30988
|
*
|
|
30989
|
+
* @param params - Filters and pagination.
|
|
30990
|
+
* @returns The page of `invoices` and its `pagination`.
|
|
30991
|
+
*
|
|
30946
30992
|
* @example
|
|
30947
30993
|
* const { invoices, pagination } = await beel.invoices.list({ status: 'ISSUED', limit: 20 });
|
|
30948
30994
|
*/
|
|
@@ -30953,6 +30999,9 @@ declare class InvoicesResource {
|
|
|
30953
30999
|
/**
|
|
30954
31000
|
* Create a new invoice. An idempotency key is automatically added.
|
|
30955
31001
|
*
|
|
31002
|
+
* @param body - Type, recipient and lines.
|
|
31003
|
+
* @returns The created invoice.
|
|
31004
|
+
*
|
|
30956
31005
|
* @example
|
|
30957
31006
|
* const invoice = await beel.invoices.create({
|
|
30958
31007
|
* type: 'STANDARD',
|
|
@@ -31011,7 +31060,12 @@ declare class InvoicesResource {
|
|
|
31011
31060
|
created_at: string;
|
|
31012
31061
|
updated_at: string;
|
|
31013
31062
|
}>;
|
|
31014
|
-
/**
|
|
31063
|
+
/**
|
|
31064
|
+
* Get an invoice by ID.
|
|
31065
|
+
*
|
|
31066
|
+
* @param id - Invoice UUID.
|
|
31067
|
+
* @returns The invoice.
|
|
31068
|
+
*/
|
|
31015
31069
|
get(id: string): Promise<{
|
|
31016
31070
|
invoice_number?: string | null;
|
|
31017
31071
|
series: components["schemas"]["SeriesInfo"];
|
|
@@ -31063,7 +31117,13 @@ declare class InvoicesResource {
|
|
|
31063
31117
|
created_at: string;
|
|
31064
31118
|
updated_at: string;
|
|
31065
31119
|
}>;
|
|
31066
|
-
/**
|
|
31120
|
+
/**
|
|
31121
|
+
* Update a draft invoice. Only draft invoices can be updated.
|
|
31122
|
+
*
|
|
31123
|
+
* @param id - Invoice UUID.
|
|
31124
|
+
* @param body - The draft's new content.
|
|
31125
|
+
* @returns The updated invoice.
|
|
31126
|
+
*/
|
|
31067
31127
|
update(id: string, body: components['schemas']['UpdateInvoiceRequest']): Promise<{
|
|
31068
31128
|
invoice_number?: string | null;
|
|
31069
31129
|
series: components["schemas"]["SeriesInfo"];
|
|
@@ -31115,9 +31175,19 @@ declare class InvoicesResource {
|
|
|
31115
31175
|
created_at: string;
|
|
31116
31176
|
updated_at: string;
|
|
31117
31177
|
}>;
|
|
31118
|
-
/**
|
|
31178
|
+
/**
|
|
31179
|
+
* Delete a draft invoice. Only draft invoices can be deleted.
|
|
31180
|
+
*
|
|
31181
|
+
* @param id - Invoice UUID.
|
|
31182
|
+
*/
|
|
31119
31183
|
delete(id: string): Promise<void>;
|
|
31120
|
-
/**
|
|
31184
|
+
/**
|
|
31185
|
+
* Duplicate an invoice, optionally into a different series.
|
|
31186
|
+
*
|
|
31187
|
+
* @param id - Invoice UUID.
|
|
31188
|
+
* @param options - `series_id` and `notes` of the copy.
|
|
31189
|
+
* @returns The new draft.
|
|
31190
|
+
*/
|
|
31121
31191
|
duplicate(id: string, options?: {
|
|
31122
31192
|
series_id?: string;
|
|
31123
31193
|
notes?: string;
|
|
@@ -31174,7 +31244,10 @@ declare class InvoicesResource {
|
|
|
31174
31244
|
}>;
|
|
31175
31245
|
/**
|
|
31176
31246
|
* Issue a draft invoice. Assigns an invoice number and triggers VeriFactu submission.
|
|
31177
|
-
*
|
|
31247
|
+
*
|
|
31248
|
+
* @param id - Invoice UUID.
|
|
31249
|
+
* @param options - `wait_for_pdf: true` to wait for the PDF.
|
|
31250
|
+
* @returns The issued invoice.
|
|
31178
31251
|
*/
|
|
31179
31252
|
issue(id: string, options?: {
|
|
31180
31253
|
wait_for_pdf?: boolean;
|
|
@@ -31231,8 +31304,10 @@ declare class InvoicesResource {
|
|
|
31231
31304
|
}>;
|
|
31232
31305
|
/**
|
|
31233
31306
|
* Mark an invoice as paid.
|
|
31234
|
-
*
|
|
31235
|
-
* @param
|
|
31307
|
+
*
|
|
31308
|
+
* @param id - Invoice UUID.
|
|
31309
|
+
* @param options - `payment_date` (default: today) and `payment_method`.
|
|
31310
|
+
* @returns The paid invoice.
|
|
31236
31311
|
*/
|
|
31237
31312
|
markPaid(id: string, options?: {
|
|
31238
31313
|
payment_date?: string;
|
|
@@ -31288,7 +31363,13 @@ declare class InvoicesResource {
|
|
|
31288
31363
|
created_at: string;
|
|
31289
31364
|
updated_at: string;
|
|
31290
31365
|
}>;
|
|
31291
|
-
/**
|
|
31366
|
+
/**
|
|
31367
|
+
* Mark an invoice as sent (e.g. delivered by other means).
|
|
31368
|
+
*
|
|
31369
|
+
* @param id - Invoice UUID.
|
|
31370
|
+
* @param options - `sent_at`.
|
|
31371
|
+
* @returns The sent invoice.
|
|
31372
|
+
*/
|
|
31292
31373
|
markSent(id: string, options?: {
|
|
31293
31374
|
sent_at?: string;
|
|
31294
31375
|
}): Promise<{
|
|
@@ -31342,7 +31423,12 @@ declare class InvoicesResource {
|
|
|
31342
31423
|
created_at: string;
|
|
31343
31424
|
updated_at: string;
|
|
31344
31425
|
}>;
|
|
31345
|
-
/**
|
|
31426
|
+
/**
|
|
31427
|
+
* Revert a paid/sent invoice back to issued status.
|
|
31428
|
+
*
|
|
31429
|
+
* @param id - Invoice UUID.
|
|
31430
|
+
* @returns The invoice, back in `ISSUED`.
|
|
31431
|
+
*/
|
|
31346
31432
|
revertToIssued(id: string): Promise<{
|
|
31347
31433
|
invoice_number?: string | null;
|
|
31348
31434
|
series: components["schemas"]["SeriesInfo"];
|
|
@@ -31397,6 +31483,10 @@ declare class InvoicesResource {
|
|
|
31397
31483
|
/**
|
|
31398
31484
|
* Void an issued invoice. Requires a reason (min 10 chars).
|
|
31399
31485
|
*
|
|
31486
|
+
* @param id - Invoice UUID.
|
|
31487
|
+
* @param params - `reason` (min 10 characters) and optional `void_date`.
|
|
31488
|
+
* @returns The voided invoice.
|
|
31489
|
+
*
|
|
31400
31490
|
* @example
|
|
31401
31491
|
* await beel.invoices.void('id', { reason: 'Duplicate invoice sent in error' });
|
|
31402
31492
|
*/
|
|
@@ -31454,7 +31544,13 @@ declare class InvoicesResource {
|
|
|
31454
31544
|
created_at: string;
|
|
31455
31545
|
updated_at: string;
|
|
31456
31546
|
}>;
|
|
31457
|
-
/**
|
|
31547
|
+
/**
|
|
31548
|
+
* Create a corrective invoice that references the original.
|
|
31549
|
+
*
|
|
31550
|
+
* @param id - UUID of the issued invoice to correct.
|
|
31551
|
+
* @param body - Rectification type, code, reason and lines.
|
|
31552
|
+
* @returns The corrective invoice.
|
|
31553
|
+
*/
|
|
31458
31554
|
createCorrective(id: string, body: components['schemas']['CreateCorrectiveInvoiceRequest']): Promise<{
|
|
31459
31555
|
invoice_number?: string | null;
|
|
31460
31556
|
series: components["schemas"]["SeriesInfo"];
|
|
@@ -31506,7 +31602,13 @@ declare class InvoicesResource {
|
|
|
31506
31602
|
created_at: string;
|
|
31507
31603
|
updated_at: string;
|
|
31508
31604
|
}>;
|
|
31509
|
-
/**
|
|
31605
|
+
/**
|
|
31606
|
+
* Schedule a draft invoice to be issued on a future date.
|
|
31607
|
+
*
|
|
31608
|
+
* @param id - UUID of the draft.
|
|
31609
|
+
* @param params - `scheduled_for` and optional `action`.
|
|
31610
|
+
* @returns The scheduled invoice.
|
|
31611
|
+
*/
|
|
31510
31612
|
schedule(id: string, params: {
|
|
31511
31613
|
scheduled_for: string;
|
|
31512
31614
|
action?: string;
|
|
@@ -31561,7 +31663,12 @@ declare class InvoicesResource {
|
|
|
31561
31663
|
created_at: string;
|
|
31562
31664
|
updated_at: string;
|
|
31563
31665
|
}>;
|
|
31564
|
-
/**
|
|
31666
|
+
/**
|
|
31667
|
+
* Cancel a scheduled invoice, returning it to draft.
|
|
31668
|
+
*
|
|
31669
|
+
* @param id - Invoice UUID.
|
|
31670
|
+
* @returns The invoice, back in draft.
|
|
31671
|
+
*/
|
|
31565
31672
|
unschedule(id: string): Promise<{
|
|
31566
31673
|
invoice_number?: string | null;
|
|
31567
31674
|
series: components["schemas"]["SeriesInfo"];
|
|
@@ -31613,7 +31720,13 @@ declare class InvoicesResource {
|
|
|
31613
31720
|
created_at: string;
|
|
31614
31721
|
updated_at: string;
|
|
31615
31722
|
}>;
|
|
31616
|
-
/**
|
|
31723
|
+
/**
|
|
31724
|
+
* Change the scheduled date of a scheduled invoice.
|
|
31725
|
+
*
|
|
31726
|
+
* @param id - Invoice UUID.
|
|
31727
|
+
* @param params - New `scheduled_for`.
|
|
31728
|
+
* @returns The rescheduled invoice.
|
|
31729
|
+
*/
|
|
31617
31730
|
reschedule(id: string, params: {
|
|
31618
31731
|
scheduled_for: string;
|
|
31619
31732
|
}): Promise<{
|
|
@@ -31670,13 +31783,22 @@ declare class InvoicesResource {
|
|
|
31670
31783
|
/**
|
|
31671
31784
|
* Get a pre-signed URL to download the invoice PDF.
|
|
31672
31785
|
* The URL expires in 5 minutes. Use `beel.downloadPdf(id)` for a simpler Buffer download.
|
|
31786
|
+
*
|
|
31787
|
+
* @param id - Invoice UUID.
|
|
31788
|
+
* @returns `download_url`, `expires_in_seconds` and `file_name`.
|
|
31673
31789
|
*/
|
|
31674
31790
|
getPdf(id: string): Promise<{
|
|
31675
31791
|
download_url: string;
|
|
31676
31792
|
expires_in_seconds: number;
|
|
31677
31793
|
file_name: string;
|
|
31678
31794
|
}>;
|
|
31679
|
-
/**
|
|
31795
|
+
/**
|
|
31796
|
+
* Send an invoice by email. Uses the customer's email by default.
|
|
31797
|
+
*
|
|
31798
|
+
* @param id - Invoice UUID.
|
|
31799
|
+
* @param options - Recipients, subject and message.
|
|
31800
|
+
* @returns The delivery record.
|
|
31801
|
+
*/
|
|
31680
31802
|
sendEmail(id: string, options?: {
|
|
31681
31803
|
to?: string[];
|
|
31682
31804
|
cc?: string[];
|
|
@@ -31696,12 +31818,20 @@ declare class InvoicesResource {
|
|
|
31696
31818
|
type Customer$1 = components['schemas']['Customer'];
|
|
31697
31819
|
type Pagination$4 = components['schemas']['Pagination'];
|
|
31698
31820
|
type ListParams$1 = operations['listCustomers']['parameters']['query'];
|
|
31821
|
+
/**
|
|
31822
|
+
* Customers of the focused company, on the flat `/v1/customers` routes.
|
|
31823
|
+
*
|
|
31824
|
+
* @deprecated The contract deprecates the session-focus routes. Use `beel.company(companyId).customers` instead.
|
|
31825
|
+
*/
|
|
31699
31826
|
declare class CustomersResource {
|
|
31700
31827
|
private client;
|
|
31701
31828
|
constructor(client: BeeLClient);
|
|
31702
31829
|
/**
|
|
31703
31830
|
* List customers with optional filters and pagination.
|
|
31704
31831
|
*
|
|
31832
|
+
* @param params - Filters and pagination.
|
|
31833
|
+
* @returns The page of `customers` and its `pagination`.
|
|
31834
|
+
*
|
|
31705
31835
|
* @example
|
|
31706
31836
|
* const { customers, pagination } = await beel.customers.list({ search: 'Acme', limit: 10 });
|
|
31707
31837
|
*/
|
|
@@ -31712,6 +31842,9 @@ declare class CustomersResource {
|
|
|
31712
31842
|
/**
|
|
31713
31843
|
* Create a new customer.
|
|
31714
31844
|
*
|
|
31845
|
+
* @param body - Legal name, NIF and address.
|
|
31846
|
+
* @returns The created customer.
|
|
31847
|
+
*
|
|
31715
31848
|
* @example
|
|
31716
31849
|
* const customer = await beel.customers.create({
|
|
31717
31850
|
* legal_name: 'Acme SL',
|
|
@@ -31738,7 +31871,12 @@ declare class CustomersResource {
|
|
|
31738
31871
|
updated_at?: string;
|
|
31739
31872
|
alternative_id?: components["schemas"]["AlternativeIdentifier"];
|
|
31740
31873
|
}>;
|
|
31741
|
-
/**
|
|
31874
|
+
/**
|
|
31875
|
+
* Get a customer by ID.
|
|
31876
|
+
*
|
|
31877
|
+
* @param id - Customer UUID.
|
|
31878
|
+
* @returns The customer.
|
|
31879
|
+
*/
|
|
31742
31880
|
get(id: string): Promise<{
|
|
31743
31881
|
id: string;
|
|
31744
31882
|
legal_name: string;
|
|
@@ -31758,7 +31896,13 @@ declare class CustomersResource {
|
|
|
31758
31896
|
updated_at?: string;
|
|
31759
31897
|
alternative_id?: components["schemas"]["AlternativeIdentifier"];
|
|
31760
31898
|
}>;
|
|
31761
|
-
/**
|
|
31899
|
+
/**
|
|
31900
|
+
* Update a customer. Only provided fields are changed.
|
|
31901
|
+
*
|
|
31902
|
+
* @param id - Customer UUID.
|
|
31903
|
+
* @param body - Fields to change.
|
|
31904
|
+
* @returns The updated customer.
|
|
31905
|
+
*/
|
|
31762
31906
|
update(id: string, body: components['schemas']['UpdateCustomerRequest']): Promise<{
|
|
31763
31907
|
id: string;
|
|
31764
31908
|
legal_name: string;
|
|
@@ -31778,19 +31922,31 @@ declare class CustomersResource {
|
|
|
31778
31922
|
updated_at?: string;
|
|
31779
31923
|
alternative_id?: components["schemas"]["AlternativeIdentifier"];
|
|
31780
31924
|
}>;
|
|
31781
|
-
/**
|
|
31925
|
+
/**
|
|
31926
|
+
* Deactivate (soft-delete) a customer.
|
|
31927
|
+
*
|
|
31928
|
+
* @param id - Customer UUID.
|
|
31929
|
+
*/
|
|
31782
31930
|
deactivate(id: string): Promise<void>;
|
|
31783
31931
|
}
|
|
31784
31932
|
|
|
31785
31933
|
type Product$1 = components['schemas']['Product'];
|
|
31786
31934
|
type Pagination$3 = components['schemas']['Pagination'];
|
|
31787
31935
|
type ListParams = operations['listProducts']['parameters']['query'];
|
|
31936
|
+
/**
|
|
31937
|
+
* Products of the focused company, on the flat `/v1/products` routes.
|
|
31938
|
+
*
|
|
31939
|
+
* @deprecated The contract deprecates the session-focus routes. Use `beel.company(companyId).products` instead.
|
|
31940
|
+
*/
|
|
31788
31941
|
declare class ProductsResource {
|
|
31789
31942
|
private client;
|
|
31790
31943
|
constructor(client: BeeLClient);
|
|
31791
31944
|
/**
|
|
31792
31945
|
* List products with optional filters and pagination.
|
|
31793
31946
|
*
|
|
31947
|
+
* @param params - Filters and pagination.
|
|
31948
|
+
* @returns The page of `products` and its `pagination`.
|
|
31949
|
+
*
|
|
31794
31950
|
* @example
|
|
31795
31951
|
* const { products, pagination } = await beel.products.list({ category: 'SERVICE' });
|
|
31796
31952
|
*/
|
|
@@ -31801,6 +31957,9 @@ declare class ProductsResource {
|
|
|
31801
31957
|
/**
|
|
31802
31958
|
* Create a new product or service.
|
|
31803
31959
|
*
|
|
31960
|
+
* @param body - Name, category, price and main tax.
|
|
31961
|
+
* @returns The created product.
|
|
31962
|
+
*
|
|
31804
31963
|
* @example
|
|
31805
31964
|
* const product = await beel.products.create({
|
|
31806
31965
|
* name: 'Consulting',
|
|
@@ -31825,7 +31984,12 @@ declare class ProductsResource {
|
|
|
31825
31984
|
created_at: string;
|
|
31826
31985
|
updated_at: string;
|
|
31827
31986
|
}>;
|
|
31828
|
-
/**
|
|
31987
|
+
/**
|
|
31988
|
+
* Get a product by ID.
|
|
31989
|
+
*
|
|
31990
|
+
* @param id - Product UUID.
|
|
31991
|
+
* @returns The product.
|
|
31992
|
+
*/
|
|
31829
31993
|
get(id: string): Promise<{
|
|
31830
31994
|
id: string;
|
|
31831
31995
|
code?: string | null;
|
|
@@ -31841,7 +32005,13 @@ declare class ProductsResource {
|
|
|
31841
32005
|
created_at: string;
|
|
31842
32006
|
updated_at: string;
|
|
31843
32007
|
}>;
|
|
31844
|
-
/**
|
|
32008
|
+
/**
|
|
32009
|
+
* Update a product. Only provided fields are changed.
|
|
32010
|
+
*
|
|
32011
|
+
* @param id - Product UUID.
|
|
32012
|
+
* @param body - Fields to change.
|
|
32013
|
+
* @returns The updated product.
|
|
32014
|
+
*/
|
|
31845
32015
|
update(id: string, body: components['schemas']['UpdateProductRequest']): Promise<{
|
|
31846
32016
|
id: string;
|
|
31847
32017
|
code?: string | null;
|
|
@@ -31857,11 +32027,19 @@ declare class ProductsResource {
|
|
|
31857
32027
|
created_at: string;
|
|
31858
32028
|
updated_at: string;
|
|
31859
32029
|
}>;
|
|
31860
|
-
/**
|
|
32030
|
+
/**
|
|
32031
|
+
* Delete a product permanently.
|
|
32032
|
+
*
|
|
32033
|
+
* @param id - Product UUID.
|
|
32034
|
+
*/
|
|
31861
32035
|
delete(id: string): Promise<void>;
|
|
31862
32036
|
/**
|
|
31863
32037
|
* Search products by name or code. Returns up to `limit` results.
|
|
31864
32038
|
*
|
|
32039
|
+
* @param q - Text to search in name or code.
|
|
32040
|
+
* @param limit - Maximum results.
|
|
32041
|
+
* @returns The matching products, as a bare array.
|
|
32042
|
+
*
|
|
31865
32043
|
* @example
|
|
31866
32044
|
* const results = await beel.products.search('consulting', 5);
|
|
31867
32045
|
*/
|
|
@@ -31882,10 +32060,21 @@ declare class ProductsResource {
|
|
|
31882
32060
|
}[]>;
|
|
31883
32061
|
}
|
|
31884
32062
|
|
|
32063
|
+
/**
|
|
32064
|
+
* Account-wide configuration on the flat `/v1/configuration/*` routes.
|
|
32065
|
+
*
|
|
32066
|
+
* @deprecated The contract deprecates these routes. Use
|
|
32067
|
+
* `beel.company(companyId).taxConfiguration`, `beel.company(companyId).verifactuConfiguration`
|
|
32068
|
+
* and {@link CatalogsResource} (`beel.catalogs`) instead.
|
|
32069
|
+
*/
|
|
31885
32070
|
declare class ConfigurationResource {
|
|
31886
32071
|
private client;
|
|
31887
32072
|
constructor(client: BeeLClient);
|
|
31888
|
-
/**
|
|
32073
|
+
/**
|
|
32074
|
+
* Get the tax configuration (default VAT, IRPF…) of the focused company.
|
|
32075
|
+
*
|
|
32076
|
+
* @returns The tax configuration.
|
|
32077
|
+
*/
|
|
31889
32078
|
getTaxConfig(): Promise<{
|
|
31890
32079
|
default_main_tax: {
|
|
31891
32080
|
type: components["schemas"]["TaxType"];
|
|
@@ -31907,7 +32096,12 @@ declare class ConfigurationResource {
|
|
|
31907
32096
|
suggested_irpf_rate: number | null;
|
|
31908
32097
|
} | undefined;
|
|
31909
32098
|
} | undefined>;
|
|
31910
|
-
/**
|
|
32099
|
+
/**
|
|
32100
|
+
* Replace the tax configuration of the focused company.
|
|
32101
|
+
*
|
|
32102
|
+
* @param body - The complete tax configuration.
|
|
32103
|
+
* @returns The stored configuration.
|
|
32104
|
+
*/
|
|
31911
32105
|
updateTaxConfig(body: any): Promise<{
|
|
31912
32106
|
default_main_tax: {
|
|
31913
32107
|
type: components["schemas"]["TaxType"];
|
|
@@ -31929,7 +32123,11 @@ declare class ConfigurationResource {
|
|
|
31929
32123
|
suggested_irpf_rate: number | null;
|
|
31930
32124
|
} | undefined;
|
|
31931
32125
|
} | undefined>;
|
|
31932
|
-
/**
|
|
32126
|
+
/**
|
|
32127
|
+
* Tax types the API accepts (IVA/IGIC rates, IRPF types, equivalence surcharges).
|
|
32128
|
+
*
|
|
32129
|
+
* @returns The tax types catalog.
|
|
32130
|
+
*/
|
|
31933
32131
|
getTaxTypes(): Promise<{
|
|
31934
32132
|
tax_regimes?: {
|
|
31935
32133
|
code: "IVA" | "IGIC" | "IPSI" | "OTHER";
|
|
@@ -31972,7 +32170,11 @@ declare class ConfigurationResource {
|
|
|
31972
32170
|
available_on_invoice_line: boolean;
|
|
31973
32171
|
}[] | undefined;
|
|
31974
32172
|
} | undefined>;
|
|
31975
|
-
/**
|
|
32173
|
+
/**
|
|
32174
|
+
* Invoice customization options (templates, colors…).
|
|
32175
|
+
*
|
|
32176
|
+
* @returns The customization options.
|
|
32177
|
+
*/
|
|
31976
32178
|
getInvoiceCustomizationOptions(): Promise<{
|
|
31977
32179
|
template_types: {
|
|
31978
32180
|
code: components["schemas"]["InvoiceTemplateType"];
|
|
@@ -31980,11 +32182,20 @@ declare class ConfigurationResource {
|
|
|
31980
32182
|
description: string;
|
|
31981
32183
|
}[];
|
|
31982
32184
|
} | undefined>;
|
|
31983
|
-
/**
|
|
32185
|
+
/**
|
|
32186
|
+
* Update the preferred language of the signed-in person.
|
|
32187
|
+
*
|
|
32188
|
+
* @param language - `es`, `en` or `ca`.
|
|
32189
|
+
* @returns The updated preferences.
|
|
32190
|
+
*/
|
|
31984
32191
|
updateLanguage(language: string): Promise<{
|
|
31985
32192
|
language?: components["schemas"]["Language"] | undefined;
|
|
31986
32193
|
} | undefined>;
|
|
31987
|
-
/**
|
|
32194
|
+
/**
|
|
32195
|
+
* Get the VeriFactu configuration of the focused company.
|
|
32196
|
+
*
|
|
32197
|
+
* @returns The VeriFactu configuration.
|
|
32198
|
+
*/
|
|
31988
32199
|
getVerifactu(): Promise<{
|
|
31989
32200
|
enabled: boolean;
|
|
31990
32201
|
nif_status?: "ACTIVATED" | "DEACTIVATED" | null | undefined;
|
|
@@ -31994,7 +32205,12 @@ declare class ConfigurationResource {
|
|
|
31994
32205
|
activated?: boolean | null | undefined;
|
|
31995
32206
|
pdf_generated?: boolean | null | undefined;
|
|
31996
32207
|
} | undefined>;
|
|
31997
|
-
/**
|
|
32208
|
+
/**
|
|
32209
|
+
* Update the VeriFactu configuration of the focused company.
|
|
32210
|
+
*
|
|
32211
|
+
* @param body - `{ enabled }`.
|
|
32212
|
+
* @returns The updated configuration.
|
|
32213
|
+
*/
|
|
31998
32214
|
updateVerifactu(body: any): Promise<{
|
|
31999
32215
|
enabled: boolean;
|
|
32000
32216
|
nif_status?: "ACTIVATED" | "DEACTIVATED" | null | undefined;
|
|
@@ -32006,7 +32222,8 @@ declare class ConfigurationResource {
|
|
|
32006
32222
|
} | undefined>;
|
|
32007
32223
|
}
|
|
32008
32224
|
/**
|
|
32009
|
-
* Account-wide catalogs and personal preferences, on their
|
|
32225
|
+
* Account-wide catalogs, the credential's identity and personal preferences, on their
|
|
32226
|
+
* canonical paths. Reach it as `beel.catalogs`.
|
|
32010
32227
|
*
|
|
32011
32228
|
* These replace the `/v1/configuration/*` reads on {@link ConfigurationResource},
|
|
32012
32229
|
* whose flat routes are deprecated.
|
|
@@ -32014,7 +32231,32 @@ declare class ConfigurationResource {
|
|
|
32014
32231
|
declare class CatalogsResource {
|
|
32015
32232
|
private client;
|
|
32016
32233
|
constructor(client: BeeLClient);
|
|
32017
|
-
/**
|
|
32234
|
+
/**
|
|
32235
|
+
* Who the API key belongs to: its `account_id` — the starting point to list the
|
|
32236
|
+
* account's companies — plus the person's email, name and language, and the credential.
|
|
32237
|
+
* Needs no scope, so it also confirms that a key works.
|
|
32238
|
+
*
|
|
32239
|
+
* @returns The identity of the credential.
|
|
32240
|
+
*
|
|
32241
|
+
* @example
|
|
32242
|
+
* ```typescript
|
|
32243
|
+
* const { account_id } = await beel.catalogs.identity();
|
|
32244
|
+
* const { companies } = await beel.account(account_id).companies.list();
|
|
32245
|
+
* ```
|
|
32246
|
+
*/
|
|
32247
|
+
identity(): Promise<{
|
|
32248
|
+
account_id: components["schemas"]["UUID"] & unknown;
|
|
32249
|
+
name?: string | null;
|
|
32250
|
+
email: components["schemas"]["Email"];
|
|
32251
|
+
logo_url?: string | null;
|
|
32252
|
+
language?: components["schemas"]["Language"] & unknown;
|
|
32253
|
+
credential?: components["schemas"]["MyCredential"];
|
|
32254
|
+
}>;
|
|
32255
|
+
/**
|
|
32256
|
+
* Tax types the API accepts. Canonical form of `configuration/tax-types`.
|
|
32257
|
+
*
|
|
32258
|
+
* @returns The tax types catalog.
|
|
32259
|
+
*/
|
|
32018
32260
|
taxTypes(): Promise<{
|
|
32019
32261
|
tax_regimes?: {
|
|
32020
32262
|
code: "IVA" | "IGIC" | "IPSI" | "OTHER";
|
|
@@ -32057,7 +32299,11 @@ declare class CatalogsResource {
|
|
|
32057
32299
|
available_on_invoice_line: boolean;
|
|
32058
32300
|
}[] | undefined;
|
|
32059
32301
|
} | undefined>;
|
|
32060
|
-
/**
|
|
32302
|
+
/**
|
|
32303
|
+
* Invoice PDF templates and customization options. Canonical form of the `configuration` read.
|
|
32304
|
+
*
|
|
32305
|
+
* @returns The customization options.
|
|
32306
|
+
*/
|
|
32061
32307
|
invoiceCustomizationOptions(): Promise<{
|
|
32062
32308
|
template_types: {
|
|
32063
32309
|
code: components["schemas"]["InvoiceTemplateType"];
|
|
@@ -32066,20 +32312,31 @@ declare class CatalogsResource {
|
|
|
32066
32312
|
}[];
|
|
32067
32313
|
} | undefined>;
|
|
32068
32314
|
/**
|
|
32069
|
-
*
|
|
32315
|
+
* Update the signed-in person's preferences. Canonical form of
|
|
32070
32316
|
* `PUT /v1/configuration/language`: the language belongs to the person, not to a company.
|
|
32317
|
+
*
|
|
32318
|
+
* @param body - Preferences to change, e.g. `{ language: 'es' }`.
|
|
32319
|
+
* @returns The updated preferences.
|
|
32071
32320
|
*/
|
|
32072
32321
|
updateMe(body: components['schemas']['UpdateMeRequest']): Promise<{
|
|
32073
32322
|
language: components["schemas"]["Language"];
|
|
32074
32323
|
}>;
|
|
32075
32324
|
}
|
|
32076
32325
|
|
|
32326
|
+
/**
|
|
32327
|
+
* Invoice series of the focused company, on the flat `/v1/configuration/series` routes.
|
|
32328
|
+
*
|
|
32329
|
+
* @deprecated The contract deprecates the session-focus routes. Use `beel.company(companyId).series` instead.
|
|
32330
|
+
*/
|
|
32077
32331
|
declare class SeriesResource {
|
|
32078
32332
|
private client;
|
|
32079
32333
|
constructor(client: BeeLClient);
|
|
32080
32334
|
/**
|
|
32081
32335
|
* List all invoice series. Optionally filter by active status.
|
|
32082
32336
|
*
|
|
32337
|
+
* @param active - Only active (`true`) or inactive (`false`) series; all when omitted.
|
|
32338
|
+
* @returns The series.
|
|
32339
|
+
*
|
|
32083
32340
|
* @example
|
|
32084
32341
|
* const series = await beel.series.list();
|
|
32085
32342
|
* const activeSeries = await beel.series.list(true);
|
|
@@ -32110,7 +32367,12 @@ declare class SeriesResource {
|
|
|
32110
32367
|
has_previous?: boolean | undefined;
|
|
32111
32368
|
} | undefined;
|
|
32112
32369
|
} | undefined>;
|
|
32113
|
-
/**
|
|
32370
|
+
/**
|
|
32371
|
+
* Create a new invoice series (e.g. "A-2026", "RECT").
|
|
32372
|
+
*
|
|
32373
|
+
* @param body - Code, name and format.
|
|
32374
|
+
* @returns The created series.
|
|
32375
|
+
*/
|
|
32114
32376
|
create(body: any): Promise<{
|
|
32115
32377
|
id: string;
|
|
32116
32378
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -32127,7 +32389,13 @@ declare class SeriesResource {
|
|
|
32127
32389
|
readonly next_number?: number | undefined;
|
|
32128
32390
|
updated_at?: string | undefined;
|
|
32129
32391
|
} | undefined>;
|
|
32130
|
-
/**
|
|
32392
|
+
/**
|
|
32393
|
+
* Update a series (name, description, etc.).
|
|
32394
|
+
*
|
|
32395
|
+
* @param id - Series UUID.
|
|
32396
|
+
* @param body - Fields to change.
|
|
32397
|
+
* @returns The updated series.
|
|
32398
|
+
*/
|
|
32131
32399
|
update(id: string, body: any): Promise<{
|
|
32132
32400
|
id: string;
|
|
32133
32401
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -32144,9 +32412,18 @@ declare class SeriesResource {
|
|
|
32144
32412
|
readonly next_number?: number | undefined;
|
|
32145
32413
|
updated_at?: string | undefined;
|
|
32146
32414
|
} | undefined>;
|
|
32147
|
-
/**
|
|
32415
|
+
/**
|
|
32416
|
+
* Delete an invoice series. Only empty series can be deleted.
|
|
32417
|
+
*
|
|
32418
|
+
* @param id - Series UUID.
|
|
32419
|
+
*/
|
|
32148
32420
|
delete(id: string): Promise<void>;
|
|
32149
|
-
/**
|
|
32421
|
+
/**
|
|
32422
|
+
* Set a series as the default for new invoices.
|
|
32423
|
+
*
|
|
32424
|
+
* @param id - Series UUID.
|
|
32425
|
+
* @returns The series.
|
|
32426
|
+
*/
|
|
32150
32427
|
setDefault(id: string): Promise<{
|
|
32151
32428
|
id: string;
|
|
32152
32429
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -32165,12 +32442,18 @@ declare class SeriesResource {
|
|
|
32165
32442
|
} | undefined>;
|
|
32166
32443
|
}
|
|
32167
32444
|
|
|
32445
|
+
/**
|
|
32446
|
+
* NIF validation against the AEAT register. Reach it as `beel.nif`.
|
|
32447
|
+
*/
|
|
32168
32448
|
declare class NifResource {
|
|
32169
32449
|
private client;
|
|
32170
32450
|
constructor(client: BeeLClient);
|
|
32171
32451
|
/**
|
|
32172
32452
|
* Validate a Spanish NIF/CIF against the AEAT tax registry.
|
|
32173
32453
|
*
|
|
32454
|
+
* @param nif - The NIF/CIF to validate.
|
|
32455
|
+
* @returns Whether it is valid and, when the register knows it, its holder's name.
|
|
32456
|
+
*
|
|
32174
32457
|
* @example
|
|
32175
32458
|
* const result = await beel.nif.validate('B12345678');
|
|
32176
32459
|
* console.log(result.valid, result.name);
|
|
@@ -32191,7 +32474,10 @@ type WebhookSubscription = components['schemas']['WebhookSubscription'];
|
|
|
32191
32474
|
type CompanyData = components['schemas']['CompanyData'];
|
|
32192
32475
|
type Pagination$2 = components['schemas']['Pagination'];
|
|
32193
32476
|
/**
|
|
32194
|
-
* Accounts
|
|
32477
|
+
* Accounts you provisioned and manage (multi-account provisioning for platforms and
|
|
32478
|
+
* advisory firms). Reach it as `beel.accounts`; scope one with `beel.account(accountId)`.
|
|
32479
|
+
*
|
|
32480
|
+
* Every method rejects with a `BeeLApiError` subclass when the API answers non-2xx.
|
|
32195
32481
|
*
|
|
32196
32482
|
* @example
|
|
32197
32483
|
* ```typescript
|
|
@@ -32203,14 +32489,24 @@ type Pagination$2 = components['schemas']['Pagination'];
|
|
|
32203
32489
|
declare class AccountsResource {
|
|
32204
32490
|
private client;
|
|
32205
32491
|
constructor(client: BeeLClient);
|
|
32206
|
-
/**
|
|
32492
|
+
/**
|
|
32493
|
+
* List the accounts you provisioned, newest first. Cursor-paginated: pass the
|
|
32494
|
+
* `next_cursor` of one page as `cursor` of the next until it is `null`.
|
|
32495
|
+
*
|
|
32496
|
+
* @param params - `status`, `external_ref` (exact), `limit`, `cursor`.
|
|
32497
|
+
* @returns The `accounts` of the page and `next_cursor`.
|
|
32498
|
+
*/
|
|
32207
32499
|
list(params?: operations['listAccounts']['parameters']['query']): Promise<{
|
|
32208
32500
|
accounts: ManagedAccountSummary[];
|
|
32209
32501
|
next_cursor?: string | null;
|
|
32210
32502
|
}>;
|
|
32211
32503
|
/**
|
|
32212
|
-
* Provision a new managed account.
|
|
32213
|
-
*
|
|
32504
|
+
* Provision a new managed account. Idempotent by `external_ref`: sending the same one
|
|
32505
|
+
* again returns the same account. Answers with the provisioning result — the account id,
|
|
32506
|
+
* its status and, when one is issued, the claim link — not with the account summary.
|
|
32507
|
+
*
|
|
32508
|
+
* @param body - `external_ref` and the holder's details.
|
|
32509
|
+
* @returns `account_id`, `status` and the claim link state.
|
|
32214
32510
|
*/
|
|
32215
32511
|
provision(body: operations['provisionAccount']['requestBody']['content']['application/json']): Promise<{
|
|
32216
32512
|
person_id?: string | null;
|
|
@@ -32221,7 +32517,12 @@ declare class AccountsResource {
|
|
|
32221
32517
|
claim_link_already_issued: boolean;
|
|
32222
32518
|
company_id?: string | null;
|
|
32223
32519
|
}>;
|
|
32224
|
-
/**
|
|
32520
|
+
/**
|
|
32521
|
+
* Get a managed account.
|
|
32522
|
+
*
|
|
32523
|
+
* @param accountId - Account UUID.
|
|
32524
|
+
* @returns The account summary.
|
|
32525
|
+
*/
|
|
32225
32526
|
get(accountId: string): Promise<{
|
|
32226
32527
|
account_id: string;
|
|
32227
32528
|
external_ref: string;
|
|
@@ -32233,20 +32534,42 @@ declare class AccountsResource {
|
|
|
32233
32534
|
representation_signed: boolean;
|
|
32234
32535
|
created_at: string;
|
|
32235
32536
|
}>;
|
|
32236
|
-
/**
|
|
32537
|
+
/**
|
|
32538
|
+
* Alias of `beel.account(accountId)`: the operations scoped to one account.
|
|
32539
|
+
*
|
|
32540
|
+
* @param accountId - Account UUID.
|
|
32541
|
+
* @returns The account scope. No request is made.
|
|
32542
|
+
*/
|
|
32237
32543
|
scope(accountId: string): AccountScope;
|
|
32238
32544
|
}
|
|
32239
|
-
/**
|
|
32545
|
+
/**
|
|
32546
|
+
* Operations scoped to one account: its companies (NIFs), members, invitations, webhooks
|
|
32547
|
+
* and usage. Reach it as `beel.account(accountId)`.
|
|
32548
|
+
*
|
|
32549
|
+
* @example
|
|
32550
|
+
* ```typescript
|
|
32551
|
+
* const { companies } = await beel.account('account-uuid').companies.list();
|
|
32552
|
+
* const company = beel.company(companies[0].id!);
|
|
32553
|
+
* ```
|
|
32554
|
+
*/
|
|
32240
32555
|
declare class AccountScope {
|
|
32241
32556
|
private client;
|
|
32242
32557
|
readonly accountId: string;
|
|
32558
|
+
/** Members of the account and their per-company grants. */
|
|
32243
32559
|
readonly members: AccountMembersResource;
|
|
32560
|
+
/** Invitations to join the account. */
|
|
32244
32561
|
readonly invitations: AccountInvitationsResource;
|
|
32562
|
+
/** Webhook subscriptions of the account. */
|
|
32245
32563
|
readonly webhooks: AccountWebhooksResource;
|
|
32564
|
+
/** Companies (NIFs) of the account — where company ids come from. */
|
|
32246
32565
|
readonly companies: AccountCompaniesResource;
|
|
32247
32566
|
constructor(client: BeeLClient, accountId: string);
|
|
32248
32567
|
private path;
|
|
32249
|
-
/**
|
|
32568
|
+
/**
|
|
32569
|
+
* Get the account summary.
|
|
32570
|
+
*
|
|
32571
|
+
* @returns The account summary.
|
|
32572
|
+
*/
|
|
32250
32573
|
get(): Promise<{
|
|
32251
32574
|
account_id: string;
|
|
32252
32575
|
external_ref: string;
|
|
@@ -32258,30 +32581,59 @@ declare class AccountScope {
|
|
|
32258
32581
|
representation_signed: boolean;
|
|
32259
32582
|
created_at: string;
|
|
32260
32583
|
}>;
|
|
32261
|
-
/**
|
|
32584
|
+
/**
|
|
32585
|
+
* Provisioning usage counters for billing: provisioned accounts and NIFs.
|
|
32586
|
+
*
|
|
32587
|
+
* @returns `provisioned_accounts` and `nifs`.
|
|
32588
|
+
*/
|
|
32262
32589
|
usage(): Promise<{
|
|
32263
32590
|
provisioned_accounts: number;
|
|
32264
32591
|
nifs: number;
|
|
32265
32592
|
}>;
|
|
32266
|
-
/**
|
|
32593
|
+
/**
|
|
32594
|
+
* Change the access level you keep over this account. Raising it is only possible while
|
|
32595
|
+
* the account is unclaimed.
|
|
32596
|
+
*
|
|
32597
|
+
* @param body - The new `access_level`.
|
|
32598
|
+
*/
|
|
32267
32599
|
changeAccessLevel(body: NonNullable<operations['changeManagedAccountAccessLevel']['requestBody']>['content']['application/json']): Promise<void>;
|
|
32268
|
-
/**
|
|
32600
|
+
/**
|
|
32601
|
+
* End your management of this account: you lose access, and the holder keeps the
|
|
32602
|
+
* account, its NIFs and its invoices.
|
|
32603
|
+
*/
|
|
32269
32604
|
endManagement(): Promise<void>;
|
|
32270
|
-
/**
|
|
32605
|
+
/**
|
|
32606
|
+
* Issue a single-use claim token so the account's holder can take ownership.
|
|
32607
|
+
*
|
|
32608
|
+
* @param body - `email` when the account has no holder yet; omit to re-issue.
|
|
32609
|
+
* @returns `claim_token`, `claim_url` and `expires_at`.
|
|
32610
|
+
*/
|
|
32271
32611
|
createClaimToken(body?: NonNullable<operations['createAccountClaimToken']['requestBody']>['content']['application/json']): Promise<{
|
|
32272
32612
|
person_id: string;
|
|
32273
32613
|
claim_token: string;
|
|
32274
32614
|
claim_url: string;
|
|
32275
32615
|
expires_at: string;
|
|
32276
32616
|
}>;
|
|
32277
|
-
/**
|
|
32617
|
+
/**
|
|
32618
|
+
* Make an existing member the account's owner. Repeatable: it states the desired owner.
|
|
32619
|
+
*
|
|
32620
|
+
* @param body - The member that becomes owner.
|
|
32621
|
+
*/
|
|
32278
32622
|
setOwner(body: operations['putAccountOwner']['requestBody']['content']['application/json']): Promise<void>;
|
|
32279
32623
|
}
|
|
32280
|
-
/**
|
|
32624
|
+
/**
|
|
32625
|
+
* Members of an account and their per-company grants. Reach it as
|
|
32626
|
+
* `beel.account(accountId).members`.
|
|
32627
|
+
*/
|
|
32281
32628
|
declare class AccountMembersResource {
|
|
32282
32629
|
private client;
|
|
32283
32630
|
private accountId;
|
|
32284
32631
|
constructor(client: BeeLClient, accountId: string);
|
|
32632
|
+
/**
|
|
32633
|
+
* List the account's members.
|
|
32634
|
+
*
|
|
32635
|
+
* @returns The members (`data.members` of the response), as an array.
|
|
32636
|
+
*/
|
|
32285
32637
|
list(): Promise<{
|
|
32286
32638
|
member_id: string;
|
|
32287
32639
|
person_id: string;
|
|
@@ -32290,6 +32642,12 @@ declare class AccountMembersResource {
|
|
|
32290
32642
|
grants?: components["schemas"]["MemberGrant"][];
|
|
32291
32643
|
permissions: components["schemas"]["MemberPermissions"];
|
|
32292
32644
|
}[]>;
|
|
32645
|
+
/**
|
|
32646
|
+
* Get one member.
|
|
32647
|
+
*
|
|
32648
|
+
* @param memberId - Member UUID.
|
|
32649
|
+
* @returns The member.
|
|
32650
|
+
*/
|
|
32293
32651
|
get(memberId: string): Promise<{
|
|
32294
32652
|
member_id: string;
|
|
32295
32653
|
person_id: string;
|
|
@@ -32298,7 +32656,13 @@ declare class AccountMembersResource {
|
|
|
32298
32656
|
grants?: components["schemas"]["MemberGrant"][];
|
|
32299
32657
|
permissions: components["schemas"]["MemberPermissions"];
|
|
32300
32658
|
}>;
|
|
32301
|
-
/**
|
|
32659
|
+
/**
|
|
32660
|
+
* Change a member's account role.
|
|
32661
|
+
*
|
|
32662
|
+
* @param memberId - Member UUID.
|
|
32663
|
+
* @param body - The new `account_role`.
|
|
32664
|
+
* @returns The updated member.
|
|
32665
|
+
*/
|
|
32302
32666
|
update(memberId: string, body: operations['patchAccountMember']['requestBody']['content']['application/json']): Promise<{
|
|
32303
32667
|
member_id: string;
|
|
32304
32668
|
person_id: string;
|
|
@@ -32307,9 +32671,18 @@ declare class AccountMembersResource {
|
|
|
32307
32671
|
grants?: components["schemas"]["MemberGrant"][];
|
|
32308
32672
|
permissions: components["schemas"]["MemberPermissions"];
|
|
32309
32673
|
}>;
|
|
32310
|
-
/**
|
|
32674
|
+
/**
|
|
32675
|
+
* Remove a member from the account.
|
|
32676
|
+
*
|
|
32677
|
+
* @param memberId - Member UUID.
|
|
32678
|
+
*/
|
|
32311
32679
|
remove(memberId: string): Promise<void>;
|
|
32312
|
-
/**
|
|
32680
|
+
/**
|
|
32681
|
+
* List a member's per-company grants.
|
|
32682
|
+
*
|
|
32683
|
+
* @param memberId - Member UUID.
|
|
32684
|
+
* @returns The `grants` and their `pagination`.
|
|
32685
|
+
*/
|
|
32313
32686
|
listGrants(memberId: string): Promise<{
|
|
32314
32687
|
grants: {
|
|
32315
32688
|
company_id: string;
|
|
@@ -32325,19 +32698,36 @@ declare class AccountMembersResource {
|
|
|
32325
32698
|
has_previous?: boolean | undefined;
|
|
32326
32699
|
};
|
|
32327
32700
|
} | undefined>;
|
|
32328
|
-
/**
|
|
32701
|
+
/**
|
|
32702
|
+
* Grant a member access to one company, or replace the grant it has.
|
|
32703
|
+
*
|
|
32704
|
+
* @param memberId - Member UUID.
|
|
32705
|
+
* @param companyId - Company UUID.
|
|
32706
|
+
* @param body - The `access_level` to grant.
|
|
32707
|
+
* @returns The grant.
|
|
32708
|
+
*/
|
|
32329
32709
|
putGrant(memberId: string, companyId: string, body: operations['putAccountMemberGrant']['requestBody']['content']['application/json']): Promise<{
|
|
32330
32710
|
company_id: string;
|
|
32331
32711
|
access_level: "VIEW" | "OPERATE";
|
|
32332
32712
|
} | undefined>;
|
|
32333
|
-
/**
|
|
32713
|
+
/**
|
|
32714
|
+
* Revoke a member's access to one company.
|
|
32715
|
+
*
|
|
32716
|
+
* @param memberId - Member UUID.
|
|
32717
|
+
* @param companyId - Company UUID.
|
|
32718
|
+
*/
|
|
32334
32719
|
removeGrant(memberId: string, companyId: string): Promise<void>;
|
|
32335
32720
|
}
|
|
32336
|
-
/** Invitations to join an account. */
|
|
32721
|
+
/** Invitations to join an account. Reach it as `beel.account(accountId).invitations`. */
|
|
32337
32722
|
declare class AccountInvitationsResource {
|
|
32338
32723
|
private client;
|
|
32339
32724
|
private accountId;
|
|
32340
32725
|
constructor(client: BeeLClient, accountId: string);
|
|
32726
|
+
/**
|
|
32727
|
+
* List the account's invitations.
|
|
32728
|
+
*
|
|
32729
|
+
* @returns The invitations.
|
|
32730
|
+
*/
|
|
32341
32731
|
list(): Promise<{
|
|
32342
32732
|
invitations: {
|
|
32343
32733
|
invitation_id: string;
|
|
@@ -32356,6 +32746,12 @@ declare class AccountInvitationsResource {
|
|
|
32356
32746
|
has_previous?: boolean | undefined;
|
|
32357
32747
|
};
|
|
32358
32748
|
}>;
|
|
32749
|
+
/**
|
|
32750
|
+
* Invite someone to join the account.
|
|
32751
|
+
*
|
|
32752
|
+
* @param body - `invited_email` and the `account_role` to grant.
|
|
32753
|
+
* @returns The invitation.
|
|
32754
|
+
*/
|
|
32359
32755
|
create(body: operations['createAccountInvitation']['requestBody']['content']['application/json']): Promise<{
|
|
32360
32756
|
invitation_id: string;
|
|
32361
32757
|
invited_email: string;
|
|
@@ -32364,6 +32760,12 @@ declare class AccountInvitationsResource {
|
|
|
32364
32760
|
token: string;
|
|
32365
32761
|
invitation_url?: string | null;
|
|
32366
32762
|
}>;
|
|
32763
|
+
/**
|
|
32764
|
+
* Get one invitation.
|
|
32765
|
+
*
|
|
32766
|
+
* @param invitationId - Invitation UUID.
|
|
32767
|
+
* @returns The invitation.
|
|
32768
|
+
*/
|
|
32367
32769
|
get(invitationId: string): Promise<{
|
|
32368
32770
|
invitation_id: string;
|
|
32369
32771
|
invited_email: string;
|
|
@@ -32372,17 +32774,37 @@ declare class AccountInvitationsResource {
|
|
|
32372
32774
|
created_at: string;
|
|
32373
32775
|
expires_at: string;
|
|
32374
32776
|
}>;
|
|
32777
|
+
/**
|
|
32778
|
+
* Revoke a `PENDING` invitation, so its link stops working.
|
|
32779
|
+
*
|
|
32780
|
+
* @param invitationId - Invitation UUID.
|
|
32781
|
+
*/
|
|
32375
32782
|
revoke(invitationId: string): Promise<void>;
|
|
32376
32783
|
}
|
|
32377
|
-
/**
|
|
32784
|
+
/**
|
|
32785
|
+
* Webhook subscriptions of an account. Reach it as `beel.account(accountId).webhooks`;
|
|
32786
|
+
* verify deliveries with `WebhookVerifier`.
|
|
32787
|
+
*/
|
|
32378
32788
|
declare class AccountWebhooksResource {
|
|
32379
32789
|
private client;
|
|
32380
32790
|
private accountId;
|
|
32381
32791
|
constructor(client: BeeLClient, accountId: string);
|
|
32792
|
+
/**
|
|
32793
|
+
* List the webhook subscriptions.
|
|
32794
|
+
*
|
|
32795
|
+
* @param params - Pagination.
|
|
32796
|
+
* @returns The `webhooks` and their `pagination`.
|
|
32797
|
+
*/
|
|
32382
32798
|
list(params?: operations['listAccountWebhookSubscriptions']['parameters']['query']): Promise<{
|
|
32383
32799
|
webhooks?: WebhookSubscription[];
|
|
32384
32800
|
pagination?: Pagination$2;
|
|
32385
32801
|
}>;
|
|
32802
|
+
/**
|
|
32803
|
+
* Subscribe an HTTPS endpoint to events.
|
|
32804
|
+
*
|
|
32805
|
+
* @param body - `url` and the `events` to receive.
|
|
32806
|
+
* @returns The subscription, with its signing secret.
|
|
32807
|
+
*/
|
|
32386
32808
|
create(body: operations['createAccountWebhookSubscription']['requestBody']['content']['application/json']): Promise<{
|
|
32387
32809
|
id: string;
|
|
32388
32810
|
url: string;
|
|
@@ -32405,6 +32827,12 @@ declare class AccountWebhooksResource {
|
|
|
32405
32827
|
failure_cause?: components["schemas"]["WebhookFailureCause"] | undefined;
|
|
32406
32828
|
} | null | undefined;
|
|
32407
32829
|
} | undefined>;
|
|
32830
|
+
/**
|
|
32831
|
+
* Get one webhook subscription.
|
|
32832
|
+
*
|
|
32833
|
+
* @param webhookId - Subscription UUID.
|
|
32834
|
+
* @returns The subscription.
|
|
32835
|
+
*/
|
|
32408
32836
|
get(webhookId: string): Promise<{
|
|
32409
32837
|
id: string;
|
|
32410
32838
|
url: string;
|
|
@@ -32419,6 +32847,13 @@ declare class AccountWebhooksResource {
|
|
|
32419
32847
|
last_used_at?: string | null;
|
|
32420
32848
|
created_at: string;
|
|
32421
32849
|
}>;
|
|
32850
|
+
/**
|
|
32851
|
+
* Update a webhook subscription. Only the fields present in `body` change.
|
|
32852
|
+
*
|
|
32853
|
+
* @param webhookId - Subscription UUID.
|
|
32854
|
+
* @param body - Fields to change.
|
|
32855
|
+
* @returns The updated subscription.
|
|
32856
|
+
*/
|
|
32422
32857
|
update(webhookId: string, body: operations['patchAccountWebhookSubscription']['requestBody']['content']['application/json']): Promise<{
|
|
32423
32858
|
id: string;
|
|
32424
32859
|
url: string;
|
|
@@ -32433,8 +32868,18 @@ declare class AccountWebhooksResource {
|
|
|
32433
32868
|
last_used_at?: string | null;
|
|
32434
32869
|
created_at: string;
|
|
32435
32870
|
}>;
|
|
32871
|
+
/**
|
|
32872
|
+
* Delete a webhook subscription.
|
|
32873
|
+
*
|
|
32874
|
+
* @param webhookId - Subscription UUID.
|
|
32875
|
+
*/
|
|
32436
32876
|
delete(webhookId: string): Promise<void>;
|
|
32437
|
-
/**
|
|
32877
|
+
/**
|
|
32878
|
+
* Send a test event to the endpoint. Test deliveries carry `test: true`.
|
|
32879
|
+
*
|
|
32880
|
+
* @param webhookId - Subscription UUID.
|
|
32881
|
+
* @returns The outcome of the delivery.
|
|
32882
|
+
*/
|
|
32438
32883
|
test(webhookId: string): Promise<{
|
|
32439
32884
|
delivery_success?: boolean | undefined;
|
|
32440
32885
|
http_status?: number | null | undefined;
|
|
@@ -32442,7 +32887,12 @@ declare class AccountWebhooksResource {
|
|
|
32442
32887
|
error?: string | null | undefined;
|
|
32443
32888
|
failure_cause?: components["schemas"]["WebhookFailureCause"] | undefined;
|
|
32444
32889
|
} | undefined>;
|
|
32445
|
-
/**
|
|
32890
|
+
/**
|
|
32891
|
+
* Rotate the signing secret. The old secret stops working immediately.
|
|
32892
|
+
*
|
|
32893
|
+
* @param webhookId - Subscription UUID.
|
|
32894
|
+
* @returns The subscription with its new secret.
|
|
32895
|
+
*/
|
|
32446
32896
|
rotateSecret(webhookId: string): Promise<{
|
|
32447
32897
|
id: string;
|
|
32448
32898
|
url: string;
|
|
@@ -32465,6 +32915,13 @@ declare class AccountWebhooksResource {
|
|
|
32465
32915
|
failure_cause?: components["schemas"]["WebhookFailureCause"] | undefined;
|
|
32466
32916
|
} | null | undefined;
|
|
32467
32917
|
} | undefined>;
|
|
32918
|
+
/**
|
|
32919
|
+
* List the delivery attempts of a subscription.
|
|
32920
|
+
*
|
|
32921
|
+
* @param webhookId - Subscription UUID.
|
|
32922
|
+
* @param params - Filters and pagination.
|
|
32923
|
+
* @returns The deliveries.
|
|
32924
|
+
*/
|
|
32468
32925
|
listDeliveries(webhookId: string, params?: operations['listAccountWebhookDeliveries']['parameters']['query']): Promise<{
|
|
32469
32926
|
deliveries?: {
|
|
32470
32927
|
id?: string | undefined;
|
|
@@ -32494,7 +32951,14 @@ declare class AccountWebhooksResource {
|
|
|
32494
32951
|
has_previous?: boolean | undefined;
|
|
32495
32952
|
} | undefined;
|
|
32496
32953
|
} | undefined>;
|
|
32497
|
-
|
|
32954
|
+
/**
|
|
32955
|
+
* Retry a failed delivery.
|
|
32956
|
+
*
|
|
32957
|
+
* @param webhookId - Subscription UUID.
|
|
32958
|
+
* @param deliveryId - Delivery UUID.
|
|
32959
|
+
* @returns The new delivery attempt.
|
|
32960
|
+
*/
|
|
32961
|
+
retryDelivery(webhookId: string, deliveryId: string): Promise<{
|
|
32498
32962
|
id?: string | undefined;
|
|
32499
32963
|
subscription_id?: string | undefined;
|
|
32500
32964
|
webhook_event_id?: string | undefined;
|
|
@@ -32514,16 +32978,37 @@ declare class AccountWebhooksResource {
|
|
|
32514
32978
|
delivered_at?: string | undefined;
|
|
32515
32979
|
} | undefined>;
|
|
32516
32980
|
}
|
|
32517
|
-
/**
|
|
32981
|
+
/**
|
|
32982
|
+
* Companies (NIFs) of an account — where the `companyId` of `beel.company(companyId)`
|
|
32983
|
+
* comes from. Reach it as `beel.account(accountId).companies`.
|
|
32984
|
+
*/
|
|
32518
32985
|
declare class AccountCompaniesResource {
|
|
32519
32986
|
private client;
|
|
32520
32987
|
private accountId;
|
|
32521
32988
|
constructor(client: BeeLClient, accountId: string);
|
|
32989
|
+
/**
|
|
32990
|
+
* List the account's companies, primary first. Always paginated (20 by default).
|
|
32991
|
+
*
|
|
32992
|
+
* @param params - `search`, `include`, `page`, `limit`.
|
|
32993
|
+
* @returns The `companies` of the page and its `pagination`.
|
|
32994
|
+
*
|
|
32995
|
+
* @example
|
|
32996
|
+
* ```typescript
|
|
32997
|
+
* const { account_id } = await beel.catalogs.identity();
|
|
32998
|
+
* const { companies } = await beel.account(account_id).companies.list({ search: 'B12345678' });
|
|
32999
|
+
* const company = beel.company(companies[0].id!);
|
|
33000
|
+
* ```
|
|
33001
|
+
*/
|
|
32522
33002
|
list(params?: operations['listCompanies']['parameters']['query']): Promise<{
|
|
32523
33003
|
companies: CompanyData[];
|
|
32524
33004
|
pagination: Pagination$2 | undefined;
|
|
32525
33005
|
}>;
|
|
32526
|
-
/**
|
|
33006
|
+
/**
|
|
33007
|
+
* Register a new company (NIF) under the account.
|
|
33008
|
+
*
|
|
33009
|
+
* @param body - NIF, legal name, entity type and address.
|
|
33010
|
+
* @returns The created company.
|
|
33011
|
+
*/
|
|
32527
33012
|
create(body: components['schemas']['CreateCompanyRequest']): Promise<{
|
|
32528
33013
|
id?: string;
|
|
32529
33014
|
access_level?: components["schemas"]["AccessLevel"];
|
|
@@ -32570,7 +33055,11 @@ declare class AccountCompaniesResource {
|
|
|
32570
33055
|
created_at?: string;
|
|
32571
33056
|
readiness?: components["schemas"]["IssuingReadinessData"] | null;
|
|
32572
33057
|
}>;
|
|
32573
|
-
/**
|
|
33058
|
+
/**
|
|
33059
|
+
* Per-company invoice stats: how many fiscal documents each issued, and when last.
|
|
33060
|
+
*
|
|
33061
|
+
* @returns One entry per company.
|
|
33062
|
+
*/
|
|
32574
33063
|
stats(): Promise<{
|
|
32575
33064
|
stats: {
|
|
32576
33065
|
company_id: string;
|
|
@@ -32588,6 +33077,31 @@ declare class AccountCompaniesResource {
|
|
|
32588
33077
|
} | undefined>;
|
|
32589
33078
|
}
|
|
32590
33079
|
|
|
33080
|
+
/**
|
|
33081
|
+
* Per-call options, accepted as the last argument of the `company.invoices` methods.
|
|
33082
|
+
*
|
|
33083
|
+
* @example
|
|
33084
|
+
* ```typescript
|
|
33085
|
+
* await company.invoices.create(body, undefined, {
|
|
33086
|
+
* idempotencyKey: `order-${order.id}`,
|
|
33087
|
+
* timeoutMs: 15_000,
|
|
33088
|
+
* });
|
|
33089
|
+
* ```
|
|
33090
|
+
*/
|
|
33091
|
+
interface RequestOptions {
|
|
33092
|
+
/**
|
|
33093
|
+
* `Idempotency-Key` of this call, instead of the automatic one: letters, digits, `_` and
|
|
33094
|
+
* `-`, up to 255 characters. Every automatic retry of the call reuses it. Persist it with
|
|
33095
|
+
* your order to retry the same operation later: within 24 hours the API replays the first
|
|
33096
|
+
* `2xx` or `5xx` answer instead of running the operation again.
|
|
33097
|
+
*/
|
|
33098
|
+
idempotencyKey?: string;
|
|
33099
|
+
/** Aborts the call — the automatic retries and the waits between them included. */
|
|
33100
|
+
signal?: AbortSignal;
|
|
33101
|
+
/** Aborts the call after this many milliseconds, automatic retries included. */
|
|
33102
|
+
timeoutMs?: number;
|
|
33103
|
+
}
|
|
33104
|
+
|
|
32591
33105
|
type ManagedPaymentConnection = components['schemas']['ManagedPaymentConnection'];
|
|
32592
33106
|
type ManagedPaymentEvent = components['schemas']['ManagedPaymentEvent'];
|
|
32593
33107
|
type Pagination$1 = components['schemas']['Pagination'];
|
|
@@ -32614,7 +33128,11 @@ declare class CompanyPaymentConnectionsResource {
|
|
|
32614
33128
|
private companyId;
|
|
32615
33129
|
constructor(client: BeeLClient, companyId: string);
|
|
32616
33130
|
private path;
|
|
32617
|
-
/**
|
|
33131
|
+
/**
|
|
33132
|
+
* Every payment connection of this company.
|
|
33133
|
+
*
|
|
33134
|
+
* @returns The `connections`.
|
|
33135
|
+
*/
|
|
32618
33136
|
list(): Promise<{
|
|
32619
33137
|
connections: ManagedPaymentConnection[];
|
|
32620
33138
|
}>;
|
|
@@ -32622,11 +33140,20 @@ declare class CompanyPaymentConnectionsResource {
|
|
|
32622
33140
|
* Start an authorization and get the URL where the NIF's holder approves it.
|
|
32623
33141
|
*
|
|
32624
33142
|
* This is the one place the provider slug is used — currently only `stripe`.
|
|
33143
|
+
*
|
|
33144
|
+
* @param body - `{ provider: 'stripe' }`, plus the return URL when needed.
|
|
33145
|
+
* @returns The `authorization_url` to send the NIF's holder to.
|
|
32625
33146
|
*/
|
|
32626
33147
|
authorize(body: components['schemas']['InitiatePaymentConnectionRequest']): Promise<{
|
|
32627
33148
|
authorization_url: string;
|
|
32628
33149
|
}>;
|
|
32629
|
-
/**
|
|
33150
|
+
/**
|
|
33151
|
+
* Update the settings of one connection, addressed by its UUID.
|
|
33152
|
+
*
|
|
33153
|
+
* @param connectionId - Connection UUID, from {@link list}.
|
|
33154
|
+
* @param body - Settings to change.
|
|
33155
|
+
* @returns The updated connection.
|
|
33156
|
+
*/
|
|
32630
33157
|
update(connectionId: string, body: components['schemas']['UpdateCompanyPaymentConnectionRequest']): Promise<{
|
|
32631
33158
|
id: string;
|
|
32632
33159
|
provider: string;
|
|
@@ -32650,14 +33177,22 @@ declare class CompanyPaymentConnectionsResource {
|
|
|
32650
33177
|
/**
|
|
32651
33178
|
* Disconnect one connection. Tokens are revoked and auto-invoicing stops;
|
|
32652
33179
|
* already-issued invoices are untouched.
|
|
33180
|
+
*
|
|
33181
|
+
* @param connectionId - Connection UUID.
|
|
32653
33182
|
*/
|
|
32654
33183
|
disconnect(connectionId: string): Promise<void>;
|
|
32655
|
-
/**
|
|
33184
|
+
/**
|
|
33185
|
+
* The payment events of one connection — where you audit what did and didn't invoice.
|
|
33186
|
+
*
|
|
33187
|
+
* @param connectionId - Connection UUID.
|
|
33188
|
+
* @returns The events resource of that connection. No request is made.
|
|
33189
|
+
*/
|
|
32656
33190
|
events(connectionId: string): CompanyPaymentEventsResource;
|
|
32657
33191
|
}
|
|
32658
33192
|
/**
|
|
32659
33193
|
* Payment events received through a connection, and the recovery levers for the ones
|
|
32660
|
-
* that did not produce an invoice.
|
|
33194
|
+
* that did not produce an invoice. Reach it as
|
|
33195
|
+
* `beel.company(companyId).paymentConnections.events(connectionId)`.
|
|
32661
33196
|
*/
|
|
32662
33197
|
declare class CompanyPaymentEventsResource {
|
|
32663
33198
|
private client;
|
|
@@ -32669,13 +33204,21 @@ declare class CompanyPaymentEventsResource {
|
|
|
32669
33204
|
* Events of the connection, most recent first. Nothing is hidden by default:
|
|
32670
33205
|
* skipped events, duplicates and disputes are all returned — narrow with the
|
|
32671
33206
|
* filters. `charges_only` returns one row per money movement instead.
|
|
33207
|
+
*
|
|
33208
|
+
* @param params - Filters (`needs_action`, `charges_only`…) and pagination.
|
|
33209
|
+
* @returns The `events`, their `pagination` and `counts`.
|
|
32672
33210
|
*/
|
|
32673
33211
|
list(params?: operations['listCompanyPaymentEvents']['parameters']['query']): Promise<{
|
|
32674
33212
|
events: ManagedPaymentEvent[];
|
|
32675
33213
|
pagination?: Pagination$1;
|
|
32676
33214
|
counts?: PaymentEventCounts;
|
|
32677
33215
|
}>;
|
|
32678
|
-
/**
|
|
33216
|
+
/**
|
|
33217
|
+
* Get one event.
|
|
33218
|
+
*
|
|
33219
|
+
* @param eventId - Event UUID.
|
|
33220
|
+
* @returns The event.
|
|
33221
|
+
*/
|
|
32679
33222
|
get(eventId: string): Promise<{
|
|
32680
33223
|
id: string;
|
|
32681
33224
|
provider: string;
|
|
@@ -32714,6 +33257,9 @@ declare class CompanyPaymentEventsResource {
|
|
|
32714
33257
|
* Reprocess an event whose automatic invoicing didn't complete, applying the NIF's
|
|
32715
33258
|
* **current** configuration. Only retryable states qualify and the retry budget is
|
|
32716
33259
|
* finite: otherwise `400`.
|
|
33260
|
+
*
|
|
33261
|
+
* @param eventId - Event UUID.
|
|
33262
|
+
* @returns The event after the retry.
|
|
32717
33263
|
*/
|
|
32718
33264
|
retry(eventId: string): Promise<{
|
|
32719
33265
|
id: string;
|
|
@@ -32751,12 +33297,20 @@ declare class CompanyPaymentEventsResource {
|
|
|
32751
33297
|
}>;
|
|
32752
33298
|
/**
|
|
32753
33299
|
* Build a **draft** invoice from an event that couldn't be invoiced automatically,
|
|
32754
|
-
* so you can review it before issuing.
|
|
33300
|
+
* so you can review it before issuing.
|
|
33301
|
+
*
|
|
33302
|
+
* @param eventId - Event UUID.
|
|
33303
|
+
* @returns The draft's `invoice_id`.
|
|
32755
33304
|
*/
|
|
32756
33305
|
draft(eventId: string): Promise<{
|
|
32757
33306
|
invoice_id: string;
|
|
32758
33307
|
}>;
|
|
32759
|
-
/**
|
|
33308
|
+
/**
|
|
33309
|
+
* Mark an event as dealt with outside the automatic flow.
|
|
33310
|
+
*
|
|
33311
|
+
* @param eventId - Event UUID.
|
|
33312
|
+
* @returns The resolved event.
|
|
33313
|
+
*/
|
|
32760
33314
|
resolve(eventId: string): Promise<{
|
|
32761
33315
|
id: string;
|
|
32762
33316
|
provider: string;
|
|
@@ -32791,7 +33345,12 @@ declare class CompanyPaymentEventsResource {
|
|
|
32791
33345
|
discarded: boolean;
|
|
32792
33346
|
discarded_at?: string | null;
|
|
32793
33347
|
}>;
|
|
32794
|
-
/**
|
|
33348
|
+
/**
|
|
33349
|
+
* Discard an event so it stops asking for attention. Reversible with {@link restore}.
|
|
33350
|
+
*
|
|
33351
|
+
* @param eventId - Event UUID.
|
|
33352
|
+
* @returns The discarded event.
|
|
33353
|
+
*/
|
|
32795
33354
|
discard(eventId: string): Promise<{
|
|
32796
33355
|
id: string;
|
|
32797
33356
|
provider: string;
|
|
@@ -32826,7 +33385,12 @@ declare class CompanyPaymentEventsResource {
|
|
|
32826
33385
|
discarded: boolean;
|
|
32827
33386
|
discarded_at?: string | null;
|
|
32828
33387
|
}>;
|
|
32829
|
-
/**
|
|
33388
|
+
/**
|
|
33389
|
+
* Bring a discarded event back into the list.
|
|
33390
|
+
*
|
|
33391
|
+
* @param eventId - Event UUID.
|
|
33392
|
+
* @returns The restored event.
|
|
33393
|
+
*/
|
|
32830
33394
|
restore(eventId: string): Promise<{
|
|
32831
33395
|
id: string;
|
|
32832
33396
|
provider: string;
|
|
@@ -32863,6 +33427,26 @@ declare class CompanyPaymentEventsResource {
|
|
|
32863
33427
|
}>;
|
|
32864
33428
|
}
|
|
32865
33429
|
|
|
33430
|
+
type CreateInvoiceRequest$1 = components['schemas']['CreateInvoiceRequest'];
|
|
33431
|
+
/**
|
|
33432
|
+
* Invoice types whose `external_ref` the API keeps unique: at most one live (not deleted)
|
|
33433
|
+
* invoice of these types per reference and environment, whatever its status — a `VOIDED`
|
|
33434
|
+
* one included. Correctives are exempt, and proformas are not covered.
|
|
33435
|
+
*/
|
|
33436
|
+
declare const EXTERNAL_REF_UNIQUE_INVOICE_TYPES: readonly ["STANDARD", "SIMPLIFIED"];
|
|
33437
|
+
/** Invoice types {@link createInvoiceOnce} accepts. */
|
|
33438
|
+
type ExternalRefUniqueInvoiceType = (typeof EXTERNAL_REF_UNIQUE_INVOICE_TYPES)[number];
|
|
33439
|
+
/**
|
|
33440
|
+
* Body of `invoices.createOnce`: a `CreateInvoiceRequest` whose `type` is `STANDARD` or
|
|
33441
|
+
* `SIMPLIFIED` and whose `external_ref` is required — it is what makes the call safe to repeat.
|
|
33442
|
+
*/
|
|
33443
|
+
type CreateInvoiceOnceRequest = Omit<CreateInvoiceRequest$1, 'type' | 'external_ref'> & {
|
|
33444
|
+
type: ExternalRefUniqueInvoiceType;
|
|
33445
|
+
external_ref: string;
|
|
33446
|
+
};
|
|
33447
|
+
/** Query of `invoices.createOnce`: the same as `invoices.create`. */
|
|
33448
|
+
type CreateInvoiceOnceParams = operations['createCompanyInvoice']['parameters']['query'];
|
|
33449
|
+
|
|
32866
33450
|
type Invoice = components['schemas']['Invoice'];
|
|
32867
33451
|
type Customer = components['schemas']['Customer'];
|
|
32868
33452
|
type Product = components['schemas']['Product'];
|
|
@@ -32870,7 +33454,10 @@ type Pagination = components['schemas']['Pagination'];
|
|
|
32870
33454
|
/**
|
|
32871
33455
|
* Operations scoped to a single company (NIF). This is the explicit multi-NIF surface:
|
|
32872
33456
|
* the company is addressed in the path, so no session focus or `BeeL-Active-Company`
|
|
32873
|
-
* header is needed.
|
|
33457
|
+
* header is needed. Get one with `beel.company(companyId)`; list the ids with
|
|
33458
|
+
* `beel.account(accountId).companies.list()`.
|
|
33459
|
+
*
|
|
33460
|
+
* Every method rejects with a `BeeLApiError` subclass when the API answers non-2xx.
|
|
32874
33461
|
*
|
|
32875
33462
|
* @example
|
|
32876
33463
|
* ```typescript
|
|
@@ -32882,17 +33469,30 @@ type Pagination = components['schemas']['Pagination'];
|
|
|
32882
33469
|
declare class CompanyScope {
|
|
32883
33470
|
private client;
|
|
32884
33471
|
readonly companyId: string;
|
|
33472
|
+
/** Invoices of this company: create, issue, void, correct, list, PDF, email. */
|
|
32885
33473
|
readonly invoices: CompanyInvoicesResource;
|
|
33474
|
+
/** Customers of this company. */
|
|
32886
33475
|
readonly customers: CompanyCustomersResource;
|
|
33476
|
+
/** Products and services of this company. */
|
|
32887
33477
|
readonly products: CompanyProductsResource;
|
|
33478
|
+
/** Invoice series (numbering) of this company. */
|
|
32888
33479
|
readonly series: CompanySeriesResource;
|
|
33480
|
+
/** Recurring invoice templates of this company. */
|
|
32889
33481
|
readonly recurringInvoices: CompanyRecurringInvoicesResource;
|
|
33482
|
+
/** Payment provider connections (Stripe) that auto-generate invoices under this NIF. */
|
|
32890
33483
|
readonly paymentConnections: CompanyPaymentConnectionsResource;
|
|
33484
|
+
/** Default taxes of this company. */
|
|
32891
33485
|
readonly taxConfiguration: CompanyTaxConfigurationResource;
|
|
33486
|
+
/** Whether this NIF submits its invoices to AEAT under VeriFactu. */
|
|
32892
33487
|
readonly verifactuConfiguration: CompanyVeriFactuConfigurationResource;
|
|
32893
33488
|
constructor(client: BeeLClient, companyId: string);
|
|
32894
33489
|
private path;
|
|
32895
|
-
/**
|
|
33490
|
+
/**
|
|
33491
|
+
* Get the company: its fiscal identity, address and settings.
|
|
33492
|
+
*
|
|
33493
|
+
* @param params - Optional query of `getCompanyById` (e.g. `include`).
|
|
33494
|
+
* @returns The company.
|
|
33495
|
+
*/
|
|
32896
33496
|
get(params?: operations['getCompanyById']['parameters']['query']): Promise<{
|
|
32897
33497
|
id?: string;
|
|
32898
33498
|
access_level?: components["schemas"]["AccessLevel"];
|
|
@@ -32939,7 +33539,12 @@ declare class CompanyScope {
|
|
|
32939
33539
|
created_at?: string;
|
|
32940
33540
|
readiness?: components["schemas"]["IssuingReadinessData"] | null;
|
|
32941
33541
|
}>;
|
|
32942
|
-
/**
|
|
33542
|
+
/**
|
|
33543
|
+
* Update the company's data. Only the fields present in `body` change.
|
|
33544
|
+
*
|
|
33545
|
+
* @param body - Fields to change.
|
|
33546
|
+
* @returns The updated company.
|
|
33547
|
+
*/
|
|
32943
33548
|
update(body: components['schemas']['UpdateCompanyRequest']): Promise<{
|
|
32944
33549
|
id?: string;
|
|
32945
33550
|
access_level?: components["schemas"]["AccessLevel"];
|
|
@@ -32986,9 +33591,17 @@ declare class CompanyScope {
|
|
|
32986
33591
|
created_at?: string;
|
|
32987
33592
|
readiness?: components["schemas"]["IssuingReadinessData"] | null;
|
|
32988
33593
|
}>;
|
|
32989
|
-
/**
|
|
33594
|
+
/**
|
|
33595
|
+
* Remove the company from its account. Blocked for the primary NIF, a NIF active in Live,
|
|
33596
|
+
* or one holding Live invoices.
|
|
33597
|
+
*/
|
|
32990
33598
|
delete(): Promise<void>;
|
|
32991
|
-
/**
|
|
33599
|
+
/**
|
|
33600
|
+
* Fiscal summary of the company for a period: taxable base, VAT and IRPF aggregates.
|
|
33601
|
+
*
|
|
33602
|
+
* @param params - `start_date` and `end_date` (both or neither; default: the current month).
|
|
33603
|
+
* @returns The aggregates of the period.
|
|
33604
|
+
*/
|
|
32992
33605
|
fiscalSummary(params?: operations['getCompanyFiscalSummary']['parameters']['query']): Promise<{
|
|
32993
33606
|
queried_period: components["schemas"]["QueriedPeriod"];
|
|
32994
33607
|
total_taxable_base: number;
|
|
@@ -33008,7 +33621,11 @@ declare class CompanyScope {
|
|
|
33008
33621
|
invoices?: components["schemas"]["InvoiceFiscalData"][];
|
|
33009
33622
|
total_invoices: number;
|
|
33010
33623
|
}>;
|
|
33011
|
-
/**
|
|
33624
|
+
/**
|
|
33625
|
+
* Whether the company can issue invoices now, and what blocks it if not.
|
|
33626
|
+
*
|
|
33627
|
+
* @returns `ready` plus the list of `blockers`.
|
|
33628
|
+
*/
|
|
33012
33629
|
issuingReadiness(): Promise<{
|
|
33013
33630
|
ready?: boolean;
|
|
33014
33631
|
blockers?: ("COMPANY_HAS_NO_NIF" | "SERIES_DEFAULT_NOT_FOUND" | "PROFILE_INCOMPLETE" | "COMPANY_NOT_ACTIVATED" | "ENV_MISMATCH" | "NIF_NOT_REGISTERED" | "NIF_REPRESENTATION_REQUIRED")[];
|
|
@@ -33018,16 +33635,28 @@ declare class CompanyScope {
|
|
|
33018
33635
|
};
|
|
33019
33636
|
}>;
|
|
33020
33637
|
}
|
|
33021
|
-
/**
|
|
33638
|
+
/**
|
|
33639
|
+
* Invoice lifecycle of one company: create a draft (or issue it directly), issue, void,
|
|
33640
|
+
* correct, list and read, PDF and email. Reach it as `beel.company(companyId).invoices`.
|
|
33641
|
+
*
|
|
33642
|
+
* A create, issue, void or corrective carries an automatic `Idempotency-Key`, reused by the
|
|
33643
|
+
* client's automatic retries. To retry a create yourself safely, use {@link createOnce}.
|
|
33644
|
+
*/
|
|
33022
33645
|
declare class CompanyInvoicesResource {
|
|
33023
33646
|
private client;
|
|
33024
33647
|
private companyId;
|
|
33648
|
+
/** Scheduled issuing of one invoice: read, set or clear it. */
|
|
33025
33649
|
readonly schedule: CompanyInvoiceScheduleResource;
|
|
33026
33650
|
constructor(client: BeeLClient, companyId: string);
|
|
33027
33651
|
/**
|
|
33028
|
-
* Derive a new invoice from an existing one — the canonical form of `duplicate`.
|
|
33652
|
+
* Derive a new draft invoice from an existing one — the canonical form of `duplicate`.
|
|
33653
|
+
* The source invoice is not modified.
|
|
33654
|
+
*
|
|
33655
|
+
* @param body - `from_invoice_id`, and optionally the `series_id` of the copy.
|
|
33656
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
33657
|
+
* @returns The new draft invoice.
|
|
33029
33658
|
*/
|
|
33030
|
-
derive(body: components['schemas']['CreateInvoiceDerivationRequest']): Promise<{
|
|
33659
|
+
derive(body: components['schemas']['CreateInvoiceDerivationRequest'], options?: RequestOptions): Promise<{
|
|
33031
33660
|
invoice_number?: string | null;
|
|
33032
33661
|
series: components["schemas"]["SeriesInfo"];
|
|
33033
33662
|
number?: number | null;
|
|
@@ -33079,11 +33708,135 @@ declare class CompanyInvoicesResource {
|
|
|
33079
33708
|
updated_at: string;
|
|
33080
33709
|
}>;
|
|
33081
33710
|
private path;
|
|
33082
|
-
|
|
33711
|
+
/**
|
|
33712
|
+
* List the company's invoices, paginated, with filters: status, type, customer, dates,
|
|
33713
|
+
* `external_ref` (exact match), VeriFactu status and more.
|
|
33714
|
+
*
|
|
33715
|
+
* @param params - Filters and pagination (`page`, `limit`).
|
|
33716
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
33717
|
+
* @returns The page of `invoices` and its `pagination`.
|
|
33718
|
+
*
|
|
33719
|
+
* @example
|
|
33720
|
+
* ```typescript
|
|
33721
|
+
* const { invoices } = await company.invoices.list({ external_ref: 'ORD-2026-0042' });
|
|
33722
|
+
* ```
|
|
33723
|
+
*/
|
|
33724
|
+
list(params?: operations['listCompanyInvoices']['parameters']['query'], options?: RequestOptions): Promise<{
|
|
33083
33725
|
invoices: Invoice[];
|
|
33084
33726
|
pagination: Pagination;
|
|
33085
33727
|
}>;
|
|
33086
|
-
|
|
33728
|
+
/**
|
|
33729
|
+
* Create an invoice: a `DRAFT` by default, or numbered and issued in the same call with
|
|
33730
|
+
* `options.issue_directly: true`. `CORRECTIVE` is not accepted here: use
|
|
33731
|
+
* {@link createCorrective}.
|
|
33732
|
+
*
|
|
33733
|
+
* One call sends one `Idempotency-Key`, reused by the client's automatic retries, so
|
|
33734
|
+
* those never duplicate the invoice. A second call is a new operation: to repeat a create
|
|
33735
|
+
* whose outcome you do not know, use {@link createOnce}.
|
|
33736
|
+
*
|
|
33737
|
+
* @param body - Type, recipient and lines; `external_ref` to tie it to your order.
|
|
33738
|
+
* @param params - `wait_for_pdf`, when issuing directly.
|
|
33739
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
33740
|
+
* @returns The created invoice. With VeriFactu, `verifactu.submission_status` starts `PENDING`.
|
|
33741
|
+
*
|
|
33742
|
+
* @example
|
|
33743
|
+
* ```typescript
|
|
33744
|
+
* const invoice = await company.invoices.create({
|
|
33745
|
+
* type: 'STANDARD',
|
|
33746
|
+
* recipient: { customer_id: 'customer-uuid' },
|
|
33747
|
+
* lines: [{
|
|
33748
|
+
* description: 'Consulting', quantity: 1, unit_price: 100,
|
|
33749
|
+
* main_tax: { type: 'IVA', percentage: 21, regime_key: '01' },
|
|
33750
|
+
* }],
|
|
33751
|
+
* external_ref: 'ORD-2026-0042',
|
|
33752
|
+
* });
|
|
33753
|
+
* ```
|
|
33754
|
+
*/
|
|
33755
|
+
create(body: components['schemas']['CreateInvoiceRequest'], params?: operations['createCompanyInvoice']['parameters']['query'], options?: RequestOptions): Promise<{
|
|
33756
|
+
invoice_number?: string | null;
|
|
33757
|
+
series: components["schemas"]["SeriesInfo"];
|
|
33758
|
+
number?: number | null;
|
|
33759
|
+
type: components["schemas"]["InvoiceType"];
|
|
33760
|
+
status: components["schemas"]["InvoiceStatus"];
|
|
33761
|
+
issue_date: string;
|
|
33762
|
+
operation_date?: string | null;
|
|
33763
|
+
due_date?: string;
|
|
33764
|
+
valid_until?: string | null;
|
|
33765
|
+
payment_date?: string;
|
|
33766
|
+
sent_at?: string | null;
|
|
33767
|
+
paid_at?: string | null;
|
|
33768
|
+
auto_emit_after?: string | null;
|
|
33769
|
+
scheduled_for?: string | null;
|
|
33770
|
+
scheduled_action?: components["schemas"]["GenerationAction"];
|
|
33771
|
+
issuer: components["schemas"]["IssuerData"];
|
|
33772
|
+
recipient: components["schemas"]["RecipientData"];
|
|
33773
|
+
lines: components["schemas"]["InvoiceLine"][];
|
|
33774
|
+
totals: components["schemas"]["InvoiceTotals"];
|
|
33775
|
+
payment_info?: components["schemas"]["PaymentInfo"];
|
|
33776
|
+
notes?: string;
|
|
33777
|
+
replaced_invoice_ids?: string[];
|
|
33778
|
+
void_cause?: components["schemas"]["VoidCause"];
|
|
33779
|
+
void_reason?: string;
|
|
33780
|
+
voided_at?: string | null;
|
|
33781
|
+
rectified_invoice_id?: string;
|
|
33782
|
+
source_proforma_id?: string;
|
|
33783
|
+
converted_invoice_id?: string;
|
|
33784
|
+
rectification_reason?: string;
|
|
33785
|
+
recurring_invoice_id?: string | null;
|
|
33786
|
+
recurring_invoice_name?: string | null;
|
|
33787
|
+
rectification_type?: components["schemas"]["RectificationType"];
|
|
33788
|
+
rectification_code?: components["schemas"]["VeriFactuRectificationCode"];
|
|
33789
|
+
external_ref?: string | null;
|
|
33790
|
+
metadata?: {
|
|
33791
|
+
[key: string]: unknown;
|
|
33792
|
+
};
|
|
33793
|
+
send_automatically?: boolean | null;
|
|
33794
|
+
email_config?: components["schemas"]["EmailConfiguration"] | null;
|
|
33795
|
+
pdf_download_url?: string | null;
|
|
33796
|
+
verifactu?: components["schemas"]["VeriFactu"];
|
|
33797
|
+
attachments?: components["schemas"]["InvoiceAttachment"][];
|
|
33798
|
+
sending_history?: components["schemas"]["InvoiceSendRecord"][];
|
|
33799
|
+
email_delivery?: components["schemas"]["InvoiceEmailDeliveryOutcome"];
|
|
33800
|
+
deleted_at?: string | null;
|
|
33801
|
+
} & {
|
|
33802
|
+
id: string;
|
|
33803
|
+
created_at: string;
|
|
33804
|
+
updated_at: string;
|
|
33805
|
+
}>;
|
|
33806
|
+
/**
|
|
33807
|
+
* Create a standard or simplified invoice once per `external_ref`, safe to call again
|
|
33808
|
+
* after any failure. It looks the reference up first and returns the invoice that already
|
|
33809
|
+
* holds it; otherwise it creates one. If the create answers
|
|
33810
|
+
* `409 INVOICE_DUPLICATE_EXTERNAL_REFERENCE`, or its outcome is unknown (network error,
|
|
33811
|
+
* `5xx`), it looks the reference up again and returns the invoice it finds.
|
|
33812
|
+
*
|
|
33813
|
+
* The returned invoice may be one created earlier, in any status (`VOIDED` included):
|
|
33814
|
+
* compare its fields if that matters to you.
|
|
33815
|
+
*
|
|
33816
|
+
* @param body - A `CreateInvoiceRequest` with `type` `STANDARD` or `SIMPLIFIED` and a
|
|
33817
|
+
* non-empty `external_ref`.
|
|
33818
|
+
* @param params - `wait_for_pdf`, when issuing directly.
|
|
33819
|
+
* @param options - `idempotencyKey` for the create; `signal` and `timeoutMs` for the whole
|
|
33820
|
+
* sequence of calls.
|
|
33821
|
+
* @returns The one invoice that holds `body.external_ref`.
|
|
33822
|
+
* @throws {TypeError} Before any request, when `external_ref` is empty or `type` is not
|
|
33823
|
+
* `STANDARD`/`SIMPLIFIED`.
|
|
33824
|
+
* @throws {BeeLApiError} The create's error when no invoice holds the reference
|
|
33825
|
+
* afterwards — nothing was created, so calling again is safe.
|
|
33826
|
+
*
|
|
33827
|
+
* @example
|
|
33828
|
+
* ```typescript
|
|
33829
|
+
* const invoice = await company.invoices.createOnce({
|
|
33830
|
+
* type: 'STANDARD',
|
|
33831
|
+
* external_ref: order.id,
|
|
33832
|
+
* recipient: { customer_id: order.customerId },
|
|
33833
|
+
* lines: [{ description: 'Order', quantity: 1, unit_price: 100,
|
|
33834
|
+
* main_tax: { type: 'IVA', percentage: 21, regime_key: '01' } }],
|
|
33835
|
+
* options: { issue_directly: true },
|
|
33836
|
+
* });
|
|
33837
|
+
* ```
|
|
33838
|
+
*/
|
|
33839
|
+
createOnce(body: CreateInvoiceOnceRequest, params?: CreateInvoiceOnceParams, options?: RequestOptions): Promise<{
|
|
33087
33840
|
invoice_number?: string | null;
|
|
33088
33841
|
series: components["schemas"]["SeriesInfo"];
|
|
33089
33842
|
number?: number | null;
|
|
@@ -33134,7 +33887,15 @@ declare class CompanyInvoicesResource {
|
|
|
33134
33887
|
created_at: string;
|
|
33135
33888
|
updated_at: string;
|
|
33136
33889
|
}>;
|
|
33137
|
-
|
|
33890
|
+
/**
|
|
33891
|
+
* Get one invoice, including its `status` and its `verifactu` block
|
|
33892
|
+
* (`submission_status`, `qr_url`, `error_code`…).
|
|
33893
|
+
*
|
|
33894
|
+
* @param invoiceId - Invoice UUID.
|
|
33895
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
33896
|
+
* @returns The invoice.
|
|
33897
|
+
*/
|
|
33898
|
+
get(invoiceId: string, options?: RequestOptions): Promise<{
|
|
33138
33899
|
invoice_number?: string | null;
|
|
33139
33900
|
series: components["schemas"]["SeriesInfo"];
|
|
33140
33901
|
number?: number | null;
|
|
@@ -33185,8 +33946,16 @@ declare class CompanyInvoicesResource {
|
|
|
33185
33946
|
created_at: string;
|
|
33186
33947
|
updated_at: string;
|
|
33187
33948
|
}>;
|
|
33188
|
-
/**
|
|
33189
|
-
|
|
33949
|
+
/**
|
|
33950
|
+
* Update a `DRAFT` or `SCHEDULED` invoice (or an `ACTIVE` proforma). Only the fields
|
|
33951
|
+
* present in `body` change; an issued invoice is amended with a corrective instead.
|
|
33952
|
+
*
|
|
33953
|
+
* @param invoiceId - Invoice UUID.
|
|
33954
|
+
* @param body - Fields to change.
|
|
33955
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
33956
|
+
* @returns The updated invoice.
|
|
33957
|
+
*/
|
|
33958
|
+
update(invoiceId: string, body: operations['patchCompanyInvoice']['requestBody']['content']['application/json'], options?: RequestOptions): Promise<{
|
|
33190
33959
|
invoice_number?: string | null;
|
|
33191
33960
|
series: components["schemas"]["SeriesInfo"];
|
|
33192
33961
|
number?: number | null;
|
|
@@ -33237,10 +34006,23 @@ declare class CompanyInvoicesResource {
|
|
|
33237
34006
|
created_at: string;
|
|
33238
34007
|
updated_at: string;
|
|
33239
34008
|
}>;
|
|
33240
|
-
/**
|
|
33241
|
-
|
|
33242
|
-
|
|
33243
|
-
|
|
34009
|
+
/**
|
|
34010
|
+
* Delete a draft invoice. Deleting frees its `external_ref` for a new invoice.
|
|
34011
|
+
*
|
|
34012
|
+
* @param invoiceId - Invoice UUID.
|
|
34013
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34014
|
+
*/
|
|
34015
|
+
delete(invoiceId: string, options?: RequestOptions): Promise<void>;
|
|
34016
|
+
/**
|
|
34017
|
+
* Issue a draft: assigns its definitive number and makes it immutable. PDF generation and
|
|
34018
|
+
* the VeriFactu submission happen after the response.
|
|
34019
|
+
*
|
|
34020
|
+
* @param invoiceId - UUID of the draft.
|
|
34021
|
+
* @param params - `wait_for_pdf: true` to wait for the PDF before answering.
|
|
34022
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34023
|
+
* @returns The issued invoice.
|
|
34024
|
+
*/
|
|
34025
|
+
issue(invoiceId: string, params?: operations['issueCompanyInvoice']['parameters']['query'], options?: RequestOptions): Promise<{
|
|
33244
34026
|
invoice_number?: string | null;
|
|
33245
34027
|
series: components["schemas"]["SeriesInfo"];
|
|
33246
34028
|
number?: number | null;
|
|
@@ -33291,8 +34073,16 @@ declare class CompanyInvoicesResource {
|
|
|
33291
34073
|
created_at: string;
|
|
33292
34074
|
updated_at: string;
|
|
33293
34075
|
}>;
|
|
33294
|
-
/**
|
|
33295
|
-
|
|
34076
|
+
/**
|
|
34077
|
+
* Void an invoice issued by mistake. The document is kept and its number never reused. If
|
|
34078
|
+
* the operation did happen but the invoice is wrong, use {@link createCorrective}.
|
|
34079
|
+
*
|
|
34080
|
+
* @param invoiceId - Invoice UUID.
|
|
34081
|
+
* @param body - `reason`; `issued_in_error: true` is required once it was sent or paid.
|
|
34082
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34083
|
+
* @returns The voided invoice.
|
|
34084
|
+
*/
|
|
34085
|
+
void(invoiceId: string, body: NonNullable<operations['voidCompanyInvoice']['requestBody']>['content']['application/json'], options?: RequestOptions): Promise<{
|
|
33296
34086
|
invoice_number?: string | null;
|
|
33297
34087
|
series: components["schemas"]["SeriesInfo"];
|
|
33298
34088
|
number?: number | null;
|
|
@@ -33343,8 +34133,27 @@ declare class CompanyInvoicesResource {
|
|
|
33343
34133
|
created_at: string;
|
|
33344
34134
|
updated_at: string;
|
|
33345
34135
|
}>;
|
|
33346
|
-
/**
|
|
33347
|
-
|
|
34136
|
+
/**
|
|
34137
|
+
* Create a corrective invoice (rectificativa) for an issued invoice.
|
|
34138
|
+
*
|
|
34139
|
+
* @param invoiceId - UUID of the issued invoice to correct.
|
|
34140
|
+
* @param body - `rectification_type` (`TOTAL`/`PARTIAL`), `rectification_code` (`R1`–`R5`),
|
|
34141
|
+
* `reason` and, for `PARTIAL`, the correcting `lines`.
|
|
34142
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34143
|
+
* @returns The corrective invoice.
|
|
34144
|
+
*
|
|
34145
|
+
* @example
|
|
34146
|
+
* ```typescript
|
|
34147
|
+
* const corrective = await company.invoices.createCorrective('invoice-uuid', {
|
|
34148
|
+
* rectification_type: 'PARTIAL',
|
|
34149
|
+
* rectification_code: 'R1',
|
|
34150
|
+
* reason: 'Discount agreed with the customer after the sale',
|
|
34151
|
+
* lines: [{ description: 'Discount', quantity: -1, unit_price: 10,
|
|
34152
|
+
* main_tax: { type: 'IVA', percentage: 21, regime_key: '01' } }],
|
|
34153
|
+
* });
|
|
34154
|
+
* ```
|
|
34155
|
+
*/
|
|
34156
|
+
createCorrective(invoiceId: string, body: operations['createCompanyCorrectiveInvoice']['requestBody']['content']['application/json'], options?: RequestOptions): Promise<{
|
|
33348
34157
|
invoice_number?: string | null;
|
|
33349
34158
|
series: components["schemas"]["SeriesInfo"];
|
|
33350
34159
|
number?: number | null;
|
|
@@ -33395,8 +34204,15 @@ declare class CompanyInvoicesResource {
|
|
|
33395
34204
|
created_at: string;
|
|
33396
34205
|
updated_at: string;
|
|
33397
34206
|
}>;
|
|
33398
|
-
/**
|
|
33399
|
-
|
|
34207
|
+
/**
|
|
34208
|
+
* Convert a proforma into an invoice.
|
|
34209
|
+
*
|
|
34210
|
+
* @param invoiceId - UUID of the proforma.
|
|
34211
|
+
* @param body - Optional overrides for the new invoice.
|
|
34212
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34213
|
+
* @returns The new invoice.
|
|
34214
|
+
*/
|
|
34215
|
+
convertToInvoice(invoiceId: string, body?: NonNullable<operations['convertCompanyProformaToInvoice']['requestBody']>['content']['application/json'], options?: RequestOptions): Promise<{
|
|
33400
34216
|
invoice_number?: string | null;
|
|
33401
34217
|
series: components["schemas"]["SeriesInfo"];
|
|
33402
34218
|
number?: number | null;
|
|
@@ -33453,6 +34269,10 @@ declare class CompanyInvoicesResource {
|
|
|
33453
34269
|
* invoices become `VOIDED` with `void_cause: 'EXCHANGED'`, and the new `STANDARD` invoice
|
|
33454
34270
|
* lists them in `replaced_invoice_ids`.
|
|
33455
34271
|
*
|
|
34272
|
+
* @param body - `simplified_invoice_ids` and the identified `recipient`.
|
|
34273
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34274
|
+
* @returns The new standard invoice.
|
|
34275
|
+
*
|
|
33456
34276
|
* @example
|
|
33457
34277
|
* ```typescript
|
|
33458
34278
|
* const invoice = await company.invoices.createSimplifiedExchange({
|
|
@@ -33461,7 +34281,7 @@ declare class CompanyInvoicesResource {
|
|
|
33461
34281
|
* });
|
|
33462
34282
|
* ```
|
|
33463
34283
|
*/
|
|
33464
|
-
createSimplifiedExchange(body: components['schemas']['CreateSimplifiedExchangeRequest']): Promise<{
|
|
34284
|
+
createSimplifiedExchange(body: components['schemas']['CreateSimplifiedExchangeRequest'], options?: RequestOptions): Promise<{
|
|
33465
34285
|
invoice_number?: string | null;
|
|
33466
34286
|
series: components["schemas"]["SeriesInfo"];
|
|
33467
34287
|
number?: number | null;
|
|
@@ -33515,8 +34335,12 @@ declare class CompanyInvoicesResource {
|
|
|
33515
34335
|
/**
|
|
33516
34336
|
* The VeriFactu records of an invoice, oldest first: its registration and, if it was
|
|
33517
34337
|
* voided, its cancellation. An invoice never submitted answers with an empty list.
|
|
34338
|
+
*
|
|
34339
|
+
* @param invoiceId - Invoice UUID.
|
|
34340
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34341
|
+
* @returns The records (`data.records` of the response), each with its own `submission_status`.
|
|
33518
34342
|
*/
|
|
33519
|
-
verifactuRecords(invoiceId: string): Promise<{
|
|
34343
|
+
verifactuRecords(invoiceId: string, options?: RequestOptions): Promise<{
|
|
33520
34344
|
id: string;
|
|
33521
34345
|
operation: components["schemas"]["VeriFactuRecordOperation"];
|
|
33522
34346
|
submission_status?: components["schemas"]["VeriFactuSubmissionStatus"];
|
|
@@ -33527,8 +34351,16 @@ declare class CompanyInvoicesResource {
|
|
|
33527
34351
|
error_code?: string | null;
|
|
33528
34352
|
error_message?: string | null;
|
|
33529
34353
|
}[]>;
|
|
33530
|
-
/**
|
|
33531
|
-
|
|
34354
|
+
/**
|
|
34355
|
+
* Set the commercial status: `PAID` (from `ISSUED`, `SENT`, `OVERDUE`), `SENT` (from
|
|
34356
|
+
* `ISSUED`) or back to `ISSUED` (from `SENT`). Issuing and voiding have their own methods.
|
|
34357
|
+
*
|
|
34358
|
+
* @param invoiceId - Invoice UUID.
|
|
34359
|
+
* @param body - Target `status` and, for `PAID`, the payment details.
|
|
34360
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34361
|
+
* @returns The updated invoice.
|
|
34362
|
+
*/
|
|
34363
|
+
setStatus(invoiceId: string, body: operations['setCompanyInvoiceStatus']['requestBody']['content']['application/json'], options?: RequestOptions): Promise<{
|
|
33532
34364
|
invoice_number?: string | null;
|
|
33533
34365
|
series: components["schemas"]["SeriesInfo"];
|
|
33534
34366
|
number?: number | null;
|
|
@@ -33579,14 +34411,27 @@ declare class CompanyInvoicesResource {
|
|
|
33579
34411
|
created_at: string;
|
|
33580
34412
|
updated_at: string;
|
|
33581
34413
|
}>;
|
|
33582
|
-
/**
|
|
33583
|
-
|
|
34414
|
+
/**
|
|
34415
|
+
* Get a short-lived download URL for the invoice PDF.
|
|
34416
|
+
*
|
|
34417
|
+
* @param invoiceId - Invoice UUID.
|
|
34418
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34419
|
+
* @returns `download_url`, `expires_in_seconds` and `file_name`.
|
|
34420
|
+
*/
|
|
34421
|
+
getPdf(invoiceId: string, options?: RequestOptions): Promise<{
|
|
33584
34422
|
download_url: string;
|
|
33585
34423
|
expires_in_seconds: number;
|
|
33586
34424
|
file_name: string;
|
|
33587
34425
|
}>;
|
|
33588
|
-
/**
|
|
33589
|
-
|
|
34426
|
+
/**
|
|
34427
|
+
* Send the invoice by email with its PDF. Without recipients, the customer's addresses are used.
|
|
34428
|
+
*
|
|
34429
|
+
* @param invoiceId - Invoice UUID.
|
|
34430
|
+
* @param body - Optional recipients, subject and message.
|
|
34431
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34432
|
+
* @returns The delivery record.
|
|
34433
|
+
*/
|
|
34434
|
+
send(invoiceId: string, body: NonNullable<operations['sendCompanyInvoice']['requestBody']>['content']['application/json'], options?: RequestOptions): Promise<{
|
|
33590
34435
|
email_id?: components["schemas"]["UUID"] | undefined;
|
|
33591
34436
|
sent_to?: string[] | undefined;
|
|
33592
34437
|
sent_at?: string | undefined;
|
|
@@ -33596,12 +34441,20 @@ declare class CompanyInvoicesResource {
|
|
|
33596
34441
|
sent_at?: string | undefined;
|
|
33597
34442
|
} | undefined>;
|
|
33598
34443
|
}
|
|
33599
|
-
/**
|
|
33600
|
-
|
|
34444
|
+
/**
|
|
34445
|
+
* Scheduled issuing of one invoice: read it, set it, clear it. Reach it as
|
|
34446
|
+
* `beel.company(companyId).invoices.schedule`.
|
|
34447
|
+
*/
|
|
33601
34448
|
declare class CompanyInvoiceScheduleResource {
|
|
33602
34449
|
private client;
|
|
33603
34450
|
private companyId;
|
|
33604
34451
|
constructor(client: BeeLClient, companyId: string);
|
|
34452
|
+
/**
|
|
34453
|
+
* Get the schedule of an invoice.
|
|
34454
|
+
*
|
|
34455
|
+
* @param invoiceId - Invoice UUID.
|
|
34456
|
+
* @returns `scheduled_for` and `generation_mode`.
|
|
34457
|
+
*/
|
|
33605
34458
|
get(invoiceId: string): Promise<{
|
|
33606
34459
|
scheduled_for: string;
|
|
33607
34460
|
generation_mode: components["schemas"]["GenerationAction"];
|
|
@@ -33609,6 +34462,10 @@ declare class CompanyInvoiceScheduleResource {
|
|
|
33609
34462
|
/**
|
|
33610
34463
|
* Set or move the schedule. One `PUT` replaces the three legacy calls
|
|
33611
34464
|
* (`schedule`, `reschedule`, `unschedule`): setting it again moves it.
|
|
34465
|
+
*
|
|
34466
|
+
* @param invoiceId - UUID of a draft invoice.
|
|
34467
|
+
* @param body - `scheduled_for` date and what to do then.
|
|
34468
|
+
* @returns The scheduled invoice.
|
|
33612
34469
|
*/
|
|
33613
34470
|
set(invoiceId: string, body: components['schemas']['SetInvoiceScheduleRequest']): Promise<{
|
|
33614
34471
|
invoice_number?: string | null | undefined;
|
|
@@ -33792,17 +34649,35 @@ declare class CompanyInvoiceScheduleResource {
|
|
|
33792
34649
|
created_at: string;
|
|
33793
34650
|
updated_at: string;
|
|
33794
34651
|
} | undefined>;
|
|
33795
|
-
/**
|
|
34652
|
+
/**
|
|
34653
|
+
* Clear the schedule, returning the invoice to a plain draft — the canonical form of
|
|
34654
|
+
* `unschedule`. Idempotent.
|
|
34655
|
+
*
|
|
34656
|
+
* @param invoiceId - Invoice UUID.
|
|
34657
|
+
*/
|
|
33796
34658
|
clear(invoiceId: string): Promise<void>;
|
|
33797
34659
|
}
|
|
34660
|
+
/** Customers of one company. Reach it as `beel.company(companyId).customers`. */
|
|
33798
34661
|
declare class CompanyCustomersResource {
|
|
33799
34662
|
private client;
|
|
33800
34663
|
private companyId;
|
|
33801
34664
|
constructor(client: BeeLClient, companyId: string);
|
|
34665
|
+
/**
|
|
34666
|
+
* List the company's customers, paginated and searchable.
|
|
34667
|
+
*
|
|
34668
|
+
* @param params - Filters and pagination.
|
|
34669
|
+
* @returns The page of `customers` and its `pagination`.
|
|
34670
|
+
*/
|
|
33802
34671
|
list(params?: operations['listCompanyCustomers']['parameters']['query']): Promise<{
|
|
33803
34672
|
customers: Customer[];
|
|
33804
34673
|
pagination: Pagination;
|
|
33805
34674
|
}>;
|
|
34675
|
+
/**
|
|
34676
|
+
* Create a customer.
|
|
34677
|
+
*
|
|
34678
|
+
* @param body - Legal name, NIF (or alternative id) and address.
|
|
34679
|
+
* @returns The created customer.
|
|
34680
|
+
*/
|
|
33806
34681
|
create(body: components['schemas']['CreateCustomerRequest']): Promise<{
|
|
33807
34682
|
id: string;
|
|
33808
34683
|
legal_name: string;
|
|
@@ -33822,6 +34697,12 @@ declare class CompanyCustomersResource {
|
|
|
33822
34697
|
updated_at?: string;
|
|
33823
34698
|
alternative_id?: components["schemas"]["AlternativeIdentifier"];
|
|
33824
34699
|
}>;
|
|
34700
|
+
/**
|
|
34701
|
+
* Create several customers in one call.
|
|
34702
|
+
*
|
|
34703
|
+
* @param body - The customers, and whether it is a dry run.
|
|
34704
|
+
* @returns Per-customer results and totals.
|
|
34705
|
+
*/
|
|
33825
34706
|
createBulk(body: operations['createCompanyCustomersBulk']['requestBody']['content']['application/json']): Promise<{
|
|
33826
34707
|
metadata: {
|
|
33827
34708
|
total_customers: number;
|
|
@@ -33850,7 +34731,7 @@ declare class CompanyCustomersResource {
|
|
|
33850
34731
|
door?: string | undefined;
|
|
33851
34732
|
postal_code: string;
|
|
33852
34733
|
city: string;
|
|
33853
|
-
province
|
|
34734
|
+
province?: string | undefined;
|
|
33854
34735
|
country?: string | undefined;
|
|
33855
34736
|
country_code?: string | undefined;
|
|
33856
34737
|
} | undefined;
|
|
@@ -33896,6 +34777,12 @@ declare class CompanyCustomersResource {
|
|
|
33896
34777
|
not_importable?: number | undefined;
|
|
33897
34778
|
};
|
|
33898
34779
|
} | undefined>;
|
|
34780
|
+
/**
|
|
34781
|
+
* Get one customer.
|
|
34782
|
+
*
|
|
34783
|
+
* @param customerId - Customer UUID.
|
|
34784
|
+
* @returns The customer.
|
|
34785
|
+
*/
|
|
33899
34786
|
get(customerId: string): Promise<{
|
|
33900
34787
|
id: string;
|
|
33901
34788
|
legal_name: string;
|
|
@@ -33915,6 +34802,13 @@ declare class CompanyCustomersResource {
|
|
|
33915
34802
|
updated_at?: string;
|
|
33916
34803
|
alternative_id?: components["schemas"]["AlternativeIdentifier"];
|
|
33917
34804
|
}>;
|
|
34805
|
+
/**
|
|
34806
|
+
* Update a customer. Only the fields present in `body` change.
|
|
34807
|
+
*
|
|
34808
|
+
* @param customerId - Customer UUID.
|
|
34809
|
+
* @param body - Fields to change.
|
|
34810
|
+
* @returns The updated customer.
|
|
34811
|
+
*/
|
|
33918
34812
|
update(customerId: string, body: operations['patchCompanyCustomer']['requestBody']['content']['application/json']): Promise<{
|
|
33919
34813
|
id: string;
|
|
33920
34814
|
legal_name: string;
|
|
@@ -33934,17 +34828,35 @@ declare class CompanyCustomersResource {
|
|
|
33934
34828
|
updated_at?: string;
|
|
33935
34829
|
alternative_id?: components["schemas"]["AlternativeIdentifier"];
|
|
33936
34830
|
}>;
|
|
34831
|
+
/**
|
|
34832
|
+
* Delete a customer that has no invoices. Its NIF (or alternative id) is released for a
|
|
34833
|
+
* new customer.
|
|
34834
|
+
*
|
|
34835
|
+
* @param customerId - Customer UUID.
|
|
34836
|
+
*/
|
|
33937
34837
|
delete(customerId: string): Promise<void>;
|
|
33938
34838
|
}
|
|
33939
|
-
/** Products
|
|
34839
|
+
/** Products and services of one company. Reach it as `beel.company(companyId).products`. */
|
|
33940
34840
|
declare class CompanyProductsResource {
|
|
33941
34841
|
private client;
|
|
33942
34842
|
private companyId;
|
|
33943
34843
|
constructor(client: BeeLClient, companyId: string);
|
|
34844
|
+
/**
|
|
34845
|
+
* List the company's products, paginated and searchable.
|
|
34846
|
+
*
|
|
34847
|
+
* @param params - Filters and pagination.
|
|
34848
|
+
* @returns The page of `products` and its `pagination`.
|
|
34849
|
+
*/
|
|
33944
34850
|
list(params?: operations['listCompanyProducts']['parameters']['query']): Promise<{
|
|
33945
34851
|
products: Product[];
|
|
33946
34852
|
pagination: Pagination;
|
|
33947
34853
|
}>;
|
|
34854
|
+
/**
|
|
34855
|
+
* Create a product or service.
|
|
34856
|
+
*
|
|
34857
|
+
* @param body - Name, category, price and main tax.
|
|
34858
|
+
* @returns The created product.
|
|
34859
|
+
*/
|
|
33948
34860
|
create(body: components['schemas']['CreateProductRequest']): Promise<{
|
|
33949
34861
|
id: string;
|
|
33950
34862
|
code?: string | null;
|
|
@@ -33960,6 +34872,12 @@ declare class CompanyProductsResource {
|
|
|
33960
34872
|
created_at: string;
|
|
33961
34873
|
updated_at: string;
|
|
33962
34874
|
}>;
|
|
34875
|
+
/**
|
|
34876
|
+
* Get one product.
|
|
34877
|
+
*
|
|
34878
|
+
* @param productId - Product UUID.
|
|
34879
|
+
* @returns The product.
|
|
34880
|
+
*/
|
|
33963
34881
|
get(productId: string): Promise<{
|
|
33964
34882
|
id: string;
|
|
33965
34883
|
code?: string | null;
|
|
@@ -33975,6 +34893,13 @@ declare class CompanyProductsResource {
|
|
|
33975
34893
|
created_at: string;
|
|
33976
34894
|
updated_at: string;
|
|
33977
34895
|
}>;
|
|
34896
|
+
/**
|
|
34897
|
+
* Update a product. Only the fields present in `body` change.
|
|
34898
|
+
*
|
|
34899
|
+
* @param productId - Product UUID.
|
|
34900
|
+
* @param body - Fields to change.
|
|
34901
|
+
* @returns The updated product.
|
|
34902
|
+
*/
|
|
33978
34903
|
update(productId: string, body: operations['patchCompanyProduct']['requestBody']['content']['application/json']): Promise<{
|
|
33979
34904
|
id: string;
|
|
33980
34905
|
code?: string | null;
|
|
@@ -33990,13 +34915,27 @@ declare class CompanyProductsResource {
|
|
|
33990
34915
|
created_at: string;
|
|
33991
34916
|
updated_at: string;
|
|
33992
34917
|
}>;
|
|
34918
|
+
/**
|
|
34919
|
+
* Delete a product from the catalog. Existing invoice lines are unaffected.
|
|
34920
|
+
*
|
|
34921
|
+
* @param productId - Product UUID.
|
|
34922
|
+
*/
|
|
33993
34923
|
delete(productId: string): Promise<void>;
|
|
33994
34924
|
}
|
|
33995
|
-
/**
|
|
34925
|
+
/**
|
|
34926
|
+
* Invoice series (numbering) of one company. Each series numbers one `document_type`.
|
|
34927
|
+
* Reach it as `beel.company(companyId).series`.
|
|
34928
|
+
*/
|
|
33996
34929
|
declare class CompanySeriesResource {
|
|
33997
34930
|
private client;
|
|
33998
34931
|
private companyId;
|
|
33999
34932
|
constructor(client: BeeLClient, companyId: string);
|
|
34933
|
+
/**
|
|
34934
|
+
* List the company's series.
|
|
34935
|
+
*
|
|
34936
|
+
* @param params - Filters; `page`/`limit` to paginate.
|
|
34937
|
+
* @returns The `series`, and `pagination` when you paginated.
|
|
34938
|
+
*/
|
|
34000
34939
|
list(params?: operations['listCompanySeries']['parameters']['query']): Promise<{
|
|
34001
34940
|
series: {
|
|
34002
34941
|
id: string;
|
|
@@ -34023,6 +34962,12 @@ declare class CompanySeriesResource {
|
|
|
34023
34962
|
has_previous?: boolean | undefined;
|
|
34024
34963
|
} | undefined;
|
|
34025
34964
|
} | undefined>;
|
|
34965
|
+
/**
|
|
34966
|
+
* Create a series.
|
|
34967
|
+
*
|
|
34968
|
+
* @param body - Code, name, format and the `document_type` it numbers.
|
|
34969
|
+
* @returns The created series.
|
|
34970
|
+
*/
|
|
34026
34971
|
create(body: operations['createCompanySeries']['requestBody']['content']['application/json']): Promise<{
|
|
34027
34972
|
id: string;
|
|
34028
34973
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -34039,6 +34984,13 @@ declare class CompanySeriesResource {
|
|
|
34039
34984
|
readonly next_number?: number | undefined;
|
|
34040
34985
|
updated_at?: string | undefined;
|
|
34041
34986
|
} | undefined>;
|
|
34987
|
+
/**
|
|
34988
|
+
* Update a series. Only the fields present in `body` change.
|
|
34989
|
+
*
|
|
34990
|
+
* @param seriesId - Series UUID.
|
|
34991
|
+
* @param body - Fields to change.
|
|
34992
|
+
* @returns The updated series.
|
|
34993
|
+
*/
|
|
34042
34994
|
update(seriesId: string, body: operations['patchCompanySeries']['requestBody']['content']['application/json']): Promise<{
|
|
34043
34995
|
id: string;
|
|
34044
34996
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -34055,8 +35007,17 @@ declare class CompanySeriesResource {
|
|
|
34055
35007
|
readonly next_number?: number | undefined;
|
|
34056
35008
|
updated_at?: string | undefined;
|
|
34057
35009
|
} | undefined>;
|
|
35010
|
+
/**
|
|
35011
|
+
* Delete (soft-delete) a series. Its code stays taken, since issued invoices carry it.
|
|
35012
|
+
*
|
|
35013
|
+
* @param seriesId - Series UUID.
|
|
35014
|
+
*/
|
|
34058
35015
|
delete(seriesId: string): Promise<void>;
|
|
34059
|
-
/**
|
|
35016
|
+
/**
|
|
35017
|
+
* The current default series per document type.
|
|
35018
|
+
*
|
|
35019
|
+
* @returns One entry per document type, saying whether a default exists.
|
|
35020
|
+
*/
|
|
34060
35021
|
getDefaults(): Promise<{
|
|
34061
35022
|
defaults: {
|
|
34062
35023
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -34066,7 +35027,12 @@ declare class CompanySeriesResource {
|
|
|
34066
35027
|
provisional?: boolean | undefined;
|
|
34067
35028
|
}[];
|
|
34068
35029
|
} | undefined>;
|
|
34069
|
-
/**
|
|
35030
|
+
/**
|
|
35031
|
+
* Ensure a default series exists per document type, creating the missing ones.
|
|
35032
|
+
* Idempotent.
|
|
35033
|
+
*
|
|
35034
|
+
* @returns The default series.
|
|
35035
|
+
*/
|
|
34070
35036
|
ensureDefaults(): Promise<{
|
|
34071
35037
|
series: {
|
|
34072
35038
|
id: string;
|
|
@@ -34085,7 +35051,12 @@ declare class CompanySeriesResource {
|
|
|
34085
35051
|
updated_at?: string | undefined;
|
|
34086
35052
|
}[];
|
|
34087
35053
|
} | undefined>;
|
|
34088
|
-
/**
|
|
35054
|
+
/**
|
|
35055
|
+
* Mark a series as the default for its document type.
|
|
35056
|
+
*
|
|
35057
|
+
* @param seriesId - Series UUID.
|
|
35058
|
+
* @returns The series.
|
|
35059
|
+
*/
|
|
34089
35060
|
setDefault(seriesId: string): Promise<{
|
|
34090
35061
|
id: string;
|
|
34091
35062
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -34103,12 +35074,21 @@ declare class CompanySeriesResource {
|
|
|
34103
35074
|
updated_at?: string | undefined;
|
|
34104
35075
|
} | undefined>;
|
|
34105
35076
|
}
|
|
34106
|
-
/**
|
|
35077
|
+
/**
|
|
35078
|
+
* Recurring invoice templates of one company. Reach it as
|
|
35079
|
+
* `beel.company(companyId).recurringInvoices`.
|
|
35080
|
+
*/
|
|
34107
35081
|
declare class CompanyRecurringInvoicesResource {
|
|
34108
35082
|
private client;
|
|
34109
35083
|
private companyId;
|
|
34110
35084
|
constructor(client: BeeLClient, companyId: string);
|
|
34111
35085
|
private path;
|
|
35086
|
+
/**
|
|
35087
|
+
* List the recurring invoices.
|
|
35088
|
+
*
|
|
35089
|
+
* @param params - Filters and pagination.
|
|
35090
|
+
* @returns The page of `recurring_invoices` and its `pagination`.
|
|
35091
|
+
*/
|
|
34112
35092
|
list(params?: operations['listCompanyRecurringInvoices']['parameters']['query']): Promise<{
|
|
34113
35093
|
recurring_invoices: {
|
|
34114
35094
|
id?: string | undefined;
|
|
@@ -34190,6 +35170,12 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34190
35170
|
has_previous?: boolean | undefined;
|
|
34191
35171
|
} | undefined;
|
|
34192
35172
|
} | undefined>;
|
|
35173
|
+
/**
|
|
35174
|
+
* Create a recurring invoice template.
|
|
35175
|
+
*
|
|
35176
|
+
* @param body - Frequency, schedule, recipient and lines.
|
|
35177
|
+
* @returns The recurring invoice.
|
|
35178
|
+
*/
|
|
34193
35179
|
create(body: operations['createCompanyRecurringInvoice']['requestBody']['content']['application/json']): Promise<{
|
|
34194
35180
|
id?: string | undefined;
|
|
34195
35181
|
name?: string | undefined;
|
|
@@ -34261,6 +35247,12 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34261
35247
|
created_at?: string | undefined;
|
|
34262
35248
|
updated_at?: string | undefined;
|
|
34263
35249
|
} | undefined>;
|
|
35250
|
+
/**
|
|
35251
|
+
* Get one recurring invoice.
|
|
35252
|
+
*
|
|
35253
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35254
|
+
* @returns The recurring invoice.
|
|
35255
|
+
*/
|
|
34264
35256
|
get(recurringInvoiceId: string): Promise<{
|
|
34265
35257
|
id?: string | undefined;
|
|
34266
35258
|
name?: string | undefined;
|
|
@@ -34332,6 +35324,13 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34332
35324
|
created_at?: string | undefined;
|
|
34333
35325
|
updated_at?: string | undefined;
|
|
34334
35326
|
} | undefined>;
|
|
35327
|
+
/**
|
|
35328
|
+
* Update a recurring invoice. Only the fields present in `body` change.
|
|
35329
|
+
*
|
|
35330
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35331
|
+
* @param body - Fields to change.
|
|
35332
|
+
* @returns The updated recurring invoice.
|
|
35333
|
+
*/
|
|
34335
35334
|
update(recurringInvoiceId: string, body: operations['patchCompanyRecurringInvoice']['requestBody']['content']['application/json']): Promise<{
|
|
34336
35335
|
id?: string | undefined;
|
|
34337
35336
|
name?: string | undefined;
|
|
@@ -34403,8 +35402,20 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34403
35402
|
created_at?: string | undefined;
|
|
34404
35403
|
updated_at?: string | undefined;
|
|
34405
35404
|
} | undefined>;
|
|
35405
|
+
/**
|
|
35406
|
+
* Delete a recurring invoice and cancel its pending generations. Invoices it already
|
|
35407
|
+
* generated are kept.
|
|
35408
|
+
*
|
|
35409
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35410
|
+
*/
|
|
34406
35411
|
delete(recurringInvoiceId: string): Promise<void>;
|
|
34407
|
-
/**
|
|
35412
|
+
/**
|
|
35413
|
+
* Pause, resume or end the template.
|
|
35414
|
+
*
|
|
35415
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35416
|
+
* @param body - Target `status` (e.g. `PAUSED`, `ACTIVE`).
|
|
35417
|
+
* @returns The updated recurring invoice.
|
|
35418
|
+
*/
|
|
34408
35419
|
setStatus(recurringInvoiceId: string, body: operations['setCompanyRecurringInvoiceStatus']['requestBody']['content']['application/json']): Promise<{
|
|
34409
35420
|
id?: string | undefined;
|
|
34410
35421
|
name?: string | undefined;
|
|
@@ -34476,7 +35487,12 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34476
35487
|
created_at?: string | undefined;
|
|
34477
35488
|
updated_at?: string | undefined;
|
|
34478
35489
|
} | undefined>;
|
|
34479
|
-
/**
|
|
35490
|
+
/**
|
|
35491
|
+
* Skip the next scheduled occurrence.
|
|
35492
|
+
*
|
|
35493
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35494
|
+
* @returns The recurring invoice with its next date moved.
|
|
35495
|
+
*/
|
|
34480
35496
|
skip(recurringInvoiceId: string): Promise<{
|
|
34481
35497
|
id?: string | undefined;
|
|
34482
35498
|
name?: string | undefined;
|
|
@@ -34548,11 +35564,22 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34548
35564
|
created_at?: string | undefined;
|
|
34549
35565
|
updated_at?: string | undefined;
|
|
34550
35566
|
} | undefined>;
|
|
34551
|
-
/**
|
|
35567
|
+
/**
|
|
35568
|
+
* Generate the next invoice now instead of waiting for the schedule.
|
|
35569
|
+
*
|
|
35570
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35571
|
+
* @returns The generated `invoice_id` and the `next_generation` date.
|
|
35572
|
+
*/
|
|
34552
35573
|
generateNow(recurringInvoiceId: string): Promise<{
|
|
34553
35574
|
invoice_id?: string | undefined;
|
|
34554
35575
|
next_generation?: string | null | undefined;
|
|
34555
35576
|
} | undefined>;
|
|
35577
|
+
/**
|
|
35578
|
+
* Preview the next invoice the template will generate.
|
|
35579
|
+
*
|
|
35580
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35581
|
+
* @returns The invoice as it would be generated.
|
|
35582
|
+
*/
|
|
34556
35583
|
nextOccurrence(recurringInvoiceId: string): Promise<{
|
|
34557
35584
|
invoice_number?: string | null | undefined;
|
|
34558
35585
|
series: {
|
|
@@ -34732,6 +35759,13 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34732
35759
|
} | undefined;
|
|
34733
35760
|
deleted_at?: string | null | undefined;
|
|
34734
35761
|
} | undefined>;
|
|
35762
|
+
/**
|
|
35763
|
+
* The generation history of the template: generated, skipped and failed occurrences.
|
|
35764
|
+
*
|
|
35765
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35766
|
+
* @param params - Pagination.
|
|
35767
|
+
* @returns The `history` entries.
|
|
35768
|
+
*/
|
|
34735
35769
|
history(recurringInvoiceId: string, params?: operations['getCompanyRecurringInvoiceHistory']['parameters']['query']): Promise<{
|
|
34736
35770
|
history: {
|
|
34737
35771
|
id?: string | undefined;
|
|
@@ -34758,13 +35792,19 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34758
35792
|
} | undefined>;
|
|
34759
35793
|
}
|
|
34760
35794
|
/**
|
|
34761
|
-
* Tax defaults of one company
|
|
34762
|
-
* `beel.configuration.
|
|
35795
|
+
* Tax defaults of one company (main tax, IRPF, equivalence surcharge). The canonical
|
|
35796
|
+
* replacement for the account-wide `beel.configuration.getTaxConfig()`, whose flat route is
|
|
35797
|
+
* deprecated. Reach it as `beel.company(companyId).taxConfiguration`.
|
|
34763
35798
|
*/
|
|
34764
35799
|
declare class CompanyTaxConfigurationResource {
|
|
34765
35800
|
private client;
|
|
34766
35801
|
private companyId;
|
|
34767
35802
|
constructor(client: BeeLClient, companyId: string);
|
|
35803
|
+
/**
|
|
35804
|
+
* Get the tax configuration.
|
|
35805
|
+
*
|
|
35806
|
+
* @returns The company's tax defaults.
|
|
35807
|
+
*/
|
|
34768
35808
|
get(): Promise<{
|
|
34769
35809
|
default_main_tax: {
|
|
34770
35810
|
type: components["schemas"]["TaxType"];
|
|
@@ -34786,7 +35826,12 @@ declare class CompanyTaxConfigurationResource {
|
|
|
34786
35826
|
suggested_irpf_rate: number | null;
|
|
34787
35827
|
} | undefined;
|
|
34788
35828
|
} | undefined>;
|
|
34789
|
-
/**
|
|
35829
|
+
/**
|
|
35830
|
+
* Replace the tax configuration — this is a `PUT`, not a merge: send the whole state.
|
|
35831
|
+
*
|
|
35832
|
+
* @param body - The complete tax configuration.
|
|
35833
|
+
* @returns The stored configuration.
|
|
35834
|
+
*/
|
|
34790
35835
|
update(body: components['schemas']['UpdateTaxConfigurationRequest']): Promise<{
|
|
34791
35836
|
default_main_tax: {
|
|
34792
35837
|
type: components["schemas"]["TaxType"];
|
|
@@ -34811,16 +35856,23 @@ declare class CompanyTaxConfigurationResource {
|
|
|
34811
35856
|
}
|
|
34812
35857
|
/**
|
|
34813
35858
|
* VeriFactu configuration of one company. The canonical replacement for
|
|
34814
|
-
* `beel.configuration.getVerifactu()`, whose flat route is deprecated.
|
|
35859
|
+
* `beel.configuration.getVerifactu()`, whose flat route is deprecated. Reach it as
|
|
35860
|
+
* `beel.company(companyId).verifactuConfiguration`.
|
|
34815
35861
|
*
|
|
34816
35862
|
* Whether an invoice reaches AEAT is a fact of this NIF resolved at issue time, not a
|
|
34817
35863
|
* per-invoice choice: `enabled` is the only writable field. Everything else — `status`,
|
|
34818
|
-
* `nif_status`, `signed`, `activated`, `pdf_generated` — is resolved server-side.
|
|
35864
|
+
* `nif_status`, `signed`, `activated`, `pdf_generated` — is resolved server-side. The
|
|
35865
|
+
* outcome of each invoice is on the invoice itself: `invoice.verifactu.submission_status`.
|
|
34819
35866
|
*/
|
|
34820
35867
|
declare class CompanyVeriFactuConfigurationResource {
|
|
34821
35868
|
private client;
|
|
34822
35869
|
private companyId;
|
|
34823
35870
|
constructor(client: BeeLClient, companyId: string);
|
|
35871
|
+
/**
|
|
35872
|
+
* Get the VeriFactu configuration of this NIF.
|
|
35873
|
+
*
|
|
35874
|
+
* @returns `enabled` and the server-resolved state of the NIF.
|
|
35875
|
+
*/
|
|
34824
35876
|
get(): Promise<{
|
|
34825
35877
|
enabled: boolean;
|
|
34826
35878
|
nif_status?: "ACTIVATED" | "DEACTIVATED" | null | undefined;
|
|
@@ -34830,7 +35882,12 @@ declare class CompanyVeriFactuConfigurationResource {
|
|
|
34830
35882
|
activated?: boolean | null | undefined;
|
|
34831
35883
|
pdf_generated?: boolean | null | undefined;
|
|
34832
35884
|
} | undefined>;
|
|
34833
|
-
/**
|
|
35885
|
+
/**
|
|
35886
|
+
* Turn VeriFactu on or off for this NIF. `enabled` is the only field you can write.
|
|
35887
|
+
*
|
|
35888
|
+
* @param body - `{ enabled }`.
|
|
35889
|
+
* @returns The updated configuration.
|
|
35890
|
+
*/
|
|
34834
35891
|
update(body: components['schemas']['UpdateVeriFactuConfigurationRequest']): Promise<{
|
|
34835
35892
|
enabled: boolean;
|
|
34836
35893
|
nif_status?: "ACTIVATED" | "DEACTIVATED" | null | undefined;
|
|
@@ -34843,18 +35900,25 @@ declare class CompanyVeriFactuConfigurationResource {
|
|
|
34843
35900
|
}
|
|
34844
35901
|
|
|
34845
35902
|
/**
|
|
34846
|
-
* BeeL
|
|
35903
|
+
* The BeeL API client. Create one per API key and reuse it; it holds no global state.
|
|
35904
|
+
* Address a company with {@link company} and an account with {@link account}.
|
|
35905
|
+
*
|
|
35906
|
+
* Requests are retried automatically when it is safe — see `BeeLConfig` — and every `POST`
|
|
35907
|
+
* carries an `Idempotency-Key` that those retries reuse.
|
|
34847
35908
|
*
|
|
34848
35909
|
* @example
|
|
34849
35910
|
* ```typescript
|
|
34850
35911
|
* import { BeeL } from '@beel_es/sdk';
|
|
34851
35912
|
*
|
|
34852
|
-
* const beel = new BeeL({ apiKey:
|
|
35913
|
+
* const beel = new BeeL({ apiKey: process.env.BEEL_API_KEY! });
|
|
34853
35914
|
*
|
|
34854
35915
|
* const invoice = await beel.company('company-uuid').invoices.create({
|
|
34855
35916
|
* type: 'STANDARD',
|
|
34856
|
-
* recipient: { customer_id: 'uuid' },
|
|
34857
|
-
* lines: [{
|
|
35917
|
+
* recipient: { customer_id: 'customer-uuid' },
|
|
35918
|
+
* lines: [{
|
|
35919
|
+
* description: 'Service', quantity: 1, unit_price: 100,
|
|
35920
|
+
* main_tax: { type: 'IVA', percentage: 21, regime_key: '01' },
|
|
35921
|
+
* }],
|
|
34858
35922
|
* });
|
|
34859
35923
|
* ```
|
|
34860
35924
|
*/
|
|
@@ -34869,8 +35933,9 @@ declare class BeeL {
|
|
|
34869
35933
|
readonly configuration: ConfigurationResource;
|
|
34870
35934
|
/** @deprecated Session-focus endpoints are deprecated in the API contract. Use `beel.company(companyId).series` instead. */
|
|
34871
35935
|
readonly series: SeriesResource;
|
|
34872
|
-
/** Account-wide catalogs and personal preferences
|
|
35936
|
+
/** Account-wide catalogs, the credential's identity and personal preferences. */
|
|
34873
35937
|
readonly catalogs: CatalogsResource;
|
|
35938
|
+
/** NIF validation against the AEAT register. */
|
|
34874
35939
|
readonly nif: NifResource;
|
|
34875
35940
|
/** Accounts you manage (multi-account provisioning: members, invitations, webhooks, companies). */
|
|
34876
35941
|
readonly accounts: AccountsResource;
|
|
@@ -34885,7 +35950,9 @@ declare class BeeL {
|
|
|
34885
35950
|
* builders) and the naming stability the wrappers provide.
|
|
34886
35951
|
*
|
|
34887
35952
|
* Retries, the `Authorization` header and `Idempotency-Key` still apply: it is the
|
|
34888
|
-
* same client the resources use, middleware included.
|
|
35953
|
+
* same client the resources use, middleware included. That includes error handling: a
|
|
35954
|
+
* non-2xx answer is **thrown** as a `BeeLApiError` subclass, so `raw` calls never resolve
|
|
35955
|
+
* with openapi-fetch's `{ error }`; `data` is always the successful body.
|
|
34889
35956
|
*
|
|
34890
35957
|
* @example
|
|
34891
35958
|
* ```typescript
|
|
@@ -34898,7 +35965,11 @@ declare class BeeL {
|
|
|
34898
35965
|
constructor(config: BeeLConfig);
|
|
34899
35966
|
/**
|
|
34900
35967
|
* Returns a facade scoped to one company (NIF) — the explicit multi-NIF surface.
|
|
34901
|
-
* All operations address the company in the path, no session focus needed.
|
|
35968
|
+
* All operations address the company in the path, no session focus needed. No request
|
|
35969
|
+
* is made; get the ids from `beel.account(accountId).companies.list()`.
|
|
35970
|
+
*
|
|
35971
|
+
* @param companyId - Company UUID (not its NIF).
|
|
35972
|
+
* @returns The company scope.
|
|
34902
35973
|
*
|
|
34903
35974
|
* @example
|
|
34904
35975
|
* ```typescript
|
|
@@ -34908,8 +35979,12 @@ declare class BeeL {
|
|
|
34908
35979
|
*/
|
|
34909
35980
|
company(companyId: string): CompanyScope;
|
|
34910
35981
|
/**
|
|
34911
|
-
* Returns a facade scoped to one
|
|
34912
|
-
*
|
|
35982
|
+
* Returns a facade scoped to one account — companies, members, invitations, account
|
|
35983
|
+
* webhooks, usage. Symmetric with {@link company}. No request is made; your own account
|
|
35984
|
+
* id is `(await beel.catalogs.identity()).account_id`.
|
|
35985
|
+
*
|
|
35986
|
+
* @param accountId - Account UUID.
|
|
35987
|
+
* @returns The account scope.
|
|
34913
35988
|
*
|
|
34914
35989
|
* @example
|
|
34915
35990
|
* ```typescript
|
|
@@ -34924,6 +35999,10 @@ declare class BeeL {
|
|
|
34924
35999
|
* @deprecated Relies on the deprecated session-focus PDF endpoint. Use
|
|
34925
36000
|
* `beel.company(companyId).invoices.getPdf(invoiceId)` and fetch `download_url` instead.
|
|
34926
36001
|
*
|
|
36002
|
+
* @param invoiceId - Invoice UUID.
|
|
36003
|
+
* @returns The PDF bytes and its file name.
|
|
36004
|
+
* @throws {Error} When downloading the file fails.
|
|
36005
|
+
*
|
|
34927
36006
|
* @example
|
|
34928
36007
|
* ```typescript
|
|
34929
36008
|
* const { buffer, fileName } = await beel.downloadPdf('invoice-uuid');
|
|
@@ -34937,37 +36016,89 @@ declare class BeeL {
|
|
|
34937
36016
|
}
|
|
34938
36017
|
|
|
34939
36018
|
/**
|
|
34940
|
-
* Base error for
|
|
36019
|
+
* Base error for every non-2xx answer of the BeeL API. The client throws it (or one of its
|
|
36020
|
+
* subclasses) from any resource method; a network failure is thrown as the platform's own
|
|
36021
|
+
* `fetch` error instead.
|
|
36022
|
+
*
|
|
36023
|
+
* @example
|
|
36024
|
+
* ```typescript
|
|
36025
|
+
* try {
|
|
36026
|
+
* await company.invoices.issue(invoiceId);
|
|
36027
|
+
* } catch (error) {
|
|
36028
|
+
* if (error instanceof BeeLApiError) console.error(error.statusCode, error.apiCode, error.requestId);
|
|
36029
|
+
* throw error;
|
|
36030
|
+
* }
|
|
36031
|
+
* ```
|
|
34941
36032
|
*/
|
|
34942
36033
|
declare class BeeLApiError extends Error {
|
|
36034
|
+
/** HTTP status of the response. */
|
|
34943
36035
|
readonly statusCode: number;
|
|
36036
|
+
/**
|
|
36037
|
+
* Stable code of the error class. On the base class it is the API's `error.code`; the
|
|
36038
|
+
* subclasses keep a fixed generic value (`CONFLICT`, `NOT_FOUND`…) for backward
|
|
36039
|
+
* compatibility. Read {@link apiCode} for the API's specific code.
|
|
36040
|
+
*/
|
|
34944
36041
|
readonly code: string;
|
|
36042
|
+
/**
|
|
36043
|
+
* The `error.code` the API answered with, verbatim — for example
|
|
36044
|
+
* `INVOICE_DUPLICATE_EXTERNAL_REFERENCE`. Equal to {@link code} when the response did not
|
|
36045
|
+
* carry one. See {@link BeeLErrorCodes} for the codes this SDK reacts to.
|
|
36046
|
+
*/
|
|
36047
|
+
readonly apiCode: string;
|
|
36048
|
+
/** `error.details` of the response, when the API sent any. */
|
|
34945
36049
|
readonly details?: Record<string, string>;
|
|
36050
|
+
/** `meta.request_id` of the response. Quote it when you contact support. */
|
|
34946
36051
|
readonly requestId?: string;
|
|
34947
|
-
constructor(message: string, statusCode: number, code: string, details?: Record<string, string>, requestId?: string);
|
|
36052
|
+
constructor(message: string, statusCode: number, code: string, details?: Record<string, string>, requestId?: string, apiCode?: string);
|
|
34948
36053
|
}
|
|
34949
|
-
/** 429
|
|
36054
|
+
/** `429`: rate limit exceeded. Retried automatically, see `maxRetries`. */
|
|
34950
36055
|
declare class BeeLRateLimitError extends BeeLApiError {
|
|
36056
|
+
/** Seconds the API asked to wait before the next request. */
|
|
34951
36057
|
readonly retryAfterSeconds: number;
|
|
34952
|
-
constructor(message: string, retryAfterSeconds: number, requestId?: string);
|
|
36058
|
+
constructor(message: string, retryAfterSeconds: number, requestId?: string, apiCode?: string);
|
|
34953
36059
|
}
|
|
34954
|
-
/** 422
|
|
36060
|
+
/** `422`: validation or business rule error. `details` names the offending fields. */
|
|
34955
36061
|
declare class BeeLValidationError extends BeeLApiError {
|
|
34956
|
-
constructor(message: string, details?: Record<string, string>, requestId?: string);
|
|
36062
|
+
constructor(message: string, details?: Record<string, string>, requestId?: string, apiCode?: string);
|
|
34957
36063
|
}
|
|
34958
|
-
/** 401 / 403
|
|
36064
|
+
/** `401` / `403`: the API key is missing or invalid, or lacks access to the resource. */
|
|
34959
36065
|
declare class BeeLAuthError extends BeeLApiError {
|
|
34960
|
-
constructor(message: string, statusCode: 401 | 403, requestId?: string);
|
|
36066
|
+
constructor(message: string, statusCode: 401 | 403, requestId?: string, apiCode?: string);
|
|
34961
36067
|
}
|
|
34962
|
-
/** 404
|
|
36068
|
+
/** `404`: the resource does not exist. */
|
|
34963
36069
|
declare class BeeLNotFoundError extends BeeLApiError {
|
|
34964
|
-
constructor(message: string, requestId?: string);
|
|
36070
|
+
constructor(message: string, requestId?: string, apiCode?: string);
|
|
34965
36071
|
}
|
|
34966
|
-
/**
|
|
36072
|
+
/**
|
|
36073
|
+
* `409`: conflict — for example `INVOICE_DUPLICATE_EXTERNAL_REFERENCE` or an
|
|
36074
|
+
* `Idempotency-Key` reused with another body. Branch on {@link BeeLApiError.apiCode}.
|
|
36075
|
+
*/
|
|
34967
36076
|
declare class BeeLConflictError extends BeeLApiError {
|
|
34968
|
-
constructor(message: string, requestId?: string);
|
|
36077
|
+
constructor(message: string, requestId?: string, apiCode?: string, details?: Record<string, string>);
|
|
34969
36078
|
}
|
|
34970
36079
|
|
|
36080
|
+
/**
|
|
36081
|
+
* `error.code` values of the API that the SDK itself reacts to. Compare them with
|
|
36082
|
+
* {@link BeeLApiError.apiCode}. The full catalogue lives in the API reference
|
|
36083
|
+
* (https://docs.beel.es); these are the ones this package has behaviour for.
|
|
36084
|
+
*/
|
|
36085
|
+
declare const BeeLErrorCodes: {
|
|
36086
|
+
/**
|
|
36087
|
+
* `409`: a live standard or simplified invoice with the same `external_ref` already exists
|
|
36088
|
+
* in this environment. Look it up with `invoices.list({ external_ref })`.
|
|
36089
|
+
*/
|
|
36090
|
+
readonly INVOICE_DUPLICATE_EXTERNAL_REFERENCE: "INVOICE_DUPLICATE_EXTERNAL_REFERENCE";
|
|
36091
|
+
/**
|
|
36092
|
+
* `409`: the first request with this `Idempotency-Key` is still being processed. Retry with
|
|
36093
|
+
* the same key after `Retry-After`; the client does so automatically.
|
|
36094
|
+
*/
|
|
36095
|
+
readonly IDEMPOTENCY_KEY_PROCESSING: "IDEMPOTENCY_KEY_PROCESSING";
|
|
36096
|
+
/** `409`: the `Idempotency-Key` was already used with a different body. Use a new key. */
|
|
36097
|
+
readonly IDEMPOTENCY_KEY_MISMATCH: "IDEMPOTENCY_KEY_MISMATCH";
|
|
36098
|
+
};
|
|
36099
|
+
/** One of the {@link BeeLErrorCodes} values. */
|
|
36100
|
+
type BeeLErrorCode = (typeof BeeLErrorCodes)[keyof typeof BeeLErrorCodes];
|
|
36101
|
+
|
|
34971
36102
|
type WebhookEventDataAccountBase = {
|
|
34972
36103
|
/**
|
|
34973
36104
|
* The provisioned account this event refers to.
|
|
@@ -35253,6 +36384,19 @@ type WebhookEventDataRepresentationSigned = (WebhookEventDataAccountBase & {
|
|
|
35253
36384
|
signed_at: string;
|
|
35254
36385
|
});
|
|
35255
36386
|
|
|
36387
|
+
/**
|
|
36388
|
+
* Which record changed status: the invoice's registration or, if it was voided, its
|
|
36389
|
+
* cancellation. The same value as `operation` in the invoice's `verifactu-records`.
|
|
36390
|
+
*
|
|
36391
|
+
* * `REGISTRATION` — registration of the invoice.
|
|
36392
|
+
* * `VOID` — cancellation of a previously registered invoice.
|
|
36393
|
+
*
|
|
36394
|
+
*/
|
|
36395
|
+
declare enum VeriFactuRecordOperation {
|
|
36396
|
+
REGISTRATION = "REGISTRATION",
|
|
36397
|
+
VOID = "VOID"
|
|
36398
|
+
}
|
|
36399
|
+
|
|
35256
36400
|
/**
|
|
35257
36401
|
* VeriFactu registration status. Every value is also a value of `verifactu.submission_status`
|
|
35258
36402
|
* on the invoice resource, so a status read from a webhook can be fed straight back into the
|
|
@@ -35289,6 +36433,7 @@ type WebhookEventDataVeriFactuStatusUpdated = {
|
|
|
35289
36433
|
* BeeL. VeriFactu registration identifier.
|
|
35290
36434
|
*/
|
|
35291
36435
|
verifactu_registration_id: string;
|
|
36436
|
+
operation: VeriFactuRecordOperation;
|
|
35292
36437
|
/**
|
|
35293
36438
|
* Status of this registration before the change. Omitted on the first notification of a
|
|
35294
36439
|
* registration, because there is no earlier status: the submission was just accepted for
|
|
@@ -35375,7 +36520,7 @@ type WebhookEventDataTest = {
|
|
|
35375
36520
|
* @example Express.js
|
|
35376
36521
|
* ```typescript
|
|
35377
36522
|
* import express from 'express';
|
|
35378
|
-
* import { WebhookVerifier } from '@
|
|
36523
|
+
* import { WebhookVerifier } from '@beel_es/sdk';
|
|
35379
36524
|
*
|
|
35380
36525
|
* const verifier = new WebhookVerifier('your_webhook_secret');
|
|
35381
36526
|
*
|
|
@@ -35470,15 +36615,25 @@ type BusinessEvent<K extends `${WebhookEventType}`, D> = Omit<WebhookEventEnvelo
|
|
|
35470
36615
|
test?: false | null;
|
|
35471
36616
|
data: D;
|
|
35472
36617
|
};
|
|
36618
|
+
/** `verifactu.status.updated`: AEAT answered for an invoice's VeriFactu record (`new_status`, `qr_url`…). */
|
|
35473
36619
|
type VeriFactuStatusUpdatedEvent = BusinessEvent<'verifactu.status.updated', WebhookEventDataVeriFactuStatusUpdated>;
|
|
36620
|
+
/** `invoice.issued`: an invoice was issued. */
|
|
35474
36621
|
type InvoiceIssuedEvent = BusinessEvent<'invoice.issued', WebhookEventDataInvoiceIssued>;
|
|
36622
|
+
/** `invoice.voided`: an invoice was voided. */
|
|
35475
36623
|
type InvoiceVoidedEvent = BusinessEvent<'invoice.voided', WebhookEventDataInvoiceVoided>;
|
|
36624
|
+
/** `invoice.email.sent`: an invoice email was accepted by the email provider. */
|
|
35476
36625
|
type InvoiceEmailSentEvent = BusinessEvent<'invoice.email.sent', WebhookEventDataInvoiceEmailSent>;
|
|
36626
|
+
/** `invoice.pdf.generated`: the PDF of an invoice is ready. */
|
|
35477
36627
|
type InvoicePdfGeneratedEvent = BusinessEvent<'invoice.pdf.generated', WebhookEventDataInvoicePdfGenerated>;
|
|
36628
|
+
/** `invoice.schedule_failed`: a scheduled invoice could not be processed. */
|
|
35478
36629
|
type InvoiceScheduleFailedEvent = BusinessEvent<'invoice.schedule_failed', WebhookEventDataInvoiceScheduleFailed>;
|
|
36630
|
+
/** `recurring_invoice.paused`: a recurring invoice was paused. */
|
|
35479
36631
|
type RecurringInvoicePausedEvent = BusinessEvent<'recurring_invoice.paused', WebhookEventDataRecurringInvoicePaused>;
|
|
36632
|
+
/** `account.claimed`: the holder of a provisioned account took ownership. */
|
|
35480
36633
|
type AccountClaimedEvent = BusinessEvent<'account.claimed', WebhookEventDataAccountClaimed>;
|
|
36634
|
+
/** `company.created`: a company (NIF) was created. */
|
|
35481
36635
|
type CompanyCreatedEvent = BusinessEvent<'company.created', WebhookEventDataCompanyCreated>;
|
|
36636
|
+
/** `representation.signed`: a representation document was signed. */
|
|
35482
36637
|
type RepresentationSignedEvent = BusinessEvent<'representation.signed', WebhookEventDataRepresentationSigned>;
|
|
35483
36638
|
/**
|
|
35484
36639
|
* A delivery sent with "Send test": `test` is `true` and `data` is a synthetic message,
|
|
@@ -35496,7 +36651,8 @@ type WebhookEvent = VeriFactuStatusUpdatedEvent | InvoiceIssuedEvent | InvoiceVo
|
|
|
35496
36651
|
|
|
35497
36652
|
type CreateCustomerRequest = components['schemas']['CreateCustomerRequest'];
|
|
35498
36653
|
/**
|
|
35499
|
-
* Fluent builder for
|
|
36654
|
+
* Fluent builder for the body of `customers.create`. It builds the request object only;
|
|
36655
|
+
* send it with `beel.company(companyId).customers.create(builder.build())`.
|
|
35500
36656
|
*
|
|
35501
36657
|
* @example
|
|
35502
36658
|
* ```typescript
|
|
@@ -35516,28 +36672,88 @@ declare class CustomerBuilder {
|
|
|
35516
36672
|
private _address?;
|
|
35517
36673
|
private _notes?;
|
|
35518
36674
|
private constructor();
|
|
36675
|
+
/**
|
|
36676
|
+
* Start a new builder.
|
|
36677
|
+
*
|
|
36678
|
+
* @returns An empty customer builder.
|
|
36679
|
+
*/
|
|
35519
36680
|
static create(): CustomerBuilder;
|
|
36681
|
+
/**
|
|
36682
|
+
* Legal name of the customer. Required.
|
|
36683
|
+
*
|
|
36684
|
+
* @param name - Legal name.
|
|
36685
|
+
* @returns This builder.
|
|
36686
|
+
*/
|
|
35520
36687
|
name(name: string): this;
|
|
36688
|
+
/**
|
|
36689
|
+
* NIF/CIF of the customer. Required.
|
|
36690
|
+
*
|
|
36691
|
+
* @param nif - Spanish tax id.
|
|
36692
|
+
* @returns This builder.
|
|
36693
|
+
*/
|
|
35521
36694
|
nif(nif: string): this;
|
|
36695
|
+
/**
|
|
36696
|
+
* Contact email.
|
|
36697
|
+
*
|
|
36698
|
+
* @param email - Email address.
|
|
36699
|
+
* @returns This builder.
|
|
36700
|
+
*/
|
|
35522
36701
|
email(email: string): this;
|
|
36702
|
+
/**
|
|
36703
|
+
* Contact phone: 9 to 20 characters of digits, spaces, dashes, parentheses and a leading `+`.
|
|
36704
|
+
*
|
|
36705
|
+
* @param phone - Phone number.
|
|
36706
|
+
* @returns This builder.
|
|
36707
|
+
*/
|
|
35523
36708
|
phone(phone: string): this;
|
|
36709
|
+
/**
|
|
36710
|
+
* Fiscal address. Required.
|
|
36711
|
+
*
|
|
36712
|
+
* @param street - Street name.
|
|
36713
|
+
* @param number - Street number.
|
|
36714
|
+
* @param postalCode - Postal code.
|
|
36715
|
+
* @param city - City.
|
|
36716
|
+
* @param province - Province.
|
|
36717
|
+
* @param country - Country name.
|
|
36718
|
+
* @param countryCode - ISO 3166-1 alpha-2 code. Default: `ES`.
|
|
36719
|
+
* @returns This builder.
|
|
36720
|
+
*/
|
|
35524
36721
|
address(street: string, number: string, postalCode: string, city: string, province: string, country: string, countryCode?: string): this;
|
|
36722
|
+
/**
|
|
36723
|
+
* Internal notes about the customer.
|
|
36724
|
+
*
|
|
36725
|
+
* @param notes - Free text.
|
|
36726
|
+
* @returns This builder.
|
|
36727
|
+
*/
|
|
35525
36728
|
notes(notes: string): this;
|
|
36729
|
+
/**
|
|
36730
|
+
* Build the request body.
|
|
36731
|
+
*
|
|
36732
|
+
* @returns The `CreateCustomerRequest`.
|
|
36733
|
+
* @throws {Error} When the name, NIF or address is missing.
|
|
36734
|
+
*/
|
|
35526
36735
|
build(): CreateCustomerRequest;
|
|
35527
36736
|
}
|
|
35528
36737
|
|
|
35529
36738
|
type CreateInvoiceRequest = components['schemas']['CreateInvoiceRequest'];
|
|
35530
36739
|
type InvoiceType = components['schemas']['InvoiceType'];
|
|
35531
36740
|
type InvoiceLine = CreateInvoiceRequest['lines'][number];
|
|
36741
|
+
type LineMainTax = NonNullable<InvoiceLine['main_tax']>;
|
|
35532
36742
|
/**
|
|
35533
|
-
* Fluent builder for
|
|
36743
|
+
* Fluent builder for the body of `invoices.create`. It builds the request object only; send
|
|
36744
|
+
* it with `beel.company(companyId).invoices.create(builder.build())`.
|
|
36745
|
+
*
|
|
36746
|
+
* The API requires a `main_tax` on every `NORMAL` line (`422 LINE_MAIN_TAX_REQUIRED`
|
|
36747
|
+
* otherwise): set it once with {@link mainTax}, or per line in {@link addLine}.
|
|
35534
36748
|
*
|
|
35535
36749
|
* @example
|
|
35536
36750
|
* ```typescript
|
|
35537
|
-
* const
|
|
36751
|
+
* const request = InvoiceBuilder.create()
|
|
35538
36752
|
* .forCustomer('customer-uuid')
|
|
35539
|
-
* .
|
|
36753
|
+
* .mainTax({ type: 'IVA', percentage: 21, regime_key: '01' })
|
|
36754
|
+
* .addLine('Consulting services', 10, 85.5)
|
|
35540
36755
|
* .build();
|
|
36756
|
+
* const invoice = await beel.company(companyId).invoices.create(request);
|
|
35541
36757
|
* ```
|
|
35542
36758
|
*/
|
|
35543
36759
|
declare class InvoiceBuilder {
|
|
@@ -35549,17 +36765,96 @@ declare class InvoiceBuilder {
|
|
|
35549
36765
|
private _notes?;
|
|
35550
36766
|
private _seriesId?;
|
|
35551
36767
|
private _metadata?;
|
|
36768
|
+
private _mainTax?;
|
|
35552
36769
|
private constructor();
|
|
36770
|
+
/**
|
|
36771
|
+
* Start a new builder.
|
|
36772
|
+
*
|
|
36773
|
+
* @returns An empty `STANDARD` invoice builder.
|
|
36774
|
+
*/
|
|
35553
36775
|
static create(): InvoiceBuilder;
|
|
36776
|
+
/**
|
|
36777
|
+
* Set the invoice type. Default: `STANDARD`.
|
|
36778
|
+
*
|
|
36779
|
+
* @param type - `STANDARD`, `SIMPLIFIED` or `PROFORMA` (correctives use `createCorrective`).
|
|
36780
|
+
* @returns This builder.
|
|
36781
|
+
*/
|
|
35554
36782
|
type(type: InvoiceType): this;
|
|
36783
|
+
/**
|
|
36784
|
+
* Invoice a registered customer.
|
|
36785
|
+
*
|
|
36786
|
+
* @param customerId - Customer UUID.
|
|
36787
|
+
* @returns This builder.
|
|
36788
|
+
*/
|
|
35555
36789
|
forCustomer(customerId: string): this;
|
|
36790
|
+
/**
|
|
36791
|
+
* Date the operation took place, when it differs from the issue date.
|
|
36792
|
+
*
|
|
36793
|
+
* @param date - A `Date` or a `YYYY-MM-DD` string.
|
|
36794
|
+
* @returns This builder.
|
|
36795
|
+
*/
|
|
35556
36796
|
operationDate(date: string | Date): this;
|
|
36797
|
+
/**
|
|
36798
|
+
* Payment due date.
|
|
36799
|
+
*
|
|
36800
|
+
* @param date - A `Date` or a `YYYY-MM-DD` string.
|
|
36801
|
+
* @returns This builder.
|
|
36802
|
+
*/
|
|
35557
36803
|
dueDate(date: string | Date): this;
|
|
35558
|
-
|
|
36804
|
+
/**
|
|
36805
|
+
* Main tax applied to every line added with {@link addLine} after this call, unless the
|
|
36806
|
+
* line passes its own.
|
|
36807
|
+
*
|
|
36808
|
+
* @param tax - For example `{ type: 'IVA', percentage: 21, regime_key: '01' }`.
|
|
36809
|
+
* @returns This builder.
|
|
36810
|
+
*/
|
|
36811
|
+
mainTax(tax: LineMainTax): this;
|
|
36812
|
+
/**
|
|
36813
|
+
* Add a `NORMAL` line.
|
|
36814
|
+
*
|
|
36815
|
+
* @param description - What is invoiced.
|
|
36816
|
+
* @param quantity - Units.
|
|
36817
|
+
* @param unitPrice - Price per unit before taxes.
|
|
36818
|
+
* @param discountPercentage - Discount, 0–100. Default: `0`.
|
|
36819
|
+
* @param mainTax - Tax of this line; defaults to the one set with {@link mainTax}. The API
|
|
36820
|
+
* rejects a `NORMAL` line without one.
|
|
36821
|
+
* @returns This builder.
|
|
36822
|
+
*/
|
|
36823
|
+
addLine(description: string, quantity: number, unitPrice: number, discountPercentage?: number, mainTax?: LineMainTax): this;
|
|
36824
|
+
/**
|
|
36825
|
+
* Add a line exactly as given — any line type or pricing mode.
|
|
36826
|
+
*
|
|
36827
|
+
* @param line - A line of `CreateInvoiceRequest`.
|
|
36828
|
+
* @returns This builder.
|
|
36829
|
+
*/
|
|
35559
36830
|
addLineObject(line: InvoiceLine): this;
|
|
36831
|
+
/**
|
|
36832
|
+
* Notes printed on the invoice.
|
|
36833
|
+
*
|
|
36834
|
+
* @param notes - Free text.
|
|
36835
|
+
* @returns This builder.
|
|
36836
|
+
*/
|
|
35560
36837
|
notes(notes: string): this;
|
|
36838
|
+
/**
|
|
36839
|
+
* Number the invoice in this series instead of the default one.
|
|
36840
|
+
*
|
|
36841
|
+
* @param id - Series UUID.
|
|
36842
|
+
* @returns This builder.
|
|
36843
|
+
*/
|
|
35561
36844
|
series(id: string): this;
|
|
36845
|
+
/**
|
|
36846
|
+
* Your own key/value pairs, filterable when listing.
|
|
36847
|
+
*
|
|
36848
|
+
* @param data - Metadata to store with the invoice.
|
|
36849
|
+
* @returns This builder.
|
|
36850
|
+
*/
|
|
35562
36851
|
metadata(data: Record<string, any>): this;
|
|
36852
|
+
/**
|
|
36853
|
+
* Build the request body.
|
|
36854
|
+
*
|
|
36855
|
+
* @returns The `CreateInvoiceRequest`.
|
|
36856
|
+
* @throws {Error} When there is no customer or no line.
|
|
36857
|
+
*/
|
|
35563
36858
|
build(): CreateInvoiceRequest;
|
|
35564
36859
|
}
|
|
35565
36860
|
|
|
@@ -35568,4 +36863,4 @@ type VeriFactuStatusUpdatedData = WebhookEventDataVeriFactuStatusUpdated;
|
|
|
35568
36863
|
/** @deprecated Renamed in the contract — use `VeriFactuSubmissionStatus`. */
|
|
35569
36864
|
type VeriFactuStatus = VeriFactuSubmissionStatus;
|
|
35570
36865
|
|
|
35571
|
-
export { type AccountClaimedEvent, AccountCompaniesResource, AccountInvitationsResource, AccountMembersResource, AccountScope, AccountWebhooksResource, AccountsResource, BeeL, BeeLApiError, BeeLAuthError, type BeeLConfig, BeeLConflictError, BeeLNotFoundError, BeeLRateLimitError, BeeLValidationError, CatalogsResource, type CompanyCreatedEvent, CompanyCustomersResource, CompanyInvoiceScheduleResource, CompanyInvoicesResource, CompanyPaymentConnectionsResource, CompanyPaymentEventsResource, CompanyProductsResource, CompanyRecurringInvoicesResource, CompanyScope, CompanySeriesResource, CompanyTaxConfigurationResource, CompanyVeriFactuConfigurationResource, CustomerBuilder, InvoiceBuilder, type InvoiceEmailSentEvent, type InvoiceIssuedEvent, type InvoicePdfGeneratedEvent, type InvoiceScheduleFailedEvent, type InvoiceVoidedEvent, type RecurringInvoicePausedEvent, type RepresentationSignedEvent, type VeriFactuStatus, type VeriFactuStatusUpdatedData, type VeriFactuStatusUpdatedEvent, VeriFactuSubmissionStatus, type WebhookEvent, type WebhookEventDataAccountClaimed, type WebhookEventDataCompanyCreated, type WebhookEventDataInvoiceEmailSent, type WebhookEventDataInvoiceIssued, type WebhookEventDataInvoicePdfGenerated, type WebhookEventDataInvoiceScheduleFailed, type WebhookEventDataInvoiceVoided, type WebhookEventDataRecurringInvoicePaused, type WebhookEventDataRepresentationSigned, type WebhookEventDataTest, type WebhookEventDataVeriFactuStatusUpdated, type WebhookEventEnvelope, WebhookEventType, type WebhookTestEvent, WebhookVerificationError, WebhookVerifier, type components, type operations, type paths };
|
|
36866
|
+
export { type AccountClaimedEvent, AccountCompaniesResource, AccountInvitationsResource, AccountMembersResource, AccountScope, AccountWebhooksResource, AccountsResource, BeeL, BeeLApiError, BeeLAuthError, type BeeLConfig, BeeLConflictError, type BeeLErrorCode, BeeLErrorCodes, BeeLNotFoundError, BeeLRateLimitError, BeeLValidationError, CatalogsResource, type CompanyCreatedEvent, CompanyCustomersResource, CompanyInvoiceScheduleResource, CompanyInvoicesResource, CompanyPaymentConnectionsResource, CompanyPaymentEventsResource, CompanyProductsResource, CompanyRecurringInvoicesResource, CompanyScope, CompanySeriesResource, CompanyTaxConfigurationResource, CompanyVeriFactuConfigurationResource, type CreateInvoiceOnceParams, type CreateInvoiceOnceRequest, CustomerBuilder, EXTERNAL_REF_UNIQUE_INVOICE_TYPES, type ExternalRefUniqueInvoiceType, InvoiceBuilder, type InvoiceEmailSentEvent, type InvoiceIssuedEvent, type InvoicePdfGeneratedEvent, type InvoiceScheduleFailedEvent, type InvoiceVoidedEvent, type RecurringInvoicePausedEvent, type RepresentationSignedEvent, type RequestOptions, VeriFactuRecordOperation, type VeriFactuStatus, type VeriFactuStatusUpdatedData, type VeriFactuStatusUpdatedEvent, VeriFactuSubmissionStatus, type WebhookEvent, type WebhookEventDataAccountClaimed, type WebhookEventDataCompanyCreated, type WebhookEventDataInvoiceEmailSent, type WebhookEventDataInvoiceIssued, type WebhookEventDataInvoicePdfGenerated, type WebhookEventDataInvoiceScheduleFailed, type WebhookEventDataInvoiceVoided, type WebhookEventDataRecurringInvoicePaused, type WebhookEventDataRepresentationSigned, type WebhookEventDataTest, type WebhookEventDataVeriFactuStatusUpdated, type WebhookEventEnvelope, WebhookEventType, type WebhookTestEvent, WebhookVerificationError, WebhookVerifier, type components, type operations, type paths };
|