@owlmeans/payment 0.1.18-rc.15 → 0.1.18-rc.17

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.
Files changed (58) hide show
  1. package/README.md +18 -26
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/payment/SKILL.md +45 -22
  4. package/build/consts.d.ts +5 -23
  5. package/build/consts.d.ts.map +1 -1
  6. package/build/consts.js +9 -23
  7. package/build/consts.js.map +1 -1
  8. package/build/entitlement.d.ts +4 -3
  9. package/build/entitlement.d.ts.map +1 -1
  10. package/build/entitlement.js +6 -3
  11. package/build/entitlement.js.map +1 -1
  12. package/build/entrypoints.d.ts +30 -2
  13. package/build/entrypoints.d.ts.map +1 -1
  14. package/build/entrypoints.js +45 -15
  15. package/build/entrypoints.js.map +1 -1
  16. package/build/index.d.ts +1 -0
  17. package/build/index.d.ts.map +1 -1
  18. package/build/index.js +1 -0
  19. package/build/index.js.map +1 -1
  20. package/build/model/checkout.d.ts +2 -3
  21. package/build/model/checkout.d.ts.map +1 -1
  22. package/build/model/checkout.js +8 -6
  23. package/build/model/checkout.js.map +1 -1
  24. package/build/model/index.d.ts +1 -0
  25. package/build/model/index.d.ts.map +1 -1
  26. package/build/model/index.js +1 -0
  27. package/build/model/index.js.map +1 -1
  28. package/build/model/plan.d.ts.map +1 -1
  29. package/build/model/plan.js +5 -1
  30. package/build/model/plan.js.map +1 -1
  31. package/build/model/pricing.d.ts +4 -0
  32. package/build/model/pricing.d.ts.map +1 -0
  33. package/build/model/pricing.js +31 -0
  34. package/build/model/pricing.js.map +1 -0
  35. package/build/model/subscription.d.ts +2 -2
  36. package/build/model/subscription.d.ts.map +1 -1
  37. package/build/model/subscription.js +9 -14
  38. package/build/model/subscription.js.map +1 -1
  39. package/build/pricing.d.ts +7 -0
  40. package/build/pricing.d.ts.map +1 -0
  41. package/build/pricing.js +63 -0
  42. package/build/pricing.js.map +1 -0
  43. package/build/types.d.ts +25 -3
  44. package/build/types.d.ts.map +1 -1
  45. package/package.json +13 -12
  46. package/src/consts.ts +10 -24
  47. package/src/entitlement.ts +8 -5
  48. package/src/entrypoints.ts +62 -39
  49. package/src/index.ts +1 -0
  50. package/src/model/checkout.ts +8 -6
  51. package/src/model/index.ts +1 -0
  52. package/src/model/plan.ts +5 -1
  53. package/src/model/pricing.ts +34 -0
  54. package/src/model/subscription.ts +11 -14
  55. package/src/pricing.ts +87 -0
  56. package/src/types.ts +29 -3
  57. package/tests/pricing.spec.ts +33 -0
  58. package/tests/protocol.spec.ts +46 -0
package/README.md CHANGED
@@ -1,18 +1,21 @@
1
1
  # @owlmeans/payment
2
2
 
3
- Payment service abstraction — product catalog, subscription management, and Stripe checkout integration.
3
+ Payment contracts and service abstractions for product catalogs, subscriptions, and amount- or
4
+ quantity-priced checkout.
4
5
 
5
6
  ## Overview
6
7
 
7
8
  - `makePaymentService(alias?)` — creates a payment service for context registration
8
9
  - `appendPaymentService(context, alias?)` — registers the payment service in the context
9
10
  - `PaymentService` — interface for products, plans, subscriptions, and checkout session creation
10
- - `CreateCheckoutBody` / `CreateCheckoutResponse` — request/response types for checkout
11
+ - `paymentApi` — immutable protocol declarations for subscription propagation and checkout
12
+ - `CheckoutPricingMode` plus amount/quantity checkout policy schemas and validators
13
+ - `chargeAmountMinor()` — integer-minor-unit processing adjustment calculation
11
14
 
12
15
  ## Installation
13
16
 
14
17
  ```bash
15
- bun add @owlmeans/payment@^0.1.18-rc.12
18
+ bun add @owlmeans/payment@^0.1.18-rc.13
16
19
  ```
17
20
 
18
21
  ## Usage
@@ -20,34 +23,20 @@ bun add @owlmeans/payment@^0.1.18-rc.12
20
23
  Create a checkout session:
21
24
 
