@beel_es/sdk 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -62,8 +62,22 @@ const company = beel.company('company-uuid');
62
62
  // Invoices — full lifecycle
63
63
  const { invoices, pagination } = await company.invoices.list({ status: 'ISSUED' });
64
64
  await company.invoices.issue('invoice-uuid');
65
- await company.invoices.void('invoice-uuid', { reason: 'Billing error' });
66
- await company.invoices.createCorrective('invoice-uuid', { ... });
65
+ // A void is only for an invoice issued by mistake; `issued_in_error: true` is required
66
+ // once it has been sent or paid. An operation that did happen gets a corrective instead.
67
+ await company.invoices.void('invoice-uuid', { reason: 'Duplicate', issued_in_error: true });
68
+ await company.invoices.createCorrective('invoice-uuid', {
69
+ rectification_type: 'PARTIAL',
70
+ rectification_code: 'R1',
71
+ reason: 'Discount granted after the sale',
72
+ circumstance_date: '2026-09-01', // when the art. 80 circumstance happened, if any
73
+ lines: [ ... ],
74
+ });
75
+ // Exchange issued simplified invoices for a full one with the customer identified
76
+ await company.invoices.createSimplifiedExchange({
77
+ simplified_invoice_ids: ['simplified-uuid'],
78
+ recipient: { customer_id: 'customer-uuid' },
79
+ });
80
+ const records = await company.invoices.verifactuRecords('invoice-uuid'); // registration, cancellation
67
81
  const pdf = await company.invoices.getPdf('invoice-uuid');
68
82
 
69
83
  // Customers, products, series
@@ -134,7 +148,7 @@ wrapper is written by hand. `beel.raw` lets you call anything in the contract to
134
148
  without waiting for a release:
135
149
 
136
150
  ```typescript
137
- const { data } = await beel.raw.GET('/v1/companies/{company_id}/logo', {
151
+ const { data } = await beel.raw.GET('/v1/companies/{company_id}/invoice-customization', {
138
152
  params: { path: { company_id: 'company-uuid' } },
139
153
  });
140
154
  ```
@@ -290,8 +304,11 @@ app.post('/webhooks/beel', express.raw({ type: 'application/json' }), (req, res)
290
304
  req.headers['beel-signature'] as string,
291
305
  );
292
306
 
307
+ // "Send test" deliveries carry a synthetic `data`: acknowledge and stop.
308
+ if (event.test) return res.status(200).send('OK');
309
+
293
310
  if (event.type === 'verifactu.status.updated') {
294
- console.log(event.data.new_status); // 'ACCEPTED' | 'REJECTED'
311
+ console.log(event.data.new_status); // 'PENDING' | 'ACCEPTED' | 'REJECTED' | 'VOIDED'
295
312
  }
296
313
 
297
314
  res.status(200).send('OK');