@adonis-agora/payments 0.10.0 → 0.12.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/dist/assets/spa/assets/{index-Q4Eewxjq.js → index-DYQO0uZL.js} +2 -2
  3. package/dist/assets/spa/assets/{index-Q4Eewxjq.js.map → index-DYQO0uZL.js.map} +1 -1
  4. package/dist/assets/spa/index.html +1 -1
  5. package/dist/commands/payments_sync.d.ts +43 -1
  6. package/dist/commands/payments_sync.d.ts.map +1 -1
  7. package/dist/commands/payments_sync.js +102 -23
  8. package/dist/commands/payments_sync.js.map +1 -1
  9. package/dist/src/billing/billing_health.js +2 -2
  10. package/dist/src/billing/billing_health.js.map +1 -1
  11. package/dist/src/billing/billing_store.d.ts +48 -13
  12. package/dist/src/billing/billing_store.d.ts.map +1 -1
  13. package/dist/src/billing/billing_store.js.map +1 -1
  14. package/dist/src/billing/index.d.ts +1 -1
  15. package/dist/src/billing/index.d.ts.map +1 -1
  16. package/dist/src/billing/index.js +1 -1
  17. package/dist/src/billing/index.js.map +1 -1
  18. package/dist/src/billing/list_query.d.ts +23 -7
  19. package/dist/src/billing/list_query.d.ts.map +1 -1
  20. package/dist/src/billing/list_query.js +33 -16
  21. package/dist/src/billing/list_query.js.map +1 -1
  22. package/dist/src/billing/lucid_billing_store.d.ts +2 -2
  23. package/dist/src/billing/lucid_billing_store.d.ts.map +1 -1
  24. package/dist/src/billing/lucid_billing_store.js +18 -18
  25. package/dist/src/billing/lucid_billing_store.js.map +1 -1
  26. package/dist/src/dashboard/handlers.d.ts +3 -3
  27. package/dist/src/dashboard/handlers.d.ts.map +1 -1
  28. package/dist/src/dashboard/handlers.js +68 -54
  29. package/dist/src/dashboard/handlers.js.map +1 -1
  30. package/dist/src/index.d.ts +1 -1
  31. package/dist/src/index.d.ts.map +1 -1
  32. package/dist/src/index.js +1 -1
  33. package/dist/src/index.js.map +1 -1
  34. package/dist/src/testing/in_memory_billing_store.d.ts +2 -2
  35. package/dist/src/testing/in_memory_billing_store.d.ts.map +1 -1
  36. package/dist/src/testing/in_memory_billing_store.js +8 -8
  37. package/dist/src/testing/in_memory_billing_store.js.map +1 -1
  38. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,75 @@
