@adonis-agora/payments 0.16.2 → 0.18.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 +27 -0
- package/dist/assets/spa/assets/index-CmP4DYhG.js +10 -0
- package/dist/assets/spa/assets/index-CmP4DYhG.js.map +1 -0
- package/dist/assets/spa/index.html +1 -1
- package/dist/src/billing/billing_store.d.ts +26 -2
- package/dist/src/billing/billing_store.d.ts.map +1 -1
- package/dist/src/billing/billing_store.js.map +1 -1
- package/dist/src/billing/lucid_billing_store.d.ts +3 -1
- package/dist/src/billing/lucid_billing_store.d.ts.map +1 -1
- package/dist/src/billing/lucid_billing_store.js +9 -1
- package/dist/src/billing/lucid_billing_store.js.map +1 -1
- package/dist/src/billing/managed_subscriptions.d.ts +12 -0
- package/dist/src/billing/managed_subscriptions.d.ts.map +1 -1
- package/dist/src/billing/managed_subscriptions.js +13 -3
- package/dist/src/billing/managed_subscriptions.js.map +1 -1
- package/dist/src/billing/mixins/with_subscription.d.ts +5 -1
- package/dist/src/billing/mixins/with_subscription.d.ts.map +1 -1
- package/dist/src/billing/mixins/with_subscription.js.map +1 -1
- package/dist/src/billing/mixins/with_usage_event.d.ts +8 -0
- package/dist/src/billing/mixins/with_usage_event.d.ts.map +1 -1
- package/dist/src/billing/mixins/with_usage_event.js +6 -0
- package/dist/src/billing/mixins/with_usage_event.js.map +1 -1
- package/dist/src/billing/schema.d.ts.map +1 -1
- package/dist/src/billing/schema.js +15 -0
- package/dist/src/billing/schema.js.map +1 -1
- package/dist/src/billing/usage.d.ts +121 -0
- package/dist/src/billing/usage.d.ts.map +1 -0
- package/dist/src/billing/usage.js +123 -0
- package/dist/src/billing/usage.js.map +1 -0
- package/dist/src/drivers/asaas.d.ts.map +1 -1
- package/dist/src/drivers/asaas.js +41 -0
- package/dist/src/drivers/asaas.js.map +1 -1
- package/dist/src/index.d.ts +6 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/invoice/drivers/asaas.d.ts +44 -1
- package/dist/src/invoice/drivers/asaas.d.ts.map +1 -1
- package/dist/src/invoice/drivers/asaas.js +152 -42
- package/dist/src/invoice/drivers/asaas.js.map +1 -1
- package/dist/src/invoice/drivers/enotas.d.ts +2 -0
- package/dist/src/invoice/drivers/enotas.d.ts.map +1 -1
- package/dist/src/invoice/drivers/enotas.js +5 -0
- package/dist/src/invoice/drivers/enotas.js.map +1 -1
- package/dist/src/invoice/drivers/focus.d.ts +2 -0
- package/dist/src/invoice/drivers/focus.d.ts.map +1 -1
- package/dist/src/invoice/drivers/focus.js +5 -0
- package/dist/src/invoice/drivers/focus.js.map +1 -1
- package/dist/src/invoice/drivers/plugnotas.d.ts +2 -0
- package/dist/src/invoice/drivers/plugnotas.d.ts.map +1 -1
- package/dist/src/invoice/drivers/plugnotas.js +5 -0
- package/dist/src/invoice/drivers/plugnotas.js.map +1 -1
- package/dist/src/invoice/drivers/shared.d.ts +7 -0
- package/dist/src/invoice/drivers/shared.d.ts.map +1 -0
- package/dist/src/invoice/drivers/shared.js +9 -0
- package/dist/src/invoice/drivers/shared.js.map +1 -0
- package/dist/src/invoice/drivers/tecnospeed.d.ts +2 -0
- package/dist/src/invoice/drivers/tecnospeed.d.ts.map +1 -1
- package/dist/src/invoice/drivers/tecnospeed.js +5 -0
- package/dist/src/invoice/drivers/tecnospeed.js.map +1 -1
- package/dist/src/invoice/emit_invoice.d.ts.map +1 -1
- package/dist/src/invoice/emit_invoice.js +6 -0
- package/dist/src/invoice/emit_invoice.js.map +1 -1
- package/dist/src/invoice/invoice_provider.d.ts +51 -4
- package/dist/src/invoice/invoice_provider.d.ts.map +1 -1
- package/dist/src/payments_manager.d.ts +19 -0
- package/dist/src/payments_manager.d.ts.map +1 -1
- package/dist/src/payments_manager.js +28 -0
- package/dist/src/payments_manager.js.map +1 -1
- package/dist/src/testing/in_memory_billing_store.d.ts +5 -1
- package/dist/src/testing/in_memory_billing_store.d.ts.map +1 -1
- package/dist/src/testing/in_memory_billing_store.js +6 -0
- package/dist/src/testing/in_memory_billing_store.js.map +1 -1
- package/dist/src/types.d.ts +39 -1
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +44 -40
- package/dist/assets/spa/assets/index-1Gb8l6g0.js +0 -10
- package/dist/assets/spa/assets/index-1Gb8l6g0.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @adonis-agora/payments
|
|
2
2
|
|
|
3
|
+
## 0.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#142](https://github.com/DavideCarvalho/adonis-agora-payments/pull/142) [`6dfa41b`](https://github.com/DavideCarvalho/adonis-agora-payments/commit/6dfa41b887fa646e232523e1e1229395c8677152) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Meter usage against an application resource, read it back against a quota, and type free-plan subscriptions honestly.
|
|
8
|
+
|
|
9
|
+
- `billing_usage_events` gains `scope_type` / `scope_id` and an index on `(scope_type, scope_id, meter)`. `recordUsage` and `usageReport` take `scope: { type, id }` — a project, a workspace, a site — alongside `subscriptionId` / `customerId`, so per-resource usage no longer has to live in `metadata`. Added through the existing `createBillingTables()` upgrade path: an existing install picks the columns up on the next boot (or the next run of the published migration), no new migration to publish. Existing rows read as unscoped.
|
|
10
|
+
- `payments.usage()` — `record`, `total`, `remaining` and `period` — plus the standalone `usageTotal`, `usageRemaining` and `usagePeriodFor`. `period: { subscription }` derives the window from the subscription's billing cycle: the stored current period when it is current, otherwise stepped by `cycle` from its anchor, so a free row nothing renews still resets every cycle.
|
|
11
|
+
- `advancePeriodBy(from, cycle, count)` — anchored multi-cycle arithmetic, without the drift chained clamps accumulate.
|
|
12
|
+
- **Source-breaking:** `SubscriptionRow.gatewayId` (the `withSubscription()` mixin) widens to `string | null`, matching `BillingSubscription` and the column, which was always nullable. Free plans, local trials and comped subscriptions have no gateway subscription to point at. Code assigning `row.gatewayId` into a `string` needs a null check.
|
|
13
|
+
- `LucidBillingStore.usageReport` now applies `customerId` together with `subscriptionId` instead of dropping it, matching `InMemoryBillingStore`.
|
|
14
|
+
|
|
15
|
+
## 0.17.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#125](https://github.com/DavideCarvalho/adonis-agora-payments/pull/125) [`d55ca3b`](https://github.com/DavideCarvalho/adonis-agora-payments/commit/d55ca3bf16bb6630b6510e758b300d3ec8a561eb) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - **Asaas NFS-e provider fixed** (`invoice.asaas()`); it could not schedule a valid note before.
|
|
20
|
+
|
|
21
|
+
- **Recipient:** sends the Asaas charge as `payment` (when the charge went through Asaas) or the Asaas customer id as `customer` (new `customer.gatewayId`, `cus_…`). It used to send the CPF/CNPJ in `customer`, which Asaas rejects. With neither id, `emit` throws.
|
|
22
|
+
- **Required fields:** sends `effectiveDate` (default: today in Brasília), `deductions` (default 0), `observations` and the full `taxes` object (`retainIss`, `iss`, `pis`, `cofins`, `csll`, `inss`, `ir`, plus `nbsCode` and any other key given). Retentions default to none; a missing `tax.iss` throws instead of being sent as 0. `municipalServiceId` / `municipalServiceName` are new optional `service` fields; `cityServiceCode` (or `code`) goes as `municipalServiceCode`. The non-existent `serviceCode` is no longer sent.
|
|
23
|
+
- **No more customer data in free text:** the customer's name and e-mail no longer go into `description`/`notes`, and `metadata` no longer goes into `observations`. `serviceDescription` and `observations` carry what you passed.
|
|
24
|
+
- **Idempotency:** new `externalReference`; with it, `emit` returns the live note (not cancelled, not `ERROR`) already under that reference instead of scheduling a second one.
|
|
25
|
+
- **Response mapping** follows the documented `InvoiceGetResponseDTO`: `number`, `pdfUrl`, and the statuses `SCHEDULED`/`SYNCHRONIZED` → `pending`, `AUTHORIZED`/`PROCESSING_CANCELLATION`/`CANCELLATION_DENIED` → `issued`, `CANCELED` → `canceled`, `ERROR` → `failed`.
|
|
26
|
+
- **Webhooks:** the Asaas payments driver maps `INVOICE_*` to `nfse.created|updated|synchronized|authorized|failed|cancellation_processing|canceled|cancellation_denied`, with the note on `event.data` (`gatewayId`, `status`, `providerStatus`, `number`, `pdfUrl`, `xmlUrl`, `paymentId`, `customerId`, `externalReference`, `statusDescription`…).
|
|
27
|
+
|
|
28
|
+
**Contract:** `InvoiceProvider` gains `cancel(invoiceId, options?: { reason?, providerOnly? })` (Asaas: `POST /invoices/{id}/cancel`, `providerOnly` = `cancelOnlyOnAsaas`; the other built-in providers throw "not supported"). A custom `InvoiceProvider` must add the method. `InvoiceEmitInput` and `InvoiceOptions` gain the optional `effectiveDate`, `deductions`, `observations`, `externalReference`, `customer.gatewayId`, `service.municipalServiceId` and `service.municipalServiceName`; `tax` is now typed as `InvoiceTaxes` (still open to other keys).
|
|
29
|
+
|
|
3
30
|
## 0.16.2
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|