@beel_es/sdk 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -0
- package/dist/index.d.mts +10104 -3678
- package/dist/index.d.ts +10104 -3678
- package/dist/index.js +255 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +249 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -75,11 +75,74 @@ await company.series.ensureDefaults(); // idempotent seeding of the typed defaul
|
|
|
75
75
|
await company.recurringInvoices.create({ ... });
|
|
76
76
|
await company.recurringInvoices.setStatus('rec-uuid', { status: 'PAUSED' });
|
|
77
77
|
|
|
78
|
+
// Scheduling — one PUT sets or moves it, one DELETE clears it
|
|
79
|
+
await company.invoices.schedule.set('invoice-uuid', { scheduled_for: '2026-12-01' });
|
|
80
|
+
await company.invoices.schedule.clear('invoice-uuid');
|
|
81
|
+
|
|
82
|
+
// Derive a new invoice from an existing one
|
|
83
|
+
const copy = await company.invoices.derive({ from_invoice_id: 'invoice-uuid' });
|
|
84
|
+
|
|
85
|
+
// Fiscal configuration of this NIF
|
|
86
|
+
const verifactu = await company.verifactuConfiguration.get();
|
|
87
|
+
await company.verifactuConfiguration.update({ enabled: true });
|
|
88
|
+
const taxes = await company.taxConfiguration.get();
|
|
89
|
+
|
|
78
90
|
// Company health
|
|
79
91
|
const summary = await company.fiscalSummary({ year: 2026 });
|
|
80
92
|
const readiness = await company.issuingReadiness();
|
|
81
93
|
```
|
|
82
94
|
|
|
95
|
+
Whether an invoice reaches AEAT is a fact of the **NIF**, resolved at issue time — not a
|
|
96
|
+
per-invoice choice. `enabled` is the only writable field of the VeriFactu configuration.
|
|
97
|
+
|
|
98
|
+
### Payment connections (Stripe per NIF)
|
|
99
|
+
|
|
100
|
+
A connection links Stripe to one NIF so its charges auto-generate invoices under it. It is
|
|
101
|
+
addressed by **its own UUID**, not by the provider slug — a NIF can hold several
|
|
102
|
+
connections of the same provider. The slug only appears when you start an authorization.
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
const { connections } = await company.paymentConnections.list();
|
|
106
|
+
|
|
107
|
+
const { authorization_url } = await company.paymentConnections.authorize({
|
|
108
|
+
provider: 'stripe',
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const events = company.paymentConnections.events(connections[0].id);
|
|
112
|
+
const { events: pending } = await events.list({ needs_action: true });
|
|
113
|
+
|
|
114
|
+
// Recovery levers for a charge that did not invoice
|
|
115
|
+
await events.retry('event-uuid');
|
|
116
|
+
const { invoice_id } = await events.draft('event-uuid'); // review before issuing
|
|
117
|
+
await events.resolve('event-uuid');
|
|
118
|
+
|
|
119
|
+
await company.paymentConnections.disconnect(connections[0].id);
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Catalogs and preferences
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
const taxTypes = await beel.catalogs.taxTypes();
|
|
126
|
+
const options = await beel.catalogs.invoiceCustomizationOptions();
|
|
127
|
+
await beel.catalogs.updateMe({ language: 'es' }); // the language belongs to the person
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Any endpoint: `beel.raw`
|
|
131
|
+
|
|
132
|
+
A route reaches the generated types as soon as the contract is synced, but its ergonomic
|
|
133
|
+
wrapper is written by hand. `beel.raw` lets you call anything in the contract today,
|
|
134
|
+
without waiting for a release:
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
const { data } = await beel.raw.GET('/v1/companies/{company_id}/logo', {
|
|
138
|
+
params: { path: { company_id: 'company-uuid' } },
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
It is the same client the resources use — authentication, retries and `Idempotency-Key`
|
|
143
|
+
still apply — and it stays typed: a path, parameter or body the contract does not have
|
|
144
|
+
will not compile. What you give up is the sugar and the naming stability of the wrappers.
|
|
145
|
+
|
|
83
146
|
## Accounts (managed accounts, members & webhooks)
|
|
84
147
|
|
|
85
148
|
For integrators managing several accounts (provisioning, gestorías, platforms):
|