1
1
  # @adonis-agora/payments
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#43](https://github.com/DavideCarvalho/adonis-agora-payments/pull/43) [`ea598e8`](https://github.com/DavideCarvalho/adonis-agora-payments/commit/ea598e840aa85e4b2634863165da6bd4fcde90f8) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Pagination is now `{ page, size }` everywhere, matching `@adonis-agora/filter`.
8
+
9
+ **Breaking rename.** Every list read took `{ limit?, offset? }` with a **0-based** `offset`; it now
10
+ takes `{ page?, size? }` with a **1-based** `page` (default `1`) and `size` as the page size
11
+ (default 50, capped at 200 — the same numbers as before). The 0-based SQL offset became an internal
12
+ detail computed by the store, so it can no longer leak into a public type or a query string.
13
+
14
+ The reason is ecosystem consistency, not taste: `@adonis-agora/filter` exposes `FilterInput.page`
15
+ /`.size` and resolves them to `{ page, size }`, and every `@adonis-agora/*` library is being moved
16
+ onto that one shape so an app (or a console) never has to remember which library counts from zero.
17
+ The match is **structural** — this package still depends on no filter package.
18
+
19
+ ```ts
20
+ // before
21
+ await store.listPayments({ status: 'failed', limit: 20, offset: 40 })
22
+ // after — page 3 of 20, 1-based
23
+ await store.listPayments({ status: 'failed', size: 20, page: 3 })
24
+ ```
25
+
26
+ What changed, concretely:
27
+
28
+ - `BillingListQuery`, `PaymentListQuery`, `WebhookEventListQuery`, `CustomerListQuery`,
29
+ `AuditEventQuery`, `DisputeDeadlineQuery`, `OpenDisputeQuery` and
30
+ `listWebhookEventsForPayment`'s options: `limit`/`offset` → `size`/`page`.
31
+ - `AuditEventCountQuery` is now `Omit<AuditEventQuery, 'page' | 'size'>`, and
32
+ `countDisputesDueWithin` takes `Omit<DisputeDeadlineQuery, 'page' | 'size'>`.
33
+ - `BILLING_LIST_DEFAULT_LIMIT` → `BILLING_LIST_DEFAULT_SIZE` (still 50);
34
+ `BILLING_LIST_MAX_LIMIT` → `BILLING_LIST_MAX_SIZE` (still 200).
35
+ - `clampLimit`/`clampOffset` → `clampSize`/`clampPage`, plus `listOffset(page, size)` for stores
36
+ that need the SQL offset.
37
+ - Dashboard JSON API: lists read `?page=1&size=25` instead of `?limit=25&offset=0`, and echo the
38
+ paging back under `meta: { page, size, count, … }` instead of `page: { limit, offset, … }`.
39
+ `count === size` is still the only "there might be more" signal. `meta` is Lucid's own spelling —
40
+ `.paginate()` answers `{ meta, data }` — and it is the envelope key every `@adonis-agora` console
41
+ now uses.
42
+ - Dashboard SPA: `paymentsClient` list options take `{ page, size }`, the `Page` wire type is now
43
+ `ListMeta` and every list response carries it as `meta`, and the `Pager` control is page-based
44
+ (`page`/`size`/`onPage`). `ScanNotice` takes a `meta` prop.
45
+
46
+ ## 0.11.0
47
+
48
+ ### Minor Changes
49
+
50
+ - [#36](https://github.com/DavideCarvalho/adonis-agora-payments/pull/36) [`1bcff3b`](https://github.com/DavideCarvalho/adonis-agora-payments/commit/1bcff3bc62edbbdf4a8e972782dca407d92fe278) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - `payments:sync --subscriptions` — backfill and drift-correct subscription price, cycle and status.
51
+
52
+ A subscription's price only reaches the store when a `subscription.created`/`updated` delivery
53
+ carries it. Every subscription created before that shipped therefore has no `amount`/`cycle` on
54
+ its row, and recurring-revenue maths skips it until the gateway happens to send an update —
55
+ which for a healthy subscription nobody edits is never.
56
+
57
+ This is the backfill. Afterwards it is the drift correction: an amount changed in the gateway's
58
+ own dashboard produces no webhook on some gateways, and a reconcile is the only thing that
59
+ would notice.
60
+
61
+ Two kinds of row are skipped, for opposite reasons. **Managed** ones: the library owns that
62
+ recurrence, the gateway has never heard of it, and "correcting" it from a gateway answer would
63
+ overwrite the only authority there is. **Rows with no gateway id**: a free plan or an admin
64
+ courtesy, with nothing to ask about.
65
+
66
+ A subscription the gateway does not recognise is reported and left alone — never cancelled. A
67
+ rotated API key and a wrong environment both produce exactly that answer, and cancelling in bulk
68
+ from it would be worse than the problem this command solves.
69
+
70
+ The reconcile is exported as `reconcileSubscriptions(manager, store, { provider, log })`, so it
71
+ can be driven from a job or a test without an ace kernel.
72
+
3
73
  ## 0.10.0
4
74
 
5
75
  ### Minor Changes