@antelopejs/payment-subscriptions 0.0.2 → 0.0.4

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.
@@ -1,13 +1,19 @@
1
- # The provider schedule
1
+ ---
2
+ title: The provider schedule
3
+ description: Why the module can mirror part of a subscription with a provider such as Mangopay, and how the providerSchedule extension point works.
4
+ mode: explanation
5
+ ---
2
6
 
3
- This module always owns the clock. Some providers that leave the merchant to
4
- fire each charge will still store the schedule, and handle the authentication
5
- chain between charges, if asked. Mangopay's Recurring PayIn Registration stores
6
- frequency, dates and amounts and chains the customer-initiated first payment to
7
- the merchant-initiated ones; Mangopay still does not fire them.
7
+ This module always owns the clock. Some providers leave the merchant to fire
8
+ each charge, but still store the schedule if asked, and handle the
9
+ authentication chain between charges. The Recurring PayIn Registration of
10
+ Mangopay stores the frequency, the dates, and the amounts. It chains the first
11
+ payment, which the customer starts, to the later payments, which the merchant
12
+ starts. Mangopay still does not fire those payments.
8
13
 
9
- For those, part of a subscription's state can live with the provider as well as
10
- in this module's database. The seam for it is `ProviderSchedule`:
14
+ For those providers, part of the state of a subscription can live with the
15
+ provider as well as in the database of this module. The extension point for it
16
+ is the `ProviderSchedule` interface in `src/schedule.ts`:
11
17
 
12
18
  | Call | When | The default |
13
19
  | ---------- | ---------------------------------------------- | ------------------------------ |
@@ -15,17 +21,20 @@ in this module's database. The seam for it is `ProviderSchedule`:
15
21
  | `charge` | Each time a period is charged | An off-session `CreatePayment` |
16
22
  | `release` | Once, when a subscription ends, for any reason | Does nothing |
17
23
 
18
- What `register` returns is stored with the subscription and handed to every
19
- `charge` and `release`. A schedule never decides when to charge, and never
20
- throws for a decline: a declined charge resolves with a `failed` payment, as
21
- `CreatePayment` does.
24
+ The module stores what `register` returns with the subscription, and hands it
25
+ to every `charge` and `release` call. A schedule never decides when to charge.
26
+ It never throws for a decline either. A declined charge resolves with a
27
+ `failed` payment, as `CreatePayment` does.
22
28
 
23
- `register` runs before the subscription is stored and is given no idempotency
24
- key, so two creations racing on one key may both call it. A schedule that
25
- registers anything real must tolerate that, or derive its own key from the
26
- subscription identifier it is handed.
29
+ `register` runs before the module stores the subscription, and it receives no
30
+ idempotency key. Two creations that race on one key can therefore both call
31
+ it. A schedule that registers anything real must tolerate that, or derive its
32
+ own key from the subscription ID that it receives.
27
33
 
28
- The schedule is chosen by the `providerSchedule` setting. Only the default,
29
- `payment-interface`, exists. A Mangopay schedule would charge against the
30
- registration through the Mangopay module's own interface, which is the escape
31
- hatch for provider-specific behaviour everywhere else in AntelopeJS.
34
+ The `providerSchedule` setting chooses the schedule. Only the default,
35
+ `payment-interface`, exists. Any other name makes the module throw at
36
+ construction, with an error that lists the known names. A Mangopay schedule
37
+ would charge against the registration through an interface of the Mangopay
38
+ module itself. Everywhere else in AntelopeJS, provider-specific behaviour also
39
+ goes through the interface of the provider module, not through the portable
40
+ interfaces.
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": true,
5
+ "rootDir": "..",
6
+ "composite": false,
7
+ "incremental": false
8
+ },
9
+ "include": ["../src/**/*.ts", "./**/*.ts"]
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/payment-subscriptions",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Generic AntelopeJS subscriptions on top of any payment interface provider: saved methods charged off-session, on a renewal clock the module owns",
5
5
  "keywords": [
6
6
  "antelopejs",
@@ -42,23 +42,31 @@
42
42
  "test:redis": "ANTELOPE_SUBSCRIPTIONS_TEST_CLOCK=redis ajs module test .",
43
43
  "typecheck": "tsc --noEmit",
44
44
  "format:check": "oxfmt --check .",
45
- "knip": "knip"
45
+ "knip": "knip",
46
+ "prepare": "if git rev-parse --is-inside-work-tree >/dev/null 2>&1 && command -v lefthook >/dev/null 2>&1; then lefthook install; fi",
47
+ "checks": "antelopejs-checks",
48
+ "size": "antelopejs-check-size",
49
+ "sync": "antelopejs-sync",
50
+ "sync:check": "antelopejs-sync --check",
51
+ "suppressions": "antelopejs-suppressions",
52
+ "suppressions:update": "antelopejs-suppressions --update"
46
53
  },
47
54
  "dependencies": {
48
55
  "@antelopejs/interface-core": ">=0.0.5 <1.0.0",
49
- "@antelopejs/interface-database": "^0.1.8",
56
+ "@antelopejs/interface-database": ">=0.2.0 <1.0.0",
50
57
  "@antelopejs/interface-payment": ">=0.0.2 <1.0.0",
51
- "@antelopejs/interface-subscriptions": ">=0.0.2 <0.1.0"
58
+ "@antelopejs/interface-subscriptions": ">=0.1.0 <0.2.0"
52
59
  },
53
60
  "devDependencies": {
54
61
  "@antelopejs/core": "1.16.0",
55
- "@antelopejs/mongodb": "^1.4.0",
62
+ "@antelopejs/mongodb": "^1.6.0",
56
63
  "@antelopejs/redis": "^1.0.3",
57
- "@antelopejs/tooling-configs": "^0.0.8",
64
+ "@antelopejs/tooling-configs": "^0.2.18",
58
65
  "@types/mocha": "^10.0.10",
59
66
  "@types/node": "^22.19.15",
60
67
  "eslint-plugin-perfectionist": "^5.11.0",
61
68
  "knip": "^6.34.0",
69
+ "lefthook": "^2.2.2",
62
70
  "mongodb-memory-server-core": "^11.3.0",
63
71
  "oxfmt": "^0.66.0",
64
72
  "oxlint": "1.81.0",
@@ -71,7 +79,7 @@
71
79
  },
72
80
  "optionalDependencies": {
73
81
  "@antelopejs/interface-redis": ">=0.0.6 <1.0.0",
74
- "@antelopejs/interface-redis-scheduler": ">=0.0.7 <1.0.0"
82
+ "@antelopejs/interface-redis-scheduler": ">=0.0.9 <1.0.0"
75
83
  },
76
84
  "packageManager": "pnpm@10.6.5",
77
85
  "antelopeJs": {
@@ -82,6 +90,9 @@
82
90
  "test": "src/test/antelope.test.ts",
83
91
  "skills": [
84
92
  "./skills"
85
- ]
93
+ ],
94
+ "docs": {
95
+ "standard": true
96
+ }
86
97
  }
87
98
  }