@owlmeans/payment 0.1.18-rc.16 → 0.1.18-rc.18
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 +74 -5
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/payment/SKILL.md +37 -18
- package/build/consts.d.ts +5 -23
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +9 -23
- package/build/consts.js.map +1 -1
- package/build/entrypoints.d.ts +30 -6
- package/build/entrypoints.d.ts.map +1 -1
- package/build/entrypoints.js +45 -15
- package/build/entrypoints.js.map +1 -1
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/model/checkout.d.ts +2 -3
- package/build/model/checkout.d.ts.map +1 -1
- package/build/model/checkout.js +8 -6
- package/build/model/checkout.js.map +1 -1
- package/build/model/index.d.ts +1 -0
- package/build/model/index.d.ts.map +1 -1
- package/build/model/index.js +1 -0
- package/build/model/index.js.map +1 -1
- package/build/model/plan.d.ts.map +1 -1
- package/build/model/plan.js +5 -1
- package/build/model/plan.js.map +1 -1
- package/build/model/pricing.d.ts +4 -0
- package/build/model/pricing.d.ts.map +1 -0
- package/build/model/pricing.js +31 -0
- package/build/model/pricing.js.map +1 -0
- package/build/model/subscription.d.ts +2 -2
- package/build/model/subscription.d.ts.map +1 -1
- package/build/model/subscription.js +9 -14
- package/build/model/subscription.js.map +1 -1
- package/build/pricing.d.ts +7 -0
- package/build/pricing.d.ts.map +1 -0
- package/build/pricing.js +63 -0
- package/build/pricing.js.map +1 -0
- package/build/types.d.ts +25 -3
- package/build/types.d.ts.map +1 -1
- package/package.json +13 -12
- package/src/advertise.ts +15 -0
- package/src/consts.ts +10 -24
- package/src/entrypoints.ts +62 -39
- package/src/index.ts +2 -0
- package/src/model/checkout.ts +8 -6
- package/src/model/index.ts +1 -0
- package/src/model/plan.ts +5 -1
- package/src/model/pricing.ts +34 -0
- package/src/model/subscription.ts +11 -14
- package/src/pricing.ts +87 -0
- package/src/types.ts +29 -3
- package/tests/pricing.spec.ts +33 -0
- package/tests/protocol.spec.ts +46 -0
package/README.md
CHANGED
|
@@ -1,10 +1,79 @@
|
|
|
1
1
|
# @owlmeans/payment
|
|
2
2
|
|
|
3
|
-
Payment
|
|
3
|
+
Payment contracts and service abstractions for product catalogs, subscriptions, and amount- or
|
|
4
|
+
quantity-priced checkout.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
- `makePaymentService(alias?)` — creates a payment service for context registration
|
|
9
|
+
- `appendPaymentService(context, alias?)` — registers the payment service in the context
|
|
10
|
+
- `PaymentService` — interface for products, plans, subscriptions, and checkout session creation
|
|
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
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
bun add @owlmeans/payment@^0.1.18-rc.13
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Create a checkout session:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { paymentApi } from '@owlmeans/payment'
|
|
27
|
+
|
|
28
|
+
const result = await ctx.entrypoint(
|
|
29
|
+
paymentApi.service.checkout.session.external.create,
|
|
30
|
+
).call({
|
|
31
|
+
body: {
|
|
32
|
+
productSku: 'vib-tokens',
|
|
33
|
+
entitySlug,
|
|
34
|
+
service: VIB_ALIAS,
|
|
35
|
+
amountMinor: 1_000,
|
|
36
|
+
successUrl: helper.makeUrl(service)
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
window.location.assign(result.url)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## API
|
|
43
|
+
|
|
44
|
+
### `makePaymentService(alias?): PaymentService`
|
|
45
|
+
|
|
46
|
+
Creates the payment service.
|
|
47
|
+
|
|
48
|
+
### `PaymentService`
|
|
49
|
+
|
|
50
|
+
- `product(sku): Promise<Product>` — get a product by SKU
|
|
51
|
+
- `products(): Promise<Product[]>` — list all products
|
|
52
|
+
- `plans(productSku, duration): Promise<ProductPlan[]>` — list plans for a product
|
|
53
|
+
- `plan(planSku): Promise<ProductPlan>` — get a plan by SKU
|
|
54
|
+
- `shallowAuthentication(token): Promise<string>` — shallow auth for payment flows
|
|
55
|
+
- `localize(lng, entity): Promise<Localization | null>` — get localized payment content
|
|
56
|
+
|
|
57
|
+
### Types
|
|
58
|
+
|
|
59
|
+
- `CreateCheckoutBody` — `{ productSku, entitySlug, service, amountMinor?, successUrl?, cancelUrl? }`
|
|
60
|
+
- `CreateCheckoutResponse` — `{ url: string }`
|
|
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`
|
|
64
|
+
- `PlanSubscription` — `{ sku, entityId, createdAt, status, capabilities? }`
|
|
65
|
+
|
|
66
|
+
### Enums
|
|
67
|
+
|
|
68
|
+
- `PlanDuration` — `Monthly`, `Yearly`, `Consumable`, etc.
|
|
69
|
+
- `SubscriptionStatus` — `Active`, `Consumable`, `Canceled`, etc.
|
|
70
|
+
- `ProductType` — product category enum
|
|
71
|
+
- `PaymentEntityType` — entity classification enum
|
|
72
|
+
- `CheckoutPricingMode` — `Amount` or `Quantity`
|
|
73
|
+
|
|
74
|
+
## Related Packages
|
|
75
|
+
|
|
76
|
+
- [`@owlmeans/client-payment`](../client-payment) — client-side wrapper for browser contexts
|
|
8
77
|
|
|
9
78
|
<!-- owlmeans:agent-guidance:start -->
|
|
10
79
|
## Agent guidance
|
|
@@ -14,7 +83,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
14
83
|
your project's skill store (`.agents/skills/`):
|
|
15
84
|
|
|
16
85
|
```sh
|
|
17
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
86
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.17
|
|
18
87
|
```
|
|
19
88
|
|
|
20
89
|
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/payment",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-09-
|
|
4
|
+
"version": "0.1.18-rc.18",
|
|
5
|
+
"generatedAt": "2026-09-12T12:59:24.920Z",
|
|
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 —
|
|
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.
|
|
11
|
+
**Install:** `"@owlmeans/payment": "^0.1.18-rc.18"` 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` |
|
|
25
|
-
| `entrypoints` · `serviceEntrypoints` |
|
|
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. |
|
|
@@ -97,33 +101,48 @@ const granted = entitlementList(capabilities)
|
|
|
97
101
|
|
|
98
102
|
## Checkout
|
|
99
103
|
|
|
100
|
-
Register `
|
|
101
|
-
|
|
102
|
-
throws the reply's error; `invoke` returns the value and 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.
|
|
103
106
|
|
|
104
107
|
```typescript
|
|
105
108
|
import { paymentApi, serviceEntrypoints } from '@owlmeans/payment'
|
|
106
|
-
import
|
|
107
|
-
import { entrypointRef } from '@owlmeans/entrypoint'
|
|
109
|
+
import { bindAll } from '@owlmeans/client-entrypoint'
|
|
108
110
|
|
|
109
|
-
export const appEntrypoints = [...
|
|
111
|
+
export const appEntrypoints = [...bindAll(paymentApi.service)]
|
|
110
112
|
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
)
|
|
114
|
-
const result = await ctx.entrypoint(checkout).call({
|
|
115
|
-
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 }
|
|
116
115
|
})
|
|
117
|
-
window.
|
|
116
|
+
window.location.assign(result.url)
|
|
117
|
+
```
|
|
118
|
+
|
|
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
|
+
|
|
118
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.
|
|
119
136
|
|
|
120
|
-
|
|
121
|
-
|
|
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`.
|
|
122
139
|
|
|
123
140
|
## Two spellings, both registered
|
|
124
141
|
|
|
125
142
|
`entrypoints` declares `/propogate` and `/propagate` as two routes over the same
|
|
126
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.
|
|
127
146
|
`propogate` is marked `@deprecated`, as are the type alias `SubscriptionPropogateBody` and the
|
|
128
147
|
duplicate `SubscriptionPropogateBodySchema`: write every new declaration and every new call against
|
|
129
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
|
package/build/consts.d.ts.map
CHANGED
|
@@ -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,aAAa,mBAAmB;CACjC;AAED,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB;;;OAGG;IACH,UAAU,eAAe;CAC1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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
|
package/build/consts.js.map
CHANGED
|
@@ -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,IAAY,YAUX;AAVD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;IACjB,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AI,EAAE,QAAQ;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;CAClC,CAAA;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAuC;IAC1E,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC;CACxC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG;CAC7C,CAAA;AAED,MAAM,CAAC,MAAM,wBAAwB,GAA2B;IAC9D,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI;CAC9D,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAA2B;IAC3D,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC;CAC3C,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAA;AAC5C,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAA;AAExD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAA;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"}
|
package/build/entrypoints.d.ts
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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[];
|
|
7
31
|
//# sourceMappingURL=entrypoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"
|
|
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"}
|
package/build/entrypoints.js
CHANGED
|
@@ -1,18 +1,48 @@
|
|
|
1
|
-
import { contract,
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
package/build/entrypoints.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"A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AE,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
package/build/index.d.ts.map
CHANGED
|
@@ -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"}
|
|
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
package/build/index.js.map
CHANGED
|
@@ -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"}
|
|
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:
|
|
4
|
-
export declare const CreateCheckoutResponseSchema:
|
|
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":"
|
|
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"}
|
package/build/model/checkout.js
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { ResourceValueSchema, EntityValueSchema, IdValueSchema } from '@owlmeans/auth';
|
|
2
|
-
|
|
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
|
-
|
|
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', '
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../src/model/checkout.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"checkout.js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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA"}
|
package/build/model/index.js
CHANGED
package/build/model/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/model/plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/model/plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAS9C,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,WAAW,CA4CzD,CAAA"}
|
package/build/model/plan.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ResourceValueSchema, PermissionSetSchema, DateSchema } from '@owlmeans/auth';
|
|
2
|
-
import { PlanDurationSchema, ProductDescriptionSchema, ProductTitleSchema, SubscriptionStatusSchema } from '../consts.js';
|
|
2
|
+
import { CheckoutPricingModeSchema, PlanDurationSchema, ProductDescriptionSchema, ProductTitleSchema, SubscriptionStatusSchema } from '../consts.js';
|
|
3
3
|
import { LimitConfigSchema } from './utils.js';
|
|
4
|
+
import { AmountCheckoutPolicySchema, QuantityCheckoutPolicySchema } from './pricing.js';
|
|
4
5
|
export const ProductPlanSchema = {
|
|
5
6
|
type: 'object',
|
|
6
7
|
properties: {
|
|
@@ -33,6 +34,9 @@ export const ProductPlanSchema = {
|
|
|
33
34
|
type: 'object', required: [], nullable: true,
|
|
34
35
|
additionalProperties: LimitConfigSchema
|
|
35
36
|
},
|
|
37
|
+
pricingMode: { ...CheckoutPricingModeSchema, nullable: true },
|
|
38
|
+
amountPolicy: { ...AmountCheckoutPolicySchema, nullable: true },
|
|
39
|
+
quantityPolicy: { ...QuantityCheckoutPolicySchema, nullable: true },
|
|
36
40
|
},
|
|
37
41
|
required: [
|
|
38
42
|
'productSku', 'sku', 'status', 'duration',
|
package/build/model/plan.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/model/plan.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,U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,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC/D,cAAc,EAAE,EAAE,GAAG,4BAA4B,EAAE,QAAQ,EAAE,IAAI,EAAE;KACpE;IACD,QAAQ,EAAE;QACR,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU;QACzC,OAAO,EAAE,OAAO;KACjB;IACD,oBAAoB,EAAE,KAAK;CAC5B,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AmountCheckoutPolicy, QuantityCheckoutPolicy } from '../types.js';
|
|
2
|
+
export declare const AmountCheckoutPolicySchema: import("@owlmeans/entrypoint").EntrypointSchema<AmountCheckoutPolicy>;
|
|
3
|
+
export declare const QuantityCheckoutPolicySchema: import("@owlmeans/entrypoint").EntrypointSchema<QuantityCheckoutPolicy>;
|
|
4
|
+
//# sourceMappingURL=pricing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../../src/model/pricing.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAE/E,eAAO,MAAM,0BAA0B,uEAkBG,CAAA;AAE1C,eAAO,MAAM,4BAA4B,yEASG,CAAA"}
|