@adonis-agora/payments 0.10.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
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
+
3
30
  ## 0.10.0
4
31
 
5
32
  ### Minor Changes
@@ -1,7 +1,9 @@
1
1
  import { BaseCommand } from '@adonisjs/core/ace';
2
2
  import type { CommandOptions } from '@adonisjs/core/types/ace';
3
+ import type { BillingStore } from '../src/billing/billing_store.js';
4
+ import { PaymentsManager } from '../src/payments_manager.js';
3
5
  /**
4
- * `node ace payments:sync [--provider=stripe] [--customer=cus_123 | --all]` — reconcile
6
+ * `node ace payments:sync [--provider=stripe] [--customer=cus_123 | --all | --subscriptions]` — reconcile
5
7
  * local billing records with the gateway. Useful after missed webhooks or manual dashboard
6
8
  * changes: pages through every invoice for a customer (or for every recorded customer with
7
9
  * `--all`), asks the gateway what each charge's payment actually says, and writes that into
@@ -20,7 +22,46 @@ import type { CommandOptions } from '@adonisjs/core/types/ace';
20
22
  *
21
23
  * One local state is deliberately NOT reconcilable from the gateway: `disputed`. See the
22
24
  * comment on it below.
25
+ *
26
+ * `--subscriptions` is a different reconcile on the same principle: it refreshes price, cycle
27
+ * and status of every recorded gateway subscription. It is the backfill for rows created
28
+ * before the price reached the store, and afterwards the drift correction for an amount edited
29
+ * in the gateway's own dashboard — which some gateways do not send a webhook for at all.
30
+ */
31
+ /** O que `reconcileSubscriptions` reporta ao chamador. */
32
+ export interface SubscriptionSyncResult {
33
+ updated: number;
34
+ unchanged: number;
35
+ skipped: number;
36
+ missing: number;
37
+ }
38
+ /** O pedaço do logger do ace que o reconcile usa. */
39
+ export interface SyncLogger {
40
+ info(message: string): void;
41
+ warning(message: string): void;
42
+ }
43
+ /**
44
+ * Reconcile recorded subscriptions against the gateway: price, cycle and status.
45
+ *
46
+ * This exists because a subscription's price only reached the store when a
47
+ * `subscription.created`/`updated` delivery carried it. Every subscription created BEFORE
48
+ * that shipped therefore has no `amount`/`cycle` on its row, and is skipped by the recurring
49
+ * revenue maths until the gateway happens to send an update — which for a healthy
50
+ * subscription that nobody edits is never. This is the backfill, and afterwards it is the
51
+ * drift correction: an amount changed in the gateway's own dashboard produces no webhook in
52
+ * some gateways, and a reconcile is the only thing that would notice.
53
+ *
54
+ * Two kinds of row are skipped, for opposite reasons:
55
+ *
56
+ * - **Managed** — the library owns that recurrence and the gateway has never heard of it.
57
+ * Asking about it would 404, and "correcting" it from a gateway answer would be writing
58
+ * over the only authority there is.
59
+ * - **No `gatewayId`** — a free plan or an admin courtesy. Nothing to ask about.
23
60
  */
