@adonis-agora/payments 0.15.0 → 0.15.1
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,18 @@
|
|
|
1
1
|
# @adonis-agora/payments
|
|
2
2
|
|
|
3
|
+
## 0.15.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#64](https://github.com/DavideCarvalho/adonis-agora-payments/pull/64) [`4a633fb`](https://github.com/DavideCarvalho/adonis-agora-payments/commit/4a633fb53585a7bdb1dce09e05e63cbd87710b56) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Corrects what the `'payments.billingStore'` binding actually gives you.
|
|
8
|
+
|
|
9
|
+
The 0.15.0 note showed `container.swap('payments.billingStore', ...)` as the testing seam. That is wrong twice, and both matter to anyone who tried it:
|
|
10
|
+
|
|
11
|
+
1. `container.swap()` is typed for **class** tokens only. A string binding is replaced by re-registering it.
|
|
12
|
+
2. Re-registering it does **not** reach `PaymentsManager`. The manager takes its store as a thunk built at boot (`() => getBillingStore()`), reading the module-level accessor — so `payments.arrears()` and every other manager read keep using the store the provider resolved.
|
|
13
|
+
|
|
14
|
+
The token is for code that receives a store by injection. For the manager path, the seam is still `setBillingStore()` from `services/main`. Documented on the binding itself so the next reader does not have to find this out from a failing test.
|
|
15
|
+
|
|
3
16
|
## 0.15.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -4,9 +4,7 @@ import type { BillingStore } from './billing/billing_store.js';
|
|
|
4
4
|
*
|
|
5
5
|
* `'payments.billingStore'` exists because `BillingStore` is an interface: there is no class
|
|
6
6
|
* to hand `@inject()` when the app configured a custom store. AdonisJS solves the same
|
|
7
|
-
* problem the same way — `'lucid.db'` is a string alias for the `Database` singleton
|
|
8
|
-
* is what makes the store swappable in tests through the container rather than through a
|
|
9
|
-
* package-specific setter.
|
|
7
|
+
* problem the same way — `'lucid.db'` is a string alias for the `Database` singleton.
|
|
10
8
|
*
|
|
11
9
|
* ```ts
|
|
12
10
|
* import { inject } from '@adonisjs/core'
|
|
@@ -15,10 +13,21 @@ import type { BillingStore } from './billing/billing_store.js';
|
|
|
15
13
|
* export class Cobranca {
|
|
16
14
|
* constructor(private store: BillingStore) {}
|
|
17
15
|
* }
|
|
18
|
-
*
|
|
19
|
-
* // in a test
|
|
20
|
-
* app.container.swap('payments.billingStore', () => new InMemoryBillingStore())
|
|
21
16
|
* ```
|
|
17
|
+
*
|
|
18
|
+
* WHAT THIS TOKEN DOES NOT DO, because the obvious assumption is wrong in two ways:
|
|
19
|
+
*
|
|
20
|
+
* 1. `container.swap()` does not take it. Swap is typed for CLASS tokens only; a string
|
|
21
|
+
* binding is replaced by re-registering it (`container.singleton('payments.billingStore',
|
|
22
|
+
* () => other)`).
|
|
23
|
+
* 2. Re-registering it does not reach `PaymentsManager`. The manager receives its store as a
|
|
24
|
+
* thunk built at boot (`() => getBillingStore()`), which reads the module-level accessor
|
|
25
|
+
* on `services/main` — so `payments.arrears()` and every other manager read keep using the
|
|
26
|
+
* store the provider resolved. To substitute the store on THAT path, use
|
|
27
|
+
* `setBillingStore()` from `services/main` and restore it afterwards.
|
|
28
|
+
*
|
|
29
|
+
* In short: the token is for code that receives a store by injection; `setBillingStore` is
|
|
30
|
+
* for code that goes through the manager.
|
|
22
31
|
*/
|
|
23
32
|
declare module '@adonisjs/core/types' {
|
|
24
33
|
interface ContainerBindings {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container_bindings.d.ts","sourceRoot":"","sources":["../../src/container_bindings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D
|
|
1
|
+
{"version":3,"file":"container_bindings.d.ts","sourceRoot":"","sources":["../../src/container_bindings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,iBAAiB;QACzB,uBAAuB,EAAE,YAAY,CAAC;KACvC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/payments",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.1",
|
|
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": {
|