@owlmeans/server-payment 0.1.18-rc.26 → 0.1.18-rc.27
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 +42 -5
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/server-payment/SKILL.md +63 -10
- package/build/actions/resync.d.ts +5 -1
- package/build/actions/resync.d.ts.map +1 -1
- package/build/actions/resync.js +9 -4
- package/build/actions/resync.js.map +1 -1
- package/build/actions/webhook.d.ts +1 -0
- package/build/actions/webhook.d.ts.map +1 -1
- package/build/actions/webhook.js +5 -3
- package/build/actions/webhook.js.map +1 -1
- package/build/consts.d.ts +5 -4
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +5 -4
- package/build/consts.js.map +1 -1
- package/build/entrypoints.d.ts +17 -0
- package/build/entrypoints.d.ts.map +1 -1
- package/build/entrypoints.js +14 -3
- package/build/entrypoints.js.map +1 -1
- package/build/index.d.ts +3 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -3
- package/build/index.js.map +1 -1
- package/build/plugins/portal.d.ts +12 -9
- package/build/plugins/portal.d.ts.map +1 -1
- package/build/plugins/portal.js +25 -22
- package/build/plugins/portal.js.map +1 -1
- package/build/plugins/stripe.d.ts +1 -1
- package/build/plugins/stripe.d.ts.map +1 -1
- package/build/plugins/stripe.js +4 -4
- package/build/plugins/stripe.js.map +1 -1
- package/build/plugins/webhook-manager.d.ts +20 -9
- package/build/plugins/webhook-manager.d.ts.map +1 -1
- package/build/plugins/webhook-manager.js +36 -26
- package/build/plugins/webhook-manager.js.map +1 -1
- package/build/service.d.ts +22 -2
- package/build/service.d.ts.map +1 -1
- package/build/service.js +57 -11
- package/build/service.js.map +1 -1
- package/build/sync.d.ts +1 -1
- package/build/sync.d.ts.map +1 -1
- package/build/sync.js +3 -3
- package/build/sync.js.map +1 -1
- package/build/types.d.ts +37 -1
- package/build/types.d.ts.map +1 -1
- package/build/utils.d.ts +2 -0
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +3 -0
- package/build/utils.js.map +1 -1
- package/package.json +12 -12
- package/src/actions/resync.ts +9 -4
- package/src/actions/webhook.ts +5 -3
- package/src/consts.ts +5 -4
- package/src/entrypoints.ts +15 -3
- package/src/index.ts +4 -3
- package/src/plugins/portal.ts +25 -22
- package/src/plugins/stripe.ts +4 -4
- package/src/plugins/webhook-manager.ts +43 -27
- package/src/service.ts +63 -12
- package/src/sync.ts +3 -3
- package/src/types.ts +37 -1
- package/src/utils.ts +4 -0
- package/tests/fake-stripe.ts +25 -11
- package/tests/gate-handlers.spec.ts +120 -0
- package/tests/gateway-options.spec.ts +182 -0
package/README.md
CHANGED
|
@@ -54,6 +54,9 @@ import {
|
|
|
54
54
|
|
|
55
55
|
appendPaymentGatewayService(context) // the process that owns Stripe
|
|
56
56
|
appendPaymentGatewayService(context, { manage: false }) // a process that only reads entitlements
|
|
57
|
+
// several managed processes on one database — the same `owner` and `webhookService` in each:
|
|
58
|
+
appendPaymentGatewayService(context, { owner: 'app-api', webhookService: 'app-hooks' }) // receives the webhook
|
|
59
|
+
appendPaymentGatewayService(context, { owner: 'app-api', webhookService: 'app-hooks', bootstrap: false }) // checkout and portal
|
|
57
60
|
export const serverBindings = [...paymentGateEntrypoints]
|
|
58
61
|
|
|
59
62
|
observer(context).onTopUp(async completion => { /* credit, idempotent by completion.externalId */ })
|
|
@@ -68,7 +71,20 @@ customer-portal configuration, one webhook endpoint at this deployment's public
|
|
|
68
71
|
secret stored in `payment-webhook`) — and each step is fingerprinted, so an unchanged deployment
|
|
69
72
|
makes no Stripe call.
|
|
70
73
|
|
|
71
|
-
|
|
74
|
+
Three gateway options place that state when a deployment runs several processes:
|
|
75
|
+
|
|
76
|
+
| Option | Default | Decides |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `webhookService` | `cfg.service` | the `cfg.services` alias whose host and base form the webhook URL — also the portal's deployment key |
|
|
79
|
+
| `owner` | `cfg.service` | the key of the `payment-webhook` rows, the signing-secret lookup, the `portal:<owner>` fingerprint and the Stripe labels |
|
|
80
|
+
| `bootstrap` | `manage` | whether this process runs the bootstrap at boot; a forced one (`resync`, `bootstrapStripe(ctx, stripe, { force: true })`) runs in any managed process |
|
|
81
|
+
|
|
82
|
+
Give every process of the database the same `owner` and `webhookService` (the process that receives
|
|
83
|
+
the webhook), and keep `bootstrap` on that receiver only. Changing `webhookService` moves the
|
|
84
|
+
endpoint on the next bootstrap: created at the new URL, the endpoint of the owner's former URL
|
|
85
|
+
deleted, a new portal configuration for the new deployment key.
|
|
86
|
+
|
|
87
|
+
Several deployments of one application may share a Stripe account (typically every test-mode
|
|
72
88
|
deployment), each with its own database and URL — and a deployment's identity is its webhook URL,
|
|
73
89
|
even an undeliverable local one.
|
|
74
90
|
|
|
@@ -78,8 +94,8 @@ even an undeliverable local one.
|
|
|
78
94
|
retired deployment is removed by hand in the Stripe dashboard; one deleted from outside comes back
|
|
79
95
|
on the next forced `resync`.
|
|
80
96
|
- **Portal configuration.** Each deployment has its own, tagged
|
|
81
|
-
`{ owlmeans: 'payment', service
|
|
82
|
-
`portal:<
|
|
97
|
+
`{ owlmeans: 'payment', service: <owner>, deployment: <webhook URL> }`. It updates the configuration its
|
|
98
|
+
`portal:<owner>` fingerprint row names, unless that one is tagged for another deployment, and
|
|
83
99
|
without a row adopts only a configuration carrying exactly its own tag. Stripe cannot delete a
|
|
84
100
|
portal configuration, so one a deployment can no longer identify stays in the account and a new
|
|
85
101
|
one is created.
|
|
@@ -118,10 +134,31 @@ The limit gate never consumes; the handler does.
|
|
|
118
134
|
## Routes
|
|
119
135
|
|
|
120
136
|
`paymentGateEntrypoints` binds the immutable `paymentGate` tree: the public Stripe webhook
|
|
121
|
-
(`POST /payment-gate/webhook/:paygate`, verified by signature over the raw body
|
|
137
|
+
(`POST /payment-gate/webhook/:paygate`, verified by signature over the raw body; a missing or
|
|
138
|
+
unverifiable signature is a `PaygateSignatureError`, answered 400), and two
|
|
122
139
|
Ed25519-guarded repairs — `resync` (products, portal, webhook endpoint) and `resyncSubscriptions`
|
|
123
140
|
(re-reads every live Stripe subscription, answering `{ scanned, updated }`).
|
|
124
141
|
|
|
142
|
+
An application that declares the gate itself — its own aliases, pinned to the service that receives
|
|
143
|
+
the webhook — binds its declarations to the same actions instead, and registers nothing of
|
|
144
|
+
`paymentGate`:
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { bind } from '@owlmeans/server-app'
|
|
148
|
+
import { paymentGateHandlers } from '@owlmeans/server-payment'
|
|
149
|
+
|
|
150
|
+
export const hookBindings = [
|
|
151
|
+
bind(own.base),
|
|
152
|
+
bind(own.webhook, paymentGateHandlers.webhook),
|
|
153
|
+
bind(own.resync, paymentGateHandlers.resync),
|
|
154
|
+
bind(own.resyncSubscriptions, paymentGateHandlers.resyncSubscriptions),
|
|
155
|
+
]
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Each handler runs in the context of the entrypoint it is bound to. The declarations keep
|
|
159
|
+
`paymentGate`'s paths (the webhook URL registered with Stripe is formed from them), contracts and
|
|
160
|
+
guards; bind each with `bind` — `bindAll` pairs a handler only with the declaration it was made for.
|
|
161
|
+
|
|
125
162
|
<!-- owlmeans:agent-guidance:start -->
|
|
126
163
|
## Agent guidance
|
|
127
164
|
|
|
@@ -130,7 +167,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
130
167
|
your project's skill store (`.agents/skills/`):
|
|
131
168
|
|
|
132
169
|
```sh
|
|
133
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
170
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.45
|
|
134
171
|
```
|
|
135
172
|
|
|
136
173
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/server-payment",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-
|
|
4
|
+
"version": "0.1.18-rc.27",
|
|
5
|
+
"generatedAt": "2026-10-01T23:27:48.742Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -7,7 +7,7 @@ user-invocable: false
|
|
|
7
7
|
|
|
8
8
|
# @owlmeans/server-payment
|
|
9
9
|
|
|
10
|
-
**Install:** `bun add @owlmeans/server-payment@^0.1.18-rc.
|
|
10
|
+
**Install:** `bun add @owlmeans/server-payment@^0.1.18-rc.27`
|
|
11
11
|
|
|
12
12
|
Public MIT package. It embeds Stripe into an application backend and owns everything between
|
|
13
13
|
Stripe and an entity's entitlements: the subscription store, one-time fulfillments, the usage
|
|
@@ -46,14 +46,24 @@ declarePaymentPlan(cfg, { productSku: 'app-plans', sku: 'pro-monthly', rank: 10,
|
|
|
46
46
|
|
|
47
47
|
appendPaymentGatewayService(context) // the process that talks to Stripe
|
|
48
48
|
appendPaymentGatewayService(context, { manage: false }) // a worker that only reads entitlements and asserts consent
|
|
49
|
+
// One deployment, several managed processes on one database: the same owner and webhookService everywhere
|
|
50
|
+
appendPaymentGatewayService(context, { owner: 'app-api', webhookService: 'app-hooks' }) // receives the webhook, bootstraps at boot
|
|
51
|
+
appendPaymentGatewayService(context, { owner: 'app-api', webhookService: 'app-hooks', bootstrap: false }) // checkout and portal only
|
|
49
52
|
appendConsumerRights(context, { manage, usage: myUsageMeter }) // before or after the gateway; idempotent
|
|
50
53
|
consumerRights(context).useMailRenderer(myRenderer) // lazy service: works while wiring
|
|
51
54
|
gateway(context).use(myCheckoutPlugin) // a tier / cap / hold plugin — once the context is initialized
|
|
52
55
|
export const serverBindings = [
|
|
53
|
-
...paymentGateEntrypoints,
|
|
56
|
+
...paymentGateEntrypoints, // the library's own, unpinned `paymentGate`
|
|
54
57
|
...consumerRightsEntrypoints(consumerProtocols, { guardMoney, throttle, subjectOf, planNameOf }),
|
|
55
58
|
...checkoutReadEntrypoints(checkoutProtocols),
|
|
56
59
|
]
|
|
60
|
+
// …or the gate re-declared by the application (its aliases, pinned to its service, the library's paths):
|
|
61
|
+
export const hookBindings = [
|
|
62
|
+
bind(own.base),
|
|
63
|
+
bind(own.webhook, paymentGateHandlers.webhook),
|
|
64
|
+
bind(own.resync, paymentGateHandlers.resync),
|
|
65
|
+
bind(own.resyncSubscriptions, paymentGateHandlers.resyncSubscriptions),
|
|
66
|
+
]
|
|
57
67
|
observer(context).onSubscription(async event => { /* keyed by event.eventKey */ })
|
|
58
68
|
```
|
|
59
69
|
|
|
@@ -75,6 +85,26 @@ observer(context).onSubscription(async event => { /* keyed by event.eventKey */
|
|
|
75
85
|
`cancel` throw `PaygateError('unmanaged')`. `grantInternalPlan`, the entitlement service,
|
|
76
86
|
`amountPolicy`, `planPrices` and the consumer-rights reads, `recordConsent`,
|
|
77
87
|
`recordStartRequest` and `assertConsent` work, because they are Mongo only.
|
|
88
|
+
- **Three keys of a deployment's Stripe state**, each a `PaymentGatewayOptions` field, each read
|
|
89
|
+
back on the gateway (`gateway(ctx).webhookService / owner / bootstrap`):
|
|
90
|
+
- `webhookService` (default `cfg.service`) — the `cfg.services` alias whose host and base form
|
|
91
|
+
`webhookUrlOf`, the portal's deployment key too. Name the process that RECEIVES the webhook
|
|
92
|
+
(the one serving `paymentGate`) in every process, so every bootstrap computes one URL.
|
|
93
|
+
- `owner` (default `cfg.service`) — the `payment-webhook` rows' `service`, the signing-secret
|
|
94
|
+
lookup, the endpoint's `owlmeans:<owner>` description and `service` metadata, the
|
|
95
|
+
`portal:<owner>` fingerprint and the portal's `service` metadata. One value in every process of
|
|
96
|
+
the database, so each finds and replaces the others' rows.
|
|
97
|
+
- `bootstrap` (default: `manage`) — run `bootstrapStripe` at boot. Exactly one kind of process
|
|
98
|
+
keeps it (the receiver). A managed process with `bootstrap: false` still serves checkout, the
|
|
99
|
+
portal, estimates, the resyncs and the webhook route, and a FORCED bootstrap (`resync`, an
|
|
100
|
+
application's maintenance `bootstrapStripe(ctx, stripe, { force: true })`) still runs there —
|
|
101
|
+
same URL, same rows, fingerprinted, so idempotent from any process.
|
|
102
|
+
- Refused at construction: `bootstrap: true` with `manage: false`, an empty `owner` or
|
|
103
|
+
`webhookService` (`PaygateError`). A managed, bootstrapping gateway fails its initialization when
|
|
104
|
+
`webhookService` is not declared in `cfg.services` (`WebhookSetupError('service:<alias>')`).
|
|
105
|
+
- `stripe` (a `StripeFactory`, default `stripeClient`) is the gateway's own Stripe client —
|
|
106
|
+
`gateway(ctx).stripe(ctx)`, used by its methods, its boot bootstrap and the `paymentGate` handlers.
|
|
107
|
+
The consumer-rights service takes its own (`appendConsumerRights({ stripe })`).
|
|
78
108
|
- Every process that registers the gateway runs the collection validators (`collMod`) of all
|
|
79
109
|
twelve records at init: a process of an older version narrows the validators again, so roll
|
|
80
110
|
the processes of one deployment out together.
|
|
@@ -114,10 +144,10 @@ None declares an ObjectId reference: `entityId` is an organization key and every
|
|
|
114
144
|
| `payment-paygate-customer` | Stripe customer (`country`, `currency` from its webhooks; `deletedAt`) | `{paygate, externalId}` unique · `{paygate, entityId}` · `{paygate, profileId}` |
|
|
115
145
|
| `payment-subscription` | subscription: `sub_…`, `free:<entityId>`, `internal:<planSku>:<entityId>` (+ `currency` and the checkout evidence) | `{paygate, externalId}` unique · `{entityId, status, rank:-1}` · `{entityId, planSku}` · `{paygate, customerId}` · `{paygate, itemId}` sparse · `{paygate, status, updatedAt}` |
|
|
116
146
|
| `payment-fulfillment` | one-time checkout session (+ evidence: country, e-mail, totals, terms, `purchaseId`) | `{paygate, externalId}` unique · `{paygate, paymentIntentId}` sparse · `{paygate, chargeId}` sparse · `{entityId, createdAt:-1}` |
|
|
117
|
-
| `payment-webhook` | managed webhook endpoint (`secret` is `secure: true`) | `{paygate, service, url}` unique |
|
|
147
|
+
| `payment-webhook` | managed webhook endpoint of an owner (`service` = the gateway's `owner`; `secret` is `secure: true`) | `{paygate, service, url}` unique |
|
|
118
148
|
| `payment-usage` | usage event — the ledger | `{entityId, limitKey, eventKey}` unique · `{entityId, limitKey, window}` · `{entityId, limitKey, ref}` sparse · `{entityId, createdAt:-1}` |
|
|
119
149
|
| `payment-usage-counter` | (entity, limit, window) projection | `{entityId, limitKey, window}` unique |
|
|
120
|
-
| `payment-fingerprint` | synchronized product (`<productSku>`, with `prices[]`) or portal (`portal:<
|
|
150
|
+
| `payment-fingerprint` | synchronized product (`<productSku>`, with `prices[]`) or portal (`portal:<owner>`) | `{sku}` unique |
|
|
121
151
|
| `payment-billing-profile` | organization: the billing country fixed at the first purchase | `{entityId}` unique · `{paygate, customerId}` sparse |
|
|
122
152
|
| `payment-purchase` | purchase = contract + withdrawal window (a paid one-time checkout, a subscription's first invoice) | `{purchaseId}` unique · `{contractRef}` unique · `{entityId, deadline:-1}` · `{entityId, purchasedAt:-1}` · `{sessionId}` unique sparse · `{paygate, subscriptionId}` · `{invoiceId}` · `{invoiceNumber}` · `{paygate, paymentIntentId}` |
|
|
123
153
|
| `payment-consumer-consent` | append-only: a performance consent or a subscription start request | `{entityId, decidedAt:-1}` · `{kind, entityId, planSku, decidedAt:-1}` |
|
|
@@ -379,6 +409,18 @@ made (found by `metadata.withdrawalId`). Five failures of a step leave it to an
|
|
|
379
409
|
- `paymentGate` (bound by `paymentGateEntrypoints`): `webhook` is public because Stripe signs the
|
|
380
410
|
untouched raw body — never put an application guard on it; `resync` and `resyncSubscriptions`
|
|
381
411
|
carry `GUARD_ED25519`.
|
|
412
|
+
- **An application that declares the gate itself** — its own aliases, every route pinned to the
|
|
413
|
+
service that receives the webhook — binds its declarations to `paymentGateHandlers` (`webhook`,
|
|
414
|
+
`resync`, `resyncSubscriptions`) with `bind(own.webhook, paymentGateHandlers.webhook)` from
|
|
415
|
+
`@owlmeans/server-entrypoint` / `@owlmeans/server-app`, and never registers `paymentGate` or
|
|
416
|
+
`paymentGateEntrypoints`. A handler reads its context from the entrypoint it is bound to, so the
|
|
417
|
+
application's declaration is the one mounted and run. Its declarations keep the library's paths
|
|
418
|
+
(`webhookUrlOf` forms the Stripe URL from `paymentGate`'s), contracts (`PaygateParams`,
|
|
419
|
+
`ResyncResult`, `ResyncSubscriptionsResult` — `bind` refuses another shape at compile time) and
|
|
420
|
+
guards. Two ways to get it wrong: `bindAll(declarations, [paymentGateHandlers.webhook])` pairs by
|
|
421
|
+
object identity and leaves the application's declaration without a handler, and
|
|
422
|
+
`handlers().params(own.webhook, paymentGateHandlers.webhook)` answers every request with
|
|
423
|
+
`HandlerMisconfiguredError` (a handler bound to another protocol).
|
|
382
424
|
- `consumerRightsEntrypoints(protocols, { resolveEntity?, subjectOf?, guardMoney?, throttle?,
|
|
383
425
|
metaOf?, publicMinMs?, planNameOf?, serviceAlias? })` binds `makeConsumerRightsProtocols`' tree.
|
|
384
426
|
**Every hook gets the request's context as its LAST argument** — `resolveEntity(req, ctx)`,
|
|
@@ -398,20 +440,27 @@ made (found by `metadata.withdrawalId`). Five failures of a step leave it to an
|
|
|
398
440
|
|
|
399
441
|
## Stripe self-management
|
|
400
442
|
|
|
401
|
-
Runs in `initialize()` of a managed gateway, after the context is
|
|
402
|
-
|
|
443
|
+
Runs in `initialize()` of a managed gateway with `bootstrap` (default), after the context is
|
|
444
|
+
ready, and on a forced `bootstrapStripe` from any managed process; each step independent: products
|
|
445
|
+
and prices (above), the portal configuration, the webhook endpoint. A deployment's identity is its
|
|
446
|
+
webhook URL (`webhookUrlOf`: the `webhookService` alias's host and base); its rows carry the
|
|
447
|
+
`owner`.
|
|
403
448
|
|
|
404
449
|
- **The portal configuration**: customer update (email, address, tax id — **without address under
|
|
405
450
|
`mechanisms.countryLock`**), invoice history, payment method update, cancellation at period end
|
|
406
451
|
without proration, price switching between the active recurring prices. Its fingerprint covers
|
|
407
452
|
the catalogue (incl. `currencyPrices`), the lock flag, the region currencies, the branding and
|
|
408
453
|
the deployment key. Each deployment owns its own configuration, tagged `{ owlmeans: 'payment',
|
|
409
|
-
service
|
|
454
|
+
service: <owner>, deployment: webhookUrlOf(ctx) }`; one tagged for another deployment (a former
|
|
455
|
+
webhook URL included) is never touched — a moved URL creates a new configuration.
|
|
410
456
|
- `portalLink(ctx, entityId, { flow, planSku?, returnUrl })`: a customer is required
|
|
411
457
|
(`PortalUnavailable`, 409); `Cancel`/`Update`/`Change` need an entitling Stripe subscription.
|
|
412
458
|
- **The webhook endpoint** at `webhookUrlOf(ctx)`, subscribed to `WEBHOOK_EVENTS`, on the API version
|
|
413
459
|
read back from the client; only an https public host. A deployment deletes only the endpoints its
|
|
414
|
-
own rows name.
|
|
460
|
+
own rows name. A new URL (a moved host, a new `webhookService`) creates the endpoint there, then
|
|
461
|
+
deletes the endpoints of the owner's rows at other URLs and those rows — no migration step. The
|
|
462
|
+
secret (create-only) is stored field-encrypted where the database has a key; the receiver reads
|
|
463
|
+
the newest row of its `owner`.
|
|
415
464
|
- **Do not bump the Stripe SDK** (17.x, API `2025-02-24.acacia`): `current_period_*`,
|
|
416
465
|
`invoice.subscription`, `invoice.payment_intent`, `charge.invoice` are top-level there and move
|
|
417
466
|
later; credit notes link a refund by `refund`; `presentment_details` is untyped. Read them through
|
|
@@ -470,8 +519,12 @@ resources (unique and sparse-unique indexes, raw conditional updates) and a fake
|
|
|
470
519
|
every SDK call and its request options (idempotency keys) and can fail a method's next calls
|
|
471
520
|
(`state.failures`: a message, a real SDK error such as `new Stripe.errors.StripeInvalidRequestError(…)`,
|
|
472
521
|
or a list of them, one per call), so "no Stripe call" is an assertion. `makeFakeContext` wires the
|
|
473
|
-
consumer-rights call before the gateway by default (`gatewayFirst`, `rights
|
|
474
|
-
|
|
522
|
+
consumer-rights call before the gateway by default (`gatewayFirst`, `rights` and a pre-init `wire`
|
|
523
|
+
hook test the other orders); `gateway` passes the gateway's options (default `{ manage: false }`,
|
|
524
|
+
the fake always its Stripe client, so a managed one boot-bootstraps against it), `service` /
|
|
525
|
+
`host` / `base` / `services` shape `cfg.service` and `cfg.services`, and `seed` pre-fills stores
|
|
526
|
+
(a database shared between two processes). `gate-handlers.spec.ts` binds `paymentGateHandlers`
|
|
527
|
+
onto a re-declared, pinned gate and runs it in that process's context. The consumer-rights service there is
|
|
475
528
|
managed through the fake (`appendConsumerRights({ manage: true, stripe })`) with a console mailer
|
|
476
529
|
(`fake.mails`). The Mongo-gated specs prove admission under concurrency, the collection validators
|
|
477
530
|
of every record, the unique indexes, the concurrent first lock and the single winner of
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Forget every sync fingerprint and bring Stripe back to the declared catalogue, portal and webhook —
|
|
3
|
+
* in any managed process, `bootstrap: false` included: the webhook URL and the rows follow the
|
|
4
|
+
* gateway's `webhookService` and `owner`, so every process of the owner converges on one state.
|
|
5
|
+
*/
|
|
2
6
|
export declare const resync: import("@owlmeans/server-entrypoint").BoundEntrypointHandler<import("@owlmeans/entrypoint").EntrypointProtocol<{}, import("../consts.js").ResyncResult>>;
|
|
3
7
|
//# sourceMappingURL=resync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resync.d.ts","sourceRoot":"","sources":["../../src/actions/resync.ts"],"names":[],"mappings":"AASA
|
|
1
|
+
{"version":3,"file":"resync.d.ts","sourceRoot":"","sources":["../../src/actions/resync.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,eAAO,MAAM,MAAM,0JAMjB,CAAA"}
|
package/build/actions/resync.js
CHANGED
|
@@ -2,14 +2,19 @@ import { PaygateError } from '@owlmeans/payment';
|
|
|
2
2
|
import { handlers } from '@owlmeans/server-api';
|
|
3
3
|
import { paymentGate } from '../consts.js';
|
|
4
4
|
import { bootstrapStripe } from '../service.js';
|
|
5
|
-
import { fingerprints, gateway
|
|
5
|
+
import { fingerprints, gateway } from '../utils.js';
|
|
6
6
|
const bind = handlers();
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Forget every sync fingerprint and bring Stripe back to the declared catalogue, portal and webhook —
|
|
9
|
+
* in any managed process, `bootstrap: false` included: the webhook URL and the rows follow the
|
|
10
|
+
* gateway's `webhookService` and `owner`, so every process of the owner converges on one state.
|
|
11
|
+
*/
|
|
8
12
|
export const resync = bind.request(paymentGate.resync, async (_request, context) => {
|
|
9
|
-
|
|
13
|
+
const service = gateway(context);
|
|
14
|
+
if (!service.managed)
|
|
10
15
|
throw new PaygateError('unmanaged');
|
|
11
16
|
await fingerprints(context).clear();
|
|
12
|
-
await bootstrapStripe(context, await
|
|
17
|
+
await bootstrapStripe(context, await service.stripe(context), { force: true });
|
|
13
18
|
return { ok: true };
|
|
14
19
|
});
|
|
15
20
|
//# sourceMappingURL=resync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resync.js","sourceRoot":"","sources":["../../src/actions/resync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"resync.js","sourceRoot":"","sources":["../../src/actions/resync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAGnD,MAAM,IAAI,GAAG,QAAQ,EAAW,CAAA;AAEhC;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;IACjF,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAChC,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,MAAM,IAAI,YAAY,CAAC,WAAW,CAAC,CAAA;IACzD,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAA;IACnC,MAAM,eAAe,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IAC9E,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAA;AACrB,CAAC,CAAC,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** A Stripe delivery — only a managed gateway receives one; its secret is the `owner`'s stored one. */
|
|
1
2
|
export declare const webhook: import("@owlmeans/server-entrypoint").BoundEntrypointHandler<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
2
3
|
params: import("../consts.js").PaygateParams;
|
|
3
4
|
}, undefined>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/actions/webhook.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,OAAO;;
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/actions/webhook.ts"],"names":[],"mappings":"AASA,uGAAuG;AACvG,eAAO,MAAM,OAAO;;cAKlB,CAAA"}
|
package/build/actions/webhook.js
CHANGED
|
@@ -2,13 +2,15 @@ import { PaygateError, UnknownPaygate } from '@owlmeans/payment';
|
|
|
2
2
|
import { handlers } from '@owlmeans/server-api';
|
|
3
3
|
import { paymentGate, STRIPE_PAYGATE_ALIAS } from '../consts.js';
|
|
4
4
|
import { handleStripeWebhook } from '../plugins/stripe.js';
|
|
5
|
-
import { gateway
|
|
5
|
+
import { gateway } from '../utils.js';
|
|
6
6
|
const bind = handlers();
|
|
7
|
+
/** A Stripe delivery — only a managed gateway receives one; its secret is the `owner`'s stored one. */
|
|
7
8
|
export const webhook = bind.params(paymentGate.webhook, async ({ paygate }, context, request) => {
|
|
8
9
|
if (paygate !== STRIPE_PAYGATE_ALIAS)
|
|
9
10
|
throw new UnknownPaygate(paygate);
|
|
10
|
-
|
|
11
|
+
const service = gateway(context);
|
|
12
|
+
if (!service.managed)
|
|
11
13
|
throw new PaygateError('unmanaged');
|
|
12
|
-
await handleStripeWebhook(context, await
|
|
14
|
+
await handleStripeWebhook(context, await service.stripe(context), request);
|
|
13
15
|
});
|
|
14
16
|
//# sourceMappingURL=webhook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/actions/webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/actions/webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAGrC,MAAM,IAAI,GAAG,QAAQ,EAAW,CAAA;AAEhC,uGAAuG;AACvG,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IAC9F,IAAI,OAAO,KAAK,oBAAoB;QAAE,MAAM,IAAI,cAAc,CAAC,OAAO,CAAC,CAAA;IACvE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAChC,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,MAAM,IAAI,YAAY,CAAC,WAAW,CAAC,CAAA;IACzD,MAAM,mBAAmB,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAA;AAC5E,CAAC,CAAC,CAAA"}
|
package/build/consts.d.ts
CHANGED
|
@@ -51,12 +51,13 @@ export declare const PURCHASE_ID_PREFIX = "stripe";
|
|
|
51
51
|
* reference read aloud or typed from paper is never ambiguous.
|
|
52
52
|
*/
|
|
53
53
|
export declare const CONTRACT_REF_ALPHABET = "23456789ABCDEFGHJKMNPQRSTUVWXYZ";
|
|
54
|
-
/** Fingerprint sku prefix of a portal configuration: `portal:<
|
|
54
|
+
/** Fingerprint sku prefix of a portal configuration: `portal:<owner>` (the gateway's `owner`). */
|
|
55
55
|
export declare const FINGERPRINT_PORTAL = "portal";
|
|
56
56
|
/**
|
|
57
|
-
* The metadata every Stripe object this package creates carries (`{ owlmeans: 'payment', service }
|
|
58
|
-
* It labels the object for an operator; several
|
|
59
|
-
* decides on its own that an object belongs to this
|
|
57
|
+
* The metadata every Stripe object this package creates carries (`{ owlmeans: 'payment', service }`,
|
|
58
|
+
* `service` valued with the gateway's `owner`). It labels the object for an operator; several
|
|
59
|
+
* deployments of one owner share it, so it never decides on its own that an object belongs to this
|
|
60
|
+
* deployment.
|
|
60
61
|
*/
|
|
61
62
|
export declare const STRIPE_OWNER_KEY = "owlmeans";
|
|
62
63
|
export declare const STRIPE_OWNER_VALUE = "payment";
|
package/build/consts.d.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AAM,CAAA;CAAE;AAyB/E,qFAAqF;AACrF,eAAO,MAAM,WAAW;;IAEtB,yFAAyF;;;;IAKzF,mFAAmF;;IAMnF,+EAA+E;;CAMvE,CAAA"}
|
package/build/consts.js
CHANGED
|
@@ -54,12 +54,13 @@ export const PURCHASE_ID_PREFIX = 'stripe';
|
|
|
54
54
|
* reference read aloud or typed from paper is never ambiguous.
|
|
55
55
|
*/
|
|
56
56
|
export const CONTRACT_REF_ALPHABET = '23456789ABCDEFGHJKMNPQRSTUVWXYZ';
|
|
57
|
-
/** Fingerprint sku prefix of a portal configuration: `portal:<
|
|
57
|
+
/** Fingerprint sku prefix of a portal configuration: `portal:<owner>` (the gateway's `owner`). */
|
|
58
58
|
export const FINGERPRINT_PORTAL = 'portal';
|
|
59
59
|
/**
|
|
60
|
-
* The metadata every Stripe object this package creates carries (`{ owlmeans: 'payment', service }
|
|
61
|
-
* It labels the object for an operator; several
|
|
62
|
-
* decides on its own that an object belongs to this
|
|
60
|
+
* The metadata every Stripe object this package creates carries (`{ owlmeans: 'payment', service }`,
|
|
61
|
+
* `service` valued with the gateway's `owner`). It labels the object for an operator; several
|
|
62
|
+
* deployments of one owner share it, so it never decides on its own that an object belongs to this
|
|
63
|
+
* deployment.
|
|
63
64
|
*/
|
|
64
65
|
export const STRIPE_OWNER_KEY = 'owlmeans';
|
|
65
66
|
export const STRIPE_OWNER_VALUE = 'payment';
|
package/build/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,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,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,EAChG,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE,KAAK,EAAa,CAAC,CACtE;IACD,mFAAmF;IACnF,MAAM,EAAE,QAAQ,CACd,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,EACrF,QAAQ,CAAC,kBAAkB,CAAC,EAC5B,EAAE,MAAM,EAAE,aAAa,EAAE,CAC1B;IACD,+EAA+E;IAC/E,mBAAmB,EAAE,QAAQ,CAC3B,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,EAChH,QAAQ,CAAC,+BAA+B,CAAC,EACzC,EAAE,MAAM,EAAE,aAAa,EAAE,CAC1B;CACO,CAAA"}
|
package/build/entrypoints.d.ts
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The payment gate's action handlers, for an application that declares the gate itself — its own
|
|
3
|
+
* aliases, a route pinned to its own service: `bind(own.webhook, paymentGateHandlers.webhook)`.
|
|
4
|
+
*
|
|
5
|
+
* A handler reads its context from the entrypoint it is bound to, so the application's own
|
|
6
|
+
* declaration is the one registered, mounted and run. That declaration keeps `paymentGate`'s paths
|
|
7
|
+
* (`webhookUrlOf` registers the webhook at `paymentGate`'s path), contracts and guards. Bind each
|
|
8
|
+
* one with `bind` itself: `bindAll` pairs a handler with the declaration it was made for, by object
|
|
9
|
+
* identity, and leaves another declaration without one.
|
|
10
|
+
*/
|
|
11
|
+
export declare const paymentGateHandlers: Readonly<{
|
|
12
|
+
webhook: import("@owlmeans/server-entrypoint").BoundEntrypointHandler<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
13
|
+
params: import("./consts.js").PaygateParams;
|
|
14
|
+
}, undefined>>;
|
|
15
|
+
resync: import("@owlmeans/server-entrypoint").BoundEntrypointHandler<import("@owlmeans/entrypoint").EntrypointProtocol<{}, import("./consts.js").ResyncResult>>;
|
|
16
|
+
resyncSubscriptions: import("@owlmeans/server-entrypoint").BoundEntrypointHandler<import("@owlmeans/entrypoint").EntrypointProtocol<{}, import("./consts.js").ResyncSubscriptionsResult>>;
|
|
17
|
+
}>;
|
|
1
18
|
/** Runtime-local bindings for the shared immutable payment-gateway protocol tree. */
|
|
2
19
|
export declare const paymentGateEntrypoints: (import("@owlmeans/server-entrypoint").ServerProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
3
20
|
params: import("./consts.js").PaygateParams;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAIA,qFAAqF;AACrF,eAAO,MAAM,sBAAsB;;ydAKlC,CAAA"}
|
|
1
|
+
{"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB;;;;;;EAA0D,CAAA;AAE1F,qFAAqF;AACrF,eAAO,MAAM,sBAAsB;;ydAKlC,CAAA"}
|
package/build/entrypoints.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { bind } from '@owlmeans/server-entrypoint';
|
|
2
2
|
import { paymentGate } from './consts.js';
|
|
3
3
|
import { resync, resyncSubscriptions, webhook } from './actions/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* The payment gate's action handlers, for an application that declares the gate itself — its own
|
|
6
|
+
* aliases, a route pinned to its own service: `bind(own.webhook, paymentGateHandlers.webhook)`.
|
|
7
|
+
*
|
|
8
|
+
* A handler reads its context from the entrypoint it is bound to, so the application's own
|
|
9
|
+
* declaration is the one registered, mounted and run. That declaration keeps `paymentGate`'s paths
|
|
10
|
+
* (`webhookUrlOf` registers the webhook at `paymentGate`'s path), contracts and guards. Bind each
|
|
11
|
+
* one with `bind` itself: `bindAll` pairs a handler with the declaration it was made for, by object
|
|
12
|
+
* identity, and leaves another declaration without one.
|
|
13
|
+
*/
|
|
14
|
+
export const paymentGateHandlers = Object.freeze({ webhook, resync, resyncSubscriptions });
|
|
4
15
|
/** Runtime-local bindings for the shared immutable payment-gateway protocol tree. */
|
|
5
16
|
export const paymentGateEntrypoints = [
|
|
6
17
|
bind(paymentGate.base),
|
|
7
|
-
bind(paymentGate.webhook, webhook),
|
|
8
|
-
bind(paymentGate.resync, resync),
|
|
9
|
-
bind(paymentGate.resyncSubscriptions, resyncSubscriptions),
|
|
18
|
+
bind(paymentGate.webhook, paymentGateHandlers.webhook),
|
|
19
|
+
bind(paymentGate.resync, paymentGateHandlers.resync),
|
|
20
|
+
bind(paymentGate.resyncSubscriptions, paymentGateHandlers.resyncSubscriptions),
|
|
10
21
|
];
|
|
11
22
|
//# sourceMappingURL=entrypoints.js.map
|
package/build/entrypoints.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAEzE,qFAAqF;AACrF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACtB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAEzE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAA;AAE1F,qFAAqF;AACrF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACtB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC;IACtD,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC,MAAM,CAAC;IACpD,IAAI,CAAC,WAAW,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,mBAAmB,CAAC;CAC/E,CAAA"}
|
package/build/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export { makeEstimateCache, estimateStripePrice } from './plugins/estimate.js';
|
|
|
21
21
|
export type { EstimateCache } from './plugins/estimate.js';
|
|
22
22
|
export { applySubscription, createEventHandler, mapStatus } from './plugins/events.js';
|
|
23
23
|
export type { ApplyOptions } from './plugins/events.js';
|
|
24
|
-
export { ensureWebhookEndpoint, stripeWebhookSecret, stripeWebhookSecrets, webhookUrlOf, } from './plugins/webhook-manager.js';
|
|
25
|
-
export { ensurePortalConfiguration } from './plugins/portal.js';
|
|
26
|
-
export { activeSubscription, apiVersionOf, billingProfiles, consumerConsents, consumerDeclarations, consumerEvents, consumerRights, consumerRightsOf, entitlements, fingerprints, fulfillments, gateway, observer, paygateCustomers, payment, paymentWebhooks, purchases, stripeClient, stripeConfig, subscriptions, usageCounters, usageEvents, } from './utils.js';
|
|
24
|
+
export { ensureWebhookEndpoint, gatewayOwnerOf, stripeWebhookSecret, stripeWebhookSecrets, webhookRouteOf, webhookServiceOf, webhookUrlOf, } from './plugins/webhook-manager.js';
|
|
25
|
+
export { ensurePortalConfiguration, portalFingerprintSku } from './plugins/portal.js';
|
|
26
|
+
export { activeSubscription, apiVersionOf, billingProfiles, consumerConsents, consumerDeclarations, consumerEvents, consumerRights, consumerRightsOf, entitlements, fingerprints, fulfillments, gateway, gatewayOf, observer, paygateCustomers, payment, paymentWebhooks, purchases, stripeClient, stripeConfig, subscriptions, usageCounters, usageEvents, } from './utils.js';
|
|
27
27
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAC7F,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACvJ,OAAO,EACL,0BAA0B,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,oBAAoB,GACxF,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACpG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pE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACpG,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AACtF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAClG,cAAc,qBAAqB,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC9E,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACtF,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EACL,qBAAqB,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,cAAc,EAAE,gBAAgB,EAClH,YAAY,GACb,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AACrF,OAAO,EACL,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,cAAc,EACzG,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAC1H,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,GAC3G,MAAM,YAAY,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -17,7 +17,7 @@ export { assertAmountAllowed, narrowAmountFor, sessionTtlOf } from './plugins/ch
|
|
|
17
17
|
export * from './consumer/index.js';
|
|
18
18
|
export { makeEstimateCache, estimateStripePrice } from './plugins/estimate.js';
|
|
19
19
|
export { applySubscription, createEventHandler, mapStatus } from './plugins/events.js';
|
|
20
|
-
export { ensureWebhookEndpoint, stripeWebhookSecret, stripeWebhookSecrets, webhookUrlOf, } from './plugins/webhook-manager.js';
|
|
21
|
-
export { ensurePortalConfiguration } from './plugins/portal.js';
|
|
22
|
-
export { activeSubscription, apiVersionOf, billingProfiles, consumerConsents, consumerDeclarations, consumerEvents, consumerRights, consumerRightsOf, entitlements, fingerprints, fulfillments, gateway, observer, paygateCustomers, payment, paymentWebhooks, purchases, stripeClient, stripeConfig, subscriptions, usageCounters, usageEvents, } from './utils.js';
|
|
20
|
+
export { ensureWebhookEndpoint, gatewayOwnerOf, stripeWebhookSecret, stripeWebhookSecrets, webhookRouteOf, webhookServiceOf, webhookUrlOf, } from './plugins/webhook-manager.js';
|
|
21
|
+
export { ensurePortalConfiguration, portalFingerprintSku } from './plugins/portal.js';
|
|
22
|
+
export { activeSubscription, apiVersionOf, billingProfiles, consumerConsents, consumerDeclarations, consumerEvents, consumerRights, consumerRightsOf, entitlements, fingerprints, fulfillments, gateway, gatewayOf, observer, paygateCustomers, payment, paymentWebhooks, purchases, stripeClient, stripeConfig, subscriptions, usageCounters, usageEvents, } from './utils.js';
|
|
23
23
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAC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AAE,MAAM,YAAY,CAAA;AACvJ,OAAO,EACL,0BAA0B,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,oBAAoB,GACxF,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACpG,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AACtF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAClG,cAAc,qBAAqB,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE9E,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEtF,OAAO,EACL,qBAAqB,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,cAAc,EAAE,gBAAgB,EAClH,YAAY,GACb,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AACrF,OAAO,EACL,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,cAAc,EACzG,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAC1H,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,GAC3G,MAAM,YAAY,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type Stripe from 'stripe';
|
|
2
2
|
import type { Context as ApiContext } from '@owlmeans/server-api';
|
|
3
3
|
import type { PortalLinkOptions } from '../types.js';
|
|
4
|
-
|
|
4
|
+
/** The fingerprint sku of an owner's portal configuration: `portal:<owner>`. */
|
|
5
|
+
export declare const portalFingerprintSku: (owner: string) => string;
|
|
5
6
|
export interface EnsurePortalOptions {
|
|
6
7
|
force?: boolean;
|
|
7
8
|
}
|
|
@@ -10,16 +11,18 @@ export interface EnsurePortalOptions {
|
|
|
10
11
|
* method self-service, cancellation at period end, and switching between the active recurring
|
|
11
12
|
* prices of every product sold through Stripe (both subscription features off when there are none).
|
|
12
13
|
*
|
|
13
|
-
* A deployment's identity is its webhook URL (`webhookUrlOf
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* A deployment's identity is its webhook URL (`webhookUrlOf`, on the gateway's `webhookService`) —
|
|
15
|
+
* also when that URL is undeliverable, as on a local run; its fingerprint row and label carry the
|
|
16
|
+
* gateway's `owner` (`gatewayOwnerOf`). Several deployments of one application may share a Stripe
|
|
17
|
+
* account, so each owns a configuration of its own, tagged
|
|
18
|
+
* `{ owlmeans: 'payment', service: <owner>, deployment: <webhook URL> }`.
|
|
16
19
|
*
|
|
17
20
|
* - An unchanged declaration (catalogue, branding, deployment key) makes no paygate call.
|
|
18
|
-
* - The configuration the `portal:<
|
|
19
|
-
* metadata tags it for another deployment, which is never
|
|
20
|
-
* proceeds as though it held no row.
|
|
21
|
-
* - Without a usable row, an active configuration tagged with exactly this
|
|
22
|
-
* key is adopted. Nothing else is: not an untagged one, not one carrying only the
|
|
21
|
+
* - The configuration the `portal:<owner>` fingerprint row names is updated in place — unless its
|
|
22
|
+
* metadata tags it for another deployment (a moved webhook URL included), which is never
|
|
23
|
+
* overwritten; this deployment then proceeds as though it held no row.
|
|
24
|
+
* - Without a usable row, an active configuration tagged with exactly this owner and deployment
|
|
25
|
+
* key is adopted. Nothing else is: not an untagged one, not one carrying only the owner label,
|
|
23
26
|
* not one tagged for another deployment.
|
|
24
27
|
* - Otherwise a new configuration is created. Stripe cannot delete a portal configuration, so one
|
|
25
28
|
* this deployment can no longer identify stays in the account, and a lost row creates a new one
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../src/plugins/portal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAIhC,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAUjE,OAAO,KAAK,EAA6C,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAI/F,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../src/plugins/portal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAIhC,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAUjE,OAAO,KAAK,EAA6C,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAI/F,gFAAgF;AAChF,eAAO,MAAM,oBAAoB,UAAW,MAAM,KAAG,MAA0C,CAAA;AAiC/F,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAoCD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,yBAAyB,QAC/B,UAAU,UAAU,MAAM,SAAQ,mBAAmB,KACzD,OAAO,CAAC,MAAM,GAAG,IAAI,CAkGvB,CAAA;AAUD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,QACtB,UAAU,UAAU,MAAM,YAAY,MAAM,QAAQ,iBAAiB,KACzE,OAAO,CAAC,MAAM,CA2EhB,CAAA"}
|