@owlmeans/server-payment 0.1.18-rc.36 → 0.1.18-rc.38

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
@@ -178,7 +178,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
178
178
  your project's skill store (`.agents/skills/`):
179
179
 
180
180
  ```sh
181
- npx @owlmeans/agent-skills@^0.1.18-rc.56
181
+ npx @owlmeans/agent-skills@^0.1.18-rc.58
182
182
  ```
183
183
 
184
184
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
- "schemaVersion": 2,
2
+ "schemaVersion": 3,
3
3
  "package": "@owlmeans/server-payment",
4
- "version": "0.1.18-rc.36",
5
- "generatedAt": "2026-10-17T00:00:32.714Z",
4
+ "version": "0.1.18-rc.38",
5
+ "generatedAt": "2026-10-26T16:31:24.925Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -10,7 +10,33 @@
10
10
  "name": "server-payment",
11
11
  "category": "package-specific",
12
12
  "file": "skills/server-payment/SKILL.md",
13
- "canonicalPath": ".agents/skills/server-payment/SKILL.md"
13
+ "canonicalPath": ".agents/skills/server-payment/SKILL.md",
14
+ "parts": [
15
+ {
16
+ "name": "reference",
17
+ "file": "skills/server-payment/parts/reference.md",
18
+ "description": "The consumer-rights contracts — declaring the policy, the records, the ConsumerRightsService methods and usage meter, withdrawal and cancellation step by step, mails and handler options.",
19
+ "purposes": [
20
+ "payment",
21
+ "consent",
22
+ "server-api"
23
+ ],
24
+ "mentions": [
25
+ "declareConsumerRights",
26
+ "ConsumerRightsService",
27
+ "CONSUMER_RIGHTS_SERVICE",
28
+ "consumerRightsOf",
29
+ "recordConsent",
30
+ "assertConsent",
31
+ "recordStartRequest",
32
+ "withdrawalCandidates",
33
+ "PerformanceConsentRequired",
34
+ "SubscriptionStartRequired",
35
+ "UsageMeter",
36
+ "withdrawalRefundHelper"
37
+ ]
38
+ }
39
+ ]
14
40
  }
15
41
  ]
16
42
  }