22
25
  ```typescript
23
- import type { CreateCheckoutBody, CreateCheckoutResponse } from '@owlmeans/payment'
26
+ import { paymentApi } from '@owlmeans/payment'
24
27
 
25
- const result = await ctx.entrypoint<ClientEntrypoint<CreateCheckoutResponse>>(
26
- paymentApi.service.checkout.session.external.create
28
+ const result = await ctx.entrypoint(
29
+ paymentApi.service.checkout.session.external.create,
27
30
  ).call({
28
31
  body: {
29
32
  productSku: 'vib-tokens',
30
- entityId,
33
+ entitySlug,
31
34
  service: VIB_ALIAS,
35
+ amountMinor: 1_000,
32
36
  successUrl: helper.makeUrl(service)
33
- } satisfies CreateCheckoutBody
34
- })
35
- window.open(result.url, '_blank')
36
- ```
37
-
38
- Handle subscription propagation:
39
-
40
- ```typescript
41
- import { SubscriptionPropagateBody, PlanDuration, SubscriptionStatus } from '@owlmeans/payment'
42
-
43
- const handler = handleBody<SubscriptionPropagateBody>(async (body, context) => {
44
- if (body.status === SubscriptionStatus.Consumable) {
45
- const tokens = body.capabilities?.find(
46
- c => c.scope === PlanDuration.Consumable
47
- )?.permissions.units ?? 0
48
- await ctx.agentToken().topUpTokens(entityId, tokens * 1000)
49
37
  }
50
38
  })
39
+ window.location.assign(result.url)
51
40
  ```
52
41
 
53
42
  ## API
@@ -67,9 +56,11 @@ Creates the payment service.
67
56
 
68
57
  ### Types
69
58
 
70
- - `CreateCheckoutBody` — `{ productSku, entityId, service, successUrl?, cancelUrl? }`
59
+ - `CreateCheckoutBody` — `{ productSku, entitySlug, service, amountMinor?, successUrl?, cancelUrl? }`
71
60
  - `CreateCheckoutResponse` — `{ url: string }`
72
- - `SubscriptionPropagateBody` — extends `PlanSubscription`
61
+ - `AmountCheckoutPolicy` — integer minor-unit bounds, presets, currency, fixed and basis-point adjustments
62
+ - `QuantityCheckoutPolicy` — integer quantity bounds and default
63
+ - `SubscriptionPropagateBody` — propagation wire shape with `entitySlug`, never the stored `entityId`
73
64
  - `PlanSubscription` — `{ sku, entityId, createdAt, status, capabilities? }`
74
65
 
75
66
  ### Enums
@@ -78,6 +69,7 @@ Creates the payment service.
78
69
  - `SubscriptionStatus` — `Active`, `Consumable`, `Canceled`, etc.
79
70
  - `ProductType` — product category enum
80
71
  - `PaymentEntityType` — entity classification enum
72
+ - `CheckoutPricingMode` — `Amount` or `Quantity`
81
73
 
82
74
  ## Related Packages
83
75
 
@@ -91,7 +83,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
91
83
  your project's skill store (`.agents/skills/`):
92
84
 
93
85
  ```sh
94
- npx @owlmeans/agent-skills@^0.1.18-rc.14
86
+ npx @owlmeans/agent-skills@^0.1.18-rc.16
95
87
  ```
96
88
 
97
89
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/payment",
4
- "version": "0.1.18-rc.15",
5
- "generatedAt": "2026-09-10T23:12:07.517Z",
4
+ "version": "0.1.18-rc.17",
5
+ "generatedAt": "2026-09-12T12:32:46.380Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: payment
3
- description: "How to use @owlmeans/payment — the provider-agnostic payment contracts: the product/plan/subscription catalogue and its schemas, the paymentApi entrypoint aliases, PaymentService, and the entitlement grammar that gates paid capabilities. Auto-invoked when importing payment types or errors, declaring an entrypoint with entitled(), reading entitlements, or calling the checkout entrypoint."
3
+ description: "How to use @owlmeans/payment — provider-agnostic payment contracts, immutable payment protocols, amount/quantity checkout policies and pricing, catalogue records, and entitlement gates. Auto-invoked when importing payment types or errors, declaring paid routes, or creating checkout."
4
4
  user-invocable: false
5
5
  ---
6
6
  <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/payment
9
9
 
10
10
  **Layer:** Core
11
- **Install:** `"@owlmeans/payment": "^0.1.18-rc.15"` in `dependencies`
11
+ **Install:** `"@owlmeans/payment": "^0.1.18-rc.17"` in `dependencies`
12
12
 
13
13
  The contracts half of payments: the catalogue (products, plans, localizations), the subscription
14
14
  record, the entitlement grammar, and the entrypoint declarations both sides of a checkout share. It
@@ -21,8 +21,12 @@ talks to no paygate — a server-side integration implements against these, and
21
21
  |---|---|
22
22
  | `makePaymentService(alias?)` · `appendPaymentService(ctx, alias?)` | The catalogue reader, registered under `DEFAULT_ALIAS` / `PAYMENT_SERVICE` (`'payment'`). |
