@antelopejs/interface-payment 0.2.0 → 0.2.2-next.44.g580bf03

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/README.md CHANGED
@@ -1,10 +1,15 @@
1
- # `@antelopejs/interface-payment`
1
+ <a href="https://github.com/AntelopeJS/antelopejs"><img data-illustration src="./.github/readme/strip.svg" width="100%" alt="INTERFACE · PAYMENT: part of AntelopeJS, hexagonal architecture beyond your own code. A glowing button reads Star AntelopeJS."></a>
2
2
 
3
3
  <div align="center">
4
- <a href="https://www.npmjs.com/package/@antelopejs/interface-payment"><img data-illustration alt="npm" src="https://img.shields.io/npm/v/@antelopejs/interface-payment?style=for-the-badge&labelColor=000000&color=000000"></a>
5
- <a href="./LICENSE"><img data-illustration alt="License" src="https://img.shields.io/npm/l/@antelopejs/interface-payment?style=for-the-badge&labelColor=000000&color=000000"></a>
6
- <a href="https://discord.gg/g4pFt6eXqu"><img data-illustration alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
7
- <a href="./docs/1.introduction.md"><img data-illustration alt="Docs" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
4
+
5
+ # `@antelopejs/interface-payment`
6
+
7
+ <a href="https://www.npmjs.com/package/@antelopejs/interface-payment"><img data-illustration alt="npm" src="https://img.shields.io/npm/v/@antelopejs/interface-payment?style=for-the-badge&labelColor=000000&color=000000"></a> <a href="./LICENSE"><img data-illustration alt="License" src="https://img.shields.io/npm/l/@antelopejs/interface-payment?style=for-the-badge&labelColor=000000&color=000000"></a> <a href="https://discord.gg/g4pFt6eXqu"><img data-illustration alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a> <a href="./docs/1.introduction.md"><img data-illustration alt="Documentation" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a> <a href="https://github.com/AntelopeJS/antelopejs"><img data-illustration alt="Star AntelopeJS" src="https://img.shields.io/github/stars/AntelopeJS/antelopejs?label=Star%20AntelopeJS&style=for-the-badge&labelColor=000000&color=000000&logo=github"></a>
8
+
9
+ **The AntelopeJS contract for payments. Take payments, refund them, save payment methods and react to settlement events without naming a provider.**
10
+
11
+ [Documentation](./docs/1.introduction.md) · [Implementations](./docs/5.provider-capability-matrix.md) · [All interfaces and providers](https://github.com/AntelopeJS/antelopejs#ecosystem)
12
+
8
13
  </div>
9
14
 
10
15
  The provider-agnostic payment interface for AntelopeJS. You take payments,
@@ -12,7 +17,7 @@ refund them, save payment methods, and react to settlement events without naming
12
17
  a provider. To change provider, you swap the module that implements the
13
18
  interface.
14
19
 
15
- ## Installation
20
+ ## Install
16
21
 
17
22
  ```bash
18
23
  pnpm add @antelopejs/interface-payment
@@ -80,19 +85,6 @@ can charge the payer again.
80
85
  choose `@antelopejs/payment-subscriptions` explicitly. Do not run both clocks
81
86
  for the same subscription.
82
87
 
83
- ## Compatibility
84
-
85
- <!-- antelopejs-docs-compat:start -->
86
-
87
- | Package | Supported | Tested with |
88
- | ---------------------------- | ---------------- | ----------- |
89
- | `@antelopejs/interface-core` | `>=0.0.3 <1.0.0` | `0.0.12` |
90
-
91
- <!-- antelopejs-docs-compat:end -->
92
-
93
- The table lists the peer requirements in `package.json`, not the development or
94
- test-tool ranges. The implementing module can add requirements of its own.
95
-
96
88
  ## Conventions
97
89
 
98
90
  - **Integer minor units.** `{ value: 1050, currency: "EUR" }` is €10.50, never a float.
@@ -102,16 +94,6 @@ test-tool ranges. The implementing module can add requirements of its own.
102
94
  `status: "failed"`. It rejects only when the call itself could not be made.
103
95
  - **An optional trailing `provider` argument.** It selects one of several configured accounts.
104
96
 
105
- ## Documentation
106
-
107
- | Document | Contents |
108
- | -------------------------------------------------------------------- | ------------------------------------------------------------------------- |
109
- | [Introduction](./docs/1.introduction.md) | Scope, conventions, and installation |
110
- | [Payments](./docs/2.payments.md) | Checkout, direct payments, authorize and capture, refunds, and errors |
111
- | [Customers and methods](./docs/3.customers-and-methods.md) | Saved methods, and off-session and recurring charges |
112
- | [Webhooks](./docs/4.webhooks.md) | Verification, the event set, and handling |
113
- | [Provider capability matrix](./docs/5.provider-capability-matrix.md) | What each provider family does behind each call, and why the scope is set |
114
-
115
97
  ## Conformance suite
116
98
 
117
99
  The package ships a conformance suite, `src/tests/payment.test.ts` and
@@ -134,6 +116,29 @@ mint a chargeable payment method:
134
116
  | `ANTELOPE_PAYMENT_TEST_METHOD_DECLINED` | A token the provider declines. Without it the decline block skips. |
135
117
  | `ANTELOPE_PAYMENT_TEST_CURRENCY` | ISO-4217 code to run against. Defaults to `EUR`. |
136
118
 
119
+ ## Documentation
120
+
121
+ | Document | Contents |
122
+ | -------------------------------------------------------------------- | ------------------------------------------------------------------------- |
123
+ | [Introduction](./docs/1.introduction.md) | Scope, conventions, and installation |
124
+ | [Payments](./docs/2.payments.md) | Checkout, direct payments, authorize and capture, refunds, and errors |
125
+ | [Customers and methods](./docs/3.customers-and-methods.md) | Saved methods, and off-session and recurring charges |
126
+ | [Webhooks](./docs/4.webhooks.md) | Verification, the event set, and handling |
127
+ | [Provider capability matrix](./docs/5.provider-capability-matrix.md) | What each provider family does behind each call, and why the scope is set |
128
+
129
+ ## Compatibility
130
+
131
+ <!-- antelopejs-docs-compat:start -->
132
+
133
+ | Package | Supported | Tested with |
134
+ | ---------------------------- | ---------------- | ----------- |
135
+ | `@antelopejs/interface-core` | `>=0.5.1 <0.6.0` | `0.5.1` |
136
+
137
+ <!-- antelopejs-docs-compat:end -->
138
+
139
+ The table lists the peer requirements in `package.json`, not the development or
140
+ test-tool ranges. The implementing module can add requirements of its own.
141
+
137
142
  ## Contributing
138
143
 
139
144
  Read [CONTRIBUTING.md](./CONTRIBUTING.md). Use the Node.js version in `.nvmrc`
@@ -151,6 +156,24 @@ pnpm knip
151
156
  payment provider and no credentials. The provider conformance suite above is a
152
157
  separate integration check.
153
158
 
159
+ ## Part of AntelopeJS
160
+
161
+ This package belongs to [AntelopeJS](https://github.com/AntelopeJS/antelopejs), the TypeScript framework where modules depend on contracts and the application chooses the provider. The open-source back office [AntelopeJS DMS](https://github.com/AntelopeJS/dms) is built on it.
162
+
163
+ <!-- antelopejs-framework-modules:start -->
164
+
165
+ | Area | Contracts | Providers |
166
+ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
167
+ | API | [`interface-api`](https://github.com/AntelopeJS/interface-api) · [`interface-api-util`](https://github.com/AntelopeJS/interface-api-util) · [`interface-data-api`](https://github.com/AntelopeJS/interface-data-api) | [`api`](https://github.com/AntelopeJS/api) |
168
+ | Auth | [`interface-auth`](https://github.com/AntelopeJS/interface-auth) | [`auth-jwt`](https://github.com/AntelopeJS/auth-jwt) |
169
+ | Database | [`interface-database`](https://github.com/AntelopeJS/interface-database) · [`interface-database-decorators`](https://github.com/AntelopeJS/interface-database-decorators) · [`interface-database-catalog`](https://github.com/AntelopeJS/interface-database-catalog) · [`interface-mongodb`](https://github.com/AntelopeJS/interface-mongodb) · [`interface-rethinkdb`](https://github.com/AntelopeJS/interface-rethinkdb) | [`postgres`](https://github.com/AntelopeJS/postgres) · [`mysql`](https://github.com/AntelopeJS/mysql) · [`mongodb`](https://github.com/AntelopeJS/mongodb) · [`rethinkdb`](https://github.com/AntelopeJS/rethinkdb) |
170
+ | Redis | [`interface-redis`](https://github.com/AntelopeJS/interface-redis) · [`interface-redis-scheduler`](https://github.com/AntelopeJS/interface-redis-scheduler) | [`redis`](https://github.com/AntelopeJS/redis) |
171
+ | Email | [`interface-email`](https://github.com/AntelopeJS/interface-email) | [`nodemailer`](https://github.com/AntelopeJS/nodemailer) · [`brevo`](https://github.com/AntelopeJS/brevo) |
172
+ | File storage | [`interface-file-storage`](https://github.com/AntelopeJS/interface-file-storage) | [`file-storage-local`](https://github.com/AntelopeJS/file-storage-local) · [`file-storage-s3`](https://github.com/AntelopeJS/file-storage-s3) |
173
+ | Payments | **`interface-payment`** · [`interface-subscriptions`](https://github.com/AntelopeJS/interface-subscriptions) · [`interface-stripe`](https://github.com/AntelopeJS/interface-stripe) | [`stripe`](https://github.com/AntelopeJS/stripe) · [`mollie`](https://github.com/AntelopeJS/mollie) · [`checkout-com`](https://github.com/AntelopeJS/checkout-com) · [`payment-subscriptions`](https://github.com/AntelopeJS/payment-subscriptions) |
174
+
175
+ <!-- antelopejs-framework-modules:end -->
176
+
154
177
  ## License
155
178
 
156
179
  [Apache-2.0](./LICENSE)
@@ -22,6 +22,7 @@ const index_1 = require("../index");
22
22
  exports.SUITE_TIMEOUT = 60_000;
23
23
  const SETTLE_TIMEOUT = 30_000;
24
24
  const SETTLE_INTERVAL = 1_000;
25
+ const SETTLE_FIRST_POLL = 50;
25
26
  exports.CHARGE_VALUE = 2500;
26
27
  exports.PARTIAL_VALUE = 1000;
27
28
  exports.REFUND_VALUE = 700;
@@ -99,6 +100,36 @@ function assertPaymentContract(payment, expected) {
99
100
  strict_1.default.equal(payment.redirectUrl !== undefined, payment.status === "requires_action", "redirectUrl is present exactly when the payer must act");
100
101
  strict_1.default.equal(payment.failure !== undefined, payment.status === "failed", "failure is present exactly when the payment failed");
101
102
  }
103
+ /**
104
+ * Reads the payment until `done` holds or the settle deadline passes.
105
+ *
106
+ * A fixed poll reads one second after each read ends, and so does this one.
107
+ * Most payments settle within milliseconds, so extra reads come after the
108
+ * previous read ends, 50 ms first and twice as long each time, whenever one
109
+ * fits, at the last read's latency, before the next one-second read. With a
110
+ * steady read latency, a payment is never seen later than the fixed poll would
111
+ * have seen it.
112
+ */
113
+ async function pollPayment(id, done) {
114
+ const deadline = Date.now() + SETTLE_TIMEOUT;
115
+ let gap = SETTLE_FIRST_POLL;
116
+ let readStart = Date.now();
117
+ let payment = await (0, index_1.GetPayment)(id);
118
+ let readEnd = Date.now();
119
+ let intervalReadAt = readEnd + SETTLE_INTERVAL;
120
+ while (!done(payment) && Date.now() < deadline) {
121
+ const earlyAt = readEnd + gap;
122
+ const isEarly = earlyAt + (readEnd - readStart) <= intervalReadAt;
123
+ gap *= 2;
124
+ await (0, promises_1.setTimeout)(Math.max(0, (isEarly ? earlyAt : intervalReadAt) - Date.now()));
125
+ readStart = Date.now();
126
+ payment = await (0, index_1.GetPayment)(id);
127
+ readEnd = Date.now();
128
+ if (!isEarly)
129
+ intervalReadAt = readEnd + SETTLE_INTERVAL;
130
+ }
131
+ return payment;
132
+ }
102
133
  /**
103
134
  * Polls until the payment leaves the states it can leave on its own.
104
135
  *
@@ -107,14 +138,7 @@ function assertPaymentContract(payment, expected) {
107
138
  * promises a terminal state is reachable without payer action for these flows.
108
139
  */
109
140
  async function settle(id, expected) {
110
- const deadline = Date.now() + SETTLE_TIMEOUT;
111
- let payment = await (0, index_1.GetPayment)(id);
112
- while (payment.status !== expected &&
113
- !(0, index_1.isTerminalPaymentStatus)(payment.status) &&
114
- Date.now() < deadline) {
115
- await (0, promises_1.setTimeout)(SETTLE_INTERVAL);
116
- payment = await (0, index_1.GetPayment)(id);
117
- }
141
+ const payment = await pollPayment(id, (read) => read.status === expected || (0, index_1.isTerminalPaymentStatus)(read.status));
118
142
  strict_1.default.equal(payment.status, expected, `payment ${id} reached ${payment.status}, not ${expected}`);
119
143
  return payment;
120
144
  }
@@ -146,12 +170,7 @@ async function charge() {
146
170
  * the deadline is the failure this exists to catch.
147
171
  */
148
172
  async function settleRefundedTotal(id) {
149
- const deadline = Date.now() + SETTLE_TIMEOUT;
150
- let payment = await (0, index_1.GetPayment)(id);
151
- while (payment.amountRefunded.value === 0 && Date.now() < deadline) {
152
- await (0, promises_1.setTimeout)(SETTLE_INTERVAL);
153
- payment = await (0, index_1.GetPayment)(id);
154
- }
173
+ const payment = await pollPayment(id, (read) => read.amountRefunded.value !== 0);
155
174
  strict_1.default.notEqual(payment.amountRefunded.value, 0, `payment ${id} still reports nothing refunded after a settled refund`);
156
175
  return payment.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,oBAAY,CAAC;QAC5B,SAAS,EAAE,SAAS,EAAE;QACtB,aAAa,EAAE,mBAAW;QAC1B,UAAU,EAAE,IAAI;KACjB,EACD,GAAG,EAAE,CACN,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CAAC,EAAU;IAClD,MAAM,OAAO,GAAG,MAAM,WAAW,CAC/B,EAAE,EACF,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,KAAK,CAAC,CAC1C,CAAC;IACF,gBAAM,CAAC,QAAQ,CACb,OAAO,CAAC,cAAc,CAAC,KAAK,EAC5B,CAAC,EACD,WAAW,EAAE,wDAAwD,CACtE,CAAC;IACF,OAAO,OAAO,CAAC,cAAc,CAAC;AAChC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/interface-payment",
3
- "version": "0.2.0",
3
+ "version": "0.2.2-next.44.g580bf03",
4
4
  "description": "Provider-agnostic AntelopeJS payment interface: hosted checkout, direct payments with auth/capture, refunds, saved payment methods, and normalised webhook events",
5
5
  "keywords": [
6
6
  "antelopejs",
@@ -30,6 +30,10 @@
30
30
  "#built": {
31
31
  "types": "./src/index.ts",
32
32
  "default": "./dist/index.js"
33
+ },
34
+ "#built/tests/*": {
35
+ "types": "./src/tests/*.ts",
36
+ "default": "./dist/tests/*.js"
33
37
  }
34
38
  },
35
39
  "exports": {
@@ -54,10 +58,10 @@
54
58
  "lint:fix": "oxlint --fix",
55
59
  "lint": "oxlint",
56
60
  "prepack": "pnpm run build",
57
- "release": "pnpm run lint && pnpm run test && pnpm run prepack && release-it",
61
+ "release": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run prepack && release-it",
58
62
  "format:check": "oxfmt --check .",
59
63
  "knip": "knip",
60
- "prepare": "if git rev-parse --is-inside-work-tree >/dev/null 2>&1 && command -v lefthook >/dev/null 2>&1; then lefthook install; fi",
64
+ "prepare": "if [ -e .git ] && command -v git >/dev/null 2>&1 && command -v lefthook >/dev/null 2>&1 && GIT_DIR=.git GIT_WORK_TREE=. git rev-parse --git-dir >/dev/null 2>&1; then GIT_DIR=.git GIT_WORK_TREE=. lefthook install; fi",
61
65
  "checks": "antelopejs-checks",
62
66
  "size": "antelopejs-check-size",
63
67
  "sync": "antelopejs-sync",
@@ -67,9 +71,9 @@
67
71
  "suppressions:update": "antelopejs-suppressions --update"
68
72
  },
69
73
  "devDependencies": {
70
- "@antelopejs/core": "1.16.0",
71
- "@antelopejs/interface-core": ">=0.0.3 <1.0.0",
72
- "@antelopejs/tooling-configs": "^0.2.17",
74
+ "@antelopejs/core": "~1.23.3",
75
+ "@antelopejs/interface-core": ">=0.5.1 <0.6.0",
76
+ "@antelopejs/tooling-configs": ">=0.8.0 <0.9.0",
73
77
  "@types/mocha": "^10.0.10",
74
78
  "@types/node": "^22.19.15",
75
79
  "eslint-plugin-perfectionist": "^5.11.0",
@@ -84,7 +88,7 @@
84
88
  "typescript": "^5.9.3"
85
89
  },
86
90
  "peerDependencies": {
87
- "@antelopejs/interface-core": ">=0.0.3 <1.0.0"
91
+ "@antelopejs/interface-core": ">=0.5.1 <0.6.0"
88
92
  },
89
93
  "packageManager": "pnpm@10.6.5",
90
94
  "antelopeJs": {