@beel_es/sdk 2.0.0 → 2.1.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 +227 -0
- package/README.md +216 -25
- package/dist/index.d.mts +1450 -181
- package/dist/index.d.ts +1450 -181
- package/dist/index.js +1411 -188
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1409 -188
- 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.ts
CHANGED
|
@@ -7378,7 +7378,7 @@ interface components {
|
|
|
7378
7378
|
* @default 0
|
|
7379
7379
|
* @example 10
|
|
7380
7380
|
*/
|
|
7381
|
-
discount_percentage
|
|
7381
|
+
discount_percentage?: number;
|
|
7382
7382
|
/**
|
|
7383
7383
|
* @description Main tax of the line: regime (IVA/IGIC/IPSI/OTHER), percentage and regime key.
|
|
7384
7384
|
*
|
|
@@ -7464,7 +7464,7 @@ interface components {
|
|
|
7464
7464
|
* (art. 78.Tres.3 LIVA). Requires `source_invoice_reference`.
|
|
7465
7465
|
* @default NORMAL
|
|
7466
7466
|
*/
|
|
7467
|
-
line_type
|
|
7467
|
+
line_type?: components["schemas"]["InvoiceLineType"];
|
|
7468
7468
|
/**
|
|
7469
7469
|
* @description Reference to the original invoice issued by the third party in the
|
|
7470
7470
|
* client's name. Required when `line_type=SUPLIDO`.
|
|
@@ -7515,21 +7515,21 @@ interface components {
|
|
|
7515
7515
|
* If `false` (default), creates as **DRAFT** without number (editable, no PDF).
|
|
7516
7516
|
* @default false
|
|
7517
7517
|
*/
|
|
7518
|
-
issue_directly
|
|
7518
|
+
issue_directly?: boolean;
|
|
7519
7519
|
/**
|
|
7520
7520
|
* @description Only applies when `issue_directly` is `true`.
|
|
7521
7521
|
* If `true`, waits for PDF generation before returning the response (~1-3s).
|
|
7522
7522
|
* If `false` (default), PDF is generated asynchronously in the background.
|
|
7523
7523
|
* @default false
|
|
7524
7524
|
*/
|
|
7525
|
-
wait_for_pdf
|
|
7525
|
+
wait_for_pdf?: boolean;
|
|
7526
7526
|
/**
|
|
7527
7527
|
* @description Only applies when `issue_directly` is `true`.
|
|
7528
7528
|
* If `true`, sends the invoice by email with PDF attachment after issuing.
|
|
7529
7529
|
* The email is sent asynchronously after the invoice is issued.
|
|
7530
7530
|
* @default false
|
|
7531
7531
|
*/
|
|
7532
|
-
send_automatically
|
|
7532
|
+
send_automatically?: boolean;
|
|
7533
7533
|
/**
|
|
7534
7534
|
* @description Only applies when `send_automatically` is `true`. If `true`, the email sent after
|
|
7535
7535
|
* issuing also attaches a ZIP (`suplidos_<invoice-number>.zip`) with the PDFs of the
|
|
@@ -7544,7 +7544,7 @@ interface components {
|
|
|
7544
7544
|
* stored on the invoice.
|
|
7545
7545
|
* @default false
|
|
7546
7546
|
*/
|
|
7547
|
-
attach_source_invoices
|
|
7547
|
+
attach_source_invoices?: boolean;
|
|
7548
7548
|
/**
|
|
7549
7549
|
* @description Only applies when `send_automatically` is `true`.
|
|
7550
7550
|
* Overrides default email settings. If it names no recipients, the email goes to the
|
|
@@ -7765,12 +7765,12 @@ interface components {
|
|
|
7765
7765
|
/** @description Custom message (optional, added before standard message) */
|
|
7766
7766
|
message?: string;
|
|
7767
7767
|
/** @default true */
|
|
7768
|
-
attach_pdf
|
|
7768
|
+
attach_pdf?: boolean;
|
|
7769
7769
|
/**
|
|
7770
7770
|
* @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
7771
|
* @default false
|
|
7772
7772
|
*/
|
|
7773
|
-
attach_source_invoices
|
|
7773
|
+
attach_source_invoices?: boolean;
|
|
7774
7774
|
/** @description Language of the email. When omitted, the issuing company's `email_language` applies, and Spanish (`es`) when the company has none set. */
|
|
7775
7775
|
language?: components["schemas"]["Language"];
|
|
7776
7776
|
};
|
|
@@ -7873,7 +7873,7 @@ interface components {
|
|
|
7873
7873
|
*/
|
|
7874
7874
|
total_including_tax?: number;
|
|
7875
7875
|
/** @default 0 */
|
|
7876
|
-
discount_percentage
|
|
7876
|
+
discount_percentage?: number;
|
|
7877
7877
|
main_tax?: components["schemas"]["TaxInfo"];
|
|
7878
7878
|
/**
|
|
7879
7879
|
* @description Equivalence surcharge rate for this line of the corrective
|
|
@@ -9150,7 +9150,7 @@ interface components {
|
|
|
9150
9150
|
* without a year token must come with `counter_reset: NEVER`.
|
|
9151
9151
|
* @default ANNUAL
|
|
9152
9152
|
*/
|
|
9153
|
-
counter_reset
|
|
9153
|
+
counter_reset?: components["schemas"]["CounterReset"];
|
|
9154
9154
|
/**
|
|
9155
9155
|
* Format: int64
|
|
9156
9156
|
* @description Initial number for this series counter.
|
|
@@ -9163,12 +9163,12 @@ interface components {
|
|
|
9163
9163
|
* @default 1
|
|
9164
9164
|
* @example 1
|
|
9165
9165
|
*/
|
|
9166
|
-
initial_number
|
|
9166
|
+
initial_number?: number;
|
|
9167
9167
|
/**
|
|
9168
9168
|
* @description Whether the series is active
|
|
9169
9169
|
* @default true
|
|
9170
9170
|
*/
|
|
9171
|
-
active
|
|
9171
|
+
active?: boolean;
|
|
9172
9172
|
/**
|
|
9173
9173
|
* @description Whether this is the default series for its document_type.
|
|
9174
9174
|
*
|
|
@@ -9181,7 +9181,7 @@ interface components {
|
|
|
9181
9181
|
* the current default of that type.
|
|
9182
9182
|
* @default false
|
|
9183
9183
|
*/
|
|
9184
|
-
default_series
|
|
9184
|
+
default_series?: boolean;
|
|
9185
9185
|
};
|
|
9186
9186
|
/**
|
|
9187
9187
|
* @description Request to **update** an invoice series (`PUT`). Despite the verb, this is a merge
|
|
@@ -10192,7 +10192,7 @@ interface components {
|
|
|
10192
10192
|
payment_term_days?: number | null;
|
|
10193
10193
|
notes?: string | null;
|
|
10194
10194
|
/** @default false */
|
|
10195
|
-
send_automatically
|
|
10195
|
+
send_automatically?: boolean;
|
|
10196
10196
|
email_configuration?: components["schemas"]["RecurringEmailConfigRequest"];
|
|
10197
10197
|
};
|
|
10198
10198
|
CreateRecurringFromInvoiceRequest: {
|
|
@@ -10231,7 +10231,7 @@ interface components {
|
|
|
10231
10231
|
/** Format: date */
|
|
10232
10232
|
end_date?: string | null;
|
|
10233
10233
|
/** @default false */
|
|
10234
|
-
send_automatically
|
|
10234
|
+
send_automatically?: boolean;
|
|
10235
10235
|
email_configuration?: components["schemas"]["RecurringEmailConfigRequest"];
|
|
10236
10236
|
};
|
|
10237
10237
|
/**
|
|
@@ -10443,7 +10443,7 @@ interface components {
|
|
|
10443
10443
|
* send `aeat_environment`.
|
|
10444
10444
|
* @default TEST
|
|
10445
10445
|
*/
|
|
10446
|
-
aeat_environment
|
|
10446
|
+
aeat_environment?: components["schemas"]["Environment"];
|
|
10447
10447
|
/**
|
|
10448
10448
|
* @description Whether to **switch the company on** in `aeat_environment` as part of this call.
|
|
10449
10449
|
*
|
|
@@ -10465,7 +10465,7 @@ interface components {
|
|
|
10465
10465
|
* `numbering` block or activate a mode in the same call.
|
|
10466
10466
|
* @default true
|
|
10467
10467
|
*/
|
|
10468
|
-
activate
|
|
10468
|
+
activate?: boolean;
|
|
10469
10469
|
};
|
|
10470
10470
|
/**
|
|
10471
10471
|
* @description Editable fields of a company.
|
|
@@ -12289,7 +12289,7 @@ interface components {
|
|
|
12289
12289
|
* Without it such a void fails with `422 VOID_REQUIRES_ISSUED_IN_ERROR`.
|
|
12290
12290
|
* @default false
|
|
12291
12291
|
*/
|
|
12292
|
-
issued_in_error
|
|
12292
|
+
issued_in_error?: boolean;
|
|
12293
12293
|
/**
|
|
12294
12294
|
* Format: date
|
|
12295
12295
|
* @deprecated
|
|
@@ -12309,7 +12309,7 @@ interface components {
|
|
|
12309
12309
|
* @default false
|
|
12310
12310
|
* @example false
|
|
12311
12311
|
*/
|
|
12312
|
-
issue
|
|
12312
|
+
issue?: boolean;
|
|
12313
12313
|
};
|
|
12314
12314
|
/**
|
|
12315
12315
|
* @description How to derive the new invoice from `from_invoice_id`.
|
|
@@ -12444,7 +12444,7 @@ interface components {
|
|
|
12444
12444
|
* @default SUMMARY
|
|
12445
12445
|
* @enum {string}
|
|
12446
12446
|
*/
|
|
12447
|
-
format
|
|
12447
|
+
format?: "SUMMARY" | "ITEMS";
|
|
12448
12448
|
/** @description Specific invoices to export. When present, `filters` is ignored. */
|
|
12449
12449
|
invoice_ids?: components["schemas"]["UUID"][];
|
|
12450
12450
|
filters?: components["schemas"]["InvoiceExportFilters"];
|
|
@@ -12989,7 +12989,7 @@ interface components {
|
|
|
12989
12989
|
/** Format: date */
|
|
12990
12990
|
end_date?: string | null;
|
|
12991
12991
|
/** @default false */
|
|
12992
|
-
send_automatically
|
|
12992
|
+
send_automatically?: boolean;
|
|
12993
12993
|
email_configuration?: components["schemas"]["RecurringEmailConfigRequest"];
|
|
12994
12994
|
};
|
|
12995
12995
|
/**
|
|
@@ -13723,12 +13723,12 @@ interface components {
|
|
|
13723
13723
|
* @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
13724
|
* @default false
|
|
13725
13725
|
*/
|
|
13726
|
-
send_email
|
|
13726
|
+
send_email?: boolean;
|
|
13727
13727
|
/**
|
|
13728
13728
|
* @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
13729
|
* @default []
|
|
13730
13730
|
*/
|
|
13731
|
-
grants
|
|
13731
|
+
grants?: components["schemas"]["GrantAssignment"][];
|
|
13732
13732
|
};
|
|
13733
13733
|
/** @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
13734
|
Invitation: {
|
|
@@ -13842,7 +13842,7 @@ interface components {
|
|
|
13842
13842
|
* @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
13843
|
* @default false
|
|
13844
13844
|
*/
|
|
13845
|
-
send_email
|
|
13845
|
+
send_email?: boolean;
|
|
13846
13846
|
};
|
|
13847
13847
|
/** @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
13848
|
ProvisionAccountResult: {
|
|
@@ -13961,7 +13961,7 @@ interface components {
|
|
|
13961
13961
|
* What it did comes back in `own_company_customers`, apart from the per-account counters.
|
|
13962
13962
|
* @default false
|
|
13963
13963
|
*/
|
|
13964
|
-
apply_customers_to_own_company
|
|
13964
|
+
apply_customers_to_own_company?: boolean;
|
|
13965
13965
|
};
|
|
13966
13966
|
AccountImportUpload: {
|
|
13967
13967
|
/**
|
|
@@ -15206,7 +15206,7 @@ interface components {
|
|
|
15206
15206
|
* @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
15207
|
* @default own
|
|
15208
15208
|
*/
|
|
15209
|
-
account_relationship
|
|
15209
|
+
account_relationship?: components["schemas"]["WebhookAccountRelationship"];
|
|
15210
15210
|
};
|
|
15211
15211
|
WebhookTestResult: {
|
|
15212
15212
|
/** @description Whether your endpoint responded with HTTP 2xx. */
|
|
@@ -30917,18 +30917,44 @@ interface operations {
|
|
|
30917
30917
|
};
|
|
30918
30918
|
}
|
|
30919
30919
|
|
|
30920
|
+
/**
|
|
30921
|
+
* Options of `new BeeL(config)`. Only `apiKey` is required.
|
|
30922
|
+
*
|
|
30923
|
+
* **Retries and idempotency.** A call is retried automatically, up to `maxRetries` times,
|
|
30924
|
+
* only when sending it again can never apply it twice:
|
|
30925
|
+
*
|
|
30926
|
+
* - `429` is always retried, after `Retry-After`: the API refused the request unprocessed.
|
|
30927
|
+
* - `409 IDEMPOTENCY_KEY_PROCESSING` is retried with the same key after `Retry-After`.
|
|
30928
|
+
* - `5xx` and network errors are retried for `GET` requests and for requests that carry an
|
|
30929
|
+
* `Idempotency-Key` — every `POST` does, unless `autoIdempotencyKey` is `false`. A `5xx`
|
|
30930
|
+
* the API marks `Idempotency-Replay: true` is the stored outcome of that key and is not
|
|
30931
|
+
* retried: the same key would return it again.
|
|
30932
|
+
* - `PUT`, `PATCH` and `DELETE` without a key are not retried after a `5xx` or network error.
|
|
30933
|
+
*
|
|
30934
|
+
* Every retry of a call reuses that call's `Idempotency-Key`, so an automatic retry never
|
|
30935
|
+
* creates a second invoice. Two separate calls get two keys: to retry a create yourself
|
|
30936
|
+
* after it failed with a `5xx` or a network error, use `invoices.createOnce`, or look the
|
|
30937
|
+
* invoice up by `external_ref` before creating it again.
|
|
30938
|
+
*/
|
|
30920
30939
|
interface BeeLConfig {
|
|
30921
|
-
/** API key
|
|
30940
|
+
/** API key: `beel_sk_live_*` (production) or `beel_sk_test_*` (sandbox). */
|
|
30922
30941
|
apiKey: string;
|
|
30923
|
-
/** Base URL.
|
|
30942
|
+
/** Base URL. Default: `https://app.beel.es/api`. */
|
|
30924
30943
|
baseUrl?: string;
|
|
30925
|
-
/**
|
|
30944
|
+
/**
|
|
30945
|
+
* Automatic retries after the first attempt, for the cases listed on {@link BeeLConfig}.
|
|
30946
|
+
* `0` disables them. Default: `3`.
|
|
30947
|
+
*/
|
|
30926
30948
|
maxRetries?: number;
|
|
30927
|
-
/**
|
|
30949
|
+
/** Base delay of the exponential backoff, in milliseconds. Default: `500`. */
|
|
30928
30950
|
retryDelayMs?: number;
|
|
30929
|
-
/**
|
|
30951
|
+
/** Upper bound of any single wait between attempts, `Retry-After` included, in ms. Default: `30000`. */
|
|
30930
30952
|
maxRetryDelayMs?: number;
|
|
30931
|
-
/**
|
|
30953
|
+
/**
|
|
30954
|
+
* Add one `Idempotency-Key` (a UUID) to every `POST` that does not carry its own, reused by
|
|
30955
|
+
* every automatic retry of that call. With `false`, a `POST` without a key is only retried
|
|
30956
|
+
* after a `429`. Default: `true`.
|
|
30957
|
+
*/
|
|
30932
30958
|
autoIdempotencyKey?: boolean;
|
|
30933
30959
|
}
|
|
30934
30960
|
declare function createBeeLClient(config: BeeLConfig): openapi_fetch.Client<paths, `${string}/${string}`>;
|
|
@@ -30937,12 +30963,20 @@ type BeeLClient = ReturnType<typeof createBeeLClient>;
|
|
|
30937
30963
|
type Invoice$1 = components['schemas']['Invoice'];
|
|
30938
30964
|
type Pagination$5 = components['schemas']['Pagination'];
|
|
30939
30965
|
type ListParams$2 = operations['listInvoices']['parameters']['query'];
|
|
30966
|
+
/**
|
|
30967
|
+
* Invoices of the focused company, on the flat `/v1/invoices` routes.
|
|
30968
|
+
*
|
|
30969
|
+
* @deprecated The contract deprecates the session-focus routes. Use `beel.company(companyId).invoices` instead.
|
|
30970
|
+
*/
|
|
30940
30971
|
declare class InvoicesResource {
|
|
30941
30972
|
private client;
|
|
30942
30973
|
constructor(client: BeeLClient);
|
|
30943
30974
|
/**
|
|
30944
30975
|
* List invoices with optional filters and pagination.
|
|
30945
30976
|
*
|
|
30977
|
+
* @param params - Filters and pagination.
|
|
30978
|
+
* @returns The page of `invoices` and its `pagination`.
|
|
30979
|
+
*
|
|
30946
30980
|
* @example
|
|
30947
30981
|
* const { invoices, pagination } = await beel.invoices.list({ status: 'ISSUED', limit: 20 });
|
|
30948
30982
|
*/
|
|
@@ -30953,6 +30987,9 @@ declare class InvoicesResource {
|
|
|
30953
30987
|
/**
|
|
30954
30988
|
* Create a new invoice. An idempotency key is automatically added.
|
|
30955
30989
|
*
|
|
30990
|
+
* @param body - Type, recipient and lines.
|
|
30991
|
+
* @returns The created invoice.
|
|
30992
|
+
*
|
|
30956
30993
|
* @example
|
|
30957
30994
|
* const invoice = await beel.invoices.create({
|
|
30958
30995
|
* type: 'STANDARD',
|
|
@@ -31011,7 +31048,12 @@ declare class InvoicesResource {
|
|
|
31011
31048
|
created_at: string;
|
|
31012
31049
|
updated_at: string;
|
|
31013
31050
|
}>;
|
|
31014
|
-
/**
|
|
31051
|
+
/**
|
|
31052
|
+
* Get an invoice by ID.
|
|
31053
|
+
*
|
|
31054
|
+
* @param id - Invoice UUID.
|
|
31055
|
+
* @returns The invoice.
|
|
31056
|
+
*/
|
|
31015
31057
|
get(id: string): Promise<{
|
|
31016
31058
|
invoice_number?: string | null;
|
|
31017
31059
|
series: components["schemas"]["SeriesInfo"];
|
|
@@ -31063,7 +31105,13 @@ declare class InvoicesResource {
|
|
|
31063
31105
|
created_at: string;
|
|
31064
31106
|
updated_at: string;
|
|
31065
31107
|
}>;
|
|
31066
|
-
/**
|
|
31108
|
+
/**
|
|
31109
|
+
* Update a draft invoice. Only draft invoices can be updated.
|
|
31110
|
+
*
|
|
31111
|
+
* @param id - Invoice UUID.
|
|
31112
|
+
* @param body - The draft's new content.
|
|
31113
|
+
* @returns The updated invoice.
|
|
31114
|
+
*/
|
|
31067
31115
|
update(id: string, body: components['schemas']['UpdateInvoiceRequest']): Promise<{
|
|
31068
31116
|
invoice_number?: string | null;
|
|
31069
31117
|
series: components["schemas"]["SeriesInfo"];
|
|
@@ -31115,9 +31163,19 @@ declare class InvoicesResource {
|
|
|
31115
31163
|
created_at: string;
|
|
31116
31164
|
updated_at: string;
|
|
31117
31165
|
}>;
|
|
31118
|
-
/**
|
|
31166
|
+
/**
|
|
31167
|
+
* Delete a draft invoice. Only draft invoices can be deleted.
|
|
31168
|
+
*
|
|
31169
|
+
* @param id - Invoice UUID.
|
|
31170
|
+
*/
|
|
31119
31171
|
delete(id: string): Promise<void>;
|
|
31120
|
-
/**
|
|
31172
|
+
/**
|
|
31173
|
+
* Duplicate an invoice, optionally into a different series.
|
|
31174
|
+
*
|
|
31175
|
+
* @param id - Invoice UUID.
|
|
31176
|
+
* @param options - `series_id` and `notes` of the copy.
|
|
31177
|
+
* @returns The new draft.
|
|
31178
|
+
*/
|
|
31121
31179
|
duplicate(id: string, options?: {
|
|
31122
31180
|
series_id?: string;
|
|
31123
31181
|
notes?: string;
|
|
@@ -31174,7 +31232,10 @@ declare class InvoicesResource {
|
|
|
31174
31232
|
}>;
|
|
31175
31233
|
/**
|
|
31176
31234
|
* Issue a draft invoice. Assigns an invoice number and triggers VeriFactu submission.
|
|
31177
|
-
*
|
|
31235
|
+
*
|
|
31236
|
+
* @param id - Invoice UUID.
|
|
31237
|
+
* @param options - `wait_for_pdf: true` to wait for the PDF.
|
|
31238
|
+
* @returns The issued invoice.
|
|
31178
31239
|
*/
|
|
31179
31240
|
issue(id: string, options?: {
|
|
31180
31241
|
wait_for_pdf?: boolean;
|
|
@@ -31231,8 +31292,10 @@ declare class InvoicesResource {
|
|
|
31231
31292
|
}>;
|
|
31232
31293
|
/**
|
|
31233
31294
|
* Mark an invoice as paid.
|
|
31234
|
-
*
|
|
31235
|
-
* @param
|
|
31295
|
+
*
|
|
31296
|
+
* @param id - Invoice UUID.
|
|
31297
|
+
* @param options - `payment_date` (default: today) and `payment_method`.
|
|
31298
|
+
* @returns The paid invoice.
|
|
31236
31299
|
*/
|
|
31237
31300
|
markPaid(id: string, options?: {
|
|
31238
31301
|
payment_date?: string;
|
|
@@ -31288,7 +31351,13 @@ declare class InvoicesResource {
|
|
|
31288
31351
|
created_at: string;
|
|
31289
31352
|
updated_at: string;
|
|
31290
31353
|
}>;
|
|
31291
|
-
/**
|
|
31354
|
+
/**
|
|
31355
|
+
* Mark an invoice as sent (e.g. delivered by other means).
|
|
31356
|
+
*
|
|
31357
|
+
* @param id - Invoice UUID.
|
|
31358
|
+
* @param options - `sent_at`.
|
|
31359
|
+
* @returns The sent invoice.
|
|
31360
|
+
*/
|
|
31292
31361
|
markSent(id: string, options?: {
|
|
31293
31362
|
sent_at?: string;
|
|
31294
31363
|
}): Promise<{
|
|
@@ -31342,7 +31411,12 @@ declare class InvoicesResource {
|
|
|
31342
31411
|
created_at: string;
|
|
31343
31412
|
updated_at: string;
|
|
31344
31413
|
}>;
|
|
31345
|
-
/**
|
|
31414
|
+
/**
|
|
31415
|
+
* Revert a paid/sent invoice back to issued status.
|
|
31416
|
+
*
|
|
31417
|
+
* @param id - Invoice UUID.
|
|
31418
|
+
* @returns The invoice, back in `ISSUED`.
|
|
31419
|
+
*/
|
|
31346
31420
|
revertToIssued(id: string): Promise<{
|
|
31347
31421
|
invoice_number?: string | null;
|
|
31348
31422
|
series: components["schemas"]["SeriesInfo"];
|
|
@@ -31397,6 +31471,10 @@ declare class InvoicesResource {
|
|
|
31397
31471
|
/**
|
|
31398
31472
|
* Void an issued invoice. Requires a reason (min 10 chars).
|
|
31399
31473
|
*
|
|
31474
|
+
* @param id - Invoice UUID.
|
|
31475
|
+
* @param params - `reason` (min 10 characters) and optional `void_date`.
|
|
31476
|
+
* @returns The voided invoice.
|
|
31477
|
+
*
|
|
31400
31478
|
* @example
|
|
31401
31479
|
* await beel.invoices.void('id', { reason: 'Duplicate invoice sent in error' });
|
|
31402
31480
|
*/
|
|
@@ -31454,7 +31532,13 @@ declare class InvoicesResource {
|
|
|
31454
31532
|
created_at: string;
|
|
31455
31533
|
updated_at: string;
|
|
31456
31534
|
}>;
|
|
31457
|
-
/**
|
|
31535
|
+
/**
|
|
31536
|
+
* Create a corrective invoice that references the original.
|
|
31537
|
+
*
|
|
31538
|
+
* @param id - UUID of the issued invoice to correct.
|
|
31539
|
+
* @param body - Rectification type, code, reason and lines.
|
|
31540
|
+
* @returns The corrective invoice.
|
|
31541
|
+
*/
|
|
31458
31542
|
createCorrective(id: string, body: components['schemas']['CreateCorrectiveInvoiceRequest']): Promise<{
|
|
31459
31543
|
invoice_number?: string | null;
|
|
31460
31544
|
series: components["schemas"]["SeriesInfo"];
|
|
@@ -31506,7 +31590,13 @@ declare class InvoicesResource {
|
|
|
31506
31590
|
created_at: string;
|
|
31507
31591
|
updated_at: string;
|
|
31508
31592
|
}>;
|
|
31509
|
-
/**
|
|
31593
|
+
/**
|
|
31594
|
+
* Schedule a draft invoice to be issued on a future date.
|
|
31595
|
+
*
|
|
31596
|
+
* @param id - UUID of the draft.
|
|
31597
|
+
* @param params - `scheduled_for` and optional `action`.
|
|
31598
|
+
* @returns The scheduled invoice.
|
|
31599
|
+
*/
|
|
31510
31600
|
schedule(id: string, params: {
|
|
31511
31601
|
scheduled_for: string;
|
|
31512
31602
|
action?: string;
|
|
@@ -31561,7 +31651,12 @@ declare class InvoicesResource {
|
|
|
31561
31651
|
created_at: string;
|
|
31562
31652
|
updated_at: string;
|
|
31563
31653
|
}>;
|
|
31564
|
-
/**
|
|
31654
|
+
/**
|
|
31655
|
+
* Cancel a scheduled invoice, returning it to draft.
|
|
31656
|
+
*
|
|
31657
|
+
* @param id - Invoice UUID.
|
|
31658
|
+
* @returns The invoice, back in draft.
|
|
31659
|
+
*/
|
|
31565
31660
|
unschedule(id: string): Promise<{
|
|
31566
31661
|
invoice_number?: string | null;
|
|
31567
31662
|
series: components["schemas"]["SeriesInfo"];
|
|
@@ -31613,7 +31708,13 @@ declare class InvoicesResource {
|
|
|
31613
31708
|
created_at: string;
|
|
31614
31709
|
updated_at: string;
|
|
31615
31710
|
}>;
|
|
31616
|
-
/**
|
|
31711
|
+
/**
|
|
31712
|
+
* Change the scheduled date of a scheduled invoice.
|
|
31713
|
+
*
|
|
31714
|
+
* @param id - Invoice UUID.
|
|
31715
|
+
* @param params - New `scheduled_for`.
|
|
31716
|
+
* @returns The rescheduled invoice.
|
|
31717
|
+
*/
|
|
31617
31718
|
reschedule(id: string, params: {
|
|
31618
31719
|
scheduled_for: string;
|
|
31619
31720
|
}): Promise<{
|
|
@@ -31670,13 +31771,22 @@ declare class InvoicesResource {
|
|
|
31670
31771
|
/**
|
|
31671
31772
|
* Get a pre-signed URL to download the invoice PDF.
|
|
31672
31773
|
* The URL expires in 5 minutes. Use `beel.downloadPdf(id)` for a simpler Buffer download.
|
|
31774
|
+
*
|
|
31775
|
+
* @param id - Invoice UUID.
|
|
31776
|
+
* @returns `download_url`, `expires_in_seconds` and `file_name`.
|
|
31673
31777
|
*/
|
|
31674
31778
|
getPdf(id: string): Promise<{
|
|
31675
31779
|
download_url: string;
|
|
31676
31780
|
expires_in_seconds: number;
|
|
31677
31781
|
file_name: string;
|
|
31678
31782
|
}>;
|
|
31679
|
-
/**
|
|
31783
|
+
/**
|
|
31784
|
+
* Send an invoice by email. Uses the customer's email by default.
|
|
31785
|
+
*
|
|
31786
|
+
* @param id - Invoice UUID.
|
|
31787
|
+
* @param options - Recipients, subject and message.
|
|
31788
|
+
* @returns The delivery record.
|
|
31789
|
+
*/
|
|
31680
31790
|
sendEmail(id: string, options?: {
|
|
31681
31791
|
to?: string[];
|
|
31682
31792
|
cc?: string[];
|
|
@@ -31696,12 +31806,20 @@ declare class InvoicesResource {
|
|
|
31696
31806
|
type Customer$1 = components['schemas']['Customer'];
|
|
31697
31807
|
type Pagination$4 = components['schemas']['Pagination'];
|
|
31698
31808
|
type ListParams$1 = operations['listCustomers']['parameters']['query'];
|
|
31809
|
+
/**
|
|
31810
|
+
* Customers of the focused company, on the flat `/v1/customers` routes.
|
|
31811
|
+
*
|
|
31812
|
+
* @deprecated The contract deprecates the session-focus routes. Use `beel.company(companyId).customers` instead.
|
|
31813
|
+
*/
|
|
31699
31814
|
declare class CustomersResource {
|
|
31700
31815
|
private client;
|
|
31701
31816
|
constructor(client: BeeLClient);
|
|
31702
31817
|
/**
|
|
31703
31818
|
* List customers with optional filters and pagination.
|
|
31704
31819
|
*
|
|
31820
|
+
* @param params - Filters and pagination.
|
|
31821
|
+
* @returns The page of `customers` and its `pagination`.
|
|
31822
|
+
*
|
|
31705
31823
|
* @example
|
|
31706
31824
|
* const { customers, pagination } = await beel.customers.list({ search: 'Acme', limit: 10 });
|
|
31707
31825
|
*/
|
|
@@ -31712,6 +31830,9 @@ declare class CustomersResource {
|
|
|
31712
31830
|
/**
|
|
31713
31831
|
* Create a new customer.
|
|
31714
31832
|
*
|
|
31833
|
+
* @param body - Legal name, NIF and address.
|
|
31834
|
+
* @returns The created customer.
|
|
31835
|
+
*
|
|
31715
31836
|
* @example
|
|
31716
31837
|
* const customer = await beel.customers.create({
|
|
31717
31838
|
* legal_name: 'Acme SL',
|
|
@@ -31738,7 +31859,12 @@ declare class CustomersResource {
|
|
|
31738
31859
|
updated_at?: string;
|
|
31739
31860
|
alternative_id?: components["schemas"]["AlternativeIdentifier"];
|
|
31740
31861
|
}>;
|
|
31741
|
-
/**
|
|
31862
|
+
/**
|
|
31863
|
+
* Get a customer by ID.
|
|
31864
|
+
*
|
|
31865
|
+
* @param id - Customer UUID.
|
|
31866
|
+
* @returns The customer.
|
|
31867
|
+
*/
|
|
31742
31868
|
get(id: string): Promise<{
|
|
31743
31869
|
id: string;
|
|
31744
31870
|
legal_name: string;
|
|
@@ -31758,7 +31884,13 @@ declare class CustomersResource {
|
|
|
31758
31884
|
updated_at?: string;
|
|
31759
31885
|
alternative_id?: components["schemas"]["AlternativeIdentifier"];
|
|
31760
31886
|
}>;
|
|
31761
|
-
/**
|
|
31887
|
+
/**
|
|
31888
|
+
* Update a customer. Only provided fields are changed.
|
|
31889
|
+
*
|
|
31890
|
+
* @param id - Customer UUID.
|
|
31891
|
+
* @param body - Fields to change.
|
|
31892
|
+
* @returns The updated customer.
|
|
31893
|
+
*/
|
|
31762
31894
|
update(id: string, body: components['schemas']['UpdateCustomerRequest']): Promise<{
|
|
31763
31895
|
id: string;
|
|
31764
31896
|
legal_name: string;
|
|
@@ -31778,19 +31910,31 @@ declare class CustomersResource {
|
|
|
31778
31910
|
updated_at?: string;
|
|
31779
31911
|
alternative_id?: components["schemas"]["AlternativeIdentifier"];
|
|
31780
31912
|
}>;
|
|
31781
|
-
/**
|
|
31913
|
+
/**
|
|
31914
|
+
* Deactivate (soft-delete) a customer.
|
|
31915
|
+
*
|
|
31916
|
+
* @param id - Customer UUID.
|
|
31917
|
+
*/
|
|
31782
31918
|
deactivate(id: string): Promise<void>;
|
|
31783
31919
|
}
|
|
31784
31920
|
|
|
31785
31921
|
type Product$1 = components['schemas']['Product'];
|
|
31786
31922
|
type Pagination$3 = components['schemas']['Pagination'];
|
|
31787
31923
|
type ListParams = operations['listProducts']['parameters']['query'];
|
|
31924
|
+
/**
|
|
31925
|
+
* Products of the focused company, on the flat `/v1/products` routes.
|
|
31926
|
+
*
|
|
31927
|
+
* @deprecated The contract deprecates the session-focus routes. Use `beel.company(companyId).products` instead.
|
|
31928
|
+
*/
|
|
31788
31929
|
declare class ProductsResource {
|
|
31789
31930
|
private client;
|
|
31790
31931
|
constructor(client: BeeLClient);
|
|
31791
31932
|
/**
|
|
31792
31933
|
* List products with optional filters and pagination.
|
|
31793
31934
|
*
|
|
31935
|
+
* @param params - Filters and pagination.
|
|
31936
|
+
* @returns The page of `products` and its `pagination`.
|
|
31937
|
+
*
|
|
31794
31938
|
* @example
|
|
31795
31939
|
* const { products, pagination } = await beel.products.list({ category: 'SERVICE' });
|
|
31796
31940
|
*/
|
|
@@ -31801,6 +31945,9 @@ declare class ProductsResource {
|
|
|
31801
31945
|
/**
|
|
31802
31946
|
* Create a new product or service.
|
|
31803
31947
|
*
|
|
31948
|
+
* @param body - Name, category, price and main tax.
|
|
31949
|
+
* @returns The created product.
|
|
31950
|
+
*
|
|
31804
31951
|
* @example
|
|
31805
31952
|
* const product = await beel.products.create({
|
|
31806
31953
|
* name: 'Consulting',
|
|
@@ -31825,7 +31972,12 @@ declare class ProductsResource {
|
|
|
31825
31972
|
created_at: string;
|
|
31826
31973
|
updated_at: string;
|
|
31827
31974
|
}>;
|
|
31828
|
-
/**
|
|
31975
|
+
/**
|
|
31976
|
+
* Get a product by ID.
|
|
31977
|
+
*
|
|
31978
|
+
* @param id - Product UUID.
|
|
31979
|
+
* @returns The product.
|
|
31980
|
+
*/
|
|
31829
31981
|
get(id: string): Promise<{
|
|
31830
31982
|
id: string;
|
|
31831
31983
|
code?: string | null;
|
|
@@ -31841,7 +31993,13 @@ declare class ProductsResource {
|
|
|
31841
31993
|
created_at: string;
|
|
31842
31994
|
updated_at: string;
|
|
31843
31995
|
}>;
|
|
31844
|
-
/**
|
|
31996
|
+
/**
|
|
31997
|
+
* Update a product. Only provided fields are changed.
|
|
31998
|
+
*
|
|
31999
|
+
* @param id - Product UUID.
|
|
32000
|
+
* @param body - Fields to change.
|
|
32001
|
+
* @returns The updated product.
|
|
32002
|
+
*/
|
|
31845
32003
|
update(id: string, body: components['schemas']['UpdateProductRequest']): Promise<{
|
|
31846
32004
|
id: string;
|
|
31847
32005
|
code?: string | null;
|
|
@@ -31857,11 +32015,19 @@ declare class ProductsResource {
|
|
|
31857
32015
|
created_at: string;
|
|
31858
32016
|
updated_at: string;
|
|
31859
32017
|
}>;
|
|
31860
|
-
/**
|
|
32018
|
+
/**
|
|
32019
|
+
* Delete a product permanently.
|
|
32020
|
+
*
|
|
32021
|
+
* @param id - Product UUID.
|
|
32022
|
+
*/
|
|
31861
32023
|
delete(id: string): Promise<void>;
|
|
31862
32024
|
/**
|
|
31863
32025
|
* Search products by name or code. Returns up to `limit` results.
|
|
31864
32026
|
*
|
|
32027
|
+
* @param q - Text to search in name or code.
|
|
32028
|
+
* @param limit - Maximum results.
|
|
32029
|
+
* @returns The matching products, as a bare array.
|
|
32030
|
+
*
|
|
31865
32031
|
* @example
|
|
31866
32032
|
* const results = await beel.products.search('consulting', 5);
|
|
31867
32033
|
*/
|
|
@@ -31882,10 +32048,21 @@ declare class ProductsResource {
|
|
|
31882
32048
|
}[]>;
|
|
31883
32049
|
}
|
|
31884
32050
|
|
|
32051
|
+
/**
|
|
32052
|
+
* Account-wide configuration on the flat `/v1/configuration/*` routes.
|
|
32053
|
+
*
|
|
32054
|
+
* @deprecated The contract deprecates these routes. Use
|
|
32055
|
+
* `beel.company(companyId).taxConfiguration`, `beel.company(companyId).verifactuConfiguration`
|
|
32056
|
+
* and {@link CatalogsResource} (`beel.catalogs`) instead.
|
|
32057
|
+
*/
|
|
31885
32058
|
declare class ConfigurationResource {
|
|
31886
32059
|
private client;
|
|
31887
32060
|
constructor(client: BeeLClient);
|
|
31888
|
-
/**
|
|
32061
|
+
/**
|
|
32062
|
+
* Get the tax configuration (default VAT, IRPF…) of the focused company.
|
|
32063
|
+
*
|
|
32064
|
+
* @returns The tax configuration.
|
|
32065
|
+
*/
|
|
31889
32066
|
getTaxConfig(): Promise<{
|
|
31890
32067
|
default_main_tax: {
|
|
31891
32068
|
type: components["schemas"]["TaxType"];
|
|
@@ -31907,7 +32084,12 @@ declare class ConfigurationResource {
|
|
|
31907
32084
|
suggested_irpf_rate: number | null;
|
|
31908
32085
|
} | undefined;
|
|
31909
32086
|
} | undefined>;
|
|
31910
|
-
/**
|
|
32087
|
+
/**
|
|
32088
|
+
* Replace the tax configuration of the focused company.
|
|
32089
|
+
*
|
|
32090
|
+
* @param body - The complete tax configuration.
|
|
32091
|
+
* @returns The stored configuration.
|
|
32092
|
+
*/
|
|
31911
32093
|
updateTaxConfig(body: any): Promise<{
|
|
31912
32094
|
default_main_tax: {
|
|
31913
32095
|
type: components["schemas"]["TaxType"];
|
|
@@ -31929,7 +32111,11 @@ declare class ConfigurationResource {
|
|
|
31929
32111
|
suggested_irpf_rate: number | null;
|
|
31930
32112
|
} | undefined;
|
|
31931
32113
|
} | undefined>;
|
|
31932
|
-
/**
|
|
32114
|
+
/**
|
|
32115
|
+
* Tax types the API accepts (IVA/IGIC rates, IRPF types, equivalence surcharges).
|
|
32116
|
+
*
|
|
32117
|
+
* @returns The tax types catalog.
|
|
32118
|
+
*/
|
|
31933
32119
|
getTaxTypes(): Promise<{
|
|
31934
32120
|
tax_regimes?: {
|
|
31935
32121
|
code: "IVA" | "IGIC" | "IPSI" | "OTHER";
|
|
@@ -31972,7 +32158,11 @@ declare class ConfigurationResource {
|
|
|
31972
32158
|
available_on_invoice_line: boolean;
|
|
31973
32159
|
}[] | undefined;
|
|
31974
32160
|
} | undefined>;
|
|
31975
|
-
/**
|
|
32161
|
+
/**
|
|
32162
|
+
* Invoice customization options (templates, colors…).
|
|
32163
|
+
*
|
|
32164
|
+
* @returns The customization options.
|
|
32165
|
+
*/
|
|
31976
32166
|
getInvoiceCustomizationOptions(): Promise<{
|
|
31977
32167
|
template_types: {
|
|
31978
32168
|
code: components["schemas"]["InvoiceTemplateType"];
|
|
@@ -31980,11 +32170,20 @@ declare class ConfigurationResource {
|
|
|
31980
32170
|
description: string;
|
|
31981
32171
|
}[];
|
|
31982
32172
|
} | undefined>;
|
|
31983
|
-
/**
|
|
32173
|
+
/**
|
|
32174
|
+
* Update the preferred language of the signed-in person.
|
|
32175
|
+
*
|
|
32176
|
+
* @param language - `es`, `en` or `ca`.
|
|
32177
|
+
* @returns The updated preferences.
|
|
32178
|
+
*/
|
|
31984
32179
|
updateLanguage(language: string): Promise<{
|
|
31985
32180
|
language?: components["schemas"]["Language"] | undefined;
|
|
31986
32181
|
} | undefined>;
|
|
31987
|
-
/**
|
|
32182
|
+
/**
|
|
32183
|
+
* Get the VeriFactu configuration of the focused company.
|
|
32184
|
+
*
|
|
32185
|
+
* @returns The VeriFactu configuration.
|
|
32186
|
+
*/
|
|
31988
32187
|
getVerifactu(): Promise<{
|
|
31989
32188
|
enabled: boolean;
|
|
31990
32189
|
nif_status?: "ACTIVATED" | "DEACTIVATED" | null | undefined;
|
|
@@ -31994,7 +32193,12 @@ declare class ConfigurationResource {
|
|
|
31994
32193
|
activated?: boolean | null | undefined;
|
|
31995
32194
|
pdf_generated?: boolean | null | undefined;
|
|
31996
32195
|
} | undefined>;
|
|
31997
|
-
/**
|
|
32196
|
+
/**
|
|
32197
|
+
* Update the VeriFactu configuration of the focused company.
|
|
32198
|
+
*
|
|
32199
|
+
* @param body - `{ enabled }`.
|
|
32200
|
+
* @returns The updated configuration.
|
|
32201
|
+
*/
|
|
31998
32202
|
updateVerifactu(body: any): Promise<{
|
|
31999
32203
|
enabled: boolean;
|
|
32000
32204
|
nif_status?: "ACTIVATED" | "DEACTIVATED" | null | undefined;
|
|
@@ -32006,7 +32210,8 @@ declare class ConfigurationResource {
|
|
|
32006
32210
|
} | undefined>;
|
|
32007
32211
|
}
|
|
32008
32212
|
/**
|
|
32009
|
-
* Account-wide catalogs and personal preferences, on their
|
|
32213
|
+
* Account-wide catalogs, the credential's identity and personal preferences, on their
|
|
32214
|
+
* canonical paths. Reach it as `beel.catalogs`.
|
|
32010
32215
|
*
|
|
32011
32216
|
* These replace the `/v1/configuration/*` reads on {@link ConfigurationResource},
|
|
32012
32217
|
* whose flat routes are deprecated.
|
|
@@ -32014,7 +32219,32 @@ declare class ConfigurationResource {
|
|
|
32014
32219
|
declare class CatalogsResource {
|
|
32015
32220
|
private client;
|
|
32016
32221
|
constructor(client: BeeLClient);
|
|
32017
|
-
/**
|
|
32222
|
+
/**
|
|
32223
|
+
* Who the API key belongs to: its `account_id` — the starting point to list the
|
|
32224
|
+
* account's companies — plus the person's email, name and language, and the credential.
|
|
32225
|
+
* Needs no scope, so it also confirms that a key works.
|
|
32226
|
+
*
|
|
32227
|
+
* @returns The identity of the credential.
|
|
32228
|
+
*
|
|
32229
|
+
* @example
|
|
32230
|
+
* ```typescript
|
|
32231
|
+
* const { account_id } = await beel.catalogs.identity();
|
|
32232
|
+
* const { companies } = await beel.account(account_id).companies.list();
|
|
32233
|
+
* ```
|
|
32234
|
+
*/
|
|
32235
|
+
identity(): Promise<{
|
|
32236
|
+
account_id: components["schemas"]["UUID"] & unknown;
|
|
32237
|
+
name?: string | null;
|
|
32238
|
+
email: components["schemas"]["Email"];
|
|
32239
|
+
logo_url?: string | null;
|
|
32240
|
+
language?: components["schemas"]["Language"] & unknown;
|
|
32241
|
+
credential?: components["schemas"]["MyCredential"];
|
|
32242
|
+
}>;
|
|
32243
|
+
/**
|
|
32244
|
+
* Tax types the API accepts. Canonical form of `configuration/tax-types`.
|
|
32245
|
+
*
|
|
32246
|
+
* @returns The tax types catalog.
|
|
32247
|
+
*/
|
|
32018
32248
|
taxTypes(): Promise<{
|
|
32019
32249
|
tax_regimes?: {
|
|
32020
32250
|
code: "IVA" | "IGIC" | "IPSI" | "OTHER";
|
|
@@ -32057,7 +32287,11 @@ declare class CatalogsResource {
|
|
|
32057
32287
|
available_on_invoice_line: boolean;
|
|
32058
32288
|
}[] | undefined;
|
|
32059
32289
|
} | undefined>;
|
|
32060
|
-
/**
|
|
32290
|
+
/**
|
|
32291
|
+
* Invoice PDF templates and customization options. Canonical form of the `configuration` read.
|
|
32292
|
+
*
|
|
32293
|
+
* @returns The customization options.
|
|
32294
|
+
*/
|
|
32061
32295
|
invoiceCustomizationOptions(): Promise<{
|
|
32062
32296
|
template_types: {
|
|
32063
32297
|
code: components["schemas"]["InvoiceTemplateType"];
|
|
@@ -32066,20 +32300,31 @@ declare class CatalogsResource {
|
|
|
32066
32300
|
}[];
|
|
32067
32301
|
} | undefined>;
|
|
32068
32302
|
/**
|
|
32069
|
-
*
|
|
32303
|
+
* Update the signed-in person's preferences. Canonical form of
|
|
32070
32304
|
* `PUT /v1/configuration/language`: the language belongs to the person, not to a company.
|
|
32305
|
+
*
|
|
32306
|
+
* @param body - Preferences to change, e.g. `{ language: 'es' }`.
|
|
32307
|
+
* @returns The updated preferences.
|
|
32071
32308
|
*/
|
|
32072
32309
|
updateMe(body: components['schemas']['UpdateMeRequest']): Promise<{
|
|
32073
32310
|
language: components["schemas"]["Language"];
|
|
32074
32311
|
}>;
|
|
32075
32312
|
}
|
|
32076
32313
|
|
|
32314
|
+
/**
|
|
32315
|
+
* Invoice series of the focused company, on the flat `/v1/configuration/series` routes.
|
|
32316
|
+
*
|
|
32317
|
+
* @deprecated The contract deprecates the session-focus routes. Use `beel.company(companyId).series` instead.
|
|
32318
|
+
*/
|
|
32077
32319
|
declare class SeriesResource {
|
|
32078
32320
|
private client;
|
|
32079
32321
|
constructor(client: BeeLClient);
|
|
32080
32322
|
/**
|
|
32081
32323
|
* List all invoice series. Optionally filter by active status.
|
|
32082
32324
|
*
|
|
32325
|
+
* @param active - Only active (`true`) or inactive (`false`) series; all when omitted.
|
|
32326
|
+
* @returns The series.
|
|
32327
|
+
*
|
|
32083
32328
|
* @example
|
|
32084
32329
|
* const series = await beel.series.list();
|
|
32085
32330
|
* const activeSeries = await beel.series.list(true);
|
|
@@ -32110,7 +32355,12 @@ declare class SeriesResource {
|
|
|
32110
32355
|
has_previous?: boolean | undefined;
|
|
32111
32356
|
} | undefined;
|
|
32112
32357
|
} | undefined>;
|
|
32113
|
-
/**
|
|
32358
|
+
/**
|
|
32359
|
+
* Create a new invoice series (e.g. "A-2026", "RECT").
|
|
32360
|
+
*
|
|
32361
|
+
* @param body - Code, name and format.
|
|
32362
|
+
* @returns The created series.
|
|
32363
|
+
*/
|
|
32114
32364
|
create(body: any): Promise<{
|
|
32115
32365
|
id: string;
|
|
32116
32366
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -32127,7 +32377,13 @@ declare class SeriesResource {
|
|
|
32127
32377
|
readonly next_number?: number | undefined;
|
|
32128
32378
|
updated_at?: string | undefined;
|
|
32129
32379
|
} | undefined>;
|
|
32130
|
-
/**
|
|
32380
|
+
/**
|
|
32381
|
+
* Update a series (name, description, etc.).
|
|
32382
|
+
*
|
|
32383
|
+
* @param id - Series UUID.
|
|
32384
|
+
* @param body - Fields to change.
|
|
32385
|
+
* @returns The updated series.
|
|
32386
|
+
*/
|
|
32131
32387
|
update(id: string, body: any): Promise<{
|
|
32132
32388
|
id: string;
|
|
32133
32389
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -32144,9 +32400,18 @@ declare class SeriesResource {
|
|
|
32144
32400
|
readonly next_number?: number | undefined;
|
|
32145
32401
|
updated_at?: string | undefined;
|
|
32146
32402
|
} | undefined>;
|
|
32147
|
-
/**
|
|
32403
|
+
/**
|
|
32404
|
+
* Delete an invoice series. Only empty series can be deleted.
|
|
32405
|
+
*
|
|
32406
|
+
* @param id - Series UUID.
|
|
32407
|
+
*/
|
|
32148
32408
|
delete(id: string): Promise<void>;
|
|
32149
|
-
/**
|
|
32409
|
+
/**
|
|
32410
|
+
* Set a series as the default for new invoices.
|
|
32411
|
+
*
|
|
32412
|
+
* @param id - Series UUID.
|
|
32413
|
+
* @returns The series.
|
|
32414
|
+
*/
|
|
32150
32415
|
setDefault(id: string): Promise<{
|
|
32151
32416
|
id: string;
|
|
32152
32417
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -32165,12 +32430,18 @@ declare class SeriesResource {
|
|
|
32165
32430
|
} | undefined>;
|
|
32166
32431
|
}
|
|
32167
32432
|
|
|
32433
|
+
/**
|
|
32434
|
+
* NIF validation against the AEAT register. Reach it as `beel.nif`.
|
|
32435
|
+
*/
|
|
32168
32436
|
declare class NifResource {
|
|
32169
32437
|
private client;
|
|
32170
32438
|
constructor(client: BeeLClient);
|
|
32171
32439
|
/**
|
|
32172
32440
|
* Validate a Spanish NIF/CIF against the AEAT tax registry.
|
|
32173
32441
|
*
|
|
32442
|
+
* @param nif - The NIF/CIF to validate.
|
|
32443
|
+
* @returns Whether it is valid and, when the register knows it, its holder's name.
|
|
32444
|
+
*
|
|
32174
32445
|
* @example
|
|
32175
32446
|
* const result = await beel.nif.validate('B12345678');
|
|
32176
32447
|
* console.log(result.valid, result.name);
|
|
@@ -32191,7 +32462,10 @@ type WebhookSubscription = components['schemas']['WebhookSubscription'];
|
|
|
32191
32462
|
type CompanyData = components['schemas']['CompanyData'];
|
|
32192
32463
|
type Pagination$2 = components['schemas']['Pagination'];
|
|
32193
32464
|
/**
|
|
32194
|
-
* Accounts
|
|
32465
|
+
* Accounts you provisioned and manage (multi-account provisioning for platforms and
|
|
32466
|
+
* advisory firms). Reach it as `beel.accounts`; scope one with `beel.account(accountId)`.
|
|
32467
|
+
*
|
|
32468
|
+
* Every method rejects with a `BeeLApiError` subclass when the API answers non-2xx.
|
|
32195
32469
|
*
|
|
32196
32470
|
* @example
|
|
32197
32471
|
* ```typescript
|
|
@@ -32203,14 +32477,24 @@ type Pagination$2 = components['schemas']['Pagination'];
|
|
|
32203
32477
|
declare class AccountsResource {
|
|
32204
32478
|
private client;
|
|
32205
32479
|
constructor(client: BeeLClient);
|
|
32206
|
-
/**
|
|
32480
|
+
/**
|
|
32481
|
+
* List the accounts you provisioned, newest first. Cursor-paginated: pass the
|
|
32482
|
+
* `next_cursor` of one page as `cursor` of the next until it is `null`.
|
|
32483
|
+
*
|
|
32484
|
+
* @param params - `status`, `external_ref` (exact), `limit`, `cursor`.
|
|
32485
|
+
* @returns The `accounts` of the page and `next_cursor`.
|
|
32486
|
+
*/
|
|
32207
32487
|
list(params?: operations['listAccounts']['parameters']['query']): Promise<{
|
|
32208
32488
|
accounts: ManagedAccountSummary[];
|
|
32209
32489
|
next_cursor?: string | null;
|
|
32210
32490
|
}>;
|
|
32211
32491
|
/**
|
|
32212
|
-
* Provision a new managed account.
|
|
32213
|
-
*
|
|
32492
|
+
* Provision a new managed account. Idempotent by `external_ref`: sending the same one
|
|
32493
|
+
* again returns the same account. Answers with the provisioning result — the account id,
|
|
32494
|
+
* its status and, when one is issued, the claim link — not with the account summary.
|
|
32495
|
+
*
|
|
32496
|
+
* @param body - `external_ref` and the holder's details.
|
|
32497
|
+
* @returns `account_id`, `status` and the claim link state.
|
|
32214
32498
|
*/
|
|
32215
32499
|
provision(body: operations['provisionAccount']['requestBody']['content']['application/json']): Promise<{
|
|
32216
32500
|
person_id?: string | null;
|
|
@@ -32221,7 +32505,12 @@ declare class AccountsResource {
|
|
|
32221
32505
|
claim_link_already_issued: boolean;
|
|
32222
32506
|
company_id?: string | null;
|
|
32223
32507
|
}>;
|
|
32224
|
-
/**
|
|
32508
|
+
/**
|
|
32509
|
+
* Get a managed account.
|
|
32510
|
+
*
|
|
32511
|
+
* @param accountId - Account UUID.
|
|
32512
|
+
* @returns The account summary.
|
|
32513
|
+
*/
|
|
32225
32514
|
get(accountId: string): Promise<{
|
|
32226
32515
|
account_id: string;
|
|
32227
32516
|
external_ref: string;
|
|
@@ -32233,20 +32522,42 @@ declare class AccountsResource {
|
|
|
32233
32522
|
representation_signed: boolean;
|
|
32234
32523
|
created_at: string;
|
|
32235
32524
|
}>;
|
|
32236
|
-
/**
|
|
32525
|
+
/**
|
|
32526
|
+
* Alias of `beel.account(accountId)`: the operations scoped to one account.
|
|
32527
|
+
*
|
|
32528
|
+
* @param accountId - Account UUID.
|
|
32529
|
+
* @returns The account scope. No request is made.
|
|
32530
|
+
*/
|
|
32237
32531
|
scope(accountId: string): AccountScope;
|
|
32238
32532
|
}
|
|
32239
|
-
/**
|
|
32533
|
+
/**
|
|
32534
|
+
* Operations scoped to one account: its companies (NIFs), members, invitations, webhooks
|
|
32535
|
+
* and usage. Reach it as `beel.account(accountId)`.
|
|
32536
|
+
*
|
|
32537
|
+
* @example
|
|
32538
|
+
* ```typescript
|
|
32539
|
+
* const { companies } = await beel.account('account-uuid').companies.list();
|
|
32540
|
+
* const company = beel.company(companies[0].id!);
|
|
32541
|
+
* ```
|
|
32542
|
+
*/
|
|
32240
32543
|
declare class AccountScope {
|
|
32241
32544
|
private client;
|
|
32242
32545
|
readonly accountId: string;
|
|
32546
|
+
/** Members of the account and their per-company grants. */
|
|
32243
32547
|
readonly members: AccountMembersResource;
|
|
32548
|
+
/** Invitations to join the account. */
|
|
32244
32549
|
readonly invitations: AccountInvitationsResource;
|
|
32550
|
+
/** Webhook subscriptions of the account. */
|
|
32245
32551
|
readonly webhooks: AccountWebhooksResource;
|
|
32552
|
+
/** Companies (NIFs) of the account — where company ids come from. */
|
|
32246
32553
|
readonly companies: AccountCompaniesResource;
|
|
32247
32554
|
constructor(client: BeeLClient, accountId: string);
|
|
32248
32555
|
private path;
|
|
32249
|
-
/**
|
|
32556
|
+
/**
|
|
32557
|
+
* Get the account summary.
|
|
32558
|
+
*
|
|
32559
|
+
* @returns The account summary.
|
|
32560
|
+
*/
|
|
32250
32561
|
get(): Promise<{
|
|
32251
32562
|
account_id: string;
|
|
32252
32563
|
external_ref: string;
|
|
@@ -32258,30 +32569,59 @@ declare class AccountScope {
|
|
|
32258
32569
|
representation_signed: boolean;
|
|
32259
32570
|
created_at: string;
|
|
32260
32571
|
}>;
|
|
32261
|
-
/**
|
|
32572
|
+
/**
|
|
32573
|
+
* Provisioning usage counters for billing: provisioned accounts and NIFs.
|
|
32574
|
+
*
|
|
32575
|
+
* @returns `provisioned_accounts` and `nifs`.
|
|
32576
|
+
*/
|
|
32262
32577
|
usage(): Promise<{
|
|
32263
32578
|
provisioned_accounts: number;
|
|
32264
32579
|
nifs: number;
|
|
32265
32580
|
}>;
|
|
32266
|
-
/**
|
|
32581
|
+
/**
|
|
32582
|
+
* Change the access level you keep over this account. Raising it is only possible while
|
|
32583
|
+
* the account is unclaimed.
|
|
32584
|
+
*
|
|
32585
|
+
* @param body - The new `access_level`.
|
|
32586
|
+
*/
|
|
32267
32587
|
changeAccessLevel(body: NonNullable<operations['changeManagedAccountAccessLevel']['requestBody']>['content']['application/json']): Promise<void>;
|
|
32268
|
-
/**
|
|
32588
|
+
/**
|
|
32589
|
+
* End your management of this account: you lose access, and the holder keeps the
|
|
32590
|
+
* account, its NIFs and its invoices.
|
|
32591
|
+
*/
|
|
32269
32592
|
endManagement(): Promise<void>;
|
|
32270
|
-
/**
|
|
32593
|
+
/**
|
|
32594
|
+
* Issue a single-use claim token so the account's holder can take ownership.
|
|
32595
|
+
*
|
|
32596
|
+
* @param body - `email` when the account has no holder yet; omit to re-issue.
|
|
32597
|
+
* @returns `claim_token`, `claim_url` and `expires_at`.
|
|
32598
|
+
*/
|
|
32271
32599
|
createClaimToken(body?: NonNullable<operations['createAccountClaimToken']['requestBody']>['content']['application/json']): Promise<{
|
|
32272
32600
|
person_id: string;
|
|
32273
32601
|
claim_token: string;
|
|
32274
32602
|
claim_url: string;
|
|
32275
32603
|
expires_at: string;
|
|
32276
32604
|
}>;
|
|
32277
|
-
/**
|
|
32605
|
+
/**
|
|
32606
|
+
* Make an existing member the account's owner. Repeatable: it states the desired owner.
|
|
32607
|
+
*
|
|
32608
|
+
* @param body - The member that becomes owner.
|
|
32609
|
+
*/
|
|
32278
32610
|
setOwner(body: operations['putAccountOwner']['requestBody']['content']['application/json']): Promise<void>;
|
|
32279
32611
|
}
|
|
32280
|
-
/**
|
|
32612
|
+
/**
|
|
32613
|
+
* Members of an account and their per-company grants. Reach it as
|
|
32614
|
+
* `beel.account(accountId).members`.
|
|
32615
|
+
*/
|
|
32281
32616
|
declare class AccountMembersResource {
|
|
32282
32617
|
private client;
|
|
32283
32618
|
private accountId;
|
|
32284
32619
|
constructor(client: BeeLClient, accountId: string);
|
|
32620
|
+
/**
|
|
32621
|
+
* List the account's members.
|
|
32622
|
+
*
|
|
32623
|
+
* @returns The members (`data.members` of the response), as an array.
|
|
32624
|
+
*/
|
|
32285
32625
|
list(): Promise<{
|
|
32286
32626
|
member_id: string;
|
|
32287
32627
|
person_id: string;
|
|
@@ -32290,6 +32630,12 @@ declare class AccountMembersResource {
|
|
|
32290
32630
|
grants?: components["schemas"]["MemberGrant"][];
|
|
32291
32631
|
permissions: components["schemas"]["MemberPermissions"];
|
|
32292
32632
|
}[]>;
|
|
32633
|
+
/**
|
|
32634
|
+
* Get one member.
|
|
32635
|
+
*
|
|
32636
|
+
* @param memberId - Member UUID.
|
|
32637
|
+
* @returns The member.
|
|
32638
|
+
*/
|
|
32293
32639
|
get(memberId: string): Promise<{
|
|
32294
32640
|
member_id: string;
|
|
32295
32641
|
person_id: string;
|
|
@@ -32298,7 +32644,13 @@ declare class AccountMembersResource {
|
|
|
32298
32644
|
grants?: components["schemas"]["MemberGrant"][];
|
|
32299
32645
|
permissions: components["schemas"]["MemberPermissions"];
|
|
32300
32646
|
}>;
|
|
32301
|
-
/**
|
|
32647
|
+
/**
|
|
32648
|
+
* Change a member's account role.
|
|
32649
|
+
*
|
|
32650
|
+
* @param memberId - Member UUID.
|
|
32651
|
+
* @param body - The new `account_role`.
|
|
32652
|
+
* @returns The updated member.
|
|
32653
|
+
*/
|
|
32302
32654
|
update(memberId: string, body: operations['patchAccountMember']['requestBody']['content']['application/json']): Promise<{
|
|
32303
32655
|
member_id: string;
|
|
32304
32656
|
person_id: string;
|
|
@@ -32307,9 +32659,18 @@ declare class AccountMembersResource {
|
|
|
32307
32659
|
grants?: components["schemas"]["MemberGrant"][];
|
|
32308
32660
|
permissions: components["schemas"]["MemberPermissions"];
|
|
32309
32661
|
}>;
|
|
32310
|
-
/**
|
|
32662
|
+
/**
|
|
32663
|
+
* Remove a member from the account.
|
|
32664
|
+
*
|
|
32665
|
+
* @param memberId - Member UUID.
|
|
32666
|
+
*/
|
|
32311
32667
|
remove(memberId: string): Promise<void>;
|
|
32312
|
-
/**
|
|
32668
|
+
/**
|
|
32669
|
+
* List a member's per-company grants.
|
|
32670
|
+
*
|
|
32671
|
+
* @param memberId - Member UUID.
|
|
32672
|
+
* @returns The `grants` and their `pagination`.
|
|
32673
|
+
*/
|
|
32313
32674
|
listGrants(memberId: string): Promise<{
|
|
32314
32675
|
grants: {
|
|
32315
32676
|
company_id: string;
|
|
@@ -32325,19 +32686,36 @@ declare class AccountMembersResource {
|
|
|
32325
32686
|
has_previous?: boolean | undefined;
|
|
32326
32687
|
};
|
|
32327
32688
|
} | undefined>;
|
|
32328
|
-
/**
|
|
32689
|
+
/**
|
|
32690
|
+
* Grant a member access to one company, or replace the grant it has.
|
|
32691
|
+
*
|
|
32692
|
+
* @param memberId - Member UUID.
|
|
32693
|
+
* @param companyId - Company UUID.
|
|
32694
|
+
* @param body - The `access_level` to grant.
|
|
32695
|
+
* @returns The grant.
|
|
32696
|
+
*/
|
|
32329
32697
|
putGrant(memberId: string, companyId: string, body: operations['putAccountMemberGrant']['requestBody']['content']['application/json']): Promise<{
|
|
32330
32698
|
company_id: string;
|
|
32331
32699
|
access_level: "VIEW" | "OPERATE";
|
|
32332
32700
|
} | undefined>;
|
|
32333
|
-
/**
|
|
32701
|
+
/**
|
|
32702
|
+
* Revoke a member's access to one company.
|
|
32703
|
+
*
|
|
32704
|
+
* @param memberId - Member UUID.
|
|
32705
|
+
* @param companyId - Company UUID.
|
|
32706
|
+
*/
|
|
32334
32707
|
removeGrant(memberId: string, companyId: string): Promise<void>;
|
|
32335
32708
|
}
|
|
32336
|
-
/** Invitations to join an account. */
|
|
32709
|
+
/** Invitations to join an account. Reach it as `beel.account(accountId).invitations`. */
|
|
32337
32710
|
declare class AccountInvitationsResource {
|
|
32338
32711
|
private client;
|
|
32339
32712
|
private accountId;
|
|
32340
32713
|
constructor(client: BeeLClient, accountId: string);
|
|
32714
|
+
/**
|
|
32715
|
+
* List the account's invitations.
|
|
32716
|
+
*
|
|
32717
|
+
* @returns The invitations.
|
|
32718
|
+
*/
|
|
32341
32719
|
list(): Promise<{
|
|
32342
32720
|
invitations: {
|
|
32343
32721
|
invitation_id: string;
|
|
@@ -32356,6 +32734,12 @@ declare class AccountInvitationsResource {
|
|
|
32356
32734
|
has_previous?: boolean | undefined;
|
|
32357
32735
|
};
|
|
32358
32736
|
}>;
|
|
32737
|
+
/**
|
|
32738
|
+
* Invite someone to join the account.
|
|
32739
|
+
*
|
|
32740
|
+
* @param body - `invited_email` and the `account_role` to grant.
|
|
32741
|
+
* @returns The invitation.
|
|
32742
|
+
*/
|
|
32359
32743
|
create(body: operations['createAccountInvitation']['requestBody']['content']['application/json']): Promise<{
|
|
32360
32744
|
invitation_id: string;
|
|
32361
32745
|
invited_email: string;
|
|
@@ -32364,6 +32748,12 @@ declare class AccountInvitationsResource {
|
|
|
32364
32748
|
token: string;
|
|
32365
32749
|
invitation_url?: string | null;
|
|
32366
32750
|
}>;
|
|
32751
|
+
/**
|
|
32752
|
+
* Get one invitation.
|
|
32753
|
+
*
|
|
32754
|
+
* @param invitationId - Invitation UUID.
|
|
32755
|
+
* @returns The invitation.
|
|
32756
|
+
*/
|
|
32367
32757
|
get(invitationId: string): Promise<{
|
|
32368
32758
|
invitation_id: string;
|
|
32369
32759
|
invited_email: string;
|
|
@@ -32372,17 +32762,37 @@ declare class AccountInvitationsResource {
|
|
|
32372
32762
|
created_at: string;
|
|
32373
32763
|
expires_at: string;
|
|
32374
32764
|
}>;
|
|
32765
|
+
/**
|
|
32766
|
+
* Revoke a `PENDING` invitation, so its link stops working.
|
|
32767
|
+
*
|
|
32768
|
+
* @param invitationId - Invitation UUID.
|
|
32769
|
+
*/
|
|
32375
32770
|
revoke(invitationId: string): Promise<void>;
|
|
32376
32771
|
}
|
|
32377
|
-
/**
|
|
32772
|
+
/**
|
|
32773
|
+
* Webhook subscriptions of an account. Reach it as `beel.account(accountId).webhooks`;
|
|
32774
|
+
* verify deliveries with `WebhookVerifier`.
|
|
32775
|
+
*/
|
|
32378
32776
|
declare class AccountWebhooksResource {
|
|
32379
32777
|
private client;
|
|
32380
32778
|
private accountId;
|
|
32381
32779
|
constructor(client: BeeLClient, accountId: string);
|
|
32780
|
+
/**
|
|
32781
|
+
* List the webhook subscriptions.
|
|
32782
|
+
*
|
|
32783
|
+
* @param params - Pagination.
|
|
32784
|
+
* @returns The `webhooks` and their `pagination`.
|
|
32785
|
+
*/
|
|
32382
32786
|
list(params?: operations['listAccountWebhookSubscriptions']['parameters']['query']): Promise<{
|
|
32383
32787
|
webhooks?: WebhookSubscription[];
|
|
32384
32788
|
pagination?: Pagination$2;
|
|
32385
32789
|
}>;
|
|
32790
|
+
/**
|
|
32791
|
+
* Subscribe an HTTPS endpoint to events.
|
|
32792
|
+
*
|
|
32793
|
+
* @param body - `url` and the `events` to receive.
|
|
32794
|
+
* @returns The subscription, with its signing secret.
|
|
32795
|
+
*/
|
|
32386
32796
|
create(body: operations['createAccountWebhookSubscription']['requestBody']['content']['application/json']): Promise<{
|
|
32387
32797
|
id: string;
|
|
32388
32798
|
url: string;
|
|
@@ -32405,6 +32815,12 @@ declare class AccountWebhooksResource {
|
|
|
32405
32815
|
failure_cause?: components["schemas"]["WebhookFailureCause"] | undefined;
|
|
32406
32816
|
} | null | undefined;
|
|
32407
32817
|
} | undefined>;
|
|
32818
|
+
/**
|
|
32819
|
+
* Get one webhook subscription.
|
|
32820
|
+
*
|
|
32821
|
+
* @param webhookId - Subscription UUID.
|
|
32822
|
+
* @returns The subscription.
|
|
32823
|
+
*/
|
|
32408
32824
|
get(webhookId: string): Promise<{
|
|
32409
32825
|
id: string;
|
|
32410
32826
|
url: string;
|
|
@@ -32419,6 +32835,13 @@ declare class AccountWebhooksResource {
|
|
|
32419
32835
|
last_used_at?: string | null;
|
|
32420
32836
|
created_at: string;
|
|
32421
32837
|
}>;
|
|
32838
|
+
/**
|
|
32839
|
+
* Update a webhook subscription. Only the fields present in `body` change.
|
|
32840
|
+
*
|
|
32841
|
+
* @param webhookId - Subscription UUID.
|
|
32842
|
+
* @param body - Fields to change.
|
|
32843
|
+
* @returns The updated subscription.
|
|
32844
|
+
*/
|
|
32422
32845
|
update(webhookId: string, body: operations['patchAccountWebhookSubscription']['requestBody']['content']['application/json']): Promise<{
|
|
32423
32846
|
id: string;
|
|
32424
32847
|
url: string;
|
|
@@ -32433,8 +32856,18 @@ declare class AccountWebhooksResource {
|
|
|
32433
32856
|
last_used_at?: string | null;
|
|
32434
32857
|
created_at: string;
|
|
32435
32858
|
}>;
|
|
32859
|
+
/**
|
|
32860
|
+
* Delete a webhook subscription.
|
|
32861
|
+
*
|
|
32862
|
+
* @param webhookId - Subscription UUID.
|
|
32863
|
+
*/
|
|
32436
32864
|
delete(webhookId: string): Promise<void>;
|
|
32437
|
-
/**
|
|
32865
|
+
/**
|
|
32866
|
+
* Send a test event to the endpoint. Test deliveries carry `test: true`.
|
|
32867
|
+
*
|
|
32868
|
+
* @param webhookId - Subscription UUID.
|
|
32869
|
+
* @returns The outcome of the delivery.
|
|
32870
|
+
*/
|
|
32438
32871
|
test(webhookId: string): Promise<{
|
|
32439
32872
|
delivery_success?: boolean | undefined;
|
|
32440
32873
|
http_status?: number | null | undefined;
|
|
@@ -32442,7 +32875,12 @@ declare class AccountWebhooksResource {
|
|
|
32442
32875
|
error?: string | null | undefined;
|
|
32443
32876
|
failure_cause?: components["schemas"]["WebhookFailureCause"] | undefined;
|
|
32444
32877
|
} | undefined>;
|
|
32445
|
-
/**
|
|
32878
|
+
/**
|
|
32879
|
+
* Rotate the signing secret. The old secret stops working immediately.
|
|
32880
|
+
*
|
|
32881
|
+
* @param webhookId - Subscription UUID.
|
|
32882
|
+
* @returns The subscription with its new secret.
|
|
32883
|
+
*/
|
|
32446
32884
|
rotateSecret(webhookId: string): Promise<{
|
|
32447
32885
|
id: string;
|
|
32448
32886
|
url: string;
|
|
@@ -32465,6 +32903,13 @@ declare class AccountWebhooksResource {
|
|
|
32465
32903
|
failure_cause?: components["schemas"]["WebhookFailureCause"] | undefined;
|
|
32466
32904
|
} | null | undefined;
|
|
32467
32905
|
} | undefined>;
|
|
32906
|
+
/**
|
|
32907
|
+
* List the delivery attempts of a subscription.
|
|
32908
|
+
*
|
|
32909
|
+
* @param webhookId - Subscription UUID.
|
|
32910
|
+
* @param params - Filters and pagination.
|
|
32911
|
+
* @returns The deliveries.
|
|
32912
|
+
*/
|
|
32468
32913
|
listDeliveries(webhookId: string, params?: operations['listAccountWebhookDeliveries']['parameters']['query']): Promise<{
|
|
32469
32914
|
deliveries?: {
|
|
32470
32915
|
id?: string | undefined;
|
|
@@ -32494,6 +32939,13 @@ declare class AccountWebhooksResource {
|
|
|
32494
32939
|
has_previous?: boolean | undefined;
|
|
32495
32940
|
} | undefined;
|
|
32496
32941
|
} | undefined>;
|
|
32942
|
+
/**
|
|
32943
|
+
* Retry a failed delivery.
|
|
32944
|
+
*
|
|
32945
|
+
* @param webhookId - Subscription UUID.
|
|
32946
|
+
* @param deliveryId - Delivery UUID.
|
|
32947
|
+
* @returns The new delivery attempt.
|
|
32948
|
+
*/
|
|
32497
32949
|
retryDelivery(webhookId: string, deliveryId: string): Promise<{
|
|
32498
32950
|
id?: string | undefined;
|
|
32499
32951
|
subscription_id?: string | undefined;
|
|
@@ -32514,16 +32966,37 @@ declare class AccountWebhooksResource {
|
|
|
32514
32966
|
delivered_at?: string | undefined;
|
|
32515
32967
|
} | undefined>;
|
|
32516
32968
|
}
|
|
32517
|
-
/**
|
|
32969
|
+
/**
|
|
32970
|
+
* Companies (NIFs) of an account — where the `companyId` of `beel.company(companyId)`
|
|
32971
|
+
* comes from. Reach it as `beel.account(accountId).companies`.
|
|
32972
|
+
*/
|
|
32518
32973
|
declare class AccountCompaniesResource {
|
|
32519
32974
|
private client;
|
|
32520
32975
|
private accountId;
|
|
32521
32976
|
constructor(client: BeeLClient, accountId: string);
|
|
32522
|
-
|
|
32977
|
+
/**
|
|
32978
|
+
* List the account's companies, primary first. Always paginated (20 by default).
|
|
32979
|
+
*
|
|
32980
|
+
* @param params - `search`, `include`, `page`, `limit`.
|
|
32981
|
+
* @returns The `companies` of the page and its `pagination`.
|
|
32982
|
+
*
|
|
32983
|
+
* @example
|
|
32984
|
+
* ```typescript
|
|
32985
|
+
* const { account_id } = await beel.catalogs.identity();
|
|
32986
|
+
* const { companies } = await beel.account(account_id).companies.list({ search: 'B12345678' });
|
|
32987
|
+
* const company = beel.company(companies[0].id!);
|
|
32988
|
+
* ```
|
|
32989
|
+
*/
|
|
32990
|
+
list(params?: operations['listCompanies']['parameters']['query']): Promise<{
|
|
32523
32991
|
companies: CompanyData[];
|
|
32524
32992
|
pagination: Pagination$2 | undefined;
|
|
32525
32993
|
}>;
|
|
32526
|
-
/**
|
|
32994
|
+
/**
|
|
32995
|
+
* Register a new company (NIF) under the account.
|
|
32996
|
+
*
|
|
32997
|
+
* @param body - NIF, legal name, entity type and address.
|
|
32998
|
+
* @returns The created company.
|
|
32999
|
+
*/
|
|
32527
33000
|
create(body: components['schemas']['CreateCompanyRequest']): Promise<{
|
|
32528
33001
|
id?: string;
|
|
32529
33002
|
access_level?: components["schemas"]["AccessLevel"];
|
|
@@ -32570,7 +33043,11 @@ declare class AccountCompaniesResource {
|
|
|
32570
33043
|
created_at?: string;
|
|
32571
33044
|
readiness?: components["schemas"]["IssuingReadinessData"] | null;
|
|
32572
33045
|
}>;
|
|
32573
|
-
/**
|
|
33046
|
+
/**
|
|
33047
|
+
* Per-company invoice stats: how many fiscal documents each issued, and when last.
|
|
33048
|
+
*
|
|
33049
|
+
* @returns One entry per company.
|
|
33050
|
+
*/
|
|
32574
33051
|
stats(): Promise<{
|
|
32575
33052
|
stats: {
|
|
32576
33053
|
company_id: string;
|
|
@@ -32588,6 +33065,31 @@ declare class AccountCompaniesResource {
|
|
|
32588
33065
|
} | undefined>;
|
|
32589
33066
|
}
|
|
32590
33067
|
|
|
33068
|
+
/**
|
|
33069
|
+
* Per-call options, accepted as the last argument of the `company.invoices` methods.
|
|
33070
|
+
*
|
|
33071
|
+
* @example
|
|
33072
|
+
* ```typescript
|
|
33073
|
+
* await company.invoices.create(body, undefined, {
|
|
33074
|
+
* idempotencyKey: `order-${order.id}`,
|
|
33075
|
+
* timeoutMs: 15_000,
|
|
33076
|
+
* });
|
|
33077
|
+
* ```
|
|
33078
|
+
*/
|
|
33079
|
+
interface RequestOptions {
|
|
33080
|
+
/**
|
|
33081
|
+
* `Idempotency-Key` of this call, instead of the automatic one: letters, digits, `_` and
|
|
33082
|
+
* `-`, up to 255 characters. Every automatic retry of the call reuses it. Persist it with
|
|
33083
|
+
* your order to retry the same operation later: within 24 hours the API replays the first
|
|
33084
|
+
* `2xx` or `5xx` answer instead of running the operation again.
|
|
33085
|
+
*/
|
|
33086
|
+
idempotencyKey?: string;
|
|
33087
|
+
/** Aborts the call — the automatic retries and the waits between them included. */
|
|
33088
|
+
signal?: AbortSignal;
|
|
33089
|
+
/** Aborts the call after this many milliseconds, automatic retries included. */
|
|
33090
|
+
timeoutMs?: number;
|
|
33091
|
+
}
|
|
33092
|
+
|
|
32591
33093
|
type ManagedPaymentConnection = components['schemas']['ManagedPaymentConnection'];
|
|
32592
33094
|
type ManagedPaymentEvent = components['schemas']['ManagedPaymentEvent'];
|
|
32593
33095
|
type Pagination$1 = components['schemas']['Pagination'];
|
|
@@ -32614,7 +33116,11 @@ declare class CompanyPaymentConnectionsResource {
|
|
|
32614
33116
|
private companyId;
|
|
32615
33117
|
constructor(client: BeeLClient, companyId: string);
|
|
32616
33118
|
private path;
|
|
32617
|
-
/**
|
|
33119
|
+
/**
|
|
33120
|
+
* Every payment connection of this company.
|
|
33121
|
+
*
|
|
33122
|
+
* @returns The `connections`.
|
|
33123
|
+
*/
|
|
32618
33124
|
list(): Promise<{
|
|
32619
33125
|
connections: ManagedPaymentConnection[];
|
|
32620
33126
|
}>;
|
|
@@ -32622,11 +33128,20 @@ declare class CompanyPaymentConnectionsResource {
|
|
|
32622
33128
|
* Start an authorization and get the URL where the NIF's holder approves it.
|
|
32623
33129
|
*
|
|
32624
33130
|
* This is the one place the provider slug is used — currently only `stripe`.
|
|
33131
|
+
*
|
|
33132
|
+
* @param body - `{ provider: 'stripe' }`, plus the return URL when needed.
|
|
33133
|
+
* @returns The `authorization_url` to send the NIF's holder to.
|
|
32625
33134
|
*/
|
|
32626
33135
|
authorize(body: components['schemas']['InitiatePaymentConnectionRequest']): Promise<{
|
|
32627
33136
|
authorization_url: string;
|
|
32628
33137
|
}>;
|
|
32629
|
-
/**
|
|
33138
|
+
/**
|
|
33139
|
+
* Update the settings of one connection, addressed by its UUID.
|
|
33140
|
+
*
|
|
33141
|
+
* @param connectionId - Connection UUID, from {@link list}.
|
|
33142
|
+
* @param body - Settings to change.
|
|
33143
|
+
* @returns The updated connection.
|
|
33144
|
+
*/
|
|
32630
33145
|
update(connectionId: string, body: components['schemas']['UpdateCompanyPaymentConnectionRequest']): Promise<{
|
|
32631
33146
|
id: string;
|
|
32632
33147
|
provider: string;
|
|
@@ -32650,14 +33165,22 @@ declare class CompanyPaymentConnectionsResource {
|
|
|
32650
33165
|
/**
|
|
32651
33166
|
* Disconnect one connection. Tokens are revoked and auto-invoicing stops;
|
|
32652
33167
|
* already-issued invoices are untouched.
|
|
33168
|
+
*
|
|
33169
|
+
* @param connectionId - Connection UUID.
|
|
32653
33170
|
*/
|
|
32654
33171
|
disconnect(connectionId: string): Promise<void>;
|
|
32655
|
-
/**
|
|
33172
|
+
/**
|
|
33173
|
+
* The payment events of one connection — where you audit what did and didn't invoice.
|
|
33174
|
+
*
|
|
33175
|
+
* @param connectionId - Connection UUID.
|
|
33176
|
+
* @returns The events resource of that connection. No request is made.
|
|
33177
|
+
*/
|
|
32656
33178
|
events(connectionId: string): CompanyPaymentEventsResource;
|
|
32657
33179
|
}
|
|
32658
33180
|
/**
|
|
32659
33181
|
* Payment events received through a connection, and the recovery levers for the ones
|
|
32660
|
-
* that did not produce an invoice.
|
|
33182
|
+
* that did not produce an invoice. Reach it as
|
|
33183
|
+
* `beel.company(companyId).paymentConnections.events(connectionId)`.
|
|
32661
33184
|
*/
|
|
32662
33185
|
declare class CompanyPaymentEventsResource {
|
|
32663
33186
|
private client;
|
|
@@ -32669,13 +33192,21 @@ declare class CompanyPaymentEventsResource {
|
|
|
32669
33192
|
* Events of the connection, most recent first. Nothing is hidden by default:
|
|
32670
33193
|
* skipped events, duplicates and disputes are all returned — narrow with the
|
|
32671
33194
|
* filters. `charges_only` returns one row per money movement instead.
|
|
33195
|
+
*
|
|
33196
|
+
* @param params - Filters (`needs_action`, `charges_only`…) and pagination.
|
|
33197
|
+
* @returns The `events`, their `pagination` and `counts`.
|
|
32672
33198
|
*/
|
|
32673
33199
|
list(params?: operations['listCompanyPaymentEvents']['parameters']['query']): Promise<{
|
|
32674
33200
|
events: ManagedPaymentEvent[];
|
|
32675
33201
|
pagination?: Pagination$1;
|
|
32676
33202
|
counts?: PaymentEventCounts;
|
|
32677
33203
|
}>;
|
|
32678
|
-
/**
|
|
33204
|
+
/**
|
|
33205
|
+
* Get one event.
|
|
33206
|
+
*
|
|
33207
|
+
* @param eventId - Event UUID.
|
|
33208
|
+
* @returns The event.
|
|
33209
|
+
*/
|
|
32679
33210
|
get(eventId: string): Promise<{
|
|
32680
33211
|
id: string;
|
|
32681
33212
|
provider: string;
|
|
@@ -32714,6 +33245,9 @@ declare class CompanyPaymentEventsResource {
|
|
|
32714
33245
|
* Reprocess an event whose automatic invoicing didn't complete, applying the NIF's
|
|
32715
33246
|
* **current** configuration. Only retryable states qualify and the retry budget is
|
|
32716
33247
|
* finite: otherwise `400`.
|
|
33248
|
+
*
|
|
33249
|
+
* @param eventId - Event UUID.
|
|
33250
|
+
* @returns The event after the retry.
|
|
32717
33251
|
*/
|
|
32718
33252
|
retry(eventId: string): Promise<{
|
|
32719
33253
|
id: string;
|
|
@@ -32751,12 +33285,20 @@ declare class CompanyPaymentEventsResource {
|
|
|
32751
33285
|
}>;
|
|
32752
33286
|
/**
|
|
32753
33287
|
* Build a **draft** invoice from an event that couldn't be invoiced automatically,
|
|
32754
|
-
* so you can review it before issuing.
|
|
33288
|
+
* so you can review it before issuing.
|
|
33289
|
+
*
|
|
33290
|
+
* @param eventId - Event UUID.
|
|
33291
|
+
* @returns The draft's `invoice_id`.
|
|
32755
33292
|
*/
|
|
32756
33293
|
draft(eventId: string): Promise<{
|
|
32757
33294
|
invoice_id: string;
|
|
32758
33295
|
}>;
|
|
32759
|
-
/**
|
|
33296
|
+
/**
|
|
33297
|
+
* Mark an event as dealt with outside the automatic flow.
|
|
33298
|
+
*
|
|
33299
|
+
* @param eventId - Event UUID.
|
|
33300
|
+
* @returns The resolved event.
|
|
33301
|
+
*/
|
|
32760
33302
|
resolve(eventId: string): Promise<{
|
|
32761
33303
|
id: string;
|
|
32762
33304
|
provider: string;
|
|
@@ -32791,7 +33333,12 @@ declare class CompanyPaymentEventsResource {
|
|
|
32791
33333
|
discarded: boolean;
|
|
32792
33334
|
discarded_at?: string | null;
|
|
32793
33335
|
}>;
|
|
32794
|
-
/**
|
|
33336
|
+
/**
|
|
33337
|
+
* Discard an event so it stops asking for attention. Reversible with {@link restore}.
|
|
33338
|
+
*
|
|
33339
|
+
* @param eventId - Event UUID.
|
|
33340
|
+
* @returns The discarded event.
|
|
33341
|
+
*/
|
|
32795
33342
|
discard(eventId: string): Promise<{
|
|
32796
33343
|
id: string;
|
|
32797
33344
|
provider: string;
|
|
@@ -32826,7 +33373,12 @@ declare class CompanyPaymentEventsResource {
|
|
|
32826
33373
|
discarded: boolean;
|
|
32827
33374
|
discarded_at?: string | null;
|
|
32828
33375
|
}>;
|
|
32829
|
-
/**
|
|
33376
|
+
/**
|
|
33377
|
+
* Bring a discarded event back into the list.
|
|
33378
|
+
*
|
|
33379
|
+
* @param eventId - Event UUID.
|
|
33380
|
+
* @returns The restored event.
|
|
33381
|
+
*/
|
|
32830
33382
|
restore(eventId: string): Promise<{
|
|
32831
33383
|
id: string;
|
|
32832
33384
|
provider: string;
|
|
@@ -32863,6 +33415,26 @@ declare class CompanyPaymentEventsResource {
|
|
|
32863
33415
|
}>;
|
|
32864
33416
|
}
|
|
32865
33417
|
|
|
33418
|
+
type CreateInvoiceRequest$1 = components['schemas']['CreateInvoiceRequest'];
|
|
33419
|
+
/**
|
|
33420
|
+
* Invoice types whose `external_ref` the API keeps unique: at most one live (not deleted)
|
|
33421
|
+
* invoice of these types per reference and environment, whatever its status — a `VOIDED`
|
|
33422
|
+
* one included. Correctives are exempt, and proformas are not covered.
|
|
33423
|
+
*/
|
|
33424
|
+
declare const EXTERNAL_REF_UNIQUE_INVOICE_TYPES: readonly ["STANDARD", "SIMPLIFIED"];
|
|
33425
|
+
/** Invoice types {@link createInvoiceOnce} accepts. */
|
|
33426
|
+
type ExternalRefUniqueInvoiceType = (typeof EXTERNAL_REF_UNIQUE_INVOICE_TYPES)[number];
|
|
33427
|
+
/**
|
|
33428
|
+
* Body of `invoices.createOnce`: a `CreateInvoiceRequest` whose `type` is `STANDARD` or
|
|
33429
|
+
* `SIMPLIFIED` and whose `external_ref` is required — it is what makes the call safe to repeat.
|
|
33430
|
+
*/
|
|
33431
|
+
type CreateInvoiceOnceRequest = Omit<CreateInvoiceRequest$1, 'type' | 'external_ref'> & {
|
|
33432
|
+
type: ExternalRefUniqueInvoiceType;
|
|
33433
|
+
external_ref: string;
|
|
33434
|
+
};
|
|
33435
|
+
/** Query of `invoices.createOnce`: the same as `invoices.create`. */
|
|
33436
|
+
type CreateInvoiceOnceParams = operations['createCompanyInvoice']['parameters']['query'];
|
|
33437
|
+
|
|
32866
33438
|
type Invoice = components['schemas']['Invoice'];
|
|
32867
33439
|
type Customer = components['schemas']['Customer'];
|
|
32868
33440
|
type Product = components['schemas']['Product'];
|
|
@@ -32870,7 +33442,10 @@ type Pagination = components['schemas']['Pagination'];
|
|
|
32870
33442
|
/**
|
|
32871
33443
|
* Operations scoped to a single company (NIF). This is the explicit multi-NIF surface:
|
|
32872
33444
|
* the company is addressed in the path, so no session focus or `BeeL-Active-Company`
|
|
32873
|
-
* header is needed.
|
|
33445
|
+
* header is needed. Get one with `beel.company(companyId)`; list the ids with
|
|
33446
|
+
* `beel.account(accountId).companies.list()`.
|
|
33447
|
+
*
|
|
33448
|
+
* Every method rejects with a `BeeLApiError` subclass when the API answers non-2xx.
|
|
32874
33449
|
*
|
|
32875
33450
|
* @example
|
|
32876
33451
|
* ```typescript
|
|
@@ -32882,17 +33457,30 @@ type Pagination = components['schemas']['Pagination'];
|
|
|
32882
33457
|
declare class CompanyScope {
|
|
32883
33458
|
private client;
|
|
32884
33459
|
readonly companyId: string;
|
|
33460
|
+
/** Invoices of this company: create, issue, void, correct, list, PDF, email. */
|
|
32885
33461
|
readonly invoices: CompanyInvoicesResource;
|
|
33462
|
+
/** Customers of this company. */
|
|
32886
33463
|
readonly customers: CompanyCustomersResource;
|
|
33464
|
+
/** Products and services of this company. */
|
|
32887
33465
|
readonly products: CompanyProductsResource;
|
|
33466
|
+
/** Invoice series (numbering) of this company. */
|
|
32888
33467
|
readonly series: CompanySeriesResource;
|
|
33468
|
+
/** Recurring invoice templates of this company. */
|
|
32889
33469
|
readonly recurringInvoices: CompanyRecurringInvoicesResource;
|
|
33470
|
+
/** Payment provider connections (Stripe) that auto-generate invoices under this NIF. */
|
|
32890
33471
|
readonly paymentConnections: CompanyPaymentConnectionsResource;
|
|
33472
|
+
/** Default taxes of this company. */
|
|
32891
33473
|
readonly taxConfiguration: CompanyTaxConfigurationResource;
|
|
33474
|
+
/** Whether this NIF submits its invoices to AEAT under VeriFactu. */
|
|
32892
33475
|
readonly verifactuConfiguration: CompanyVeriFactuConfigurationResource;
|
|
32893
33476
|
constructor(client: BeeLClient, companyId: string);
|
|
32894
33477
|
private path;
|
|
32895
|
-
/**
|
|
33478
|
+
/**
|
|
33479
|
+
* Get the company: its fiscal identity, address and settings.
|
|
33480
|
+
*
|
|
33481
|
+
* @param params - Optional query of `getCompanyById` (e.g. `include`).
|
|
33482
|
+
* @returns The company.
|
|
33483
|
+
*/
|
|
32896
33484
|
get(params?: operations['getCompanyById']['parameters']['query']): Promise<{
|
|
32897
33485
|
id?: string;
|
|
32898
33486
|
access_level?: components["schemas"]["AccessLevel"];
|
|
@@ -32939,7 +33527,12 @@ declare class CompanyScope {
|
|
|
32939
33527
|
created_at?: string;
|
|
32940
33528
|
readiness?: components["schemas"]["IssuingReadinessData"] | null;
|
|
32941
33529
|
}>;
|
|
32942
|
-
/**
|
|
33530
|
+
/**
|
|
33531
|
+
* Update the company's data. Only the fields present in `body` change.
|
|
33532
|
+
*
|
|
33533
|
+
* @param body - Fields to change.
|
|
33534
|
+
* @returns The updated company.
|
|
33535
|
+
*/
|
|
32943
33536
|
update(body: components['schemas']['UpdateCompanyRequest']): Promise<{
|
|
32944
33537
|
id?: string;
|
|
32945
33538
|
access_level?: components["schemas"]["AccessLevel"];
|
|
@@ -32986,9 +33579,17 @@ declare class CompanyScope {
|
|
|
32986
33579
|
created_at?: string;
|
|
32987
33580
|
readiness?: components["schemas"]["IssuingReadinessData"] | null;
|
|
32988
33581
|
}>;
|
|
32989
|
-
/**
|
|
33582
|
+
/**
|
|
33583
|
+
* Remove the company from its account. Blocked for the primary NIF, a NIF active in Live,
|
|
33584
|
+
* or one holding Live invoices.
|
|
33585
|
+
*/
|
|
32990
33586
|
delete(): Promise<void>;
|
|
32991
|
-
/**
|
|
33587
|
+
/**
|
|
33588
|
+
* Fiscal summary of the company for a period: taxable base, VAT and IRPF aggregates.
|
|
33589
|
+
*
|
|
33590
|
+
* @param params - `start_date` and `end_date` (both or neither; default: the current month).
|
|
33591
|
+
* @returns The aggregates of the period.
|
|
33592
|
+
*/
|
|
32992
33593
|
fiscalSummary(params?: operations['getCompanyFiscalSummary']['parameters']['query']): Promise<{
|
|
32993
33594
|
queried_period: components["schemas"]["QueriedPeriod"];
|
|
32994
33595
|
total_taxable_base: number;
|
|
@@ -33008,7 +33609,11 @@ declare class CompanyScope {
|
|
|
33008
33609
|
invoices?: components["schemas"]["InvoiceFiscalData"][];
|
|
33009
33610
|
total_invoices: number;
|
|
33010
33611
|
}>;
|
|
33011
|
-
/**
|
|
33612
|
+
/**
|
|
33613
|
+
* Whether the company can issue invoices now, and what blocks it if not.
|
|
33614
|
+
*
|
|
33615
|
+
* @returns `ready` plus the list of `blockers`.
|
|
33616
|
+
*/
|
|
33012
33617
|
issuingReadiness(): Promise<{
|
|
33013
33618
|
ready?: boolean;
|
|
33014
33619
|
blockers?: ("COMPANY_HAS_NO_NIF" | "SERIES_DEFAULT_NOT_FOUND" | "PROFILE_INCOMPLETE" | "COMPANY_NOT_ACTIVATED" | "ENV_MISMATCH" | "NIF_NOT_REGISTERED" | "NIF_REPRESENTATION_REQUIRED")[];
|
|
@@ -33018,16 +33623,28 @@ declare class CompanyScope {
|
|
|
33018
33623
|
};
|
|
33019
33624
|
}>;
|
|
33020
33625
|
}
|
|
33021
|
-
/**
|
|
33626
|
+
/**
|
|
33627
|
+
* Invoice lifecycle of one company: create a draft (or issue it directly), issue, void,
|
|
33628
|
+
* correct, list and read, PDF and email. Reach it as `beel.company(companyId).invoices`.
|
|
33629
|
+
*
|
|
33630
|
+
* A create, issue, void or corrective carries an automatic `Idempotency-Key`, reused by the
|
|
33631
|
+
* client's automatic retries. To retry a create yourself safely, use {@link createOnce}.
|
|
33632
|
+
*/
|
|
33022
33633
|
declare class CompanyInvoicesResource {
|
|
33023
33634
|
private client;
|
|
33024
33635
|
private companyId;
|
|
33636
|
+
/** Scheduled issuing of one invoice: read, set or clear it. */
|
|
33025
33637
|
readonly schedule: CompanyInvoiceScheduleResource;
|
|
33026
33638
|
constructor(client: BeeLClient, companyId: string);
|
|
33027
33639
|
/**
|
|
33028
|
-
* Derive a new invoice from an existing one — the canonical form of `duplicate`.
|
|
33640
|
+
* Derive a new draft invoice from an existing one — the canonical form of `duplicate`.
|
|
33641
|
+
* The source invoice is not modified.
|
|
33642
|
+
*
|
|
33643
|
+
* @param body - `from_invoice_id`, and optionally the `series_id` of the copy.
|
|
33644
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
33645
|
+
* @returns The new draft invoice.
|
|
33029
33646
|
*/
|
|
33030
|
-
derive(body: components['schemas']['CreateInvoiceDerivationRequest']): Promise<{
|
|
33647
|
+
derive(body: components['schemas']['CreateInvoiceDerivationRequest'], options?: RequestOptions): Promise<{
|
|
33031
33648
|
invoice_number?: string | null;
|
|
33032
33649
|
series: components["schemas"]["SeriesInfo"];
|
|
33033
33650
|
number?: number | null;
|
|
@@ -33079,11 +33696,51 @@ declare class CompanyInvoicesResource {
|
|
|
33079
33696
|
updated_at: string;
|
|
33080
33697
|
}>;
|
|
33081
33698
|
private path;
|
|
33082
|
-
|
|
33699
|
+
/**
|
|
33700
|
+
* List the company's invoices, paginated, with filters: status, type, customer, dates,
|
|
33701
|
+
* `external_ref` (exact match), VeriFactu status and more.
|
|
33702
|
+
*
|
|
33703
|
+
* @param params - Filters and pagination (`page`, `limit`).
|
|
33704
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
33705
|
+
* @returns The page of `invoices` and its `pagination`.
|
|
33706
|
+
*
|
|
33707
|
+
* @example
|
|
33708
|
+
* ```typescript
|
|
33709
|
+
* const { invoices } = await company.invoices.list({ external_ref: 'ORD-2026-0042' });
|
|
33710
|
+
* ```
|
|
33711
|
+
*/
|
|
33712
|
+
list(params?: operations['listCompanyInvoices']['parameters']['query'], options?: RequestOptions): Promise<{
|
|
33083
33713
|
invoices: Invoice[];
|
|
33084
33714
|
pagination: Pagination;
|
|
33085
33715
|
}>;
|
|
33086
|
-
|
|
33716
|
+
/**
|
|
33717
|
+
* Create an invoice: a `DRAFT` by default, or numbered and issued in the same call with
|
|
33718
|
+
* `options.issue_directly: true`. `CORRECTIVE` is not accepted here: use
|
|
33719
|
+
* {@link createCorrective}.
|
|
33720
|
+
*
|
|
33721
|
+
* One call sends one `Idempotency-Key`, reused by the client's automatic retries, so
|
|
33722
|
+
* those never duplicate the invoice. A second call is a new operation: to repeat a create
|
|
33723
|
+
* whose outcome you do not know, use {@link createOnce}.
|
|
33724
|
+
*
|
|
33725
|
+
* @param body - Type, recipient and lines; `external_ref` to tie it to your order.
|
|
33726
|
+
* @param params - `wait_for_pdf`, when issuing directly.
|
|
33727
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
33728
|
+
* @returns The created invoice. With VeriFactu, `verifactu.submission_status` starts `PENDING`.
|
|
33729
|
+
*
|
|
33730
|
+
* @example
|
|
33731
|
+
* ```typescript
|
|
33732
|
+
* const invoice = await company.invoices.create({
|
|
33733
|
+
* type: 'STANDARD',
|
|
33734
|
+
* recipient: { customer_id: 'customer-uuid' },
|
|
33735
|
+
* lines: [{
|
|
33736
|
+
* description: 'Consulting', quantity: 1, unit_price: 100,
|
|
33737
|
+
* main_tax: { type: 'IVA', percentage: 21, regime_key: '01' },
|
|
33738
|
+
* }],
|
|
33739
|
+
* external_ref: 'ORD-2026-0042',
|
|
33740
|
+
* });
|
|
33741
|
+
* ```
|
|
33742
|
+
*/
|
|
33743
|
+
create(body: components['schemas']['CreateInvoiceRequest'], params?: operations['createCompanyInvoice']['parameters']['query'], options?: RequestOptions): Promise<{
|
|
33087
33744
|
invoice_number?: string | null;
|
|
33088
33745
|
series: components["schemas"]["SeriesInfo"];
|
|
33089
33746
|
number?: number | null;
|
|
@@ -33134,7 +33791,99 @@ declare class CompanyInvoicesResource {
|
|
|
33134
33791
|
created_at: string;
|
|
33135
33792
|
updated_at: string;
|
|
33136
33793
|
}>;
|
|
33137
|
-
|
|
33794
|
+
/**
|
|
33795
|
+
* Create a standard or simplified invoice once per `external_ref`, safe to call again
|
|
33796
|
+
* after any failure. It looks the reference up first and returns the invoice that already
|
|
33797
|
+
* holds it; otherwise it creates one. If the create answers
|
|
33798
|
+
* `409 INVOICE_DUPLICATE_EXTERNAL_REFERENCE`, or its outcome is unknown (network error,
|
|
33799
|
+
* `5xx`), it looks the reference up again and returns the invoice it finds.
|
|
33800
|
+
*
|
|
33801
|
+
* The returned invoice may be one created earlier, in any status (`VOIDED` included):
|
|
33802
|
+
* compare its fields if that matters to you.
|
|
33803
|
+
*
|
|
33804
|
+
* @param body - A `CreateInvoiceRequest` with `type` `STANDARD` or `SIMPLIFIED` and a
|
|
33805
|
+
* non-empty `external_ref`.
|
|
33806
|
+
* @param params - `wait_for_pdf`, when issuing directly.
|
|
33807
|
+
* @param options - `idempotencyKey` for the create; `signal` and `timeoutMs` for the whole
|
|
33808
|
+
* sequence of calls.
|
|
33809
|
+
* @returns The one invoice that holds `body.external_ref`.
|
|
33810
|
+
* @throws {TypeError} Before any request, when `external_ref` is empty or `type` is not
|
|
33811
|
+
* `STANDARD`/`SIMPLIFIED`.
|
|
33812
|
+
* @throws {BeeLApiError} The create's error when no invoice holds the reference
|
|
33813
|
+
* afterwards — nothing was created, so calling again is safe.
|
|
33814
|
+
*
|
|
33815
|
+
* @example
|
|
33816
|
+
* ```typescript
|
|
33817
|
+
* const invoice = await company.invoices.createOnce({
|
|
33818
|
+
* type: 'STANDARD',
|
|
33819
|
+
* external_ref: order.id,
|
|
33820
|
+
* recipient: { customer_id: order.customerId },
|
|
33821
|
+
* lines: [{ description: 'Order', quantity: 1, unit_price: 100,
|
|
33822
|
+
* main_tax: { type: 'IVA', percentage: 21, regime_key: '01' } }],
|
|
33823
|
+
* options: { issue_directly: true },
|
|
33824
|
+
* });
|
|
33825
|
+
* ```
|
|
33826
|
+
*/
|
|
33827
|
+
createOnce(body: CreateInvoiceOnceRequest, params?: CreateInvoiceOnceParams, options?: RequestOptions): Promise<{
|
|
33828
|
+
invoice_number?: string | null;
|
|
33829
|
+
series: components["schemas"]["SeriesInfo"];
|
|
33830
|
+
number?: number | null;
|
|
33831
|
+
type: components["schemas"]["InvoiceType"];
|
|
33832
|
+
status: components["schemas"]["InvoiceStatus"];
|
|
33833
|
+
issue_date: string;
|
|
33834
|
+
operation_date?: string | null;
|
|
33835
|
+
due_date?: string;
|
|
33836
|
+
valid_until?: string | null;
|
|
33837
|
+
payment_date?: string;
|
|
33838
|
+
sent_at?: string | null;
|
|
33839
|
+
paid_at?: string | null;
|
|
33840
|
+
auto_emit_after?: string | null;
|
|
33841
|
+
scheduled_for?: string | null;
|
|
33842
|
+
scheduled_action?: components["schemas"]["GenerationAction"];
|
|
33843
|
+
issuer: components["schemas"]["IssuerData"];
|
|
33844
|
+
recipient: components["schemas"]["RecipientData"];
|
|
33845
|
+
lines: components["schemas"]["InvoiceLine"][];
|
|
33846
|
+
totals: components["schemas"]["InvoiceTotals"];
|
|
33847
|
+
payment_info?: components["schemas"]["PaymentInfo"];
|
|
33848
|
+
notes?: string;
|
|
33849
|
+
replaced_invoice_ids?: string[];
|
|
33850
|
+
void_cause?: components["schemas"]["VoidCause"];
|
|
33851
|
+
void_reason?: string;
|
|
33852
|
+
voided_at?: string | null;
|
|
33853
|
+
rectified_invoice_id?: string;
|
|
33854
|
+
source_proforma_id?: string;
|
|
33855
|
+
converted_invoice_id?: string;
|
|
33856
|
+
rectification_reason?: string;
|
|
33857
|
+
recurring_invoice_id?: string | null;
|
|
33858
|
+
recurring_invoice_name?: string | null;
|
|
33859
|
+
rectification_type?: components["schemas"]["RectificationType"];
|
|
33860
|
+
rectification_code?: components["schemas"]["VeriFactuRectificationCode"];
|
|
33861
|
+
external_ref?: string | null;
|
|
33862
|
+
metadata?: {
|
|
33863
|
+
[key: string]: unknown;
|
|
33864
|
+
};
|
|
33865
|
+
send_automatically?: boolean | null;
|
|
33866
|
+
email_config?: components["schemas"]["EmailConfiguration"] | null;
|
|
33867
|
+
pdf_download_url?: string | null;
|
|
33868
|
+
verifactu?: components["schemas"]["VeriFactu"];
|
|
33869
|
+
attachments?: components["schemas"]["InvoiceAttachment"][];
|
|
33870
|
+
sending_history?: components["schemas"]["InvoiceSendRecord"][];
|
|
33871
|
+
email_delivery?: components["schemas"]["InvoiceEmailDeliveryOutcome"];
|
|
33872
|
+
deleted_at?: string | null;
|
|
33873
|
+
} & {
|
|
33874
|
+
id: string;
|
|
33875
|
+
created_at: string;
|
|
33876
|
+
updated_at: string;
|
|
33877
|
+
}>;
|
|
33878
|
+
/**
|
|
33879
|
+
* Get one invoice, including its `status` and its `verifactu` block
|
|
33880
|
+
* (`submission_status`, `qr_url`, `error_code`…).
|
|
33881
|
+
*
|
|
33882
|
+
* @param invoiceId - Invoice UUID.
|
|
33883
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
33884
|
+
* @returns The invoice.
|
|
33885
|
+
*/
|
|
33886
|
+
get(invoiceId: string, options?: RequestOptions): Promise<{
|
|
33138
33887
|
invoice_number?: string | null;
|
|
33139
33888
|
series: components["schemas"]["SeriesInfo"];
|
|
33140
33889
|
number?: number | null;
|
|
@@ -33185,8 +33934,16 @@ declare class CompanyInvoicesResource {
|
|
|
33185
33934
|
created_at: string;
|
|
33186
33935
|
updated_at: string;
|
|
33187
33936
|
}>;
|
|
33188
|
-
/**
|
|
33189
|
-
|
|
33937
|
+
/**
|
|
33938
|
+
* Update a `DRAFT` or `SCHEDULED` invoice (or an `ACTIVE` proforma). Only the fields
|
|
33939
|
+
* present in `body` change; an issued invoice is amended with a corrective instead.
|
|
33940
|
+
*
|
|
33941
|
+
* @param invoiceId - Invoice UUID.
|
|
33942
|
+
* @param body - Fields to change.
|
|
33943
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
33944
|
+
* @returns The updated invoice.
|
|
33945
|
+
*/
|
|
33946
|
+
update(invoiceId: string, body: operations['patchCompanyInvoice']['requestBody']['content']['application/json'], options?: RequestOptions): Promise<{
|
|
33190
33947
|
invoice_number?: string | null;
|
|
33191
33948
|
series: components["schemas"]["SeriesInfo"];
|
|
33192
33949
|
number?: number | null;
|
|
@@ -33237,10 +33994,23 @@ declare class CompanyInvoicesResource {
|
|
|
33237
33994
|
created_at: string;
|
|
33238
33995
|
updated_at: string;
|
|
33239
33996
|
}>;
|
|
33240
|
-
/**
|
|
33241
|
-
|
|
33242
|
-
|
|
33243
|
-
|
|
33997
|
+
/**
|
|
33998
|
+
* Delete a draft invoice. Deleting frees its `external_ref` for a new invoice.
|
|
33999
|
+
*
|
|
34000
|
+
* @param invoiceId - Invoice UUID.
|
|
34001
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34002
|
+
*/
|
|
34003
|
+
delete(invoiceId: string, options?: RequestOptions): Promise<void>;
|
|
34004
|
+
/**
|
|
34005
|
+
* Issue a draft: assigns its definitive number and makes it immutable. PDF generation and
|
|
34006
|
+
* the VeriFactu submission happen after the response.
|
|
34007
|
+
*
|
|
34008
|
+
* @param invoiceId - UUID of the draft.
|
|
34009
|
+
* @param params - `wait_for_pdf: true` to wait for the PDF before answering.
|
|
34010
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34011
|
+
* @returns The issued invoice.
|
|
34012
|
+
*/
|
|
34013
|
+
issue(invoiceId: string, params?: operations['issueCompanyInvoice']['parameters']['query'], options?: RequestOptions): Promise<{
|
|
33244
34014
|
invoice_number?: string | null;
|
|
33245
34015
|
series: components["schemas"]["SeriesInfo"];
|
|
33246
34016
|
number?: number | null;
|
|
@@ -33291,8 +34061,16 @@ declare class CompanyInvoicesResource {
|
|
|
33291
34061
|
created_at: string;
|
|
33292
34062
|
updated_at: string;
|
|
33293
34063
|
}>;
|
|
33294
|
-
/**
|
|
33295
|
-
|
|
34064
|
+
/**
|
|
34065
|
+
* Void an invoice issued by mistake. The document is kept and its number never reused. If
|
|
34066
|
+
* the operation did happen but the invoice is wrong, use {@link createCorrective}.
|
|
34067
|
+
*
|
|
34068
|
+
* @param invoiceId - Invoice UUID.
|
|
34069
|
+
* @param body - `reason`; `issued_in_error: true` is required once it was sent or paid.
|
|
34070
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34071
|
+
* @returns The voided invoice.
|
|
34072
|
+
*/
|
|
34073
|
+
void(invoiceId: string, body: NonNullable<operations['voidCompanyInvoice']['requestBody']>['content']['application/json'], options?: RequestOptions): Promise<{
|
|
33296
34074
|
invoice_number?: string | null;
|
|
33297
34075
|
series: components["schemas"]["SeriesInfo"];
|
|
33298
34076
|
number?: number | null;
|
|
@@ -33343,8 +34121,27 @@ declare class CompanyInvoicesResource {
|
|
|
33343
34121
|
created_at: string;
|
|
33344
34122
|
updated_at: string;
|
|
33345
34123
|
}>;
|
|
33346
|
-
/**
|
|
33347
|
-
|
|
34124
|
+
/**
|
|
34125
|
+
* Create a corrective invoice (rectificativa) for an issued invoice.
|
|
34126
|
+
*
|
|
34127
|
+
* @param invoiceId - UUID of the issued invoice to correct.
|
|
34128
|
+
* @param body - `rectification_type` (`TOTAL`/`PARTIAL`), `rectification_code` (`R1`–`R5`),
|
|
34129
|
+
* `reason` and, for `PARTIAL`, the correcting `lines`.
|
|
34130
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34131
|
+
* @returns The corrective invoice.
|
|
34132
|
+
*
|
|
34133
|
+
* @example
|
|
34134
|
+
* ```typescript
|
|
34135
|
+
* const corrective = await company.invoices.createCorrective('invoice-uuid', {
|
|
34136
|
+
* rectification_type: 'PARTIAL',
|
|
34137
|
+
* rectification_code: 'R1',
|
|
34138
|
+
* reason: 'Discount agreed with the customer after the sale',
|
|
34139
|
+
* lines: [{ description: 'Discount', quantity: -1, unit_price: 10,
|
|
34140
|
+
* main_tax: { type: 'IVA', percentage: 21, regime_key: '01' } }],
|
|
34141
|
+
* });
|
|
34142
|
+
* ```
|
|
34143
|
+
*/
|
|
34144
|
+
createCorrective(invoiceId: string, body: operations['createCompanyCorrectiveInvoice']['requestBody']['content']['application/json'], options?: RequestOptions): Promise<{
|
|
33348
34145
|
invoice_number?: string | null;
|
|
33349
34146
|
series: components["schemas"]["SeriesInfo"];
|
|
33350
34147
|
number?: number | null;
|
|
@@ -33395,8 +34192,15 @@ declare class CompanyInvoicesResource {
|
|
|
33395
34192
|
created_at: string;
|
|
33396
34193
|
updated_at: string;
|
|
33397
34194
|
}>;
|
|
33398
|
-
/**
|
|
33399
|
-
|
|
34195
|
+
/**
|
|
34196
|
+
* Convert a proforma into an invoice.
|
|
34197
|
+
*
|
|
34198
|
+
* @param invoiceId - UUID of the proforma.
|
|
34199
|
+
* @param body - Optional overrides for the new invoice.
|
|
34200
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34201
|
+
* @returns The new invoice.
|
|
34202
|
+
*/
|
|
34203
|
+
convertToInvoice(invoiceId: string, body?: NonNullable<operations['convertCompanyProformaToInvoice']['requestBody']>['content']['application/json'], options?: RequestOptions): Promise<{
|
|
33400
34204
|
invoice_number?: string | null;
|
|
33401
34205
|
series: components["schemas"]["SeriesInfo"];
|
|
33402
34206
|
number?: number | null;
|
|
@@ -33453,6 +34257,10 @@ declare class CompanyInvoicesResource {
|
|
|
33453
34257
|
* invoices become `VOIDED` with `void_cause: 'EXCHANGED'`, and the new `STANDARD` invoice
|
|
33454
34258
|
* lists them in `replaced_invoice_ids`.
|
|
33455
34259
|
*
|
|
34260
|
+
* @param body - `simplified_invoice_ids` and the identified `recipient`.
|
|
34261
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34262
|
+
* @returns The new standard invoice.
|
|
34263
|
+
*
|
|
33456
34264
|
* @example
|
|
33457
34265
|
* ```typescript
|
|
33458
34266
|
* const invoice = await company.invoices.createSimplifiedExchange({
|
|
@@ -33461,7 +34269,7 @@ declare class CompanyInvoicesResource {
|
|
|
33461
34269
|
* });
|
|
33462
34270
|
* ```
|
|
33463
34271
|
*/
|
|
33464
|
-
createSimplifiedExchange(body: components['schemas']['CreateSimplifiedExchangeRequest']): Promise<{
|
|
34272
|
+
createSimplifiedExchange(body: components['schemas']['CreateSimplifiedExchangeRequest'], options?: RequestOptions): Promise<{
|
|
33465
34273
|
invoice_number?: string | null;
|
|
33466
34274
|
series: components["schemas"]["SeriesInfo"];
|
|
33467
34275
|
number?: number | null;
|
|
@@ -33515,8 +34323,12 @@ declare class CompanyInvoicesResource {
|
|
|
33515
34323
|
/**
|
|
33516
34324
|
* The VeriFactu records of an invoice, oldest first: its registration and, if it was
|
|
33517
34325
|
* voided, its cancellation. An invoice never submitted answers with an empty list.
|
|
34326
|
+
*
|
|
34327
|
+
* @param invoiceId - Invoice UUID.
|
|
34328
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34329
|
+
* @returns The records (`data.records` of the response), each with its own `submission_status`.
|
|
33518
34330
|
*/
|
|
33519
|
-
verifactuRecords(invoiceId: string): Promise<{
|
|
34331
|
+
verifactuRecords(invoiceId: string, options?: RequestOptions): Promise<{
|
|
33520
34332
|
id: string;
|
|
33521
34333
|
operation: components["schemas"]["VeriFactuRecordOperation"];
|
|
33522
34334
|
submission_status?: components["schemas"]["VeriFactuSubmissionStatus"];
|
|
@@ -33527,8 +34339,16 @@ declare class CompanyInvoicesResource {
|
|
|
33527
34339
|
error_code?: string | null;
|
|
33528
34340
|
error_message?: string | null;
|
|
33529
34341
|
}[]>;
|
|
33530
|
-
/**
|
|
33531
|
-
|
|
34342
|
+
/**
|
|
34343
|
+
* Set the commercial status: `PAID` (from `ISSUED`, `SENT`, `OVERDUE`), `SENT` (from
|
|
34344
|
+
* `ISSUED`) or back to `ISSUED` (from `SENT`). Issuing and voiding have their own methods.
|
|
34345
|
+
*
|
|
34346
|
+
* @param invoiceId - Invoice UUID.
|
|
34347
|
+
* @param body - Target `status` and, for `PAID`, the payment details.
|
|
34348
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34349
|
+
* @returns The updated invoice.
|
|
34350
|
+
*/
|
|
34351
|
+
setStatus(invoiceId: string, body: operations['setCompanyInvoiceStatus']['requestBody']['content']['application/json'], options?: RequestOptions): Promise<{
|
|
33532
34352
|
invoice_number?: string | null;
|
|
33533
34353
|
series: components["schemas"]["SeriesInfo"];
|
|
33534
34354
|
number?: number | null;
|
|
@@ -33579,14 +34399,27 @@ declare class CompanyInvoicesResource {
|
|
|
33579
34399
|
created_at: string;
|
|
33580
34400
|
updated_at: string;
|
|
33581
34401
|
}>;
|
|
33582
|
-
/**
|
|
33583
|
-
|
|
34402
|
+
/**
|
|
34403
|
+
* Get a short-lived download URL for the invoice PDF.
|
|
34404
|
+
*
|
|
34405
|
+
* @param invoiceId - Invoice UUID.
|
|
34406
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34407
|
+
* @returns `download_url`, `expires_in_seconds` and `file_name`.
|
|
34408
|
+
*/
|
|
34409
|
+
getPdf(invoiceId: string, options?: RequestOptions): Promise<{
|
|
33584
34410
|
download_url: string;
|
|
33585
34411
|
expires_in_seconds: number;
|
|
33586
34412
|
file_name: string;
|
|
33587
34413
|
}>;
|
|
33588
|
-
/**
|
|
33589
|
-
|
|
34414
|
+
/**
|
|
34415
|
+
* Send the invoice by email with its PDF. Without recipients, the customer's addresses are used.
|
|
34416
|
+
*
|
|
34417
|
+
* @param invoiceId - Invoice UUID.
|
|
34418
|
+
* @param body - Optional recipients, subject and message.
|
|
34419
|
+
* @param options - Per-call `idempotencyKey`, `signal` and `timeoutMs`.
|
|
34420
|
+
* @returns The delivery record.
|
|
34421
|
+
*/
|
|
34422
|
+
send(invoiceId: string, body: NonNullable<operations['sendCompanyInvoice']['requestBody']>['content']['application/json'], options?: RequestOptions): Promise<{
|
|
33590
34423
|
email_id?: components["schemas"]["UUID"] | undefined;
|
|
33591
34424
|
sent_to?: string[] | undefined;
|
|
33592
34425
|
sent_at?: string | undefined;
|
|
@@ -33596,12 +34429,20 @@ declare class CompanyInvoicesResource {
|
|
|
33596
34429
|
sent_at?: string | undefined;
|
|
33597
34430
|
} | undefined>;
|
|
33598
34431
|
}
|
|
33599
|
-
/**
|
|
33600
|
-
|
|
34432
|
+
/**
|
|
34433
|
+
* Scheduled issuing of one invoice: read it, set it, clear it. Reach it as
|
|
34434
|
+
* `beel.company(companyId).invoices.schedule`.
|
|
34435
|
+
*/
|
|
33601
34436
|
declare class CompanyInvoiceScheduleResource {
|
|
33602
34437
|
private client;
|
|
33603
34438
|
private companyId;
|
|
33604
34439
|
constructor(client: BeeLClient, companyId: string);
|
|
34440
|
+
/**
|
|
34441
|
+
* Get the schedule of an invoice.
|
|
34442
|
+
*
|
|
34443
|
+
* @param invoiceId - Invoice UUID.
|
|
34444
|
+
* @returns `scheduled_for` and `generation_mode`.
|
|
34445
|
+
*/
|
|
33605
34446
|
get(invoiceId: string): Promise<{
|
|
33606
34447
|
scheduled_for: string;
|
|
33607
34448
|
generation_mode: components["schemas"]["GenerationAction"];
|
|
@@ -33609,6 +34450,10 @@ declare class CompanyInvoiceScheduleResource {
|
|
|
33609
34450
|
/**
|
|
33610
34451
|
* Set or move the schedule. One `PUT` replaces the three legacy calls
|
|
33611
34452
|
* (`schedule`, `reschedule`, `unschedule`): setting it again moves it.
|
|
34453
|
+
*
|
|
34454
|
+
* @param invoiceId - UUID of a draft invoice.
|
|
34455
|
+
* @param body - `scheduled_for` date and what to do then.
|
|
34456
|
+
* @returns The scheduled invoice.
|
|
33612
34457
|
*/
|
|
33613
34458
|
set(invoiceId: string, body: components['schemas']['SetInvoiceScheduleRequest']): Promise<{
|
|
33614
34459
|
invoice_number?: string | null | undefined;
|
|
@@ -33792,17 +34637,35 @@ declare class CompanyInvoiceScheduleResource {
|
|
|
33792
34637
|
created_at: string;
|
|
33793
34638
|
updated_at: string;
|
|
33794
34639
|
} | undefined>;
|
|
33795
|
-
/**
|
|
34640
|
+
/**
|
|
34641
|
+
* Clear the schedule, returning the invoice to a plain draft — the canonical form of
|
|
34642
|
+
* `unschedule`. Idempotent.
|
|
34643
|
+
*
|
|
34644
|
+
* @param invoiceId - Invoice UUID.
|
|
34645
|
+
*/
|
|
33796
34646
|
clear(invoiceId: string): Promise<void>;
|
|
33797
34647
|
}
|
|
34648
|
+
/** Customers of one company. Reach it as `beel.company(companyId).customers`. */
|
|
33798
34649
|
declare class CompanyCustomersResource {
|
|
33799
34650
|
private client;
|
|
33800
34651
|
private companyId;
|
|
33801
34652
|
constructor(client: BeeLClient, companyId: string);
|
|
34653
|
+
/**
|
|
34654
|
+
* List the company's customers, paginated and searchable.
|
|
34655
|
+
*
|
|
34656
|
+
* @param params - Filters and pagination.
|
|
34657
|
+
* @returns The page of `customers` and its `pagination`.
|
|
34658
|
+
*/
|
|
33802
34659
|
list(params?: operations['listCompanyCustomers']['parameters']['query']): Promise<{
|
|
33803
34660
|
customers: Customer[];
|
|
33804
34661
|
pagination: Pagination;
|
|
33805
34662
|
}>;
|
|
34663
|
+
/**
|
|
34664
|
+
* Create a customer.
|
|
34665
|
+
*
|
|
34666
|
+
* @param body - Legal name, NIF (or alternative id) and address.
|
|
34667
|
+
* @returns The created customer.
|
|
34668
|
+
*/
|
|
33806
34669
|
create(body: components['schemas']['CreateCustomerRequest']): Promise<{
|
|
33807
34670
|
id: string;
|
|
33808
34671
|
legal_name: string;
|
|
@@ -33822,6 +34685,12 @@ declare class CompanyCustomersResource {
|
|
|
33822
34685
|
updated_at?: string;
|
|
33823
34686
|
alternative_id?: components["schemas"]["AlternativeIdentifier"];
|
|
33824
34687
|
}>;
|
|
34688
|
+
/**
|
|
34689
|
+
* Create several customers in one call.
|
|
34690
|
+
*
|
|
34691
|
+
* @param body - The customers, and whether it is a dry run.
|
|
34692
|
+
* @returns Per-customer results and totals.
|
|
34693
|
+
*/
|
|
33825
34694
|
createBulk(body: operations['createCompanyCustomersBulk']['requestBody']['content']['application/json']): Promise<{
|
|
33826
34695
|
metadata: {
|
|
33827
34696
|
total_customers: number;
|
|
@@ -33896,6 +34765,12 @@ declare class CompanyCustomersResource {
|
|
|
33896
34765
|
not_importable?: number | undefined;
|
|
33897
34766
|
};
|
|
33898
34767
|
} | undefined>;
|
|
34768
|
+
/**
|
|
34769
|
+
* Get one customer.
|
|
34770
|
+
*
|
|
34771
|
+
* @param customerId - Customer UUID.
|
|
34772
|
+
* @returns The customer.
|
|
34773
|
+
*/
|
|
33899
34774
|
get(customerId: string): Promise<{
|
|
33900
34775
|
id: string;
|
|
33901
34776
|
legal_name: string;
|
|
@@ -33915,6 +34790,13 @@ declare class CompanyCustomersResource {
|
|
|
33915
34790
|
updated_at?: string;
|
|
33916
34791
|
alternative_id?: components["schemas"]["AlternativeIdentifier"];
|
|
33917
34792
|
}>;
|
|
34793
|
+
/**
|
|
34794
|
+
* Update a customer. Only the fields present in `body` change.
|
|
34795
|
+
*
|
|
34796
|
+
* @param customerId - Customer UUID.
|
|
34797
|
+
* @param body - Fields to change.
|
|
34798
|
+
* @returns The updated customer.
|
|
34799
|
+
*/
|
|
33918
34800
|
update(customerId: string, body: operations['patchCompanyCustomer']['requestBody']['content']['application/json']): Promise<{
|
|
33919
34801
|
id: string;
|
|
33920
34802
|
legal_name: string;
|
|
@@ -33934,17 +34816,35 @@ declare class CompanyCustomersResource {
|
|
|
33934
34816
|
updated_at?: string;
|
|
33935
34817
|
alternative_id?: components["schemas"]["AlternativeIdentifier"];
|
|
33936
34818
|
}>;
|
|
34819
|
+
/**
|
|
34820
|
+
* Delete a customer that has no invoices. Its NIF (or alternative id) is released for a
|
|
34821
|
+
* new customer.
|
|
34822
|
+
*
|
|
34823
|
+
* @param customerId - Customer UUID.
|
|
34824
|
+
*/
|
|
33937
34825
|
delete(customerId: string): Promise<void>;
|
|
33938
34826
|
}
|
|
33939
|
-
/** Products
|
|
34827
|
+
/** Products and services of one company. Reach it as `beel.company(companyId).products`. */
|
|
33940
34828
|
declare class CompanyProductsResource {
|
|
33941
34829
|
private client;
|
|
33942
34830
|
private companyId;
|
|
33943
34831
|
constructor(client: BeeLClient, companyId: string);
|
|
34832
|
+
/**
|
|
34833
|
+
* List the company's products, paginated and searchable.
|
|
34834
|
+
*
|
|
34835
|
+
* @param params - Filters and pagination.
|
|
34836
|
+
* @returns The page of `products` and its `pagination`.
|
|
34837
|
+
*/
|
|
33944
34838
|
list(params?: operations['listCompanyProducts']['parameters']['query']): Promise<{
|
|
33945
34839
|
products: Product[];
|
|
33946
34840
|
pagination: Pagination;
|
|
33947
34841
|
}>;
|
|
34842
|
+
/**
|
|
34843
|
+
* Create a product or service.
|
|
34844
|
+
*
|
|
34845
|
+
* @param body - Name, category, price and main tax.
|
|
34846
|
+
* @returns The created product.
|
|
34847
|
+
*/
|
|
33948
34848
|
create(body: components['schemas']['CreateProductRequest']): Promise<{
|
|
33949
34849
|
id: string;
|
|
33950
34850
|
code?: string | null;
|
|
@@ -33960,6 +34860,12 @@ declare class CompanyProductsResource {
|
|
|
33960
34860
|
created_at: string;
|
|
33961
34861
|
updated_at: string;
|
|
33962
34862
|
}>;
|
|
34863
|
+
/**
|
|
34864
|
+
* Get one product.
|
|
34865
|
+
*
|
|
34866
|
+
* @param productId - Product UUID.
|
|
34867
|
+
* @returns The product.
|
|
34868
|
+
*/
|
|
33963
34869
|
get(productId: string): Promise<{
|
|
33964
34870
|
id: string;
|
|
33965
34871
|
code?: string | null;
|
|
@@ -33975,6 +34881,13 @@ declare class CompanyProductsResource {
|
|
|
33975
34881
|
created_at: string;
|
|
33976
34882
|
updated_at: string;
|
|
33977
34883
|
}>;
|
|
34884
|
+
/**
|
|
34885
|
+
* Update a product. Only the fields present in `body` change.
|
|
34886
|
+
*
|
|
34887
|
+
* @param productId - Product UUID.
|
|
34888
|
+
* @param body - Fields to change.
|
|
34889
|
+
* @returns The updated product.
|
|
34890
|
+
*/
|
|
33978
34891
|
update(productId: string, body: operations['patchCompanyProduct']['requestBody']['content']['application/json']): Promise<{
|
|
33979
34892
|
id: string;
|
|
33980
34893
|
code?: string | null;
|
|
@@ -33990,13 +34903,27 @@ declare class CompanyProductsResource {
|
|
|
33990
34903
|
created_at: string;
|
|
33991
34904
|
updated_at: string;
|
|
33992
34905
|
}>;
|
|
34906
|
+
/**
|
|
34907
|
+
* Delete a product from the catalog. Existing invoice lines are unaffected.
|
|
34908
|
+
*
|
|
34909
|
+
* @param productId - Product UUID.
|
|
34910
|
+
*/
|
|
33993
34911
|
delete(productId: string): Promise<void>;
|
|
33994
34912
|
}
|
|
33995
|
-
/**
|
|
34913
|
+
/**
|
|
34914
|
+
* Invoice series (numbering) of one company. Each series numbers one `document_type`.
|
|
34915
|
+
* Reach it as `beel.company(companyId).series`.
|
|
34916
|
+
*/
|
|
33996
34917
|
declare class CompanySeriesResource {
|
|
33997
34918
|
private client;
|
|
33998
34919
|
private companyId;
|
|
33999
34920
|
constructor(client: BeeLClient, companyId: string);
|
|
34921
|
+
/**
|
|
34922
|
+
* List the company's series.
|
|
34923
|
+
*
|
|
34924
|
+
* @param params - Filters; `page`/`limit` to paginate.
|
|
34925
|
+
* @returns The `series`, and `pagination` when you paginated.
|
|
34926
|
+
*/
|
|
34000
34927
|
list(params?: operations['listCompanySeries']['parameters']['query']): Promise<{
|
|
34001
34928
|
series: {
|
|
34002
34929
|
id: string;
|
|
@@ -34023,6 +34950,12 @@ declare class CompanySeriesResource {
|
|
|
34023
34950
|
has_previous?: boolean | undefined;
|
|
34024
34951
|
} | undefined;
|
|
34025
34952
|
} | undefined>;
|
|
34953
|
+
/**
|
|
34954
|
+
* Create a series.
|
|
34955
|
+
*
|
|
34956
|
+
* @param body - Code, name, format and the `document_type` it numbers.
|
|
34957
|
+
* @returns The created series.
|
|
34958
|
+
*/
|
|
34026
34959
|
create(body: operations['createCompanySeries']['requestBody']['content']['application/json']): Promise<{
|
|
34027
34960
|
id: string;
|
|
34028
34961
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -34039,6 +34972,13 @@ declare class CompanySeriesResource {
|
|
|
34039
34972
|
readonly next_number?: number | undefined;
|
|
34040
34973
|
updated_at?: string | undefined;
|
|
34041
34974
|
} | undefined>;
|
|
34975
|
+
/**
|
|
34976
|
+
* Update a series. Only the fields present in `body` change.
|
|
34977
|
+
*
|
|
34978
|
+
* @param seriesId - Series UUID.
|
|
34979
|
+
* @param body - Fields to change.
|
|
34980
|
+
* @returns The updated series.
|
|
34981
|
+
*/
|
|
34042
34982
|
update(seriesId: string, body: operations['patchCompanySeries']['requestBody']['content']['application/json']): Promise<{
|
|
34043
34983
|
id: string;
|
|
34044
34984
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -34055,8 +34995,17 @@ declare class CompanySeriesResource {
|
|
|
34055
34995
|
readonly next_number?: number | undefined;
|
|
34056
34996
|
updated_at?: string | undefined;
|
|
34057
34997
|
} | undefined>;
|
|
34998
|
+
/**
|
|
34999
|
+
* Delete (soft-delete) a series. Its code stays taken, since issued invoices carry it.
|
|
35000
|
+
*
|
|
35001
|
+
* @param seriesId - Series UUID.
|
|
35002
|
+
*/
|
|
34058
35003
|
delete(seriesId: string): Promise<void>;
|
|
34059
|
-
/**
|
|
35004
|
+
/**
|
|
35005
|
+
* The current default series per document type.
|
|
35006
|
+
*
|
|
35007
|
+
* @returns One entry per document type, saying whether a default exists.
|
|
35008
|
+
*/
|
|
34060
35009
|
getDefaults(): Promise<{
|
|
34061
35010
|
defaults: {
|
|
34062
35011
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -34066,7 +35015,12 @@ declare class CompanySeriesResource {
|
|
|
34066
35015
|
provisional?: boolean | undefined;
|
|
34067
35016
|
}[];
|
|
34068
35017
|
} | undefined>;
|
|
34069
|
-
/**
|
|
35018
|
+
/**
|
|
35019
|
+
* Ensure a default series exists per document type, creating the missing ones.
|
|
35020
|
+
* Idempotent.
|
|
35021
|
+
*
|
|
35022
|
+
* @returns The default series.
|
|
35023
|
+
*/
|
|
34070
35024
|
ensureDefaults(): Promise<{
|
|
34071
35025
|
series: {
|
|
34072
35026
|
id: string;
|
|
@@ -34085,7 +35039,12 @@ declare class CompanySeriesResource {
|
|
|
34085
35039
|
updated_at?: string | undefined;
|
|
34086
35040
|
}[];
|
|
34087
35041
|
} | undefined>;
|
|
34088
|
-
/**
|
|
35042
|
+
/**
|
|
35043
|
+
* Mark a series as the default for its document type.
|
|
35044
|
+
*
|
|
35045
|
+
* @param seriesId - Series UUID.
|
|
35046
|
+
* @returns The series.
|
|
35047
|
+
*/
|
|
34089
35048
|
setDefault(seriesId: string): Promise<{
|
|
34090
35049
|
id: string;
|
|
34091
35050
|
document_type: components["schemas"]["DocumentType"];
|
|
@@ -34103,12 +35062,21 @@ declare class CompanySeriesResource {
|
|
|
34103
35062
|
updated_at?: string | undefined;
|
|
34104
35063
|
} | undefined>;
|
|
34105
35064
|
}
|
|
34106
|
-
/**
|
|
35065
|
+
/**
|
|
35066
|
+
* Recurring invoice templates of one company. Reach it as
|
|
35067
|
+
* `beel.company(companyId).recurringInvoices`.
|
|
35068
|
+
*/
|
|
34107
35069
|
declare class CompanyRecurringInvoicesResource {
|
|
34108
35070
|
private client;
|
|
34109
35071
|
private companyId;
|
|
34110
35072
|
constructor(client: BeeLClient, companyId: string);
|
|
34111
35073
|
private path;
|
|
35074
|
+
/**
|
|
35075
|
+
* List the recurring invoices.
|
|
35076
|
+
*
|
|
35077
|
+
* @param params - Filters and pagination.
|
|
35078
|
+
* @returns The page of `recurring_invoices` and its `pagination`.
|
|
35079
|
+
*/
|
|
34112
35080
|
list(params?: operations['listCompanyRecurringInvoices']['parameters']['query']): Promise<{
|
|
34113
35081
|
recurring_invoices: {
|
|
34114
35082
|
id?: string | undefined;
|
|
@@ -34190,6 +35158,12 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34190
35158
|
has_previous?: boolean | undefined;
|
|
34191
35159
|
} | undefined;
|
|
34192
35160
|
} | undefined>;
|
|
35161
|
+
/**
|
|
35162
|
+
* Create a recurring invoice template.
|
|
35163
|
+
*
|
|
35164
|
+
* @param body - Frequency, schedule, recipient and lines.
|
|
35165
|
+
* @returns The recurring invoice.
|
|
35166
|
+
*/
|
|
34193
35167
|
create(body: operations['createCompanyRecurringInvoice']['requestBody']['content']['application/json']): Promise<{
|
|
34194
35168
|
id?: string | undefined;
|
|
34195
35169
|
name?: string | undefined;
|
|
@@ -34261,6 +35235,12 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34261
35235
|
created_at?: string | undefined;
|
|
34262
35236
|
updated_at?: string | undefined;
|
|
34263
35237
|
} | undefined>;
|
|
35238
|
+
/**
|
|
35239
|
+
* Get one recurring invoice.
|
|
35240
|
+
*
|
|
35241
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35242
|
+
* @returns The recurring invoice.
|
|
35243
|
+
*/
|
|
34264
35244
|
get(recurringInvoiceId: string): Promise<{
|
|
34265
35245
|
id?: string | undefined;
|
|
34266
35246
|
name?: string | undefined;
|
|
@@ -34332,6 +35312,13 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34332
35312
|
created_at?: string | undefined;
|
|
34333
35313
|
updated_at?: string | undefined;
|
|
34334
35314
|
} | undefined>;
|
|
35315
|
+
/**
|
|
35316
|
+
* Update a recurring invoice. Only the fields present in `body` change.
|
|
35317
|
+
*
|
|
35318
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35319
|
+
* @param body - Fields to change.
|
|
35320
|
+
* @returns The updated recurring invoice.
|
|
35321
|
+
*/
|
|
34335
35322
|
update(recurringInvoiceId: string, body: operations['patchCompanyRecurringInvoice']['requestBody']['content']['application/json']): Promise<{
|
|
34336
35323
|
id?: string | undefined;
|
|
34337
35324
|
name?: string | undefined;
|
|
@@ -34403,8 +35390,20 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34403
35390
|
created_at?: string | undefined;
|
|
34404
35391
|
updated_at?: string | undefined;
|
|
34405
35392
|
} | undefined>;
|
|
35393
|
+
/**
|
|
35394
|
+
* Delete a recurring invoice and cancel its pending generations. Invoices it already
|
|
35395
|
+
* generated are kept.
|
|
35396
|
+
*
|
|
35397
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35398
|
+
*/
|
|
34406
35399
|
delete(recurringInvoiceId: string): Promise<void>;
|
|
34407
|
-
/**
|
|
35400
|
+
/**
|
|
35401
|
+
* Pause, resume or end the template.
|
|
35402
|
+
*
|
|
35403
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35404
|
+
* @param body - Target `status` (e.g. `PAUSED`, `ACTIVE`).
|
|
35405
|
+
* @returns The updated recurring invoice.
|
|
35406
|
+
*/
|
|
34408
35407
|
setStatus(recurringInvoiceId: string, body: operations['setCompanyRecurringInvoiceStatus']['requestBody']['content']['application/json']): Promise<{
|
|
34409
35408
|
id?: string | undefined;
|
|
34410
35409
|
name?: string | undefined;
|
|
@@ -34476,7 +35475,12 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34476
35475
|
created_at?: string | undefined;
|
|
34477
35476
|
updated_at?: string | undefined;
|
|
34478
35477
|
} | undefined>;
|
|
34479
|
-
/**
|
|
35478
|
+
/**
|
|
35479
|
+
* Skip the next scheduled occurrence.
|
|
35480
|
+
*
|
|
35481
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35482
|
+
* @returns The recurring invoice with its next date moved.
|
|
35483
|
+
*/
|
|
34480
35484
|
skip(recurringInvoiceId: string): Promise<{
|
|
34481
35485
|
id?: string | undefined;
|
|
34482
35486
|
name?: string | undefined;
|
|
@@ -34548,11 +35552,22 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34548
35552
|
created_at?: string | undefined;
|
|
34549
35553
|
updated_at?: string | undefined;
|
|
34550
35554
|
} | undefined>;
|
|
34551
|
-
/**
|
|
35555
|
+
/**
|
|
35556
|
+
* Generate the next invoice now instead of waiting for the schedule.
|
|
35557
|
+
*
|
|
35558
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35559
|
+
* @returns The generated `invoice_id` and the `next_generation` date.
|
|
35560
|
+
*/
|
|
34552
35561
|
generateNow(recurringInvoiceId: string): Promise<{
|
|
34553
35562
|
invoice_id?: string | undefined;
|
|
34554
35563
|
next_generation?: string | null | undefined;
|
|
34555
35564
|
} | undefined>;
|
|
35565
|
+
/**
|
|
35566
|
+
* Preview the next invoice the template will generate.
|
|
35567
|
+
*
|
|
35568
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35569
|
+
* @returns The invoice as it would be generated.
|
|
35570
|
+
*/
|
|
34556
35571
|
nextOccurrence(recurringInvoiceId: string): Promise<{
|
|
34557
35572
|
invoice_number?: string | null | undefined;
|
|
34558
35573
|
series: {
|
|
@@ -34732,6 +35747,13 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34732
35747
|
} | undefined;
|
|
34733
35748
|
deleted_at?: string | null | undefined;
|
|
34734
35749
|
} | undefined>;
|
|
35750
|
+
/**
|
|
35751
|
+
* The generation history of the template: generated, skipped and failed occurrences.
|
|
35752
|
+
*
|
|
35753
|
+
* @param recurringInvoiceId - Recurring invoice UUID.
|
|
35754
|
+
* @param params - Pagination.
|
|
35755
|
+
* @returns The `history` entries.
|
|
35756
|
+
*/
|
|
34735
35757
|
history(recurringInvoiceId: string, params?: operations['getCompanyRecurringInvoiceHistory']['parameters']['query']): Promise<{
|
|
34736
35758
|
history: {
|
|
34737
35759
|
id?: string | undefined;
|
|
@@ -34758,13 +35780,19 @@ declare class CompanyRecurringInvoicesResource {
|
|
|
34758
35780
|
} | undefined>;
|
|
34759
35781
|
}
|
|
34760
35782
|
/**
|
|
34761
|
-
* Tax defaults of one company
|
|
34762
|
-
* `beel.configuration.
|
|
35783
|
+
* Tax defaults of one company (main tax, IRPF, equivalence surcharge). The canonical
|
|
35784
|
+
* replacement for the account-wide `beel.configuration.getTaxConfig()`, whose flat route is
|
|
35785
|
+
* deprecated. Reach it as `beel.company(companyId).taxConfiguration`.
|
|
34763
35786
|
*/
|
|
34764
35787
|
declare class CompanyTaxConfigurationResource {
|
|
34765
35788
|
private client;
|
|
34766
35789
|
private companyId;
|
|
34767
35790
|
constructor(client: BeeLClient, companyId: string);
|
|
35791
|
+
/**
|
|
35792
|
+
* Get the tax configuration.
|
|
35793
|
+
*
|
|
35794
|
+
* @returns The company's tax defaults.
|
|
35795
|
+
*/
|
|
34768
35796
|
get(): Promise<{
|
|
34769
35797
|
default_main_tax: {
|
|
34770
35798
|
type: components["schemas"]["TaxType"];
|
|
@@ -34786,7 +35814,12 @@ declare class CompanyTaxConfigurationResource {
|
|
|
34786
35814
|
suggested_irpf_rate: number | null;
|
|
34787
35815
|
} | undefined;
|
|
34788
35816
|
} | undefined>;
|
|
34789
|
-
/**
|
|
35817
|
+
/**
|
|
35818
|
+
* Replace the tax configuration — this is a `PUT`, not a merge: send the whole state.
|
|
35819
|
+
*
|
|
35820
|
+
* @param body - The complete tax configuration.
|
|
35821
|
+
* @returns The stored configuration.
|
|
35822
|
+
*/
|
|
34790
35823
|
update(body: components['schemas']['UpdateTaxConfigurationRequest']): Promise<{
|
|
34791
35824
|
default_main_tax: {
|
|
34792
35825
|
type: components["schemas"]["TaxType"];
|
|
@@ -34811,16 +35844,23 @@ declare class CompanyTaxConfigurationResource {
|
|
|
34811
35844
|
}
|
|
34812
35845
|
/**
|
|
34813
35846
|
* VeriFactu configuration of one company. The canonical replacement for
|
|
34814
|
-
* `beel.configuration.getVerifactu()`, whose flat route is deprecated.
|
|
35847
|
+
* `beel.configuration.getVerifactu()`, whose flat route is deprecated. Reach it as
|
|
35848
|
+
* `beel.company(companyId).verifactuConfiguration`.
|
|
34815
35849
|
*
|
|
34816
35850
|
* Whether an invoice reaches AEAT is a fact of this NIF resolved at issue time, not a
|
|
34817
35851
|
* per-invoice choice: `enabled` is the only writable field. Everything else — `status`,
|
|
34818
|
-
* `nif_status`, `signed`, `activated`, `pdf_generated` — is resolved server-side.
|
|
35852
|
+
* `nif_status`, `signed`, `activated`, `pdf_generated` — is resolved server-side. The
|
|
35853
|
+
* outcome of each invoice is on the invoice itself: `invoice.verifactu.submission_status`.
|
|
34819
35854
|
*/
|
|
34820
35855
|
declare class CompanyVeriFactuConfigurationResource {
|
|
34821
35856
|
private client;
|
|
34822
35857
|
private companyId;
|
|
34823
35858
|
constructor(client: BeeLClient, companyId: string);
|
|
35859
|
+
/**
|
|
35860
|
+
* Get the VeriFactu configuration of this NIF.
|
|
35861
|
+
*
|
|
35862
|
+
* @returns `enabled` and the server-resolved state of the NIF.
|
|
35863
|
+
*/
|
|
34824
35864
|
get(): Promise<{
|
|
34825
35865
|
enabled: boolean;
|
|
34826
35866
|
nif_status?: "ACTIVATED" | "DEACTIVATED" | null | undefined;
|
|
@@ -34830,7 +35870,12 @@ declare class CompanyVeriFactuConfigurationResource {
|
|
|
34830
35870
|
activated?: boolean | null | undefined;
|
|
34831
35871
|
pdf_generated?: boolean | null | undefined;
|
|
34832
35872
|
} | undefined>;
|
|
34833
|
-
/**
|
|
35873
|
+
/**
|
|
35874
|
+
* Turn VeriFactu on or off for this NIF. `enabled` is the only field you can write.
|
|
35875
|
+
*
|
|
35876
|
+
* @param body - `{ enabled }`.
|
|
35877
|
+
* @returns The updated configuration.
|
|
35878
|
+
*/
|
|
34834
35879
|
update(body: components['schemas']['UpdateVeriFactuConfigurationRequest']): Promise<{
|
|
34835
35880
|
enabled: boolean;
|
|
34836
35881
|
nif_status?: "ACTIVATED" | "DEACTIVATED" | null | undefined;
|
|
@@ -34843,18 +35888,25 @@ declare class CompanyVeriFactuConfigurationResource {
|
|
|
34843
35888
|
}
|
|
34844
35889
|
|
|
34845
35890
|
/**
|
|
34846
|
-
* BeeL
|
|
35891
|
+
* The BeeL API client. Create one per API key and reuse it; it holds no global state.
|
|
35892
|
+
* Address a company with {@link company} and an account with {@link account}.
|
|
35893
|
+
*
|
|
35894
|
+
* Requests are retried automatically when it is safe — see `BeeLConfig` — and every `POST`
|
|
35895
|
+
* carries an `Idempotency-Key` that those retries reuse.
|
|
34847
35896
|
*
|
|
34848
35897
|
* @example
|
|
34849
35898
|
* ```typescript
|
|
34850
35899
|
* import { BeeL } from '@beel_es/sdk';
|
|
34851
35900
|
*
|
|
34852
|
-
* const beel = new BeeL({ apiKey:
|
|
35901
|
+
* const beel = new BeeL({ apiKey: process.env.BEEL_API_KEY! });
|
|
34853
35902
|
*
|
|
34854
35903
|
* const invoice = await beel.company('company-uuid').invoices.create({
|
|
34855
35904
|
* type: 'STANDARD',
|
|
34856
|
-
* recipient: { customer_id: 'uuid' },
|
|
34857
|
-
* lines: [{
|
|
35905
|
+
* recipient: { customer_id: 'customer-uuid' },
|
|
35906
|
+
* lines: [{
|
|
35907
|
+
* description: 'Service', quantity: 1, unit_price: 100,
|
|
35908
|
+
* main_tax: { type: 'IVA', percentage: 21, regime_key: '01' },
|
|
35909
|
+
* }],
|
|
34858
35910
|
* });
|
|
34859
35911
|
* ```
|
|
34860
35912
|
*/
|
|
@@ -34869,8 +35921,9 @@ declare class BeeL {
|
|
|
34869
35921
|
readonly configuration: ConfigurationResource;
|
|
34870
35922
|
/** @deprecated Session-focus endpoints are deprecated in the API contract. Use `beel.company(companyId).series` instead. */
|
|
34871
35923
|
readonly series: SeriesResource;
|
|
34872
|
-
/** Account-wide catalogs and personal preferences
|
|
35924
|
+
/** Account-wide catalogs, the credential's identity and personal preferences. */
|
|
34873
35925
|
readonly catalogs: CatalogsResource;
|
|
35926
|
+
/** NIF validation against the AEAT register. */
|
|
34874
35927
|
readonly nif: NifResource;
|
|
34875
35928
|
/** Accounts you manage (multi-account provisioning: members, invitations, webhooks, companies). */
|
|
34876
35929
|
readonly accounts: AccountsResource;
|
|
@@ -34885,7 +35938,9 @@ declare class BeeL {
|
|
|
34885
35938
|
* builders) and the naming stability the wrappers provide.
|
|
34886
35939
|
*
|
|
34887
35940
|
* Retries, the `Authorization` header and `Idempotency-Key` still apply: it is the
|
|
34888
|
-
* same client the resources use, middleware included.
|
|
35941
|
+
* same client the resources use, middleware included. That includes error handling: a
|
|
35942
|
+
* non-2xx answer is **thrown** as a `BeeLApiError` subclass, so `raw` calls never resolve
|
|
35943
|
+
* with openapi-fetch's `{ error }`; `data` is always the successful body.
|
|
34889
35944
|
*
|
|
34890
35945
|
* @example
|
|
34891
35946
|
* ```typescript
|
|
@@ -34898,7 +35953,11 @@ declare class BeeL {
|
|
|
34898
35953
|
constructor(config: BeeLConfig);
|
|
34899
35954
|
/**
|
|
34900
35955
|
* 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.
|
|
35956
|
+
* All operations address the company in the path, no session focus needed. No request
|
|
35957
|
+
* is made; get the ids from `beel.account(accountId).companies.list()`.
|
|
35958
|
+
*
|
|
35959
|
+
* @param companyId - Company UUID (not its NIF).
|
|
35960
|
+
* @returns The company scope.
|
|
34902
35961
|
*
|
|
34903
35962
|
* @example
|
|
34904
35963
|
* ```typescript
|
|
@@ -34908,8 +35967,12 @@ declare class BeeL {
|
|
|
34908
35967
|
*/
|
|
34909
35968
|
company(companyId: string): CompanyScope;
|
|
34910
35969
|
/**
|
|
34911
|
-
* Returns a facade scoped to one
|
|
34912
|
-
*
|
|
35970
|
+
* Returns a facade scoped to one account — companies, members, invitations, account
|
|
35971
|
+
* webhooks, usage. Symmetric with {@link company}. No request is made; your own account
|
|
35972
|
+
* id is `(await beel.catalogs.identity()).account_id`.
|
|
35973
|
+
*
|
|
35974
|
+
* @param accountId - Account UUID.
|
|
35975
|
+
* @returns The account scope.
|
|
34913
35976
|
*
|
|
34914
35977
|
* @example
|
|
34915
35978
|
* ```typescript
|
|
@@ -34924,6 +35987,10 @@ declare class BeeL {
|
|
|
34924
35987
|
* @deprecated Relies on the deprecated session-focus PDF endpoint. Use
|
|
34925
35988
|
* `beel.company(companyId).invoices.getPdf(invoiceId)` and fetch `download_url` instead.
|
|
34926
35989
|
*
|
|
35990
|
+
* @param invoiceId - Invoice UUID.
|
|
35991
|
+
* @returns The PDF bytes and its file name.
|
|
35992
|
+
* @throws {Error} When downloading the file fails.
|
|
35993
|
+
*
|
|
34927
35994
|
* @example
|
|
34928
35995
|
* ```typescript
|
|
34929
35996
|
* const { buffer, fileName } = await beel.downloadPdf('invoice-uuid');
|
|
@@ -34937,37 +36004,89 @@ declare class BeeL {
|
|
|
34937
36004
|
}
|
|
34938
36005
|
|
|
34939
36006
|
/**
|
|
34940
|
-
* Base error for
|
|
36007
|
+
* Base error for every non-2xx answer of the BeeL API. The client throws it (or one of its
|
|
36008
|
+
* subclasses) from any resource method; a network failure is thrown as the platform's own
|
|
36009
|
+
* `fetch` error instead.
|
|
36010
|
+
*
|
|
36011
|
+
* @example
|
|
36012
|
+
* ```typescript
|
|
36013
|
+
* try {
|
|
36014
|
+
* await company.invoices.issue(invoiceId);
|
|
36015
|
+
* } catch (error) {
|
|
36016
|
+
* if (error instanceof BeeLApiError) console.error(error.statusCode, error.apiCode, error.requestId);
|
|
36017
|
+
* throw error;
|
|
36018
|
+
* }
|
|
36019
|
+
* ```
|
|
34941
36020
|
*/
|
|
34942
36021
|
declare class BeeLApiError extends Error {
|
|
36022
|
+
/** HTTP status of the response. */
|
|
34943
36023
|
readonly statusCode: number;
|
|
36024
|
+
/**
|
|
36025
|
+
* Stable code of the error class. On the base class it is the API's `error.code`; the
|
|
36026
|
+
* subclasses keep a fixed generic value (`CONFLICT`, `NOT_FOUND`…) for backward
|
|
36027
|
+
* compatibility. Read {@link apiCode} for the API's specific code.
|
|
36028
|
+
*/
|
|
34944
36029
|
readonly code: string;
|
|
36030
|
+
/**
|
|
36031
|
+
* The `error.code` the API answered with, verbatim — for example
|
|
36032
|
+
* `INVOICE_DUPLICATE_EXTERNAL_REFERENCE`. Equal to {@link code} when the response did not
|
|
36033
|
+
* carry one. See {@link BeeLErrorCodes} for the codes this SDK reacts to.
|
|
36034
|
+
*/
|
|
36035
|
+
readonly apiCode: string;
|
|
36036
|
+
/** `error.details` of the response, when the API sent any. */
|
|
34945
36037
|
readonly details?: Record<string, string>;
|
|
36038
|
+
/** `meta.request_id` of the response. Quote it when you contact support. */
|
|
34946
36039
|
readonly requestId?: string;
|
|
34947
|
-
constructor(message: string, statusCode: number, code: string, details?: Record<string, string>, requestId?: string);
|
|
36040
|
+
constructor(message: string, statusCode: number, code: string, details?: Record<string, string>, requestId?: string, apiCode?: string);
|
|
34948
36041
|
}
|
|
34949
|
-
/** 429
|
|
36042
|
+
/** `429`: rate limit exceeded. Retried automatically, see `maxRetries`. */
|
|
34950
36043
|
declare class BeeLRateLimitError extends BeeLApiError {
|
|
36044
|
+
/** Seconds the API asked to wait before the next request. */
|
|
34951
36045
|
readonly retryAfterSeconds: number;
|
|
34952
|
-
constructor(message: string, retryAfterSeconds: number, requestId?: string);
|
|
36046
|
+
constructor(message: string, retryAfterSeconds: number, requestId?: string, apiCode?: string);
|
|
34953
36047
|
}
|
|
34954
|
-
/** 422
|
|
36048
|
+
/** `422`: validation or business rule error. `details` names the offending fields. */
|
|
34955
36049
|
declare class BeeLValidationError extends BeeLApiError {
|
|
34956
|
-
constructor(message: string, details?: Record<string, string>, requestId?: string);
|
|
36050
|
+
constructor(message: string, details?: Record<string, string>, requestId?: string, apiCode?: string);
|
|
34957
36051
|
}
|
|
34958
|
-
/** 401 / 403
|
|
36052
|
+
/** `401` / `403`: the API key is missing or invalid, or lacks access to the resource. */
|
|
34959
36053
|
declare class BeeLAuthError extends BeeLApiError {
|
|
34960
|
-
constructor(message: string, statusCode: 401 | 403, requestId?: string);
|
|
36054
|
+
constructor(message: string, statusCode: 401 | 403, requestId?: string, apiCode?: string);
|
|
34961
36055
|
}
|
|
34962
|
-
/** 404
|
|
36056
|
+
/** `404`: the resource does not exist. */
|
|
34963
36057
|
declare class BeeLNotFoundError extends BeeLApiError {
|
|
34964
|
-
constructor(message: string, requestId?: string);
|
|
36058
|
+
constructor(message: string, requestId?: string, apiCode?: string);
|
|
34965
36059
|
}
|
|
34966
|
-
/**
|
|
36060
|
+
/**
|
|
36061
|
+
* `409`: conflict — for example `INVOICE_DUPLICATE_EXTERNAL_REFERENCE` or an
|
|
36062
|
+
* `Idempotency-Key` reused with another body. Branch on {@link BeeLApiError.apiCode}.
|
|
36063
|
+
*/
|
|
34967
36064
|
declare class BeeLConflictError extends BeeLApiError {
|
|
34968
|
-
constructor(message: string, requestId?: string);
|
|
36065
|
+
constructor(message: string, requestId?: string, apiCode?: string, details?: Record<string, string>);
|
|
34969
36066
|
}
|
|
34970
36067
|
|
|
36068
|
+
/**
|
|
36069
|
+
* `error.code` values of the API that the SDK itself reacts to. Compare them with
|
|
36070
|
+
* {@link BeeLApiError.apiCode}. The full catalogue lives in the API reference
|
|
36071
|
+
* (https://docs.beel.es); these are the ones this package has behaviour for.
|
|
36072
|
+
*/
|
|
36073
|
+
declare const BeeLErrorCodes: {
|
|
36074
|
+
/**
|
|
36075
|
+
* `409`: a live standard or simplified invoice with the same `external_ref` already exists
|
|
36076
|
+
* in this environment. Look it up with `invoices.list({ external_ref })`.
|
|
36077
|
+
*/
|
|
36078
|
+
readonly INVOICE_DUPLICATE_EXTERNAL_REFERENCE: "INVOICE_DUPLICATE_EXTERNAL_REFERENCE";
|
|
36079
|
+
/**
|
|
36080
|
+
* `409`: the first request with this `Idempotency-Key` is still being processed. Retry with
|
|
36081
|
+
* the same key after `Retry-After`; the client does so automatically.
|
|
36082
|
+
*/
|
|
36083
|
+
readonly IDEMPOTENCY_KEY_PROCESSING: "IDEMPOTENCY_KEY_PROCESSING";
|
|
36084
|
+
/** `409`: the `Idempotency-Key` was already used with a different body. Use a new key. */
|
|
36085
|
+
readonly IDEMPOTENCY_KEY_MISMATCH: "IDEMPOTENCY_KEY_MISMATCH";
|
|
36086
|
+
};
|
|
36087
|
+
/** One of the {@link BeeLErrorCodes} values. */
|
|
36088
|
+
type BeeLErrorCode = (typeof BeeLErrorCodes)[keyof typeof BeeLErrorCodes];
|
|
36089
|
+
|
|
34971
36090
|
type WebhookEventDataAccountBase = {
|
|
34972
36091
|
/**
|
|
34973
36092
|
* The provisioned account this event refers to.
|
|
@@ -35375,7 +36494,7 @@ type WebhookEventDataTest = {
|
|
|
35375
36494
|
* @example Express.js
|
|
35376
36495
|
* ```typescript
|
|
35377
36496
|
* import express from 'express';
|
|
35378
|
-
* import { WebhookVerifier } from '@
|
|
36497
|
+
* import { WebhookVerifier } from '@beel_es/sdk';
|
|
35379
36498
|
*
|
|
35380
36499
|
* const verifier = new WebhookVerifier('your_webhook_secret');
|
|
35381
36500
|
*
|
|
@@ -35470,15 +36589,25 @@ type BusinessEvent<K extends `${WebhookEventType}`, D> = Omit<WebhookEventEnvelo
|
|
|
35470
36589
|
test?: false | null;
|
|
35471
36590
|
data: D;
|
|
35472
36591
|
};
|
|
36592
|
+
/** `verifactu.status.updated`: AEAT answered for an invoice's VeriFactu record (`new_status`, `qr_url`…). */
|
|
35473
36593
|
type VeriFactuStatusUpdatedEvent = BusinessEvent<'verifactu.status.updated', WebhookEventDataVeriFactuStatusUpdated>;
|
|
36594
|
+
/** `invoice.issued`: an invoice was issued. */
|
|
35474
36595
|
type InvoiceIssuedEvent = BusinessEvent<'invoice.issued', WebhookEventDataInvoiceIssued>;
|
|
36596
|
+
/** `invoice.voided`: an invoice was voided. */
|
|
35475
36597
|
type InvoiceVoidedEvent = BusinessEvent<'invoice.voided', WebhookEventDataInvoiceVoided>;
|
|
36598
|
+
/** `invoice.email.sent`: an invoice email was accepted by the email provider. */
|
|
35476
36599
|
type InvoiceEmailSentEvent = BusinessEvent<'invoice.email.sent', WebhookEventDataInvoiceEmailSent>;
|
|
36600
|
+
/** `invoice.pdf.generated`: the PDF of an invoice is ready. */
|
|
35477
36601
|
type InvoicePdfGeneratedEvent = BusinessEvent<'invoice.pdf.generated', WebhookEventDataInvoicePdfGenerated>;
|
|
36602
|
+
/** `invoice.schedule_failed`: a scheduled invoice could not be processed. */
|
|
35478
36603
|
type InvoiceScheduleFailedEvent = BusinessEvent<'invoice.schedule_failed', WebhookEventDataInvoiceScheduleFailed>;
|
|
36604
|
+
/** `recurring_invoice.paused`: a recurring invoice was paused. */
|
|
35479
36605
|
type RecurringInvoicePausedEvent = BusinessEvent<'recurring_invoice.paused', WebhookEventDataRecurringInvoicePaused>;
|
|
36606
|
+
/** `account.claimed`: the holder of a provisioned account took ownership. */
|
|
35480
36607
|
type AccountClaimedEvent = BusinessEvent<'account.claimed', WebhookEventDataAccountClaimed>;
|
|
36608
|
+
/** `company.created`: a company (NIF) was created. */
|
|
35481
36609
|
type CompanyCreatedEvent = BusinessEvent<'company.created', WebhookEventDataCompanyCreated>;
|
|
36610
|
+
/** `representation.signed`: a representation document was signed. */
|
|
35482
36611
|
type RepresentationSignedEvent = BusinessEvent<'representation.signed', WebhookEventDataRepresentationSigned>;
|
|
35483
36612
|
/**
|
|
35484
36613
|
* A delivery sent with "Send test": `test` is `true` and `data` is a synthetic message,
|
|
@@ -35496,7 +36625,8 @@ type WebhookEvent = VeriFactuStatusUpdatedEvent | InvoiceIssuedEvent | InvoiceVo
|
|
|
35496
36625
|
|
|
35497
36626
|
type CreateCustomerRequest = components['schemas']['CreateCustomerRequest'];
|
|
35498
36627
|
/**
|
|
35499
|
-
* Fluent builder for
|
|
36628
|
+
* Fluent builder for the body of `customers.create`. It builds the request object only;
|
|
36629
|
+
* send it with `beel.company(companyId).customers.create(builder.build())`.
|
|
35500
36630
|
*
|
|
35501
36631
|
* @example
|
|
35502
36632
|
* ```typescript
|
|
@@ -35516,28 +36646,88 @@ declare class CustomerBuilder {
|
|
|
35516
36646
|
private _address?;
|
|
35517
36647
|
private _notes?;
|
|
35518
36648
|
private constructor();
|
|
36649
|
+
/**
|
|
36650
|
+
* Start a new builder.
|
|
36651
|
+
*
|
|
36652
|
+
* @returns An empty customer builder.
|
|
36653
|
+
*/
|
|
35519
36654
|
static create(): CustomerBuilder;
|
|
36655
|
+
/**
|
|
36656
|
+
* Legal name of the customer. Required.
|
|
36657
|
+
*
|
|
36658
|
+
* @param name - Legal name.
|
|
36659
|
+
* @returns This builder.
|
|
36660
|
+
*/
|
|
35520
36661
|
name(name: string): this;
|
|
36662
|
+
/**
|
|
36663
|
+
* NIF/CIF of the customer. Required.
|
|
36664
|
+
*
|
|
36665
|
+
* @param nif - Spanish tax id.
|
|
36666
|
+
* @returns This builder.
|
|
36667
|
+
*/
|
|
35521
36668
|
nif(nif: string): this;
|
|
36669
|
+
/**
|
|
36670
|
+
* Contact email.
|
|
36671
|
+
*
|
|
36672
|
+
* @param email - Email address.
|
|
36673
|
+
* @returns This builder.
|
|
36674
|
+
*/
|
|
35522
36675
|
email(email: string): this;
|
|
36676
|
+
/**
|
|
36677
|
+
* Contact phone: 9 to 20 characters of digits, spaces, dashes, parentheses and a leading `+`.
|
|
36678
|
+
*
|
|
36679
|
+
* @param phone - Phone number.
|
|
36680
|
+
* @returns This builder.
|
|
36681
|
+
*/
|
|
35523
36682
|
phone(phone: string): this;
|
|
36683
|
+
/**
|
|
36684
|
+
* Fiscal address. Required.
|
|
36685
|
+
*
|
|
36686
|
+
* @param street - Street name.
|
|
36687
|
+
* @param number - Street number.
|
|
36688
|
+
* @param postalCode - Postal code.
|
|
36689
|
+
* @param city - City.
|
|
36690
|
+
* @param province - Province.
|
|
36691
|
+
* @param country - Country name.
|
|
36692
|
+
* @param countryCode - ISO 3166-1 alpha-2 code. Default: `ES`.
|
|
36693
|
+
* @returns This builder.
|
|
36694
|
+
*/
|
|
35524
36695
|
address(street: string, number: string, postalCode: string, city: string, province: string, country: string, countryCode?: string): this;
|
|
36696
|
+
/**
|
|
36697
|
+
* Internal notes about the customer.
|
|
36698
|
+
*
|
|
36699
|
+
* @param notes - Free text.
|
|
36700
|
+
* @returns This builder.
|
|
36701
|
+
*/
|
|
35525
36702
|
notes(notes: string): this;
|
|
36703
|
+
/**
|
|
36704
|
+
* Build the request body.
|
|
36705
|
+
*
|
|
36706
|
+
* @returns The `CreateCustomerRequest`.
|
|
36707
|
+
* @throws {Error} When the name, NIF or address is missing.
|
|
36708
|
+
*/
|
|
35526
36709
|
build(): CreateCustomerRequest;
|
|
35527
36710
|
}
|
|
35528
36711
|
|
|
35529
36712
|
type CreateInvoiceRequest = components['schemas']['CreateInvoiceRequest'];
|
|
35530
36713
|
type InvoiceType = components['schemas']['InvoiceType'];
|
|
35531
36714
|
type InvoiceLine = CreateInvoiceRequest['lines'][number];
|
|
36715
|
+
type LineMainTax = NonNullable<InvoiceLine['main_tax']>;
|
|
35532
36716
|
/**
|
|
35533
|
-
* Fluent builder for
|
|
36717
|
+
* Fluent builder for the body of `invoices.create`. It builds the request object only; send
|
|
36718
|
+
* it with `beel.company(companyId).invoices.create(builder.build())`.
|
|
36719
|
+
*
|
|
36720
|
+
* The API requires a `main_tax` on every `NORMAL` line (`422 LINE_MAIN_TAX_REQUIRED`
|
|
36721
|
+
* otherwise): set it once with {@link mainTax}, or per line in {@link addLine}.
|
|
35534
36722
|
*
|
|
35535
36723
|
* @example
|
|
35536
36724
|
* ```typescript
|
|
35537
|
-
* const
|
|
36725
|
+
* const request = InvoiceBuilder.create()
|
|
35538
36726
|
* .forCustomer('customer-uuid')
|
|
35539
|
-
* .
|
|
36727
|
+
* .mainTax({ type: 'IVA', percentage: 21, regime_key: '01' })
|
|
36728
|
+
* .addLine('Consulting services', 10, 85.5)
|
|
35540
36729
|
* .build();
|
|
36730
|
+
* const invoice = await beel.company(companyId).invoices.create(request);
|
|
35541
36731
|
* ```
|
|
35542
36732
|
*/
|
|
35543
36733
|
declare class InvoiceBuilder {
|
|
@@ -35549,17 +36739,96 @@ declare class InvoiceBuilder {
|
|
|
35549
36739
|
private _notes?;
|
|
35550
36740
|
private _seriesId?;
|
|
35551
36741
|
private _metadata?;
|
|
36742
|
+
private _mainTax?;
|
|
35552
36743
|
private constructor();
|
|
36744
|
+
/**
|
|
36745
|
+
* Start a new builder.
|
|
36746
|
+
*
|
|
36747
|
+
* @returns An empty `STANDARD` invoice builder.
|
|
36748
|
+
*/
|
|
35553
36749
|
static create(): InvoiceBuilder;
|
|
36750
|
+
/**
|
|
36751
|
+
* Set the invoice type. Default: `STANDARD`.
|
|
36752
|
+
*
|
|
36753
|
+
* @param type - `STANDARD`, `SIMPLIFIED` or `PROFORMA` (correctives use `createCorrective`).
|
|
36754
|
+
* @returns This builder.
|
|
36755
|
+
*/
|
|
35554
36756
|
type(type: InvoiceType): this;
|
|
36757
|
+
/**
|
|
36758
|
+
* Invoice a registered customer.
|
|
36759
|
+
*
|
|
36760
|
+
* @param customerId - Customer UUID.
|
|
36761
|
+
* @returns This builder.
|
|
36762
|
+
*/
|
|
35555
36763
|
forCustomer(customerId: string): this;
|
|
36764
|
+
/**
|
|
36765
|
+
* Date the operation took place, when it differs from the issue date.
|
|
36766
|
+
*
|
|
36767
|
+
* @param date - A `Date` or a `YYYY-MM-DD` string.
|
|
36768
|
+
* @returns This builder.
|
|
36769
|
+
*/
|
|
35556
36770
|
operationDate(date: string | Date): this;
|
|
36771
|
+
/**
|
|
36772
|
+
* Payment due date.
|
|
36773
|
+
*
|
|
36774
|
+
* @param date - A `Date` or a `YYYY-MM-DD` string.
|
|
36775
|
+
* @returns This builder.
|
|
36776
|
+
*/
|
|
35557
36777
|
dueDate(date: string | Date): this;
|
|
35558
|
-
|
|
36778
|
+
/**
|
|
36779
|
+
* Main tax applied to every line added with {@link addLine} after this call, unless the
|
|
36780
|
+
* line passes its own.
|
|
36781
|
+
*
|
|
36782
|
+
* @param tax - For example `{ type: 'IVA', percentage: 21, regime_key: '01' }`.
|
|
36783
|
+
* @returns This builder.
|
|
36784
|
+
*/
|
|
36785
|
+
mainTax(tax: LineMainTax): this;
|
|
36786
|
+
/**
|
|
36787
|
+
* Add a `NORMAL` line.
|
|
36788
|
+
*
|
|
36789
|
+
* @param description - What is invoiced.
|
|
36790
|
+
* @param quantity - Units.
|
|
36791
|
+
* @param unitPrice - Price per unit before taxes.
|
|
36792
|
+
* @param discountPercentage - Discount, 0–100. Default: `0`.
|
|
36793
|
+
* @param mainTax - Tax of this line; defaults to the one set with {@link mainTax}. The API
|
|
36794
|
+
* rejects a `NORMAL` line without one.
|
|
36795
|
+
* @returns This builder.
|
|
36796
|
+
*/
|
|
36797
|
+
addLine(description: string, quantity: number, unitPrice: number, discountPercentage?: number, mainTax?: LineMainTax): this;
|
|
36798
|
+
/**
|
|
36799
|
+
* Add a line exactly as given — any line type or pricing mode.
|
|
36800
|
+
*
|
|
36801
|
+
* @param line - A line of `CreateInvoiceRequest`.
|
|
36802
|
+
* @returns This builder.
|
|
36803
|
+
*/
|
|
35559
36804
|
addLineObject(line: InvoiceLine): this;
|
|
36805
|
+
/**
|
|
36806
|
+
* Notes printed on the invoice.
|
|
36807
|
+
*
|
|
36808
|
+
* @param notes - Free text.
|
|
36809
|
+
* @returns This builder.
|
|
36810
|
+
*/
|
|
35560
36811
|
notes(notes: string): this;
|
|
36812
|
+
/**
|
|
36813
|
+
* Number the invoice in this series instead of the default one.
|
|
36814
|
+
*
|
|
36815
|
+
* @param id - Series UUID.
|
|
36816
|
+
* @returns This builder.
|
|
36817
|
+
*/
|
|
35561
36818
|
series(id: string): this;
|
|
36819
|
+
/**
|
|
36820
|
+
* Your own key/value pairs, filterable when listing.
|
|
36821
|
+
*
|
|
36822
|
+
* @param data - Metadata to store with the invoice.
|
|
36823
|
+
* @returns This builder.
|
|
36824
|
+
*/
|
|
35562
36825
|
metadata(data: Record<string, any>): this;
|
|
36826
|
+
/**
|
|
36827
|
+
* Build the request body.
|
|
36828
|
+
*
|
|
36829
|
+
* @returns The `CreateInvoiceRequest`.
|
|
36830
|
+
* @throws {Error} When there is no customer or no line.
|
|
36831
|
+
*/
|
|
35563
36832
|
build(): CreateInvoiceRequest;
|
|
35564
36833
|
}
|
|
35565
36834
|
|
|
@@ -35568,4 +36837,4 @@ type VeriFactuStatusUpdatedData = WebhookEventDataVeriFactuStatusUpdated;
|
|
|
35568
36837
|
/** @deprecated Renamed in the contract — use `VeriFactuSubmissionStatus`. */
|
|
35569
36838
|
type VeriFactuStatus = VeriFactuSubmissionStatus;
|
|
35570
36839
|
|
|
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 };
|
|
36840
|
+
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, 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 };
|