23
23
  | `PaymentService` | `product(sku)` · `products()` · `plans(productSku, duration)` · `plan(planSku)` · `allPlans(productSku)` · `localize(lng, entity)` · `shallowAuthentication(token)`. |
24
- | `paymentApi` | The entrypoint alias tree — `paymentApi.subscription.propagate`, `paymentApi.service.checkout.session.external.create`. |
25
- | `entrypoints` · `serviceEntrypoints` | The declarations to register: the subscription callback surface, and the checkout service surface. |
24
+ | `paymentApi` | Immutable protocol tree — `paymentApi.subscription.propagate`, `paymentApi.service.checkout.session.external.create`. |
25
+ | `entrypoints` · `serviceEntrypoints` | Flattened protocol declarations for registration; values retain their protocol identity. |
26
+ | `CheckoutPricingMode` | `Amount` for a caller-selected net monetary value; `Quantity` for reusable unit prices. |
27
+ | `AmountCheckoutPolicy` / `QuantityCheckoutPolicy` (+ schemas) | Configured bounds/default/presets and adjustment, or quantity bounds/default. |
28
+ | `assertAmountCheckoutPolicy` / `assertQuantityCheckoutPolicy` / `assertCheckoutAmount` | Startup and request-boundary validation. |
29
+ | `chargeAmountMinor(amount, policy)` | Integer-only gross-up of net amount before tax. |
26
30
  | `entitled(params, opts?)` · `ENTITLEMENT_GATE` | Declare on a route that an entrypoint needs a paid capability. |
27
31
  | `hasEntitlement(capabilities, param)` · `entitlementList(capabilities)` · `parseEntitlementParam` · `formatEntitlementParam` | The entitlement grammar — pure, and shared by the server gate and the UI. |
28
32
  | `CAPABILITY_FEATURE_SCOPE` | `'feature'`, the scope that carries flags. |
@@ -72,8 +76,8 @@ is written as a string:
72
76
  flag, however true, does not answer it.
73
77
  - **A malformed parameter answers `false`, it never throws.** A gate that crashed on a typo would
74
78
  take down the endpoint it guards, which is strictly worse than refusing the request.
75
- - **Declare the requirement on the route, not in the handler.** `entitled(...)` is sugar over
76
- `gate(ENTITLEMENT_GATE, params)`; the framework asserts a gate before the handler is entered, so
79
+ - **Declare the requirement on the protocol, not in the handler.** `entitled(...)` is sugar over
80
+ the protocol's `gate: { alias: ENTITLEMENT_GATE, params }` option; the framework asserts a gate before the handler is entered, so
77
81
  the route table states what a feature costs and no new endpoint can forget to check. Several
78
82
  parameters are OR'd, as with every other gate.
79
83
  - The gate service itself is not here — bind something under `ENTITLEMENT_GATE` in the server
@@ -82,9 +86,12 @@ is written as a string:
82
86
  ```typescript
83
87
  import { entitled, hasEntitlement, entitlementList } from '@owlmeans/payment'
84
88
 
85
- // On the route:
86
- entrypoint(route(MY_ROUTE, '/whitelabel', backend(BASE, RouteMethod.POST)),
87
- entitled('feature:branding--whitelabel'))
89
+ // On the protocol:
90
+ protocol(
91
+ route(MY_ROUTE, '/whitelabel', backend(BASE, RouteMethod.POST)),
92
+ contract(typed()),
93
+ { gate: { alias: ENTITLEMENT_GATE, params: ['feature:branding--whitelabel'] } },
94
+ )
88
95
 
89
96
  // In the UI, to render a control disabled rather than let it fail:
90
97
  const allowed = hasEntitlement(capabilities, 'renewable:credits>=100')
@@ -94,32 +101,48 @@ const granted = entitlementList(capabilities)
94
101
 
95
102
  ## Checkout
96
103
 
97
- Register `serviceEntrypoints` (and `entrypoints` where subscriptions are propagated back), then
98
- call the alias. `ClientEntrypoint.call` resolves to the response value itself and throws the reply's
99
- error; `invoke` is the form that hands back the value and the outcome together.
104
+ Register `bindAll(paymentApi.service)` on a client and bind `serviceEntrypoints` on a server. Call
105
+ the protocol object; its body and response are inferred without a consumer generic.
100
106
 
101
107
  ```typescript
102
108
  import { paymentApi, serviceEntrypoints } from '@owlmeans/payment'
103
- import type { CreateCheckoutBody, CreateCheckoutResponse } from '@owlmeans/payment'
104
- import type { ClientEntrypoint } from '@owlmeans/client-entrypoint'
109
+ import { bindAll } from '@owlmeans/client-entrypoint'
105
110
 
106
- export const appEntrypoints = [...myEntrypoints, ...serviceEntrypoints]
111
+ export const appEntrypoints = [...bindAll(paymentApi.service)]
107
112
 
