@owlmeans/payment 0.1.18-rc.17 → 0.1.18-rc.19
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 +1 -1
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/payment/SKILL.md +11 -16
- package/build/entrypoints.d.ts +0 -6
- package/build/entrypoints.d.ts.map +1 -1
- package/build/entrypoints.js +1 -6
- package/build/entrypoints.js.map +1 -1
- package/package.json +11 -11
- package/src/entrypoints.ts +1 -10
- package/tests/protocol.spec.ts +8 -3
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
83
83
|
your project's skill store (`.agents/skills/`):
|
|
84
84
|
|
|
85
85
|
```sh
|
|
86
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
86
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.18
|
|
87
87
|
```
|
|
88
88
|
|
|
89
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.19",
|
|
5
|
+
"generatedAt": "2026-09-12T13:35:38.919Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -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.19"` 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
|
|
@@ -22,7 +22,6 @@ talks to no paygate — a server-side integration implements against these, and
|
|
|
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
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
25
|
| `CheckoutPricingMode` | `Amount` for a caller-selected net monetary value; `Quantity` for reusable unit prices. |
|
|
27
26
|
| `AmountCheckoutPolicy` / `QuantityCheckoutPolicy` (+ schemas) | Configured bounds/default/presets and adjustment, or quantity bounds/default. |
|
|
28
27
|
| `assertAmountCheckoutPolicy` / `assertQuantityCheckoutPolicy` / `assertCheckoutAmount` | Startup and request-boundary validation. |
|
|
@@ -101,11 +100,12 @@ const granted = entitlementList(capabilities)
|
|
|
101
100
|
|
|
102
101
|
## Checkout
|
|
103
102
|
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
Bind `paymentApi.service` directly in both client and server layers. Call the protocol object; its
|
|
104
|
+
body and response are inferred without a consumer generic. `protocols(paymentApi.service)` is only
|
|
105
|
+
for framework materialization, never a public compatibility export.
|
|
106
106
|
|
|
107
107
|
```typescript
|
|
108
|
-
import { paymentApi
|
|
108
|
+
import { paymentApi } from '@owlmeans/payment'
|
|
109
109
|
import { bindAll } from '@owlmeans/client-entrypoint'
|
|
110
110
|
|
|
111
111
|
export const appEntrypoints = [...bindAll(paymentApi.service)]
|
|
@@ -137,17 +137,12 @@ to `amountMinor`, not the adjusted checkout subtotal or Stripe tax-inclusive tot
|
|
|
137
137
|
Quantity checkout remains supported. It uses its reusable unit price and quantity policy; do not
|
|
138
138
|
infer a pricing mode from the presence of `amountMinor`.
|
|
139
139
|
|
|
140
|
-
##
|
|
141
|
-
|
|
142
|
-
`
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
`propogate` is marked `@deprecated`, as are the type alias `SubscriptionPropogateBody` and the
|
|
147
|
-
duplicate `SubscriptionPropogateBodySchema`: write every new declaration and every new call against
|
|
148
|
-
`propagate` / `SubscriptionPropagateBody` / `SubscriptionPropagateBodySchema`. The misspelled route
|
|
149
|
-
stays registered as long as anything might call it — dropping it is a breaking change on a wire
|
|
150
|
-
nobody controls both ends of.
|
|
140
|
+
## One propagation protocol
|
|
141
|
+
|
|
142
|
+
`paymentApi.subscription.propagate` is the one subscription propagation route. Its body carries the
|
|
143
|
+
organization as `entitySlug`; `entityId` belongs only to stored `PlanSubscription` records and
|
|
144
|
+
in-process services. Do not add misspelled aliases or flattened declaration lists as compatibility
|
|
145
|
+
surfaces: a consumer imports and binds the named protocol from the immutable tree.
|
|
151
146
|
|
|
152
147
|
## `shallowAuthentication` identifies, it does not authorize
|
|
153
148
|
|
package/build/entrypoints.d.ts
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
export declare const paymentApi: {
|
|
3
3
|
readonly subscription: {
|
|
4
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
5
|
readonly propagate: import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
10
6
|
body: import("./types.js").SubscriptionPropagateBody;
|
|
11
7
|
}, undefined>;
|
|
@@ -26,6 +22,4 @@ export declare const paymentApi: {
|
|
|
26
22
|
};
|
|
27
23
|
};
|
|
28
24
|
};
|
|
29
|
-
export declare const entrypoints: import("@owlmeans/entrypoint").EntrypointProtocolDeclaration[];
|
|
30
|
-
export declare const serviceEntrypoints: import("@owlmeans/entrypoint").EntrypointProtocolDeclaration[];
|
|
31
25
|
//# 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":"AA+BA,uFAAuF;AACvF,eAAO,MAAM,UAAU;aACrB,YAAY;iBACV,IAAI;iBACJ,SAAS;;;;aAKX,OAAO;iBACL,IAAI;iBACJ,QAAQ;qBACN,IAAI;qBACJ,OAAO;yBACL,IAAI;yBACJ,QAAQ;6BACN,IAAI;6BACJ,MAAM;;;;;;;CAQN,CAAA"}
|
package/build/entrypoints.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { contract, protocol,
|
|
1
|
+
import { contract, protocol, typed } from '@owlmeans/entrypoint';
|
|
2
2
|
import { route, backend, RouteMethod } from '@owlmeans/route';
|
|
3
3
|
import { SubscriptionPropagateBodySchema } from './model/subscription.js';
|
|
4
4
|
import { CreateCheckoutBodySchema, CreateCheckoutResponseSchema } from './model/checkout.js';
|
|
5
5
|
const aliases = {
|
|
6
6
|
subscription: {
|
|
7
7
|
base: 'payment-api:subscription',
|
|
8
|
-
typo: 'payment-api:subscription:propogate',
|
|
9
8
|
propagate: 'payment-api:subscription:propagate',
|
|
10
9
|
},
|
|
11
10
|
service: {
|
|
@@ -25,8 +24,6 @@ const externalBase = protocol(route(aliases.service.external, '/external', backe
|
|
|
25
24
|
export const paymentApi = {
|
|
26
25
|
subscription: {
|
|
27
26
|
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
27
|
propagate: protocol(route(aliases.subscription.propagate, '/propagate', backend({ parent: subscriptionBase, method: RouteMethod.POST })), contract.request({ body: SubscriptionPropagateBodySchema }, typed())),
|
|
31
28
|
},
|
|
32
29
|
service: {
|
|
@@ -43,6 +40,4 @@ export const paymentApi = {
|
|
|
43
40
|
},
|
|
44
41
|
},
|
|
45
42
|
};
|
|
46
|
-
export const entrypoints = protocols(paymentApi.subscription);
|
|
47
|
-
export const serviceEntrypoints = protocols(paymentApi.service);
|
|
48
43
|
//# sourceMappingURL=entrypoints.js.map
|
package/build/entrypoints.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7D,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAA;AACzE,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AAE5F,MAAM,OAAO,GAAG;IACd,YAAY,EAAE;QACZ,IAAI,EAAE,0BAA0B;QAChC,SAAS,EAAE,oCAAoC;KAChD;IACD,OAAO,EAAE;QACP,IAAI,EAAE,sBAAsB;QAC5B,QAAQ,EAAE,0BAA0B;QACpC,OAAO,EAAE,kCAAkC;QAC3C,QAAQ,EAAE,2CAA2C;QACrD,MAAM,EAAE,kDAAkD;KAC3D;CACO,CAAA;AAEV,MAAM,gBAAgB,GAAG,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,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/payment",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.19",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"ajv": "*"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@owlmeans/api-config": "^0.1.18-rc.
|
|
36
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
37
|
-
"@owlmeans/basic-envelope": "^0.1.18-rc.
|
|
38
|
-
"@owlmeans/config": "^0.1.18-rc.
|
|
39
|
-
"@owlmeans/context": "^0.1.18-rc.
|
|
40
|
-
"@owlmeans/error": "^0.1.18-rc.
|
|
41
|
-
"@owlmeans/i18n": "^0.1.18-rc.
|
|
42
|
-
"@owlmeans/entrypoint": "^0.1.18-rc.
|
|
43
|
-
"@owlmeans/resource": "^0.1.18-rc.
|
|
44
|
-
"@owlmeans/route": "^0.1.18-rc.
|
|
35
|
+
"@owlmeans/api-config": "^0.1.18-rc.18",
|
|
36
|
+
"@owlmeans/auth": "^0.1.18-rc.15",
|
|
37
|
+
"@owlmeans/basic-envelope": "^0.1.18-rc.18",
|
|
38
|
+
"@owlmeans/config": "^0.1.18-rc.18",
|
|
39
|
+
"@owlmeans/context": "^0.1.18-rc.14",
|
|
40
|
+
"@owlmeans/error": "^0.1.18-rc.14",
|
|
41
|
+
"@owlmeans/i18n": "^0.1.18-rc.14",
|
|
42
|
+
"@owlmeans/entrypoint": "^0.1.18-rc.17",
|
|
43
|
+
"@owlmeans/resource": "^0.1.18-rc.15",
|
|
44
|
+
"@owlmeans/route": "^0.1.18-rc.15"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@owlmeans/dep-config": "workspace:*",
|
package/src/entrypoints.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { contract, protocol,
|
|
1
|
+
import { contract, protocol, typed } from '@owlmeans/entrypoint'
|
|
2
2
|
import { route, backend, RouteMethod } from '@owlmeans/route'
|
|
3
3
|
import { SubscriptionPropagateBodySchema } from './model/subscription.js'
|
|
4
4
|
import { CreateCheckoutBodySchema, CreateCheckoutResponseSchema } from './model/checkout.js'
|
|
@@ -6,7 +6,6 @@ import { CreateCheckoutBodySchema, CreateCheckoutResponseSchema } from './model/
|
|
|
6
6
|
const aliases = {
|
|
7
7
|
subscription: {
|
|
8
8
|
base: 'payment-api:subscription',
|
|
9
|
-
typo: 'payment-api:subscription:propogate',
|
|
10
9
|
propagate: 'payment-api:subscription:propagate',
|
|
11
10
|
},
|
|
12
11
|
service: {
|
|
@@ -34,11 +33,6 @@ const externalBase = protocol(
|
|
|
34
33
|
export const paymentApi = {
|
|
35
34
|
subscription: {
|
|
36
35
|
base: subscriptionBase,
|
|
37
|
-
/** @deprecated Use propagate instead. */
|
|
38
|
-
propogate: protocol(
|
|
39
|
-
route(aliases.subscription.typo, '/propogate', backend({ parent: subscriptionBase, method: RouteMethod.POST })),
|
|
40
|
-
contract.request({ body: SubscriptionPropagateBodySchema }, typed<undefined>()),
|
|
41
|
-
),
|
|
42
36
|
propagate: protocol(
|
|
43
37
|
route(aliases.subscription.propagate, '/propagate', backend({ parent: subscriptionBase, method: RouteMethod.POST })),
|
|
44
38
|
contract.request({ body: SubscriptionPropagateBodySchema }, typed<undefined>()),
|
|
@@ -61,6 +55,3 @@ export const paymentApi = {
|
|
|
61
55
|
},
|
|
62
56
|
},
|
|
63
57
|
} as const
|
|
64
|
-
|
|
65
|
-
export const entrypoints = protocols(paymentApi.subscription)
|
|
66
|
-
export const serviceEntrypoints = protocols(paymentApi.service)
|
package/tests/protocol.spec.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { describe, expect, test } from 'bun:test'
|
|
2
2
|
import Ajv from 'ajv'
|
|
3
|
+
import { protocols } from '@owlmeans/entrypoint'
|
|
3
4
|
import type { RequestOf, ResponseOf } from '@owlmeans/entrypoint'
|
|
4
|
-
import
|
|
5
|
+
import * as payment from '../src/index.js'
|
|
6
|
+
import { paymentApi } from '../src/index.js'
|
|
5
7
|
|
|
6
8
|
const checkout = paymentApi.service.checkout.session.external.create
|
|
7
9
|
|
|
@@ -19,8 +21,10 @@ describe('payment checkout protocol', () => {
|
|
|
19
21
|
|
|
20
22
|
test('exposes protocol declarations, never flattened string aliases', () => {
|
|
21
23
|
expect(Object.isFrozen(checkout)).toBe(true)
|
|
22
|
-
expect(
|
|
23
|
-
expect(
|
|
24
|
+
expect(protocols(paymentApi.service)).toContain(checkout)
|
|
25
|
+
expect(protocols(paymentApi.service).every(entry => entry.kind === 'entrypoint-protocol')).toBe(true)
|
|
26
|
+
expect(payment).not.toHaveProperty('serviceEntrypoints')
|
|
27
|
+
expect(payment).not.toHaveProperty('entrypoints')
|
|
24
28
|
})
|
|
25
29
|
|
|
26
30
|
test('rejects an internal entity id and fractional minor units on the wire', () => {
|
|
@@ -42,5 +46,6 @@ describe('payment checkout protocol', () => {
|
|
|
42
46
|
|
|
43
47
|
expect(validate(body)).toBe(true)
|
|
44
48
|
expect(validate({ ...body, entitySlug: undefined, entityId: 'internal' })).toBe(false)
|
|
49
|
+
expect(paymentApi.subscription).not.toHaveProperty('propogate')
|
|
45
50
|
})
|
|
46
51
|
})
|