@@ -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.36`
10
+ **Install:** `bun add @owlmeans/server-payment@^0.1.18-rc.38`
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
@@ -17,7 +17,8 @@ functions. The application owns its catalogue, what a purchase is worth to it (c
17
17
  provisioning), its usage meter and its side effects. Contracts — plans, limits, promos, the
18
18
  entitlement view, the consumer-rights views, calculators, copy and refusals — are
19
19
  `@owlmeans/payment`; the model across packages is the `entitlements` skill. Field lists, the
20
- service contract and the step-by-step algorithms are in `reference.md` in this skill folder.
20
+ service contract and the step-by-step algorithms are in the `reference` part
21
+ ([parts/reference.md](parts/reference.md)).
21
22
 
22
23
  ## Wiring
23
24
 
@@ -383,7 +384,7 @@ skill).
383
384
  The EU right of withdrawal (with the Art. 11a withdrawal function), spend consent for prepaid
384
385
  credits, subscription start requests, the cancellation function and a billing country fixed at the
385
386
  first purchase. The service is `paymentAccessOf(ctx).consumerRights()` (`.consumerRightsOf()` is null-safe); its
386
- full contract is in `reference.md`.
387
+ full contract is in the `reference` part ([parts/reference.md](parts/reference.md)).
387
388
 
388
389
  - **A purchase** is a paid one-time checkout, or a subscription's FIRST invoice — renewals,
389
390
  internal grants and manual credits never are. Its row (`purchaseId` `stripe:<cs_…>` /
@@ -633,3 +634,9 @@ concurrent withdrawals.
633
634
  - [[web-payment]] — hooks and pieces, the consumer-rights dialogs and functions
634
635
  - [[mailer]] — the mail transport the consumer-rights mails go through
635
636
  - [[mongo-resource]] — raw collection access, duplicate-key detection, field locking
637
+
638
+ ## Parts
639
+
640
+ | Part | Load it when |
641
+ |---|---|
642
+ | [reference](parts/reference.md) | implementing or changing consumer rights — the policy, records, service methods, withdrawal, cancellation, mails or handler options |
@@ -0,0 +1,174 @@
1
+ ---
2
+ name: reference
3
+ description: The consumer-rights contracts — declaring the policy, the records, the ConsumerRightsService methods and usage meter, withdrawal and cancellation step by step, mails and handler options.
4
+ metadata:
5
+ purposes: payment, consent, server-api
6
+ mentions: declareConsumerRights, ConsumerRightsService, CONSUMER_RIGHTS_SERVICE, consumerRightsOf, recordConsent, assertConsent, recordStartRequest, withdrawalCandidates, PerformanceConsentRequired, SubscriptionStartRequired, UsageMeter, withdrawalRefundHelper
7
+ ---
8
+ <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
9
+
10
+ # @owlmeans/server-payment — Consumer-rights reference
11
+
12
+ The contracts behind `SKILL.md` § Consumer rights. Types live in `src/types.ts`, schemas in
13
+ `src/schemas.ts`, the service in `src/consumer/service.ts`.
14
+
15
+ ## Declaring
16
+
17
+ ```typescript
18
+ declareConsumerRights(cfg, {
19
+ ...ConsumerRightsDeclaration, // @owlmeans/payment: textVersion, links (per language), mechanisms,
20
+ // currencies { eu, other }, countries, withdrawalDays, deadline, …
21
+ trader: { name, legalName, address?, email?, website? }, // backend only; required when any mechanism is on
22
+ mail: { alias?, from?, replyTo?, bcc?: string[] }, // backend only
23
+ consentContext?: string, // advertised: the performance-consent copy variant (`included`)
24
+ }): ConsumerRightsPolicy
25
+ ```
26
+
27
+ - The policy is a singleton ADVERTISED config record (`CONSUMER_RIGHTS_RECORD_ID`), filled from
28
+ `DEFAULT_CONSUMER_RIGHTS` (14 days, weekend rollover, **margin 5 days**, every mechanism off) and
29
+ asserted; a second declaration replaces the first.
30
+ - `trader` and `mail` go to the plugin config `_external:payment-consumer-mail`
31
+ (`CONSUMER_RIGHTS_MAIL_PLUGIN_CONFIG`), never advertised. `trader.name` fills `{{trader}}` in the
32
+ consent and start statements; `legalName, address, email` (whatever is declared) fill it in the
33
+ mails, the withdrawal information and the model form.
34
+ - Refusals: `ConsumerRightsError('policy:trader')` (a mechanism on, no `name`/`legalName`),
35
+ `'policy:mail-bcc'`, and every `consumerRightsPolicyHelper.assertConsumerRightsPolicy` refusal.
36
+
37
+ ## Records
38
+
39
+ | Record | Fields |
40
+ |---|---|
41
+ | `BillingProfileRecord` | `entityId, country, region, currency, language, source ('checkout'\|'customer'\|'manual'), paygate, customerId?, sessionId?, ipCountry?, email?, name?, business?, lockedAt, createdAt, updatedAt?` |
42
+ | `PurchaseRecord` | `purchaseId, contractRef, entityId, kind, paygate, sessionId?, subscriptionId?, paymentIntentId?, invoiceId?, invoiceNumber?, invoiceLineId?, productSku, planSku?, profileId?, country?, region?, ipCountry?, inScope, language, email?, name?, business?, currency, amountSubtotalMinor, amountTaxMinor, amountTotalMinor, presentmentCurrency?, presentmentAmountMinor?, netAmountMinor?, amountCurrency?, units?, taxBehavior?, termsAccepted?, textVersion?, copyVersion?, startRequestId?, servicesStartedAt?, confirmationMailAt?, purchasedAt, deadline?, consentId?, consentedAt?, withdrawalId?, withdrawnAt?, refundedMinor?, refundedAt?, cancellationId?, cancelEffectiveAt?, createdAt, updatedAt?` |
43
+ | `ConsumerConsentRecord` | `kind ('performance'\|'subscription-start'), entityId, profileId?, name?, email?, purchaseIds[], planSku?, planName?, textVersion, copyVersion, language, uiLanguage?, trader, context? (the copy variant: the policy's `consentContext` / `consumerCopyHelper.startContextOf(plan)`), text {request, acknowledgement, checkbox}, links, deadline?, decidedAt, expiresAt?` + `RequestOrigin` |
44
+ | `ConsumerDeclarationRecord` | `kind ('withdrawal'\|'cancellation'), channel ('in-app'\|'public'), entityId?, purchaseId?, subscriptionId?, contractRef?, name, email, cancellationKind?, reason?, effective?, requestedDate?, language, textVersion?, copyVersion, receivedAt, matched, profileId?, duplicateOf?, status, refundMinor?, currency?, effectiveAt?` + `RequestOrigin` |
45
+ | `ConsumerEventRecord` | `recordId, recordKind ('purchase'\|'consent'\|'declaration'\|'profile'\|'checkout'), entityId?, action, step?, ok, skipped?, externalId?, amountMinor?, currency?, detail? (JSON), error?, at` |
46
+ | `RequestOrigin` | `ip?, forwardedFor?, userAgent?, ipCountry?, acceptLanguage?, via?` |
47
+
48
+ Event actions: `mail` (step = mail kind), `computed` (the meter reading and the refund, JSON),
49
+ `meter`, `refund`, `credit-note` (step `preview` for a failed preview), `subscription-cancel`,
50
+ `cancel-scheduled`, `observers` (step = `consent`/`withdrawal`/`cancellation`), `lock`,
51
+ `lock-mismatch`, `relock`, `unlock` (detail: `from`, `by`, `reason`, the deleted `profile`),
52
+ `duplicate`, `checkout-terms-fallback` (`recordKind: 'checkout'`, `recordId` = the entity,
53
+ `externalId` = the session created without the checkbox, `ok: false`, detail: the Stripe `message`,
54
+ `code`, `param`, `mode`, `productSku`, `planSku`; `error` when the retry failed too).
55
+
56
+ `PurchaseRecord.termsAccepted` is Stripe's `consent.terms_of_service` of the completed session and
57
+ nothing else; `confirmationMailAt` is the one claim of the purchase confirmation.
58
+
59
+ Accessors (`paymentAccessOf(ctx)`, `src/access.ts`): `billingProfiles`, `purchases`, `consumerConsents`,
60
+ `consumerDeclarations`, `consumerEvents`, `consumerRights`, `consumerRightsOf`; `paymentUtils.conditionalSet` (`src/utils.ts`).
61
+
62
+ ## The service (`ConsumerRightsService`, `CONSUMER_RIGHTS_SERVICE = 'payment-consumer-rights'`)
63
+
64
+ | Method | Does |
65
+ |---|---|
66
+ | `managed` | `false`: `withdraw`, `cancel` and reconcile's paygate steps refuse / skip. The application's explicit `manage`, else the gateway's, else `true` — whatever the registration order |
67
+ | `policy()` | the declared policy or `null` |
68
+ | `profile(entityId)` | the locked `BillingProfileView`, or `null` (the handler answers an unlocked view) |
69
+ | `lock(entityId, country, source, { force?, by?, reason?, currency?, … })` | first write wins; `manual` + `force` relocks (event `relock`) |
70
+ | `unlock(entityId, { by?, reason? })` | deletes the profile while it still holds the country read (else `ConsumerRightsError('unlock:changed:<id>')`), event `unlock`; answers the old view or `null`; no lazy lock from the paygate customer follows |
71
+ | `purchases(entityId, { open?, at? })` | `PurchaseView[]`, newest first; `withdrawable` asks the meter for top-ups |
72
+ | `consentView(entityId, at?)` | `PerformanceConsentView`: the open unconsented top-up windows, the billing language, the trader name, links, `context` = the policy's `consentContext` (absent without one) |
73
+ | `recordConsent(subject, body, origin?)` | 428 on a stale version or a view that saw none of the open windows; covers the listed open windows; `text` = `consumerCopyHelper.consentStatementOf(body.language, Performance, { trader, context: policy.consentContext })`, `context` stored |
74
+ | `assertConsent(entityId, at?)` | one indexed query; `PerformanceConsentRequired {pending, deadline}` |
75
+ | `startView(entityId, planSku, { language? })` | `SubscriptionStartView`; `required` unless locked outside the territories; `context` = `consumerCopyHelper.startContextOf(plan)` |
76
+ | `recordStartRequest(subject, body, origin?, { plan? })` | 428 `SubscriptionStartRequired` on a stale version; `UnknownPlan`; `text` = `consumerCopyHelper.consentStatementOf(body.language, SubscriptionStart, { trader, plan, context: consumerCopyHelper.startContextOf(plan) })`, `context` stored; mails the start confirmation |
77
+ | `assertStartRequest(entityId, planSku, id?)` | the fresh request bound to entity, plan and text version, or `null` when none is needed; else 428 |
78
+ | `withdrawalCandidates(entityId, subject?)` | open windows with an estimate (a top-up fully used after consent is left out); `automatic` = refunds on, meter present, managed |
79
+ | `withdraw(subject \| null, body, origin?)` | see below |
80
+ | `cancel(subject \| null, body, origin?)` | see below |
81
+ | `useMeter(meter)` / `usageMeter()` | the application's `UsageMeter` — settable while wiring (a lazy service) |
82
+ | `useMailRenderer(fn)` / `mailRenderer()` | `(kind, data, rendered) => MailMessage \| null \| undefined` |
83
+ | `reconcile({ since?, limit? })` | `{ retried, mailed, observed, backfilled, locked, failed }` |
84
+
85
+ `ConsumerSubject { entityId, profileId?, name?, email?, channel? }` — `channel: 'public'` when the
86
+ application matched a public declaration to an organization itself (the answer stays public).
87
+
88
+ ### The usage meter
89
+
90
+ ```typescript
91
+ interface PurchaseRef { purchaseId; kind; entityId; contractRef; productSku; planSku?; sessionId?; subscriptionId?; invoiceId?; purchasedAt }
92
+ interface UsageMeter {
93
+ used(ctx, q: { entityId; purchase: PurchaseRef; after?: Date; at: Date }):
94
+ Promise<{ granted; used; usedAfter; settled?; clawed?; remaining? }>
95
+ }
96
+ ```
97
+
98
+ `after` is the purchase's `consentedAt` (a subscription: its start request); without it
99
+ `usedAfter` must be 0. Deduction = `usedAfter + settled + clawed`; the units taken back
100
+ (`WithdrawalEvent.units.returned`) = `remaining ?? granted − used − settled − clawed`.
101
+
102
+ ## Withdrawal, step by step
103
+
104
+ 1. Policy and `mechanisms.withdrawal` required; managed required.
105
+ 2. Resolve: in-app `purchaseId` (or a contract) of the subject's organization — unknown,
106
+ out of scope or already refunded refuse (`WithdrawalUnavailable`, 409); public: contract
107
+ reference (normalized) or invoice number, and an e-mail of the purchase / profile / paygate
108
+ customer (case-insensitive).
109
+ 3. Already withdrawn: record the declaration with `duplicateOf`, answer the original receipt.
110
+ 4. Decide: unmatched or no right → `received`; past the deadline → `expired`; meter and automatic
111
+ refunds → compute (`processing`; a top-up with nothing to reimburse is `performed` in-app,
112
+ `review` in public); else `review`.
113
+ 5. Append the declaration (status, refund, currency); for `processing`/`review` set `withdrawnAt`
114
+ and `withdrawalId` conditionally — a loser records a `duplicate` event and answers the winner.
115
+ 6. Record `computed`; mail the receipt (refund / review / expired / unmatched text).
116
+ 7. Paygate (`processing` only), first attempt under `withdrawal:<id>:<step>`:
117
+ - subscription: `subscriptions.cancel(id, { prorate: false, invoice_now: false, cancellation_details: { comment: 'withdrawal:<id>' } })`, row `withdrawnAt`;
118
+ - invoice-backed: `creditNotes.preview({ invoice, lines: [{ type: 'invoice_line_item', invoice_line_item, amount: net }] })`, `refunds.create({ payment_intent, amount: min(open, preview.total), reason: 'requested_by_customer', metadata: { owlmeans, withdrawalId, purchaseId } })`, `creditNotes.create({ invoice, lines, refund, memo, metadata })` — a failed preview or credit note keeps the plain refund (event recorded);
119
+ - no invoice: the plain refund of the gross amount;
120
+ - no payment intent: `review`.
121
+ 8. `onWithdrawal` for `refunded` and `review`; a `failed` one is told after reconcile succeeds.
122
+
123
+ The refund is `withdrawalRefundHelper.oneTimeWithdrawalRefund` (gross on the total, net on the subtotal with the earlier
124
+ refunds' net share) or `.subscriptionWithdrawalRefund` (components of the net, time from the start
125
+ request, units by the meter; gross `ceil(paid × net' / net)`), always capped at what is still
126
+ unrefunded and rounded in the consumer's favour.
127
+
128
+ ## Cancellation, step by step
129
+
130
+ 1. Policy and `mechanisms.cancellation`; managed.
131
+ 2. Resolve the subscription: in-app `subscriptionId`, a contract, else the entitling Stripe
132
+ subscription (none → `CancellationUnavailable('no-subscription')`, ended → `'ended'`); public the
133
+ contract + e-mail, else the only organization whose paygate customer has the e-mail.
134
+ 3. Decide: extraordinary → `review` (paygate untouched); ordinary and live →
135
+ `cancellationEffectiveAt(periodEnd, interval, requested)` → `already-scheduled` when the period
136
+ end is already scheduled, else `scheduled`; otherwise `received`.
137
+ 4. Append the declaration; `scheduled`: `subscriptions.update` (`cancel_at_period_end` or
138
+ `cancel_at` + `proration_behavior: 'none'`, `cancellation_details.comment 'cancellation:<id>'`,
139
+ key `cancellation:<id>:schedule`) — a failure answers `received` and is retried.
140
+ 5. Purchase `cancellationId`/`cancelEffectiveAt`; mail the receipt (effective / review /
141
+ unmatched); `onCancellation`.
142
+
143
+ ## Mails
144
+
145
+ | Kind | When | Content |
146
+ |---|---|---|
147
+ | `purchase` | an in-scope purchase with an e-mail, once (the conditional `confirmationMailAt` claim) | order (contract, date, product, total incl. tax), the start request verbatim, withdrawal information with the function's address, model form, links |
148
+ | `consent` | a consent covering purchases | the statement verbatim (the recorded `text.checkbox` — the `consentContext` variant when declared), date/time UTC, the purchases with their last day, the unused-credits rule, links |
149
+ | `start` | a start request | the statement verbatim, the plan, the rule of the recorded variant (`email.start.rule`, `rule_units` when the record's `context` is `units`), links |
150
+ | `withdrawal` | every declaration (not a repeat) | the declaration, date/time of receipt, refund / review / expired / unmatched |
151
+ | `cancellation` | every declaration | the declaration, the effective date / review / unmatched |
152
+
153
+ Recipient: the purchase e-mail; the consent's person, else the profile / latest purchase /
154
+ paygate customer e-mail; the declaration's e-mail. `ConsumerMailData` carries the records a
155
+ renderer needs (`purchase`, `purchases`, `consent`, `declaration`, `links`, `trader`).
156
+
157
+ ## Handlers
158
+
159
+ Every hook gets the request's context last (`ctx`): reach services through it, keep no module state.
160
+
161
+ | Option | Default | Use |
162
+ |---|---|---|
163
+ | `resolveEntity(req, ctx)` | `req.entity?.id` | the organization the account routes act for |
164
+ | `subjectOf(req, ctx)` | — | profile id, name and e-mail prefill |
165
+ | `guardMoney(req, action, ctx)` | — | `consent`, `start`, `withdraw`, `cancel` — refuse API keys |
166
+ | `throttle(req, { action, email, ip }, ctx)` | **required with `public`** | per-IP / per-e-mail / global counters; throw 429 |
167
+ | `metaOf(req, ctx)` | `originHelper.requestOriginOf` | the evidence recorded |
168
+ | `publicMinMs` | 1000 | the least time a public declaration answers in |
169
+ | `planNameOf(planSku, language, req, ctx)` | — | the plan's short name in a start statement |
170
+ | `serviceAlias` | `CONSUMER_RIGHTS_SERVICE` | — |
171
+
172
+ Bound routes: account `base, profile, purchases, consent, giveConsent, start, requestStart,
173
+ withdrawals, withdraw, cancel`; public `base, policy, withdraw, cancel` (the screens are frontend
174
+ routes). `checkoutReadEntrypoints`: `base, amountPolicy, planPrices`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/server-payment",
3
- "version": "0.1.18-rc.36",
3
+ "version": "0.1.18-rc.38",
4
4
  "license": "MIT",
5
5
  "description": "Protocol-bound payment resources, entitlement gates, and Stripe checkout for OwlMeans servers.",
6
6
  "type": "module",
@@ -26,28 +26,28 @@
26
26
  "ajv": "*"
27
27
  },
28
28
  "dependencies": {
29
- "@owlmeans/auth": "^0.1.18-rc.41",
30
- "@owlmeans/config": "^0.1.18-rc.44",
31
- "@owlmeans/context": "^0.1.18-rc.34",
32
- "@owlmeans/entrypoint": "^0.1.18-rc.41",
33
- "@owlmeans/iam": "^0.1.18-rc.54",
34
- "@owlmeans/mailer": "^0.1.18-rc.37",
35
- "@owlmeans/mongo-resource": "^0.1.18-rc.45",
36
- "@owlmeans/payment": "^0.1.18-rc.52",
37
- "@owlmeans/resource": "^0.1.18-rc.40",
38
- "@owlmeans/log": "^0.1.18-rc.3",
39
- "@owlmeans/route": "^0.1.18-rc.35",
40
- "@owlmeans/server-api": "^0.1.18-rc.55",
41
- "@owlmeans/server-app": "^0.1.18-rc.57",
42
- "@owlmeans/server-context": "^0.1.18-rc.44",
43
- "@owlmeans/server-entrypoint": "^0.1.18-rc.40",
29
+ "@owlmeans/auth": "^0.1.18-rc.42",
30
+ "@owlmeans/config": "^0.1.18-rc.45",
31
+ "@owlmeans/context": "^0.1.18-rc.35",
32
+ "@owlmeans/entrypoint": "^0.1.18-rc.42",
33
+ "@owlmeans/iam": "^0.1.18-rc.56",
34
+ "@owlmeans/mailer": "^0.1.18-rc.38",
35
+ "@owlmeans/mongo-resource": "^0.1.18-rc.46",
36
+ "@owlmeans/payment": "^0.1.18-rc.54",
37
+ "@owlmeans/resource": "^0.1.18-rc.41",
38
+ "@owlmeans/log": "^0.1.18-rc.4",
39
+ "@owlmeans/route": "^0.1.18-rc.36",
40
+ "@owlmeans/server-api": "^0.1.18-rc.57",
41
+ "@owlmeans/server-app": "^0.1.18-rc.59",
42
+ "@owlmeans/server-context": "^0.1.18-rc.45",
43
+ "@owlmeans/server-entrypoint": "^0.1.18-rc.41",
44
44
  "async-mutex": "^0.5.0",
45
45
  "stripe": "^23.0.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@owlmeans/dep-config": "workspace:*",
49
- "@owlmeans/mongo": "^0.1.18-rc.49",
50
- "@owlmeans/test-integration": "^0.1.18-rc.35",
49
+ "@owlmeans/mongo": "^0.1.18-rc.51",
50
+ "@owlmeans/test-integration": "^0.1.18-rc.36",
51
51
  "@types/bun": "^1.4.2",
52
52
  "@types/node": "^26.6.4",
53
53
  "nodemon": "^3.1.14",
package/build/model.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import type { JSONSchemaType } from 'ajv';
2
- import type { BillingProfileRecord, ConsumerConsentRecord, ConsumerDeclarationRecord, ConsumerEventRecord, FingerprintRecord, PaygateCustomerRecord, PaymentFulfillmentRecord, PaymentSubscriptionRecord, PaymentUsageCounterRecord, PaymentUsageRecord, PaymentWebhookRecord, PurchaseRecord } from './types.js';
3
- export declare const PaygateCustomerSchema: JSONSchemaType<PaygateCustomerRecord>;
4
- export declare const PaymentSubscriptionSchema: JSONSchemaType<PaymentSubscriptionRecord>;
5
- export declare const PaymentFulfillmentSchema: JSONSchemaType<PaymentFulfillmentRecord>;
6
- export declare const PaymentWebhookSchema: JSONSchemaType<PaymentWebhookRecord>;
7
- export declare const PaymentUsageSchema: JSONSchemaType<PaymentUsageRecord>;
8
- export declare const PaymentUsageCounterSchema: JSONSchemaType<PaymentUsageCounterRecord>;
9
- export declare const FingerprintSchema: JSONSchemaType<FingerprintRecord>;
10
- export declare const BillingProfileSchema: JSONSchemaType<BillingProfileRecord>;
11
- export declare const PurchaseSchema: JSONSchemaType<PurchaseRecord>;
12
- export declare const ConsumerConsentSchema: JSONSchemaType<ConsumerConsentRecord>;
13
- export declare const ConsumerDeclarationSchema: JSONSchemaType<ConsumerDeclarationRecord>;
14
- export declare const ConsumerEventSchema: JSONSchemaType<ConsumerEventRecord>;
15
- //# sourceMappingURL=model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAMzC,OAAO,KAAK,EACV,oBAAoB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,iBAAiB,EAC9G,qBAAqB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,yBAAyB,EACrG,kBAAkB,EAAE,oBAAoB,EAAE,cAAc,EACzD,MAAM,YAAY,CAAA;AAkBnB,eAAO,MAAM,qBAAqB,EAQlB,cAAc,CAAC,qBAAqB,CAAC,CAAA;AAErD,eAAO,MAAM,yBAAyB,EA0CtB,cAAc,CAAC,yBAAyB,CAAC,CAAA;AAEzD,eAAO,MAAM,wBAAwB,EAcrB,cAAc,CAAC,wBAAwB,CAAC,CAAA;AAExD,eAAO,MAAM,oBAAoB,EAUjB,cAAc,CAAC,oBAAoB,CAAC,CAAA;AAEpD,eAAO,MAAM,kBAAkB,EAQf,cAAc,CAAC,kBAAkB,CAAC,CAAA;AAElD,eAAO,MAAM,yBAAyB,EAQtB,cAAc,CAAC,yBAAyB,CAAC,CAAA;AAEzD,eAAO,MAAM,iBAAiB,EAgCd,cAAc,CAAC,iBAAiB,CAAC,CAAA;AAoBjD,eAAO,MAAM,oBAAoB,EAUjB,cAAc,CAAC,oBAAoB,CAAC,CAAA;AAEpD,eAAO,MAAM,cAAc,EAoBX,cAAc,CAAC,cAAc,CAAC,CAAA;AAE9C,eAAO,MAAM,qBAAqB,EAoBlB,cAAc,CAAC,qBAAqB,CAAC,CAAA;AAErD,eAAO,MAAM,yBAAyB,EAatB,cAAc,CAAC,yBAAyB,CAAC,CAAA;AAEzD,eAAO,MAAM,mBAAmB,EAkBhB,cAAc,CAAC,mBAAmB,CAAC,CAAA"}
package/build/model.js DELETED
@@ -1,247 +0,0 @@
1
- import { DateSchema } from '@owlmeans/auth';
2
- import { CancellationKindSchema, CheckoutPricingModeSchema, ConsentKindSchema, ConsumerRegionSchema, DeclarationChannelSchema, DeclarationKindSchema, PurchaseKindSchema, SubscriptionStatusSchema, } from '@owlmeans/payment';
3
- /**
4
- * Record schemas. Every stored property is declared: the resource coerces a write through its
5
- * schema, and a property the schema does not know is written as a string. Dates follow the record
6
- * convention (`DateSchema`). None of these records declares an ObjectId reference — `entityId`
7
- * is an organization key and every other id is the paygate's.
8
- */
9
- const str = { type: 'string' };
10
- const optStr = { type: 'string', nullable: true };
11
- const num = { type: 'number' };
12
- const optNum = { type: 'number', nullable: true };
13
- const optBool = { type: 'boolean', nullable: true };
14
- const date = DateSchema;
15
- const optDate = { ...DateSchema, nullable: true };
16
- const id = { type: 'string', nullable: true };
17
- export const PaygateCustomerSchema = {
18
- type: 'object',
19
- properties: {
20
- id, paygate: str, externalId: str, entityId: optStr, profileId: optStr, email: optStr, name: optStr,
21
- taxId: optStr, country: optStr, currency: optStr, deletedAt: optDate,
22
- },
23
- required: ['paygate', 'externalId'],
24
- additionalProperties: false,
25
- };
26
- export const PaymentSubscriptionSchema = {
27
- type: 'object',
28
- properties: {
29
- id, entityId: str, planSku: str, productSku: str, service: str, paygate: str, externalId: str,
30
- itemId: optStr, priceId: optStr, status: SubscriptionStatusSchema, externalStatus: optStr, rank: num,
31
- periodStart: optDate, periodEnd: optDate, cancelAtPeriodEnd: optBool, canceledAt: optDate,
32
- endedAt: optDate, pausedAt: optDate, trialEnd: optDate, latestInvoiceId: optStr, customerId: optStr,
33
- disputedAt: optDate, disputeStatus: optStr, createdAt: date, updatedAt: optDate, syncedAt: optDate,
34
- lastEventId: optStr, initialPropagatedAt: optDate, currency: optStr,
35
- checkoutSessionId: optStr, purchaseId: optStr, firstInvoiceId: optStr, country: optStr, email: optStr,
36
- amountTotalMinor: optNum, amountTaxMinor: optNum, termsAccepted: optBool, startRequestId: optStr,
37
- withdrawnAt: optDate,
38
- overrides: {
39
- type: 'object',
40
- nullable: true,
41
- properties: {
42
- limits: {
43
- type: 'object',
44
- nullable: true,
45
- additionalProperties: {
46
- type: 'object', properties: { limit: num }, required: ['limit'], additionalProperties: false,
47
- },
48
- required: [],
49
- },
50
- },
51
- additionalProperties: false,
52
- },
53
- propagated: {
54
- type: 'object',
55
- nullable: true,
56
- properties: {
57
- planSku: str, rank: num, status: SubscriptionStatusSchema, cancelAtPeriodEnd: optBool,
58
- pausedAt: optDate, renewedInvoiceId: optStr,
59
- },
60
- required: ['planSku', 'rank', 'status'],
61
- additionalProperties: false,
62
- },
63
- },
64
- required: [
65
- 'entityId', 'planSku', 'productSku', 'service', 'paygate', 'externalId', 'status', 'rank', 'createdAt',
66
- ],
67
- additionalProperties: false,
68
- };
69
- export const PaymentFulfillmentSchema = {
70
- type: 'object',
71
- properties: {
72
- id, entityId: str, productSku: str, planSku: optStr, service: str, paygate: str, externalId: str,
73
- paymentIntentId: optStr, chargeId: optStr, invoiceId: optStr, mode: CheckoutPricingModeSchema,
74
- units: optNum, amountMinor: optNum, sourceChargeAmountMinor: optNum, amountCurrency: optStr,
75
- chargeAmountMinor: optNum, currency: optStr, createdAt: date,
76
- fulfilledAt: optDate, failedAt: optDate, refundedMinor: optNum, refundedAt: optDate,
77
- disputedAt: optDate, disputeStatus: optStr,
78
- country: optStr, email: optStr, profileId: optStr, amountTotalMinor: optNum, amountTaxMinor: optNum,
79
- termsAccepted: optBool, purchaseId: optStr,
80
- },
81
- required: ['entityId', 'productSku', 'service', 'paygate', 'externalId', 'mode', 'createdAt'],
82
- additionalProperties: false,
83
- };
84
- export const PaymentWebhookSchema = {
85
- type: 'object',
86
- properties: {
87
- id, paygate: str, service: str, url: str, externalId: str,
88
- /** The signing secret: field-encrypted when the database is configured with a key. */
89
- secret: { type: 'string', secure: true },
90
- apiVersion: str, events: { type: 'array', items: str }, hash: str, createdAt: date, updatedAt: optDate,
91
- },
92
- required: ['paygate', 'service', 'url', 'externalId', 'secret', 'apiVersion', 'events', 'hash', 'createdAt'],
93
- additionalProperties: false,
94
- };
95
- export const PaymentUsageSchema = {
96
- type: 'object',
97
- properties: {
98
- id, entityId: str, limitKey: str, window: str, delta: num, eventKey: str, ref: optStr, reason: optStr,
99
- planSku: optStr, createdAt: date, releasedAt: optDate,
100
- },
101
- required: ['entityId', 'limitKey', 'window', 'delta', 'eventKey', 'createdAt'],
102
- additionalProperties: false,
103
- };
104
- export const PaymentUsageCounterSchema = {
105
- type: 'object',
106
- properties: {
107
- id, entityId: str, limitKey: str, window: str, used: num, limit: num, planSku: optStr,
108
- overSince: optDate, updatedAt: date, reconciledAt: optDate,
109
- },
110
- required: ['entityId', 'limitKey', 'window', 'used', 'limit', 'updatedAt'],
111
- additionalProperties: false,
112
- };
113
- export const FingerprintSchema = {
114
- type: 'object',
115
- properties: {
116
- id, sku: str, hash: str, productId: optStr, externalId: optStr,
117
- prices: {
118
- type: 'array',
119
- nullable: true,
120
- items: {
121
- type: 'object',
122
- properties: {
123
- planSku: str, priceId: str, lookupKey: str, currency: str, unitAmount: num,
124
- // An array, never a currency-keyed map: the resource coerces a map's values to strings.
125
- options: {
126
- type: 'array',
127
- items: {
128
- type: 'object', properties: { currency: str, unitAmount: num },
129
- required: ['currency', 'unitAmount'], additionalProperties: false,
130
- },
131
- },
132
- taxBehavior: optStr, interval: optStr, sourceUnitAmount: num, sourceCurrency: str, syncedAt: date,
133
- },
134
- required: [
135
- 'planSku', 'priceId', 'lookupKey', 'currency', 'unitAmount', 'options', 'sourceUnitAmount',
136
- 'sourceCurrency', 'syncedAt',
137
- ],
138
- additionalProperties: false,
139
- },
140
- },
141
- updatedAt: date,
142
- },
143
- required: ['sku', 'hash', 'updatedAt'],
144
- additionalProperties: false,
145
- };
146
- /** An optional enum: `null` must be listed for a validator to accept it. */
147
- const nullableEnum = (values) => ({ type: 'string', enum: [...values, null], nullable: true });
148
- /** The request evidence every consumer act carries (`RequestOrigin`). */
149
- const origin = {
150
- ip: optStr, forwardedFor: optStr, userAgent: optStr, ipCountry: optStr, acceptLanguage: optStr, via: optStr,
151
- };
152
- const links = {
153
- type: 'object',
154
- properties: {
155
- billingTerms: str, withdrawalInformation: optStr, withdrawalForm: optStr, withdrawalFunction: optStr,
156
- cancellation: optStr,
157
- },
158
- required: ['billingTerms'],
159
- additionalProperties: false,
160
- };
161
- export const BillingProfileSchema = {
162
- type: 'object',
163
- properties: {
164
- id, entityId: str, country: str, region: ConsumerRegionSchema, currency: str, language: str,
165
- source: { type: 'string', enum: ['checkout', 'customer', 'manual'] }, paygate: str, customerId: optStr,
166
- sessionId: optStr, ipCountry: optStr, email: optStr, name: optStr, business: optBool, lockedAt: date,
167
- createdAt: date, updatedAt: optDate,
168
- },
169
- required: ['entityId', 'country', 'region', 'currency', 'language', 'source', 'paygate', 'lockedAt', 'createdAt'],
170
- additionalProperties: false,
171
- };
172
- export const PurchaseSchema = {
173
- type: 'object',
174
- properties: {
175
- id, purchaseId: str, contractRef: str, entityId: str, kind: PurchaseKindSchema, paygate: str,
176
- sessionId: optStr, subscriptionId: optStr, paymentIntentId: optStr, invoiceId: optStr, invoiceNumber: optStr,
177
- invoiceLineId: optStr, productSku: str, planSku: optStr, profileId: optStr, country: optStr,
178
- region: nullableEnum(ConsumerRegionSchema.enum), ipCountry: optStr, inScope: { type: 'boolean' },
179
- language: str, email: optStr, name: optStr, business: optBool, currency: str, amountSubtotalMinor: num,
180
- amountTaxMinor: num, amountTotalMinor: num, presentmentCurrency: optStr, presentmentAmountMinor: optNum,
181
- netAmountMinor: optNum, amountCurrency: optStr, units: optNum, taxBehavior: optStr, termsAccepted: optBool,
182
- textVersion: optStr, copyVersion: optStr, startRequestId: optStr, servicesStartedAt: optDate,
183
- confirmationMailAt: optDate, purchasedAt: date, deadline: optDate, consentId: optStr, consentedAt: optDate,
184
- withdrawalId: optStr, withdrawnAt: optDate, refundedMinor: optNum, refundedAt: optDate, cancellationId: optStr,
185
- cancelEffectiveAt: optDate, createdAt: date, updatedAt: optDate,
186
- },
187
- required: [
188
- 'purchaseId', 'contractRef', 'entityId', 'kind', 'paygate', 'productSku', 'inScope', 'language', 'currency',
189
- 'amountSubtotalMinor', 'amountTaxMinor', 'amountTotalMinor', 'purchasedAt', 'createdAt',
190
- ],
191
- additionalProperties: false,
192
- };
193
- export const ConsumerConsentSchema = {
194
- type: 'object',
195
- properties: {
196
- id, kind: ConsentKindSchema, entityId: str, profileId: optStr, name: optStr, email: optStr,
197
- purchaseIds: { type: 'array', items: str },
198
- planSku: optStr, planName: optStr, textVersion: str, copyVersion: str, language: str, uiLanguage: optStr, trader: str,
199
- context: optStr,
200
- text: {
201
- type: 'object',
202
- properties: { request: str, acknowledgement: str, checkbox: str },
203
- required: ['request', 'acknowledgement', 'checkbox'],
204
- additionalProperties: false,
205
- },
206
- links, deadline: optDate, decidedAt: date, expiresAt: optDate, ...origin,
207
- },
208
- required: [
209
- 'kind', 'entityId', 'purchaseIds', 'textVersion', 'copyVersion', 'language', 'trader', 'text', 'links',
210
- 'decidedAt',
211
- ],
212
- additionalProperties: false,
213
- };
214
- export const ConsumerDeclarationSchema = {
215
- type: 'object',
216
- properties: {
217
- id, kind: DeclarationKindSchema, channel: DeclarationChannelSchema, entityId: optStr, purchaseId: optStr,
218
- subscriptionId: optStr, contractRef: optStr, name: str, email: str,
219
- cancellationKind: nullableEnum(CancellationKindSchema.enum), reason: optStr,
220
- effective: nullableEnum(['earliest', 'date']), requestedDate: optStr,
221
- language: str, textVersion: optStr, copyVersion: str, receivedAt: date, matched: { type: 'boolean' },
222
- profileId: optStr, duplicateOf: optStr, status: str, refundMinor: optNum, currency: optStr,
223
- effectiveAt: optDate, ...origin,
224
- },
225
- required: ['kind', 'channel', 'name', 'email', 'language', 'copyVersion', 'receivedAt', 'matched', 'status'],
226
- additionalProperties: false,
227
- };
228
- export const ConsumerEventSchema = {
229
- type: 'object',
230
- properties: {
231
- id, recordId: str,
232
- recordKind: { type: 'string', enum: ['purchase', 'consent', 'declaration', 'profile', 'checkout'] },
233
- entityId: optStr,
234
- action: {
235
- type: 'string',
236
- enum: [
237
- 'mail', 'computed', 'meter', 'refund', 'credit-note', 'subscription-cancel', 'cancel-scheduled', 'observers',
238
- 'lock', 'lock-mismatch', 'relock', 'unlock', 'duplicate', 'checkout-terms-fallback',
239
- ],
240
- },
241
- step: optStr, ok: { type: 'boolean' }, skipped: optBool, externalId: optStr, amountMinor: optNum,
242
- currency: optStr, detail: optStr, error: optStr, at: date,
243
- },
244
- required: ['recordId', 'recordKind', 'action', 'ok', 'at'],
245
- additionalProperties: false,
246
- };
247
- //# sourceMappingURL=model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AACA,OAAO,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