@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.js CHANGED
@@ -587,7 +587,10 @@ var AccountsResource = class {
587
587
  const { data } = await this.client.GET("/v1/accounts", { params: { query: params } });
588
588
  return data.data;
589
589
  }
590
- /** Provision a new managed account. */
590
+ /**
591
+ * Provision a new managed account. Answers with the provisioning result — the account
592
+ * id, its status and, when one is issued, the claim link — not with the account summary.
593
+ */
591
594
  async provision(body) {
592
595
  const { data } = await this.client.POST("/v1/accounts", { body });
593
596
  return data.data;
@@ -1092,6 +1095,37 @@ var CompanyInvoicesResource = class {
1092
1095
  });
1093
1096
  return data.data;
1094
1097
  }
1098
+ /**
1099
+ * Issue a full invoice in exchange for one or more issued simplified invoices, when the
1100
+ * customer asks for an invoice with their details. It is not a corrective: the simplified
1101
+ * invoices become `VOIDED` with `void_cause: 'EXCHANGED'`, and the new `STANDARD` invoice
1102
+ * lists them in `replaced_invoice_ids`.
1103
+ *
1104
+ * @example
1105
+ * ```typescript
1106
+ * const invoice = await company.invoices.createSimplifiedExchange({
1107
+ * simplified_invoice_ids: ['simplified-uuid'],
1108
+ * recipient: { customer_id: 'customer-uuid' },
1109
+ * });
1110
+ * ```
1111
+ */
1112
+ async createSimplifiedExchange(body) {
1113
+ const { data } = await this.client.POST("/v1/companies/{company_id}/invoices/simplified-exchanges", {
1114
+ params: { path: this.path() },
1115
+ body
1116
+ });
1117
+ return data.data;
1118
+ }
1119
+ /**
1120
+ * The VeriFactu records of an invoice, oldest first: its registration and, if it was
1121
+ * voided, its cancellation. An invoice never submitted answers with an empty list.
1122
+ */
1123
+ async verifactuRecords(invoiceId) {
1124
+ const { data } = await this.client.GET("/v1/companies/{company_id}/invoices/{invoice_id}/verifactu-records", {
1125
+ params: { path: this.path({ invoice_id: invoiceId }) }
1126
+ });
1127
+ return data.data.records;
1128
+ }
1095
1129
  /** Update payment status (e.g. mark as paid). */
1096
1130
  async setStatus(invoiceId, body) {
1097
1131
  const { data } = await this.client.PUT("/v1/companies/{company_id}/invoices/{invoice_id}/status", {
@@ -1484,6 +1518,7 @@ var WebhookVerifier = class {
1484
1518
  * const verifier = new WebhookVerifier('your_secret');
1485
1519
  * const event = verifier.verify(rawBody, signature);
1486
1520
  *
1521
+ * if (event.test) return; // a "Send test" delivery carries a synthetic `data`
1487
1522
  * if (event.type === 'verifactu.status.updated') {
1488
1523
  * console.log('Invoice:', event.data.invoice_number);
1489
1524
  * console.log('Status:', event.data.new_status);
@@ -1607,6 +1642,24 @@ var InvoiceIssuedEvent;
1607
1642
  })(type = InvoiceIssuedEvent2.type || (InvoiceIssuedEvent2.type = {}));
1608
1643
  })(InvoiceIssuedEvent || (InvoiceIssuedEvent = {}));
1609
1644
 
1645
+ // src/generated-webhooks/models/InvoicePdfGeneratedEvent.ts
1646
+ var InvoicePdfGeneratedEvent;
1647
+ ((InvoicePdfGeneratedEvent2) => {
1648
+ let type;
1649
+ ((type2) => {
1650
+ type2["INVOICE_PDF_GENERATED"] = "invoice.pdf.generated";
1651
+ })(type = InvoicePdfGeneratedEvent2.type || (InvoicePdfGeneratedEvent2.type = {}));
1652
+ })(InvoicePdfGeneratedEvent || (InvoicePdfGeneratedEvent = {}));
1653
+
1654
+ // src/generated-webhooks/models/InvoiceScheduleFailedEvent.ts
1655
+ var InvoiceScheduleFailedEvent;
1656
+ ((InvoiceScheduleFailedEvent2) => {
1657
+ let type;
1658
+ ((type2) => {
1659
+ type2["INVOICE_SCHEDULE_FAILED"] = "invoice.schedule_failed";
1660
+ })(type = InvoiceScheduleFailedEvent2.type || (InvoiceScheduleFailedEvent2.type = {}));
1661
+ })(InvoiceScheduleFailedEvent || (InvoiceScheduleFailedEvent = {}));
1662
+
1610
1663
  // src/generated-webhooks/models/InvoiceVoidedEvent.ts
1611
1664
  var InvoiceVoidedEvent;
1612
1665
  ((InvoiceVoidedEvent2) => {
@@ -1657,8 +1710,10 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
1657
1710
  WebhookEventType2["VERIFACTU_STATUS_UPDATED"] = "verifactu.status.updated";
1658
1711
  WebhookEventType2["INVOICE_ISSUED"] = "invoice.issued";
1659
1712
  WebhookEventType2["INVOICE_EMAIL_SENT"] = "invoice.email.sent";
1713
+ WebhookEventType2["INVOICE_PDF_GENERATED"] = "invoice.pdf.generated";
1660
1714
  WebhookEventType2["INVOICE_VOIDED"] = "invoice.voided";
1661
1715
  WebhookEventType2["RECURRING_INVOICE_PAUSED"] = "recurring_invoice.paused";
1716
+ WebhookEventType2["INVOICE_SCHEDULE_FAILED"] = "invoice.schedule_failed";
1662
1717
  WebhookEventType2["ACCOUNT_CLAIMED"] = "account.claimed";
1663
1718
  WebhookEventType2["COMPANY_CREATED"] = "company.created";
1664
1719
  WebhookEventType2["REPRESENTATION_SIGNED"] = "representation.signed";