@adonis-agora/payments 0.9.0 → 0.11.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 (37) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/assets/spa/assets/{index-6JAJxOK8.js → index-Q4Eewxjq.js} +2 -2
  3. package/dist/assets/spa/assets/{index-6JAJxOK8.js.map → index-Q4Eewxjq.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 +97 -18
  8. package/dist/commands/payments_sync.js.map +1 -1
  9. package/dist/src/billing/billing_overview.d.ts.map +1 -1
  10. package/dist/src/billing/billing_overview.js +8 -4
  11. package/dist/src/billing/billing_overview.js.map +1 -1
  12. package/dist/src/billing/billing_store.d.ts +11 -0
  13. package/dist/src/billing/billing_store.d.ts.map +1 -1
  14. package/dist/src/billing/lucid_billing_store.d.ts +3 -0
  15. package/dist/src/billing/lucid_billing_store.d.ts.map +1 -1
  16. package/dist/src/billing/lucid_billing_store.js +9 -0
  17. package/dist/src/billing/lucid_billing_store.js.map +1 -1
  18. package/dist/src/billing/webhook_events.d.ts +10 -0
  19. package/dist/src/billing/webhook_events.d.ts.map +1 -1
  20. package/dist/src/billing/webhook_events.js.map +1 -1
  21. package/dist/src/billing/webhook_processor.d.ts.map +1 -1
  22. package/dist/src/billing/webhook_processor.js +6 -0
  23. package/dist/src/billing/webhook_processor.js.map +1 -1
  24. package/dist/src/drivers/asaas.d.ts.map +1 -1
  25. package/dist/src/drivers/asaas.js +9 -0
  26. package/dist/src/drivers/asaas.js.map +1 -1
  27. package/dist/src/drivers/stripe.d.ts +11 -0
  28. package/dist/src/drivers/stripe.d.ts.map +1 -1
  29. package/dist/src/drivers/stripe.js +54 -1
  30. package/dist/src/drivers/stripe.js.map +1 -1
  31. package/dist/src/testing/in_memory_billing_store.d.ts +3 -0
  32. package/dist/src/testing/in_memory_billing_store.d.ts.map +1 -1
  33. package/dist/src/testing/in_memory_billing_store.js +5 -0
  34. package/dist/src/testing/in_memory_billing_store.js.map +1 -1
  35. package/dist/src/types.d.ts +8 -0
  36. package/dist/src/types.d.ts.map +1 -1
  37. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
1
1
  # @adonis-agora/payments
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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.
8
+
9
+ A subscription's price only reaches the store when a `subscription.created`/`updated` delivery
10
+ carries it. Every subscription created before that shipped therefore has no `amount`/`cycle` on
11
+ its row, and recurring-revenue maths skips it until the gateway happens to send an update —
12
+ which for a healthy subscription nobody edits is never.
13
+
14
+ This is the backfill. Afterwards it is the drift correction: an amount changed in the gateway's
15
+ own dashboard produces no webhook on some gateways, and a reconcile is the only thing that
16
+ would notice.
17
+
18
+ Two kinds of row are skipped, for opposite reasons. **Managed** ones: the library owns that
19
+ recurrence, the gateway has never heard of it, and "correcting" it from a gateway answer would
20
+ overwrite the only authority there is. **Rows with no gateway id**: a free plan or an admin
21
+ courtesy, with nothing to ask about.
22
+
23
+ A subscription the gateway does not recognise is reported and left alone — never cancelled. A
24
+ rotated API key and a wrong environment both produce exactly that answer, and cancelling in bulk
25
+ from it would be worse than the problem this command solves.
26
+
27
+ The reconcile is exported as `reconcileSubscriptions(manager, store, { provider, log })`, so it
28
+ can be driven from a job or a test without an ace kernel.
29
+
30
+ ## 0.10.0
31
+
32
+ ### Minor Changes
33
+
34
+ - [#34](https://github.com/DavideCarvalho/adonis-agora-payments/pull/34) [`920ec01`](https://github.com/DavideCarvalho/adonis-agora-payments/commit/920ec017e7339fc59c4f8be0349144b6332a8449) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - MRR counts gateway-owned subscriptions too, not just the library-managed ones.
35
+
36
+ The previous release scoped recurring revenue to managed subscriptions, arguing that a
37
+ gateway-owned one keeps its price at the gateway. True about the SOURCE and wrong about the
38
+ DATA: the drivers already normalised `amount`, and the cycle was sitting in every gateway's
39
+ payload — Asaas as `cycle`, Stripe as `price.recurring`. Nobody propagated it. Summing half a
40
+ book and calling it MRR was the bigger error.
41
+
42
+ - `Subscription` gains `cycle`, mapped by the Asaas and Stripe drivers.
43
+ - `SubscriptionWebhookData` gains `amount`, `currency` and `cycle`, so a
44
+ `subscription.created`/`updated` delivery carries the price to the store.
45
+ - `saveSubscription` persists them. **Absent does not erase**: a `subscription.canceled`
46
+ carries no price, and overwriting with null would drop what `created` recorded — MRR falling
47
+ because of an event that never mentioned money.
48
+
49
+ Stripe's cycle reads `interval` **and** `interval_count`: "every 3 months" is `month` × 3, and
50
+ reading only `interval` would count it as MONTHLY and inflate MRR threefold, silently. A
51
+ combination with no name here (every 5 months) yields `undefined` and is skipped by the
52
+ calculation rather than guessed.
53
+
54
+ A subscription with no price or no known cycle is still ignored rather than assumed monthly, so
55
+ the figure stays incomplete-but-honest instead of wrong-upwards.
56
+
3
57
  ## 0.9.0
4
58
 
5
59
  ### Minor Changes