@adonis-agora/payments 0.13.0 → 0.13.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,17 @@
|
|
|
1
1
|
# @adonis-agora/payments
|
|
2
2
|
|
|
3
|
+
## 0.13.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#57](https://github.com/DavideCarvalho/adonis-agora-payments/pull/57) [`d27b1d4`](https://github.com/DavideCarvalho/adonis-agora-payments/commit/d27b1d48daf6e83c72213d5c2369ad8ea3f16511) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - `arrears()` now accepts `InMemoryBillingStore`.
|
|
8
|
+
|
|
9
|
+
It was typed `store: BillingStore`, whose row generics default to the Lucid models — so it rejected this library's own testing store, even though `listPayments` is identical on both and does not reference those generics. Anyone following the obvious testing path (inject `InMemoryBillingStore`, assert the delinquency branch) hit a type error on their first try.
|
|
10
|
+
|
|
11
|
+
Typed on the one method it reads instead, which also states the honest contract: `arrears` reads payments and nothing else.
|
|
12
|
+
|
|
13
|
+
Worth noting for maintainers: this shipped in 0.13.0 despite `test/arrears.spec.ts` passing `InMemoryBillingStore`, because `tsconfig.json` excludes `test/**`. The suite runs but is never typechecked, so a type-level regression in a public signature is invisible to CI. Including `test/**` today surfaces 285 pre-existing errors, so that cleanup is its own piece of work.
|
|
14
|
+
|
|
3
15
|
## 0.13.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -39,7 +39,7 @@ export interface Arrears {
|
|
|
39
39
|
* Reads at most `limit` recent charges (default 50) — a failure run longer than that is a
|
|
40
40
|
* subscription nobody is collecting on, and the answer ("yes, badly") does not change.
|
|
41
41
|
*/
|
|
42
|
-
export declare function arrears(store: BillingStore, query: {
|
|
42
|
+
export declare function arrears(store: Pick<BillingStore, 'listPayments'>, query: {
|
|
43
43
|
externalReference: string;
|
|
44
44
|
limit?: number;
|
|
45
45
|
}): Promise<Arrears>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrears.d.ts","sourceRoot":"","sources":["../../../src/billing/arrears.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,WAAW,OAAO;IACtB,2EAA2E;IAC3E,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;CACzB;AASD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,OAAO,
|
|
1
|
+
{"version":3,"file":"arrears.d.ts","sourceRoot":"","sources":["../../../src/billing/arrears.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,WAAW,OAAO;IACtB,2EAA2E;IAC3E,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;CACzB;AASD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,OAAO,CAS3B,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,EACzC,KAAK,EAAE;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACnD,OAAO,CAAC,OAAO,CAAC,CAmClB"}
|
|
@@ -26,7 +26,16 @@ const UP_TO_DATE = {
|
|
|
26
26
|
* Reads at most `limit` recent charges (default 50) — a failure run longer than that is a
|
|
27
27
|
* subscription nobody is collecting on, and the answer ("yes, badly") does not change.
|
|
28
28
|
*/
|
|
29
|
-
export async function arrears(
|
|
29
|
+
export async function arrears(
|
|
30
|
+
/*
|
|
31
|
+
* Structurally typed on the ONE method this reads, not on `BillingStore` whole.
|
|
32
|
+
*
|
|
33
|
+
* `BillingStore`'s row generics default to the Lucid models, so a bare `BillingStore`
|
|
34
|
+
* parameter rejects `InMemoryBillingStore` — this library's OWN testing store — even
|
|
35
|
+
* though `listPayments` is byte-identical on both and independent of those generics. The
|
|
36
|
+
* narrow type also states the honest contract: this helper reads payments and nothing else.
|
|
37
|
+
*/
|
|
38
|
+
store, query) {
|
|
30
39
|
const payments = await store.listPayments({
|
|
31
40
|
externalReference: query.externalReference,
|
|
32
41
|
size: query.limit ?? 50,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrears.js","sourceRoot":"","sources":["../../../src/billing/arrears.ts"],"names":[],"mappings":"AAqBA,MAAM,UAAU,GAAY;IAC1B,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,IAAI;IACX,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,IAAI;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,
|
|
1
|
+
{"version":3,"file":"arrears.js","sourceRoot":"","sources":["../../../src/billing/arrears.ts"],"names":[],"mappings":"AAqBA,MAAM,UAAU,GAAY;IAC1B,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,IAAI;IACX,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,IAAI;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO;AAC3B;;;;;;;GAOG;AACH,KAAyC,EACzC,KAAoD;IAEpD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,YAAY,CAAC;QACxC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;Q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6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/payments",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.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": {
|