@umohpyro/better-auth-nuvion 0.1.0 → 0.1.2

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,7 +1,13 @@
1
- # better-auth-nuvion
1
+ # @umohpyro/better-auth-nuvion
2
2
 
3
3
  Accept payments with [Nuvion](https://nuvion.co) from your [Better Auth](https://better-auth.com) app, and split every payment across your platform, resellers and merchants automatically.
4
4
 
5
+ ```bash
6
+ npm install @umohpyro/better-auth-nuvion better-auth zod
7
+ ```
8
+
9
+ [npm](https://www.npmjs.com/package/@umohpyro/better-auth-nuvion) · [Documentation](https://better-auth-nuvion.umoh.name.ng) · [Live example](https://better-auth-nuvion-example.umoh.name.ng)
10
+
5
11
  - **Multi-level merchants.** Organizations form a hierarchy (platform, reseller, merchant; depth up to 3). Each payment cascades child to parent.
6
12
  - **Flexible fees.** Per-merchant flat fee, basis points, or both, with a minimum and a cap. The payer or the merchant can bear the fee.
7
13
  - **Exact money math.** Integer minor units only. Splits always sum to the amount charged, and rounding remainders go to the platform.
@@ -9,7 +15,7 @@ Accept payments with [Nuvion](https://nuvion.co) from your [Better Auth](https:/
9
15
  - **Built on Better Auth.** Uses the `organization` plugin for tenancy and `@better-auth/api-key` for developer keys. Tables are created by Better Auth's schema migration.
10
16
  - **Provider-agnostic engine.** The split engine knows nothing about Nuvion; the Nuvion integration is one provider behind a two-method interface.
11
17
 
12
- > **Status: 0.1, pre-release, not on npm yet** (until the first release, build it with `npm run build` and install the tarball from `npm pack`). It is verified against a simulated Nuvion API and, on the Nuvion sandbox, for hosted checkout, signed webhooks and counterparty creation; real book transfers end to end are not verified yet. See [Status and limits](#status-and-limits).
18
+ > **Status: 0.1, pre-release, unofficial** (published on npm under the author's scope). It is verified against a simulated Nuvion API and, on the Nuvion sandbox, for hosted checkout, signed webhooks and counterparty creation; real book transfers end to end are not verified yet. See [Status and limits](#status-and-limits).
13
19
 
14
20
  ## Install
15
21
 
@@ -25,7 +31,7 @@ One package, three entry points:
25
31
  | `@umohpyro/better-auth-nuvion/client` | The typed client plugin |
26
32
  | `@umohpyro/better-auth-nuvion/engine` | The provider-agnostic split engine (fee math, hierarchy rules, ledger, leg executor) for use on its own |
27
33
 
28
- ESM and CommonJS are both supported. The package is published under the author's scope while it is unofficial and pre-release.
34
+ ESM and CommonJS are both supported. It is published under the author's npm scope (`@umohpyro`) while it is unofficial; the name will change if it is adopted.
29
35
 
30
36
  ## Setup
31
37
 
@@ -120,11 +126,11 @@ Nuvion has no atomic multi-recipient settlement, so each leg is its own transfer
120
126
 
121
127
  ```bash
122
128
  npm install
123
- npm test # builds, then runs 31 tests; no network or keys needed
129
+ npm test # builds, then runs the 42 tests; no network or keys needed
124
130
  npm run typecheck
125
131
  ```
126
132
 
127
- `npm run build` compiles each package with `tsc` to `dist/` (ESM plus `.d.ts`), in dependency order. The integration tests run the same scenarios against Better Auth's in-memory adapter, SQLite (`node:sqlite`) and Postgres (PGlite), using migrations generated from the plugin schema, with a simulated Nuvion API.
133
+ `npm run build` bundles the single package with tsup into `dist/` (ESM, CommonJS and `.d.ts` for `index`, `client` and `engine`). The integration tests run the same scenarios against Better Auth's in-memory adapter, SQLite (`node:sqlite`) and Postgres (PGlite), using migrations generated from the plugin schema, with a simulated Nuvion API.
128
134
 
129
135
  ## Status and limits
130
136
 
@@ -132,9 +138,8 @@ Verified: migration and queries on SQLite and Postgres (PGlite). Verified on the
132
138
 
133
139
 
134
140
 
135
- Not yet implemented: authentication of payment endpoints by API key, a reconciliation job for legs stuck in `sent`, mapping refund events to payments, subscriptions, multi-currency splits, and attribution of Nuvion's own fees to legs. Amounts use JavaScript numbers (safe for fiat). Details, platform constraints and open questions for Nuvion are in [docs/platform-notes.md](docs/platform-notes.md).
141
+ Not yet implemented: authentication of payment endpoints by API key, a reconciliation job for legs stuck in `sent`, mapping refund events to payments, subscriptions, multi-currency splits, and attribution of Nuvion's own fees to legs. Amounts use JavaScript numbers (safe for fiat). See [Status and limits](https://better-auth-nuvion.umoh.name.ng/docs/status) in the documentation for what is verified and what is not built yet.
136
142
 
137
- The package is published under the author's npm scope (`@umohpyro`) while it is unofficial; the name will change if it is adopted.
138
143
 
139
144
  ## License
140
145
 
package/dist/index.cjs CHANGED
@@ -599,7 +599,7 @@ var nuvion = (opts) => {
599
599
  return json(200, await svc.onTransferEvent({ eventId, reference: ev.reference, ok: false }));
600
600
  case "refunded":
601
601
  return json(200, { status: "refund-needs-payment-mapping" });
602
- // open question, see README
602
+ // not mapped back to a payment yet
603
603
  default:
604
604
  return json(200, { status: "ignored" });
605
605
  }
package/dist/index.js CHANGED
@@ -565,7 +565,7 @@ var nuvion = (opts) => {
565
565
  return json(200, await svc.onTransferEvent({ eventId, reference: ev.reference, ok: false }));
566
566
  case "refunded":
567
567
  return json(200, { status: "refund-needs-payment-mapping" });
568
- // open question, see README
568
+ // not mapped back to a payment yet
569
569
  default:
570
570
  return json(200, { status: "ignored" });
571
571
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umohpyro/better-auth-nuvion",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Better Auth plugin for Nuvion: hosted checkout, multi-level fee splits and child merchants. Unofficial pre-release.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,26 +13,40 @@
13
13
  "split-payments",
14
14
  "marketplace"
15
15
  ],
16
- "homepage": "https://better-auth-nuvion-docs.vercel.app",
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/umohpyro/better-auth-nuvion.git"
20
- },
16
+ "homepage": "https://better-auth-nuvion.umoh.name.ng",
21
17
  "engines": {
22
18
  "node": ">=20"
23
19
  },
24
20
  "exports": {
25
21
  ".": {
26
- "import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
27
- "require": { "types": "./dist/index.d.cts", "default": "./dist/index.cjs" }
22
+ "import": {
23
+ "types": "./dist/index.d.ts",
24
+ "default": "./dist/index.js"
25
+ },
26
+ "require": {
27
+ "types": "./dist/index.d.cts",
28
+ "default": "./dist/index.cjs"
29
+ }
28
30
  },
29
31
  "./client": {
30
- "import": { "types": "./dist/client.d.ts", "default": "./dist/client.js" },
31
- "require": { "types": "./dist/client.d.cts", "default": "./dist/client.cjs" }
32
+ "import": {
33
+ "types": "./dist/client.d.ts",
34
+ "default": "./dist/client.js"
35
+ },
36
+ "require": {
37
+ "types": "./dist/client.d.cts",
38
+ "default": "./dist/client.cjs"
39
+ }
32
40
  },
33
41
  "./engine": {
34
- "import": { "types": "./dist/engine.d.ts", "default": "./dist/engine.js" },
35
- "require": { "types": "./dist/engine.d.cts", "default": "./dist/engine.cjs" }
42
+ "import": {
43
+ "types": "./dist/engine.d.ts",
44
+ "default": "./dist/engine.js"
45
+ },
46
+ "require": {
47
+ "types": "./dist/engine.d.cts",
48
+ "default": "./dist/engine.cjs"
49
+ }
36
50
  }
37
51
  },
38
52
  "main": "./dist/index.cjs",