61
+ export declare function reconcileSubscriptions(manager: Pick<PaymentsManager, 'driver'>, store: BillingStore, options: {
62
+ provider?: string | undefined;
63
+ log: SyncLogger;
64
+ }): Promise<SubscriptionSyncResult>;
24
65
  export default class PaymentsSync extends BaseCommand {
25
66
  #private;
26
67
  static commandName: string;
@@ -29,6 +70,7 @@ export default class PaymentsSync extends BaseCommand {
29
70
  provider?: string;
30
71
  customer?: string;
31
72
  all?: boolean;
73
+ subscriptions?: boolean;
32
74
  run(): Promise<void>;
33
75
  }
34
76
  //# sourceMappingURL=payments_sync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"payments_sync.d.ts","sourceRoot":"","sources":["../../commands/payments_sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAS,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAsB/D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW;;IACnD,OAAgB,WAAW,SAAmB;IAC9C,OAAgB,WAAW,SAA6D;IACxF,OAAgB,OAAO,EAAE,cAAc,CAA+B;IAG9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAKlB,GAAG,CAAC,EAAE,OAAO,CAAC;IAEP,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAmIlC;CAwBF"}
1
+ {"version":3,"file":"payments_sync.d.ts","sourceRoot":"","sources":["../../commands/payments_sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAS,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIpE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAkB7D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,0DAA0D;AAC1D,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qDAAqD;AACrD,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,EACxC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,EAAE,UAAU,CAAA;CAAE,GAC1D,OAAO,CAAC,sBAAsB,CAAC,CA6EjC;AAED,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW;;IACnD,OAAgB,WAAW,SAAmB;IAC9C,OAAgB,WAAW,SAA6D;IACxF,OAAgB,OAAO,EAAE,cAAc,CAA+B;IAG9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAKlB,GAAG,CAAC,EAAE,OAAO,CAAC;IAKd,aAAa,CAAC,EAAE,OAAO,CAAC;IAEjB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CA8IlC;CAwBF"}
@@ -23,26 +23,91 @@ function parseInstant(value) {
23
23
  return Number.isNaN(parsed.getTime()) ? undefined : parsed;
24
24
  }
25
25
  /**
26
- * `node ace payments:sync [--provider=stripe] [--customer=cus_123 | --all]` — reconcile
27
- * local billing records with the gateway. Useful after missed webhooks or manual dashboard
28
- * changes: pages through every invoice for a customer (or for every recorded customer with
29
- * `--all`), asks the gateway what each charge's payment actually says, and writes that into
30
- * the local store — so the billing tables converge with the gateway.
26
+ * Reconcile recorded subscriptions against the gateway: price, cycle and status.
31
27
  *
32
- * Three properties this command has to have, and did not:
28
+ * This exists because a subscription's price only reached the store when a
29
+ * `subscription.created`/`updated` delivery carried it. Every subscription created BEFORE
30
+ * that shipped therefore has no `amount`/`cycle` on its row, and is skipped by the recurring
31
+ * revenue maths until the gateway happens to send an update — which for a healthy
32
+ * subscription that nobody edits is never. This is the backfill, and afterwards it is the
33
+ * drift correction: an amount changed in the gateway's own dashboard produces no webhook in
34
+ * some gateways, and a reconcile is the only thing that would notice.
33
35
  *
34
- * 1. **Every invoice, not the first page.** It read one unpaginated listing and reported the
35
- * total as if it were the whole customer.
36
- * 2. **Both directions.** It wrote `status: 'paid'` and nothing else, counting everything
37
- * that was not paid as "skipped (non-paid)" — so a local row saying `paid` while the
38
- * gateway said refunded or charged back could never be corrected, which is precisely the
39
- * drift a gateway-is-truth reconcile exists for.
40
- * 3. **The gateway's settlement date, or none.** It stamped `paidAt: new Date()`, which moved
41
- * historic revenue into the month the reconcile ran.
36
+ * Two kinds of row are skipped, for opposite reasons:
42
37
  *
43
- * One local state is deliberately NOT reconcilable from the gateway: `disputed`. See the
44
- * comment on it below.
38
+ * - **Managed** — the library owns that recurrence and the gateway has never heard of it.
39
+ * Asking about it would 404, and "correcting" it from a gateway answer would be writing
40
+ * over the only authority there is.
41
+ * - **No `gatewayId`** — a free plan or an admin courtesy. Nothing to ask about.
45
42
  */
43
+ export async function reconcileSubscriptions(manager, store, options) {
44
+ let updated = 0;
45
+ let unchanged = 0;
46
+ let skipped = 0;
47
+ let missing = 0;
48
+ for (let offset = 0;; offset += PAGE) {
49
+ const page = await store.listSubscriptions({
50
+ limit: PAGE,
51
+ offset,
52
+ ...(options.provider !== undefined ? { provider: options.provider } : {}),
53
+ });
54
+ for (const row of page) {
55
+ if (row.managed || !row.gatewayId) {
56
+ skipped += 1;
57
+ continue;
58
+ }
59
+ let driver;
60
+ try {
61
+ driver = manager.driver(row.provider);
62
+ }
63
+ catch {
64
+ // Uma linha de um provider que este deploy não configura mais. Não é erro do
65
+ // reconcile, e derrubar a varredura inteira por causa dela seria.
66
+ skipped += 1;
67
+ continue;
68
+ }
69
+ if (driver.capabilities?.subscriptions !== true) {
70
+ skipped += 1;
71
+ continue;
72
+ }
73
+ const remote = await driver.findSubscription(row.gatewayId);
74
+ if (remote === null) {
75
+ // O gateway não conhece mais. NÃO é cancelar por conta própria: uma chave de API
76
+ // trocada ou um ambiente errado produzem exatamente esta resposta, e cancelar em
77
+ // massa a partir dela seria pior que o problema que este comando resolve.
78
+ missing += 1;
79
+ options.log.warning(`${row.provider} ${row.gatewayId}: not found at the gateway`);
80
+ continue;
81
+ }
82
+ const amount = remote.amount?.amount;
83
+ const currency = remote.amount?.currency;
84
+ if (row.status === remote.status &&
85
+ row.amount === (amount ?? null) &&
86
+ row.cycle === (remote.cycle ?? null)) {
87
+ unchanged += 1;
88
+ continue;
89
+ }
90
+ await store.saveSubscription({
91
+ gatewayId: row.gatewayId,
92
+ provider: row.provider,
93
+ customerId: remote.customerId,
94
+ status: remote.status,
95
+ planId: remote.planId,
96
+ // Só o que o gateway REALMENTE respondeu. Ausente preserva o que já está gravado —
97
+ // um driver que não mapeia ciclo não pode apagar um que outro caminho gravou.
98
+ ...(amount !== undefined ? { amount } : {}),
99
+ ...(currency !== undefined ? { currency } : {}),
100
+ ...(remote.cycle !== undefined ? { cycle: remote.cycle } : {}),
101
+ payload: remote.payload,
102
+ });
103
+ updated += 1;
104
+ }
105
+ if (page.length < PAGE)
106
+ break;
107
+ }
108
+ options.log.info(`subscriptions: ${updated} updated, ${unchanged} already current, ${skipped} skipped, ${missing} not found`);
109
+ return { updated, unchanged, skipped, missing };
110
+ }
46
111
  export default class PaymentsSync extends BaseCommand {
47
112
  static commandName = 'payments:sync';
48
113
  static description = 'Reconcile local billing records with a payment provider';
@@ -53,11 +118,20 @@ export default class PaymentsSync extends BaseCommand {
53
118
  this.logger.error('The billing layer is disabled (billing.enabled = false). Nothing to sync.');
54
119
  return;
55
120
  }
121
+ const manager = await this.app.container.make(PaymentsManager);
122
+ // Assinaturas ANTES do guard de customer: este modo não itera customers, e exigir
123
+ // `--all`/`--customer` para rodá-lo seria pedir um argumento que ele ignora.
124
+ if (this.subscriptions) {
125
+ await reconcileSubscriptions(manager, await resolveBillingStore(config), {
126
+ provider: this.provider,
127
+ log: this.logger,
128
+ });
129
+ return;
130
+ }
56
131
  if (!this.customer && !this.all) {
57
- this.logger.error('Pass --customer=<gateway customer id> to sync one customer, or --all to sync every recorded gateway customer.');
132
+ this.logger.error('Pass --customer=<gateway customer id> to sync one customer, --all to sync every recorded gateway customer, or --subscriptions to reconcile subscriptions.');
58
133
  return;
59
134
  }
60
- const manager = await this.app.container.make(PaymentsManager);
61
135
  const driver = manager.driver(this.provider);
62
136
  // Some gateways (Woovi/OpenPix) have no invoice concept — fail early with a clear
63
137
  // message instead of listing nothing.
@@ -188,4 +262,9 @@ __decorate([
188
262
  description: 'Sync invoices for every recorded gateway customer',
189
263
  })
190
264
  ], PaymentsSync.prototype, "all", void 0);
265
+ __decorate([
266
+ flags.boolean({
267
+ description: 'Reconcile recorded subscriptions (price, cycle, status) instead of invoices',
268
+ })
269
+ ], PaymentsSync.prototype, "subscriptions", void 0);
191
270
  //# sourceMappingURL=payments_sync.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"payments_sync.js","sourceRoot":"","sources":["../../commands/payments_sync.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,yDAAyD;AACzD,MAAM,IAAI,GAAG,GAAG,CAAC;AAEjB;;;;;;GAMG;AACH,SAAS,YAAY,CAAC,KAAyB;I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AAE,CAAC;QACzB,KAAK,IAAI,MAAM,GAAG,CAAC,GAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC;gBACrC,KAAK,EAAE,IAAI;gBACX,MAAM;gBACN,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAChD,CAAC,CAAC;YACH,KAAK,MAAM,GAAG,IAAI,IAAI;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAChD,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI;gBAAE,OAAO,GAAG,CAAC;QACrC,CAAC;IACH,CAAC;CACF;AArLS;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;8CACpD;AAGlB;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,0CAA0C,EAAE,CAAC;8CAChD;AAKlB;IAHP,KAAK,CAAC,OAAO,CAAC;QACb,WAAW,EAAE,mDAAmD;KACjE,CAAC;yCACoB;AAKd;IAHP,KAAK,CAAC,OAAO,CAAC;QACb,WAAW,EAAE,6EAA6E;KAC3F,CAAC;mDAC8B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonis-agora/payments",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Billing library for AdonisJS — 18 payment gateways behind one driver contract, with a Cashier-style subscription billing layer: Billable mixin, Lucid stores, idempotent webhook processing and an optional Durable-backed dispatcher. Part of the Agora ecosystem.",
5
5
  "license": "MIT",
6
6
  "repository": {