@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/dist/index.mjs CHANGED
@@ -521,7 +521,10 @@ var AccountsResource = class {
521
521
  const { data } = await this.client.GET("/v1/accounts", { params: { query: params } });
522
522
  return data.data;
523
523
  }
524
- /** Provision a new managed account. */
524
+ /**
525
+ * Provision a new managed account. Answers with the provisioning result — the account
526
+ * id, its status and, when one is issued, the claim link — not with the account summary.
527
+ */
525
528
  async provision(body) {
526
529
  const { data } = await this.client.POST("/v1/accounts", { body });
527
530
  return data.data;
@@ -1026,6 +1029,37 @@ var CompanyInvoicesResource = class {
1026
1029
  });
1027
1030
  return data.data;
1028
1031
  }
1032
+ /**
1033
+ * Issue a full invoice in exchange for one or more issued simplified invoices, when the
1034
+ * customer asks for an invoice with their details. It is not a corrective: the simplified
1035
+ * invoices become `VOIDED` with `void_cause: 'EXCHANGED'`, and the new `STANDARD` invoice
1036
+ * lists them in `replaced_invoice_ids`.
1037
+ *
1038
+ * @example
1039
+ * ```typescript
1040
+ * const invoice = await company.invoices.createSimplifiedExchange({
1041
+ * simplified_invoice_ids: ['simplified-uuid'],
1042
+ * recipient: { customer_id: 'customer-uuid' },
1043
+ * });
1044
+ * ```
1045
+ */
1046
+ async createSimplifiedExchange(body) {
1047
+ const { data } = await this.client.POST("/v1/companies/{company_id}/invoices/simplified-exchanges", {
1048
+ params: { path: this.path() },
1049
+ body
1050
+ });
1051
+ return data.data;
1052
+ }
1053
+ /**
1054
+ * The VeriFactu records of an invoice, oldest first: its registration and, if it was
1055
+ * voided, its cancellation. An invoice never submitted answers with an empty list.
1056
+ */
1057
+ async verifactuRecords(invoiceId) {
1058
+ const { data } = await this.client.GET("/v1/companies/{company_id}/invoices/{invoice_id}/verifactu-records", {
1059
+ params: { path: this.path({ invoice_id: invoiceId }) }
1060
+ });
1061
+ return data.data.records;
1062
+ }
1029
1063
  /** Update payment status (e.g. mark as paid). */
1030
1064
  async setStatus(invoiceId, body) {
1031
1065
  const { data } = await this.client.PUT("/v1/companies/{company_id}/invoices/{invoice_id}/status", {
@@ -1418,6 +1452,7 @@ var WebhookVerifier = class {
1418
1452
  * const verifier = new WebhookVerifier('your_secret');
1419
1453
  * const event = verifier.verify(rawBody, signature);
1420
1454
  *
1455
+ * if (event.test) return; // a "Send test" delivery carries a synthetic `data`
1421
1456
  * if (event.type === 'verifactu.status.updated') {
1422
1457
  * console.log('Invoice:', event.data.invoice_number);
1423
1458
  * console.log('Status:', event.data.new_status);
@@ -1541,6 +1576,24 @@ var InvoiceIssuedEvent;
1541
1576
  })(type = InvoiceIssuedEvent2.type || (InvoiceIssuedEvent2.type = {}));
1542
1577
  })(InvoiceIssuedEvent || (InvoiceIssuedEvent = {}));
1543
1578
 
1579
+ // src/generated-webhooks/models/InvoicePdfGeneratedEvent.ts
1580
+ var InvoicePdfGeneratedEvent;
1581
+ ((InvoicePdfGeneratedEvent2) => {
1582
+ let type;
1583
+ ((type2) => {
1584
+ type2["INVOICE_PDF_GENERATED"] = "invoice.pdf.generated";
1585
+ })(type = InvoicePdfGeneratedEvent2.type || (InvoicePdfGeneratedEvent2.type = {}));
1586
+ })(InvoicePdfGeneratedEvent || (InvoicePdfGeneratedEvent = {}));
1587
+
1588
+ // src/generated-webhooks/models/InvoiceScheduleFailedEvent.ts
1589
+ var InvoiceScheduleFailedEvent;
1590
+ ((InvoiceScheduleFailedEvent2) => {
1591
+ let type;
1592
+ ((type2) => {
1593
+ type2["INVOICE_SCHEDULE_FAILED"] = "invoice.schedule_failed";
1594
+ })(type = InvoiceScheduleFailedEvent2.type || (InvoiceScheduleFailedEvent2.type = {}));
1595
+ })(InvoiceScheduleFailedEvent || (InvoiceScheduleFailedEvent = {}));
1596
+
1544
1597
  // src/generated-webhooks/models/InvoiceVoidedEvent.ts
1545
1598
  var InvoiceVoidedEvent;
1546
1599
  ((InvoiceVoidedEvent2) => {
@@ -1591,8 +1644,10 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
1591
1644
  WebhookEventType2["VERIFACTU_STATUS_UPDATED"] = "verifactu.status.updated";
1592
1645
  WebhookEventType2["INVOICE_ISSUED"] = "invoice.issued";
1593
1646
  WebhookEventType2["INVOICE_EMAIL_SENT"] = "invoice.email.sent";
1647
+ WebhookEventType2["INVOICE_PDF_GENERATED"] = "invoice.pdf.generated";
1594
1648
  WebhookEventType2["INVOICE_VOIDED"] = "invoice.voided";
1595
1649
  WebhookEventType2["RECURRING_INVOICE_PAUSED"] = "recurring_invoice.paused";
1650
+ WebhookEventType2["INVOICE_SCHEDULE_FAILED"] = "invoice.schedule_failed";
1596
1651
  WebhookEventType2["ACCOUNT_CLAIMED"] = "account.claimed";
1597
1652
  WebhookEventType2["COMPANY_CREATED"] = "company.created";
1598
1653
  WebhookEventType2["REPRESENTATION_SIGNED"] = "representation.signed";