108
- const result = await ctx.entrypoint<ClientEntrypoint<CreateCheckoutResponse>>(
109
- paymentApi.service.checkout.session.external.create
110
- ).call({
111
- body: { productSku, entityId, service, successUrl } satisfies CreateCheckoutBody
113
+ const result = await ctx.entrypoint(paymentApi.service.checkout.session.external.create).call({
114
+ body: { productSku, entitySlug, service, amountMinor, successUrl }
112
115
  })
113
- window.open(result.url, '_blank')
116
+ window.location.assign(result.url)
114
117
  ```
115
118
 
116
- `entityId` on a checkout and on a `PlanSubscription` is the organization entity a subscription is
117
- billed to — a stable record id, never an `entitySlug`, so a rename costs nothing.
119
+ `entitySlug` is the only organization value on a public checkout body. A server resolves it to the
120
+ stable `entityId` before persisting a customer/session. `PlanSubscription.entityId` remains an
121
+ internal record key, not an HTTP body convention.
122
+
123
+ ### Amount checkout
124
+
125
+ `amountMinor` is the net value credited to the customer, in integer currency minor units. The
126
+ policy bounds that value; fees and tax do not enlarge the credit. Gross up the pre-tax charge with:
127
+
128
+ ```
129
+ ceil((amountMinor + fixedMinor) * 10_000 / (10_000 - rateBps))
130
+ ```
131
+
132
+ Validate the whole policy when configuration is declared, then validate every selected amount at
133
+ the backend boundary. Minimum, default, maximum, preset entries, fixed adjustment and basis-point
134
+ rate are safe integers; presets are unique/in-range and the rate is below 100%. The maximum applies
135
+ to `amountMinor`, not the adjusted checkout subtotal or Stripe tax-inclusive total.
136
+
137
+ Quantity checkout remains supported. It uses its reusable unit price and quantity policy; do not
138
+ infer a pricing mode from the presence of `amountMinor`.
118
139
 
119
140
  ## Two spellings, both registered
120
141
 
121
142
  `entrypoints` declares `/propogate` and `/propagate` as two routes over the same
122
143
  `SubscriptionPropagateBodySchema`, and `paymentApi.subscription` carries an alias for each.
144
+ The protocol body carries the organization as `entitySlug`; `entityId` belongs only to stored
145
+ `PlanSubscription` records and in-process services.
123
146
  `propogate` is marked `@deprecated`, as are the type alias `SubscriptionPropogateBody` and the
124
147
  duplicate `SubscriptionPropogateBodySchema`: write every new declaration and every new call against
125
148
  `propagate` / `SubscriptionPropagateBody` / `SubscriptionPropagateBodySchema`. The misspelled route
package/build/consts.d.ts CHANGED
@@ -4,6 +4,10 @@ export declare enum ProductType {
4
4
  Service = "service",
5
5
  Consumable = "consumable"
6
6
  }
7
+ export declare enum CheckoutPricingMode {
8
+ Quantity = "quantity",
9
+ Amount = "amount"
10
+ }
7
11
  export declare enum PaymentEntityType {
8
12
  Product = "product",
9
13
  Plan = "plan",
@@ -41,6 +45,7 @@ export declare enum SubscriptionStatus {
41
45
  Consumable = "consumable"
42
46
  }
43
47
  export declare const ProductTypeSchema: JSONSchemaType<ProductType>;
48
+ export declare const CheckoutPricingModeSchema: JSONSchemaType<CheckoutPricingMode>;
44
49
  export declare const PaymentEntityTypeSchema: JSONSchemaType<PaymentEntityType>;
45
50
  export declare const PlanStatusSchema: JSONSchemaType<PlanStatus>;
46
51
  export declare const PlanDurationSchema: JSONSchemaType<PlanDuration>;
@@ -56,27 +61,4 @@ export declare const L10N_RECORD_TYPE = "l10n";
56
61
  export declare const L10N_RECORD_PREFIX = "l10n";
57
62
  export declare const DEFAULT_ALIAS = "payment";
58
63
  export declare const PAYMENT_SERVICE = "payment";
59
- export declare const paymentApi: {
60
- subscription: {
61
- base: string;
62
- /**
63
- * @deprecated Use propagate instead
64
- */
65
- propogate: string;
66
- propagate: string;
67
- };
68
- service: {
69
- base: string;
70
- checkout: {
71
- base: string;
72
- session: {
73
- base: string;
74
- external: {
75
- base: string;
76
- create: string;
77
- };
78
- };
79
- };
80
- };
81
- };
82
64
  //# sourceMappingURL=consts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAEzC,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;AAED,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,a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AA;AAED,eAAO,MAAM,uBAAuB,EAAE,cAAc,CAAC,iBAAiB,CAGrE,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,UAAU,CAGvD,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,YAAY,CAG3D,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,cAAc,CAAC,kBAAkB,CAGvE,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,MAAM,CAErD,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,cAAc,CAAC,MAAM,CAE3D,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,MAAM,CAExD,CAAA;AAED,eAAO,MAAM,mBAAmB,YAAY,CAAA;AAC5C,eAAO,MAAM,qBAAqB,YAAsB,CAAA;AAExD,eAAO,MAAM,gBAAgB,SAAS,CAAA;AACtC,eAAO,MAAM,kBAAkB,SAAmB,CAAA;AAElD,eAAO,MAAM,gBAAgB,SAAS,CAAA;AACtC,eAAO,MAAM,kBAAkB,SAAmB,CAAA;AAElD,eAAO,MAAM,aAAa,YAAY,CAAA;AAEtC,eAAO,MAAM,eAAe,YAAgB,CAAA"}
package/build/consts.js CHANGED
@@ -4,6 +4,11 @@ export var ProductType;
4
4
  ProductType["Service"] = "service";
5
5
  ProductType["Consumable"] = "consumable";
6
6
  })(ProductType || (ProductType = {}));
7
+ export var CheckoutPricingMode;
8
+ (function (CheckoutPricingMode) {
9
+ CheckoutPricingMode["Quantity"] = "quantity";
10
+ CheckoutPricingMode["Amount"] = "amount";
11
+ })(CheckoutPricingMode || (CheckoutPricingMode = {}));
7
12
  export var PaymentEntityType;
8
13
  (function (PaymentEntityType) {
9
14
  PaymentEntityType["Product"] = "product";
@@ -48,6 +53,10 @@ export const ProductTypeSchema = {
48
53
  type: 'string',
49
54
  enum: Object.values(ProductType)
50
55
  };
56
+ export const CheckoutPricingModeSchema = {
57
+ type: 'string',
58
+ enum: Object.values(CheckoutPricingMode),
59
+ };
51
60
  export const PaymentEntityTypeSchema = {
52
61
  type: 'string',
53
62
  enum: Object.values(PaymentEntityType)
@@ -81,27 +90,4 @@ export const L10N_RECORD_TYPE = 'l10n';
81
90
  export const L10N_RECORD_PREFIX = L10N_RECORD_TYPE;
82
91
  export const DEFAULT_ALIAS = 'payment';
83
92
  export const PAYMENT_SERVICE = DEFAULT_ALIAS;
84
- export const paymentApi = {
85
- subscription: {
86
- base: 'payment-api:subscription',
87
- /**
88
- * @deprecated Use propagate instead
89
- */
90
- propogate: 'payment-api:subscription:propogate',
91
- propagate: 'payment-api:subscription:propagate',
92
- },
93
- service: {
94
- base: 'payment-service:base',
95
- checkout: {
96
- base: 'payment-service:checkout',
97
- session: {
98
- base: 'payment-service:checkout:session',
99
- external: {
100
- base: 'payment-service:checkout:session:external',
101
- create: 'payment-service:checkout:session:external:create',
102
- }
103
- }
104
- }
105
- }
106
- };
107
93
  //# sourceMappingURL=consts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;AAC3B,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAED,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,kCAAa,CAAA;IACb,qDAAgC,CAAA;AAClC,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B;AAED,MAAM,CAAN,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,mCAAqB,CAAA;IACrB,uCAAyB,CAAA;IACzB,qCAAuB,CAAA;AACzB,CAAC,EAPW,UAAU,KAAV,UAAU,QAOrB;AAED,MAAM,CAAN,IAA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A;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAA;AAElD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAA;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAA;AAElD,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAA;AAEtC,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { CommonEntrypointOptions } from '@owlmeans/entrypoint';
1
+ import type { EntrypointOptions } from '@owlmeans/entrypoint';
2
2
  import type { PermissionSet } from '@owlmeans/auth';
3
3
  /**
4
4
  * The gate alias a paid capability is asserted under.
@@ -49,12 +49,13 @@ export declare const entitlementList: (capabilities: PermissionSet[] | undefined
49
49
  /**
50
50
  * Declare that an entrypoint needs a paid capability.
51
51
  *
52
- * Sugar over `gate(ENTITLEMENT_GATE, params)` so a route reads as what it means. Several
52
+ * Compatibility sugar over the protocol option
53
+ * `{ gate: { alias: ENTITLEMENT_GATE, params } }` so a route reads as what it means. Several
53
54
  * parameters are OR'd, matching every other gate in the framework.
54
55
  *
55
56
  * Putting the requirement HERE rather than in a handler is the point: the framework asserts a gate
56
57
  * before the handler is entered, so the route table states what a feature costs and no new
57
58
  * endpoint can forget to check.
58
59
  */
59
- export declare const entitled: (params: string | string[], opts?: CommonEntrypointOptions) => CommonEntrypointOptions;
60
+ export declare const entitled: (params: string | string[], opts?: EntrypointOptions) => EntrypointOptions;
60
61
  //# sourceMappingURL=entitlement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entitlement.d.ts","sourceRoot":"","sources":["../src/entitlement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAElD;;;;;;GAMG;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AM,sBAAsB,WAAY,gBAAgB,KAAG,MAER,CAAA;AAE1D;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,iBACX,aAAa,EAAE,GAAG,SAAS,SAAS,MAAM,KACvD,OAqBF,CAAA;AAED,kGAAkG;AAClG,eAAO,MAAM,eAAe,iBAAkB,aAAa,EAAE,GAAG,SAAS,KAAG,MAAM,EAYjF,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,WACX,MAAM,GAAG,MAAM,EAAE,SAAS,iBAAiB,KAClD,iBAGD,CAAA"}
@@ -1,4 +1,3 @@
1
- import { gate } from '@owlmeans/entrypoint';
2
1
  /**
3
2
  * The gate alias a paid capability is asserted under.
4
3
  *
@@ -84,12 +83,16 @@ export const entitlementList = (capabilities) => {
84
83
  /**
85
84
  * Declare that an entrypoint needs a paid capability.
86
85
  *
87
- * Sugar over `gate(ENTITLEMENT_GATE, params)` so a route reads as what it means. Several
86
+ * Compatibility sugar over the protocol option
87
+ * `{ gate: { alias: ENTITLEMENT_GATE, params } }` so a route reads as what it means. Several
88
88
  * parameters are OR'd, matching every other gate in the framework.
89
89
  *
90
90
  * Putting the requirement HERE rather than in a handler is the point: the framework asserts a gate
91
91
  * before the handler is entered, so the route table states what a feature costs and no new
92
92
  * endpoint can forget to check.
93
93
  */
94
- export const entitled = (params, opts) => gate(ENTITLEMENT_GATE, params, opts);
94
+ export const entitled = (params, opts) => ({
95
+ ...opts,
96
+ gate: { alias: ENTITLEMENT_GATE, params },
97
+ });
95
98
  //# sourceMappingURL=entitlement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entitlement.js","sourceRoot":"","sources":["../src/entitlement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAI3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AAElD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAA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AC,CAAC,CAAC,IAAI,CAAA;IAC7E,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,kGAAkG;AAClG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,YAAyC,EAAY,EAAE;IACrF,MAAM,IAAI,GAAa,EAAE,CAAA;IACzB,KAAK,MAAM,GAAG,IAAI,YAAY,IAAI,EAAE,EAAE,CAAC;QACrC,KAAK,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,CAAC;YACxE,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;gBACrC,SAAQ;YACV,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAA;QACrE,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;AAC3B,CAAC,CAAA;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,MAAyB,EAAE,IAAwB,EAChC,EAAE,CAAC,CAAC;IACvB,GAAG,IAAI;IACP,IAAI,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE;CAC1C,CAAC,CAAA"}
@@ -1,3 +1,31 @@
1
- export declare const entrypoints: import("@owlmeans/entrypoint").CommonEntrypoint[];
2
- export declare const serviceEntrypoints: import("@owlmeans/entrypoint").CommonEntrypoint[];
1
+ /** Public payment protocols. Alias strings stay private to this declaration module. */
2
+ export declare const paymentApi: {
3
+ readonly subscription: {
4
+ readonly base: import("@owlmeans/entrypoint").EntrypointProtocol<{}, undefined>;
5
+ /** @deprecated Use propagate instead. */
6
+ readonly propogate: import("@owlmeans/entrypoint").EntrypointProtocol<{
7
+ body: import("./types.js").SubscriptionPropagateBody;
8
+ }, undefined>;
9
+ readonly propagate: import("@owlmeans/entrypoint").EntrypointProtocol<{
10
+ body: import("./types.js").SubscriptionPropagateBody;
11
+ }, undefined>;
12
+ };
13
+ readonly service: {
14
+ readonly base: import("@owlmeans/entrypoint").EntrypointProtocol<{}, undefined>;
15
+ readonly checkout: {
16
+ readonly base: import("@owlmeans/entrypoint").EntrypointProtocol<{}, undefined>;
17
+ readonly session: {
18
+ readonly base: import("@owlmeans/entrypoint").EntrypointProtocol<{}, undefined>;
19
+ readonly external: {
20
+ readonly base: import("@owlmeans/entrypoint").EntrypointProtocol<{}, undefined>;
21
+ readonly create: import("@owlmeans/entrypoint").EntrypointProtocol<{
22
+ body: import("./types.js").CreateCheckoutBody;
23
+ }, import("./types.js").CreateCheckoutResponse>;
24
+ };
25
+ };
26
+ };
27
+ };
28
+ };
29
+ export declare const entrypoints: import("@owlmeans/entrypoint").EntrypointProtocolDeclaration[];
30
+ export declare const serviceEntrypoints: import("@owlmeans/entrypoint").EntrypointProtocolDeclaration[];
3
31
  //# sourceMappingURL=entrypoints.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW,mDAgBvB,CAAA;AAED,eAAO,MAAM,kBAAkB,mDAkB9B,CAAA"}
1
+ {"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAgCA,uFAAuF;AACvF,eAAO,MAAM,UAAU;aACrB,YAAY;iBACV,IAAI;QACJ,yCAAyC;iBACzC,SAAS;;;iBAIT,SAAS;;;;aAKX,OAAO;iBACL,IAAI;iBACJ,QAAQ;qBACN,IAAI;qBACJ,OAAO;yBACL,IAAI;yBACJ,QAAQ;6BACN,IAAI;6BACJ,MAAM;;;;;;;CAQN,CAAA;AAEV,eAAO,MAAM,WAAW,gEAAqC,CAAA;AAC7D,eAAO,MAAM,kBAAkB,gEAAgC,CAAA"}
@@ -1,18 +1,48 @@
1
- import { body, filter, entrypoint } from '@owlmeans/entrypoint';
1
+ import { contract, protocol, protocols, typed } from '@owlmeans/entrypoint';
2
2
  import { route, backend, RouteMethod } from '@owlmeans/route';
3
- import { paymentApi } from './consts.js';
4
3
  import { SubscriptionPropagateBodySchema } from './model/subscription.js';
5
- import { CreateCheckoutBodySchema } from './model/checkout.js';
6
- export const entrypoints = [
7
- entrypoint(route(paymentApi.subscription.base, '/subscription', backend())),
8
- entrypoint(route(paymentApi.subscription.propogate, '/propogate', backend(paymentApi.subscription.base, RouteMethod.POST)), filter(body(SubscriptionPropagateBodySchema))),
9
- entrypoint(route(paymentApi.subscription.propagate, '/propagate', backend(paymentApi.subscription.base, RouteMethod.POST)), filter(body(SubscriptionPropagateBodySchema)))
10
- ];
11
- export const serviceEntrypoints = [
12
- entrypoint(route(paymentApi.service.base, '/payment-service', backend())),
13
- entrypoint(route(paymentApi.service.checkout.base, '/checkout', backend(paymentApi.service.base))),
14
- entrypoint(route(paymentApi.service.checkout.session.base, '/session', backend(paymentApi.service.checkout.base))),
15
- entrypoint(route(paymentApi.service.checkout.session.external.base, '/external', backend(paymentApi.service.checkout.session.base))),
16
- entrypoint(route(paymentApi.service.checkout.session.external.create, '/create', backend(paymentApi.service.checkout.session.external.base, RouteMethod.POST)), filter(body(CreateCheckoutBodySchema)))
17
- ];
4
+ import { CreateCheckoutBodySchema, CreateCheckoutResponseSchema } from './model/checkout.js';
5
+ const aliases = {
6
+ subscription: {
7
+ base: 'payment-api:subscription',
8
+ typo: 'payment-api:subscription:propogate',
9
+ propagate: 'payment-api:subscription:propagate',
10
+ },
11
+ service: {
12
+ base: 'payment-service:base',
13
+ checkout: 'payment-service:checkout',
14
+ session: 'payment-service:checkout:session',
15
+ external: 'payment-service:checkout:session:external',
16
+ create: 'payment-service:checkout:session:external:create',
17
+ },
18
+ };
19
+ const subscriptionBase = protocol(route(aliases.subscription.base, '/subscription', backend()), contract());
20
+ const serviceBase = protocol(route(aliases.service.base, '/payment-service', backend()), contract());
21
+ const checkoutBase = protocol(route(aliases.service.checkout, '/checkout', backend({ parent: serviceBase })), contract());
22
+ const sessionBase = protocol(route(aliases.service.session, '/session', backend({ parent: checkoutBase })), contract());
23
+ const externalBase = protocol(route(aliases.service.external, '/external', backend({ parent: sessionBase })), contract());
24
+ /** Public payment protocols. Alias strings stay private to this declaration module. */
25
+ export const paymentApi = {
26
+ subscription: {
27
+ base: subscriptionBase,
28
+ /** @deprecated Use propagate instead. */
29
+ propogate: protocol(route(aliases.subscription.typo, '/propogate', backend({ parent: subscriptionBase, method: RouteMethod.POST })), contract.request({ body: SubscriptionPropagateBodySchema }, typed())),
30
+ propagate: protocol(route(aliases.subscription.propagate, '/propagate', backend({ parent: subscriptionBase, method: RouteMethod.POST })), contract.request({ body: SubscriptionPropagateBodySchema }, typed())),
31
+ },
32
+ service: {
33
+ base: serviceBase,
34
+ checkout: {
35
+ base: checkoutBase,
36
+ session: {
37
+ base: sessionBase,
38
+ external: {
39
+ base: externalBase,
40
+ create: protocol(route(aliases.service.create, '/create', backend({ parent: externalBase, method: RouteMethod.POST })), contract.request({ body: CreateCheckoutBodySchema }, CreateCheckoutResponseSchema)),
41
+ },
42
+ },
43
+ },
44
+ },
45
+ };
46
+ export const entrypoints = protocols(paymentApi.subscription);
47
+ export const serviceEntrypoints = protocols(paymentApi.service);
18
48
  //# sourceMappingURL=entrypoints.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAA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,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,+BAA+B,EAAE,EAAE,KAAK,EAAa,CAAC,CAChF;KACF;IACD,OAAO,EAAE;QACP,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE;YACR,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE;gBACP,IAAI,EAAE,WAAW;gBACjB,QAAQ,EAAE;oBACR,IAAI,EAAE,YAAY;oBAClB,MAAM,EAAE,QAAQ,CACd,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,EACrG,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,wBAAwB,EAAE,EAAE,4BAA4B,CAAC,CACnF;iBACF;aACF;SACF;KACF;CACO,CAAA;AAEV,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA"}
package/build/index.d.ts CHANGED
@@ -8,4 +8,5 @@ export * from './i18n.js';
8
8
  export * from './helper.js';
9
9
  export * from './entrypoints.js';
10
10
  export * from './advertise.js';
11
+ export * from './pricing.js';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA"}
package/build/index.js CHANGED
@@ -7,4 +7,5 @@ export * from './i18n.js';
7
7
  export * from './helper.js';
8
8
  export * from './entrypoints.js';
9
9
  export * from './advertise.js';
10
+ export * from './pricing.js';
10
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA"}
@@ -1,5 +1,4 @@
1
- import type { JSONSchemaType } from 'ajv';
2
1
  import type { CreateCheckoutBody, CreateCheckoutResponse } from '../types.js';
3
- export declare const CreateCheckoutBodySchema: JSONSchemaType<CreateCheckoutBody>;
4
- export declare const CreateCheckoutResponseSchema: JSONSchemaType<CreateCheckoutResponse>;
2
+ export declare const CreateCheckoutBodySchema: import("@owlmeans/entrypoint").EntrypointSchema<CreateCheckoutBody>;
3
+ export declare const CreateCheckoutResponseSchema: import("@owlmeans/entrypoint").EntrypointSchema<CreateCheckoutResponse>;
5
4
  //# sourceMappingURL=checkout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/model/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAG7E,eAAO,MAAM,wBAAwB,EAAE,cAAc,CAAC,kBAAkB,CAavE,CAAA;AAED,eAAO,MAAM,4BAA4B,EAAE,cAAc,CAAC,sBAAsB,CAO/E,CAAA"}
1
+ {"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/model/checkout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAI7E,eAAO,MAAM,wBAAwB,qEAcG,CAAA;AAExC,eAAO,MAAM,4BAA4B,yEAOG,CAAA"}
@@ -1,24 +1,26 @@
1
1
  import { ResourceValueSchema, EntityValueSchema, IdValueSchema } from '@owlmeans/auth';
2
- export const CreateCheckoutBodySchema = {
2
+ import { schema } from '@owlmeans/entrypoint';
3
+ export const CreateCheckoutBodySchema = schema({
3
4
  type: 'object',
4
5
  properties: {
5
6
  productSku: ResourceValueSchema,
6
7
  sku: { ...ResourceValueSchema, nullable: true },
7
- entityId: EntityValueSchema,
8
+ entitySlug: EntityValueSchema,
8
9
  service: { ...ResourceValueSchema, minLength: 2 },
10
+ amountMinor: { type: 'number', minimum: 0, multipleOf: 1, nullable: true },
9
11
  subscriptionId: { ...IdValueSchema, nullable: true },
10
12
  successUrl: { ...ResourceValueSchema, minLength: 1, nullable: true },
11
13
  cancelUrl: { ...ResourceValueSchema, minLength: 1, nullable: true },
12
14
  },
13
- required: ['productSku', 'entityId', 'service'],
15
+ required: ['productSku', 'entitySlug', 'service'],
14
16
  additionalProperties: false,
15
- };
16
- export const CreateCheckoutResponseSchema = {
17
+ });
18
+ export const CreateCheckoutResponseSchema = schema({
17
19
  type: 'object',
18
20
  properties: {
19
21
  url: { type: 'string', minLength: 1 },
20
22
  },
21
23
  required: ['url'],
22
24
  additionalProperties: false,
23
- };
25
+ });
24
26
  //# sourceMappingURL=checkout.js.map