@owlmeans/server-payment 0.1.18-rc.3 → 0.1.18-rc.30
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 +146 -25
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/server-payment/SKILL.md +593 -53
- package/build/actions/index.d.ts +1 -0
- package/build/actions/index.d.ts.map +1 -1
- package/build/actions/index.js +1 -0
- package/build/actions/index.js.map +1 -1
- package/build/actions/resync-subscriptions.d.ts +3 -0
- package/build/actions/resync-subscriptions.d.ts.map +1 -0
- package/build/actions/resync-subscriptions.js +6 -0
- package/build/actions/resync-subscriptions.js.map +1 -0
- package/build/actions/resync.d.ts +6 -1
- package/build/actions/resync.d.ts.map +1 -1
- package/build/actions/resync.js +12 -4
- package/build/actions/resync.js.map +1 -1
- package/build/actions/webhook.d.ts +2 -1
- package/build/actions/webhook.d.ts.map +1 -1
- package/build/actions/webhook.js +9 -4
- package/build/actions/webhook.js.map +1 -1
- package/build/config.d.ts +60 -5
- package/build/config.d.ts.map +1 -1
- package/build/config.js +248 -5
- package/build/config.js.map +1 -1
- package/build/consts.d.ts +74 -16
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +86 -23
- package/build/consts.js.map +1 -1
- package/build/consts.local.d.ts +94 -0
- package/build/consts.local.d.ts.map +1 -0
- package/build/consts.local.js +44 -0
- package/build/consts.local.js.map +1 -0
- package/build/consumer/capture.d.ts +61 -0
- package/build/consumer/capture.d.ts.map +1 -0
- package/build/consumer/capture.js +300 -0
- package/build/consumer/capture.js.map +1 -0
- package/build/consumer/consts.local.d.ts +10 -0
- package/build/consumer/consts.local.d.ts.map +1 -0
- package/build/consumer/consts.local.js +11 -0
- package/build/consumer/consts.local.js.map +1 -0
- package/build/consumer/format.d.ts +27 -0
- package/build/consumer/format.d.ts.map +1 -0
- package/build/consumer/format.js +81 -0
- package/build/consumer/format.js.map +1 -0
- package/build/consumer/handlers.d.ts +21 -0
- package/build/consumer/handlers.d.ts.map +1 -0
- package/build/consumer/handlers.js +173 -0
- package/build/consumer/handlers.js.map +1 -0
- package/build/consumer/index.d.ts +7 -0
- package/build/consumer/index.d.ts.map +1 -0
- package/build/consumer/index.js +6 -0
- package/build/consumer/index.js.map +1 -0
- package/build/consumer/mail.d.ts +27 -0
- package/build/consumer/mail.d.ts.map +1 -0
- package/build/consumer/mail.js +314 -0
- package/build/consumer/mail.js.map +1 -0
- package/build/consumer/origin.d.ts +14 -0
- package/build/consumer/origin.d.ts.map +1 -0
- package/build/consumer/origin.js +46 -0
- package/build/consumer/origin.js.map +1 -0
- package/build/consumer/reconcile.d.ts +12 -0
- package/build/consumer/reconcile.d.ts.map +1 -0
- package/build/consumer/reconcile.js +316 -0
- package/build/consumer/reconcile.js.map +1 -0
- package/build/consumer/records.d.ts +108 -0
- package/build/consumer/records.d.ts.map +1 -0
- package/build/consumer/records.js +299 -0
- package/build/consumer/records.js.map +1 -0
- package/build/consumer/service.d.ts +44 -0
- package/build/consumer/service.d.ts.map +1 -0
- package/build/consumer/service.js +771 -0
- package/build/consumer/service.js.map +1 -0
- package/build/consumer/types.d.ts +87 -0
- package/build/consumer/types.d.ts.map +1 -0
- package/build/consumer/types.js +2 -0
- package/build/consumer/types.js.map +1 -0
- package/build/consumer/types.local.d.ts +25 -0
- package/build/consumer/types.local.d.ts.map +1 -0
- package/build/consumer/types.local.js +2 -0
- package/build/consumer/types.local.js.map +1 -0
- package/build/consumer/withdrawal.d.ts +34 -0
- package/build/consumer/withdrawal.d.ts.map +1 -0
- package/build/consumer/withdrawal.js +247 -0
- package/build/consumer/withdrawal.js.map +1 -0
- package/build/entitlement.d.ts +10 -0
- package/build/entitlement.d.ts.map +1 -0
- package/build/entitlement.js +69 -0
- package/build/entitlement.js.map +1 -0
- package/build/entrypoints.d.ts +19 -2
- package/build/entrypoints.d.ts.map +1 -1
- package/build/entrypoints.js +16 -4
- package/build/entrypoints.js.map +1 -1
- package/build/gate.d.ts +20 -6
- package/build/gate.d.ts.map +1 -1
- package/build/gate.js +59 -19
- package/build/gate.js.map +1 -1
- package/build/index.d.ts +20 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +17 -3
- package/build/index.js.map +1 -1
- package/build/limit.d.ts +11 -0
- package/build/limit.d.ts.map +1 -0
- package/build/limit.js +48 -0
- package/build/limit.js.map +1 -0
- package/build/log.d.ts +3 -0
- package/build/log.d.ts.map +1 -0
- package/build/log.js +4 -0
- package/build/log.js.map +1 -0
- package/build/observer.d.ts +9 -0
- package/build/observer.d.ts.map +1 -1
- package/build/observer.js +38 -12
- package/build/observer.js.map +1 -1
- package/build/plan.d.ts +33 -0
- package/build/plan.d.ts.map +1 -0
- package/build/plan.js +101 -0
- package/build/plan.js.map +1 -0
- package/build/plugins/checkout-plugins.d.ts +41 -0
- package/build/plugins/checkout-plugins.d.ts.map +1 -0
- package/build/plugins/checkout-plugins.js +125 -0
- package/build/plugins/checkout-plugins.js.map +1 -0
- package/build/plugins/consts.local.d.ts +13 -0
- package/build/plugins/consts.local.d.ts.map +1 -0
- package/build/plugins/consts.local.js +22 -0
- package/build/plugins/consts.local.js.map +1 -0
- package/build/plugins/estimate.d.ts +18 -0
- package/build/plugins/estimate.d.ts.map +1 -0
- package/build/plugins/estimate.js +278 -0
- package/build/plugins/estimate.js.map +1 -0
- package/build/plugins/events.d.ts +31 -10
- package/build/plugins/events.d.ts.map +1 -1
- package/build/plugins/events.js +625 -136
- package/build/plugins/events.js.map +1 -1
- package/build/plugins/fx.d.ts +28 -0
- package/build/plugins/fx.d.ts.map +1 -0
- package/build/plugins/fx.js +83 -0
- package/build/plugins/fx.js.map +1 -0
- package/build/plugins/portal.d.ts +40 -0
- package/build/plugins/portal.d.ts.map +1 -0
- package/build/plugins/portal.js +278 -0
- package/build/plugins/portal.js.map +1 -0
- package/build/plugins/refunds.d.ts +13 -0
- package/build/plugins/refunds.d.ts.map +1 -0
- package/build/plugins/refunds.js +80 -0
- package/build/plugins/refunds.js.map +1 -0
- package/build/plugins/stripe.d.ts +44 -4
- package/build/plugins/stripe.d.ts.map +1 -1
- package/build/plugins/stripe.js +559 -97
- package/build/plugins/stripe.js.map +1 -1
- package/build/plugins/types.d.ts +82 -0
- package/build/plugins/types.d.ts.map +1 -0
- package/build/plugins/types.js +2 -0
- package/build/plugins/types.js.map +1 -0
- package/build/plugins/types.local.d.ts +76 -0
- package/build/plugins/types.local.d.ts.map +1 -0
- package/build/plugins/types.local.js +2 -0
- package/build/plugins/types.local.js.map +1 -0
- package/build/plugins/webhook-manager.d.ts +54 -0
- package/build/plugins/webhook-manager.d.ts.map +1 -0
- package/build/plugins/webhook-manager.js +242 -0
- package/build/plugins/webhook-manager.js.map +1 -0
- package/build/reconcile.d.ts +15 -0
- package/build/reconcile.d.ts.map +1 -0
- package/build/reconcile.js +89 -0
- package/build/reconcile.js.map +1 -0
- package/build/resource.d.ts +12 -1
- package/build/resource.d.ts.map +1 -1
- package/build/resource.js +98 -6
- package/build/resource.js.map +1 -1
- package/build/schemas.d.ts +15 -0
- package/build/schemas.d.ts.map +1 -0
- package/build/schemas.js +228 -0
- package/build/schemas.js.map +1 -0
- package/build/service.d.ts +42 -3
- package/build/service.d.ts.map +1 -1
- package/build/service.js +193 -19
- package/build/service.js.map +1 -1
- package/build/subscription.d.ts +27 -0
- package/build/subscription.d.ts.map +1 -0
- package/build/subscription.js +179 -0
- package/build/subscription.js.map +1 -0
- package/build/sync.d.ts +28 -1
- package/build/sync.d.ts.map +1 -1
- package/build/sync.js +208 -32
- package/build/sync.js.map +1 -1
- package/build/types.d.ts +1258 -36
- package/build/types.d.ts.map +1 -1
- package/build/types.local.d.ts +27 -0
- package/build/types.local.d.ts.map +1 -0
- package/build/types.local.js +2 -0
- package/build/types.local.js.map +1 -0
- package/build/usage.d.ts +52 -0
- package/build/usage.d.ts.map +1 -0
- package/build/usage.js +373 -0
- package/build/usage.js.map +1 -0
- package/build/utils.d.ts +70 -2
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +105 -7
- package/build/utils.js.map +1 -1
- package/package.json +21 -16
- package/src/actions/index.ts +1 -0
- package/src/actions/resync-subscriptions.ts +9 -0
- package/src/actions/resync.ts +11 -4
- package/src/actions/webhook.ts +8 -4
- package/src/config.ts +268 -9
- package/src/consts.local.ts +62 -0
- package/src/consts.ts +100 -36
- package/src/consumer/capture.ts +335 -0
- package/src/consumer/consts.local.ts +18 -0
- package/src/consumer/format.ts +90 -0
- package/src/consumer/handlers.ts +200 -0
- package/src/consumer/index.ts +6 -0
- package/src/consumer/mail.ts +354 -0
- package/src/consumer/origin.ts +61 -0
- package/src/consumer/reconcile.ts +326 -0
- package/src/consumer/records.ts +357 -0
- package/src/consumer/service.ts +855 -0
- package/src/consumer/types.local.ts +22 -0
- package/src/consumer/types.ts +98 -0
- package/src/consumer/withdrawal.ts +273 -0
- package/src/entitlement.ts +84 -0
- package/src/entrypoints.ts +17 -4
- package/src/gate.ts +72 -26
- package/src/index.ts +27 -3
- package/src/limit.ts +54 -0
- package/src/log.ts +4 -0
- package/src/observer.ts +44 -11
- package/src/plan.ts +124 -0
- package/src/plugins/checkout-plugins.ts +145 -0
- package/src/plugins/consts.local.ts +30 -0
- package/src/plugins/estimate.ts +319 -0
- package/src/plugins/events.ts +674 -121
- package/src/plugins/fx.ts +101 -0
- package/src/plugins/portal.ts +313 -0
- package/src/plugins/refunds.ts +93 -0
- package/src/plugins/stripe.ts +613 -98
- package/src/plugins/types.local.ts +62 -0
- package/src/plugins/types.ts +87 -0
- package/src/plugins/webhook-manager.ts +278 -0
- package/src/reconcile.ts +102 -0
- package/src/resource.ts +145 -7
- package/src/schemas.ts +247 -0
- package/src/service.ts +217 -20
- package/src/subscription.ts +208 -0
- package/src/sync.ts +240 -30
- package/src/types.local.ts +20 -0
- package/src/types.ts +1367 -32
- package/src/usage.ts +443 -0
- package/src/utils.ts +175 -14
- package/tests/checkout-consumer.spec.ts +367 -0
- package/tests/checkout-locks.spec.ts +160 -0
- package/tests/checkout-plugins.spec.ts +164 -0
- package/tests/checkout.spec.ts +204 -91
- package/tests/consumer-events.spec.ts +217 -0
- package/tests/consumer-fixtures.ts +132 -0
- package/tests/consumer-ops.spec.ts +351 -0
- package/tests/consumer-rights.integration.spec.ts +149 -0
- package/tests/consumer-rights.spec.ts +577 -0
- package/tests/context.ts +109 -0
- package/tests/entitlement.spec.ts +139 -0
- package/tests/estimate.spec.ts +274 -0
- package/tests/events.spec.ts +356 -0
- package/tests/fake-stripe.ts +975 -0
- package/tests/gate-handlers.spec.ts +120 -0
- package/tests/gate.spec.ts +62 -72
- package/tests/gateway-options.spec.ts +181 -0
- package/tests/limit-gate.spec.ts +68 -0
- package/tests/portal.spec.ts +200 -0
- package/tests/protocol.spec.ts +17 -3
- package/tests/sync.spec.ts +114 -0
- package/tests/usage.integration.spec.ts +101 -0
- package/tests/usage.spec.ts +171 -0
- package/tests/webhook-manager.spec.ts +152 -0
- package/build/model.d.ts +0 -6
- package/build/model.d.ts.map +0 -1
- package/build/model.js +0 -33
- package/build/model.js.map +0 -1
- package/src/model.ts +0 -37
package/build/actions/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,2BAA2B,CAAA"}
|
package/build/actions/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Re-read every live paygate subscription — the manually or periodically triggered repair. */
|
|
2
|
+
export declare const resyncSubscriptions: import("@owlmeans/server-entrypoint").BoundEntrypointHandler<import("@owlmeans/entrypoint").EntrypointProtocol<{}, import("../types.js").ResyncSubscriptionsResult>>;
|
|
3
|
+
//# sourceMappingURL=resync-subscriptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resync-subscriptions.d.ts","sourceRoot":"","sources":["../../src/actions/resync-subscriptions.ts"],"names":[],"mappings":"AAMA,+FAA+F;AAC/F,eAAO,MAAM,mBAAmB,sKACY,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { handlers } from '@owlmeans/server-api';
|
|
2
|
+
import { paymentGate, gateway } from '../utils.js';
|
|
3
|
+
const bind = handlers();
|
|
4
|
+
/** Re-read every live paygate subscription — the manually or periodically triggered repair. */
|
|
5
|
+
export const resyncSubscriptions = bind.request(paymentGate.resyncSubscriptions, async (_request, context) => await gateway(context).resyncAll(context));
|
|
6
|
+
//# sourceMappingURL=resync-subscriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resync-subscriptions.js","sourceRoot":"","sources":["../../src/actions/resync-subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAGlD,MAAM,IAAI,GAAG,QAAQ,EAAW,CAAA;AAEhC,+FAA+F;AAC/F,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,CAC3G,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Forget every sync fingerprint and bring Stripe back to the declared catalogue, portal and webhook —
|
|
3
|
+
* in any managed process, `bootstrap: false` included: the webhook URL and the rows follow the
|
|
4
|
+
* gateway's `webhookService` and `owner`, so every process of the owner converges on one state.
|
|
5
|
+
*/
|
|
6
|
+
export declare const resync: import("@owlmeans/server-entrypoint").BoundEntrypointHandler<import("@owlmeans/entrypoint").EntrypointProtocol<{}, import("../types.js").ResyncResult>>;
|
|
2
7
|
//# sourceMappingURL=resync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resync.d.ts","sourceRoot":"","sources":["../../src/actions/resync.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"resync.d.ts","sourceRoot":"","sources":["../../src/actions/resync.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,eAAO,MAAM,MAAM,yJAMjB,CAAA"}
|
package/build/actions/resync.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import { PaygateError } from '@owlmeans/payment';
|
|
1
2
|
import { handlers } from '@owlmeans/server-api';
|
|
2
|
-
import { paymentGate } from '../
|
|
3
|
-
import {
|
|
4
|
-
import { initialize } from '../sync.js';
|
|
3
|
+
import { paymentGate, fingerprints, gateway } from '../utils.js';
|
|
4
|
+
import { bootstrapStripe } from '../service.js';
|
|
5
5
|
const bind = handlers();
|
|
6
|
+
/**
|
|
7
|
+
* Forget every sync fingerprint and bring Stripe back to the declared catalogue, portal and webhook —
|
|
8
|
+
* in any managed process, `bootstrap: false` included: the webhook URL and the rows follow the
|
|
9
|
+
* gateway's `webhookService` and `owner`, so every process of the owner converges on one state.
|
|
10
|
+
*/
|
|
6
11
|
export const resync = bind.request(paymentGate.resync, async (_request, context) => {
|
|
12
|
+
const service = gateway(context);
|
|
13
|
+
if (!service.managed)
|
|
14
|
+
throw new PaygateError('unmanaged');
|
|
7
15
|
await fingerprints(context).clear();
|
|
8
|
-
await
|
|
16
|
+
await bootstrapStripe(context, await service.stripe(context), { force: true });
|
|
9
17
|
return { ok: true };
|
|
10
18
|
});
|
|
11
19
|
//# sourceMappingURL=resync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resync.js","sourceRoot":"","sources":["../../src/actions/resync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"resync.js","sourceRoot":"","sources":["../../src/actions/resync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAG/C,MAAM,IAAI,GAAG,QAAQ,EAAW,CAAA;AAEhC;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;IACjF,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAChC,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,MAAM,IAAI,YAAY,CAAC,WAAW,CAAC,CAAA;IACzD,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAA;IACnC,MAAM,eAAe,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IAC9E,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAA;AACrB,CAAC,CAAC,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
/** A Stripe delivery — only a managed gateway receives one; its secret is the `owner`'s stored one. */
|
|
1
2
|
export declare const webhook: import("@owlmeans/server-entrypoint").BoundEntrypointHandler<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
2
|
-
params: import("../
|
|
3
|
+
params: import("../types.js").PaygateParams;
|
|
3
4
|
}, undefined>>;
|
|
4
5
|
//# sourceMappingURL=webhook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/actions/webhook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/actions/webhook.ts"],"names":[],"mappings":"AASA,uGAAuG;AACvG,eAAO,MAAM,OAAO;;cAKlB,CAAA"}
|
package/build/actions/webhook.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { UnknownPaygate } from '@owlmeans/payment';
|
|
1
|
+
import { PaygateError, UnknownPaygate } from '@owlmeans/payment';
|
|
2
2
|
import { handlers } from '@owlmeans/server-api';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { STRIPE_PAYGATE_ALIAS } from '../consts.js';
|
|
4
|
+
import { paymentGate, gateway } from '../utils.js';
|
|
5
|
+
import { handleStripeWebhook } from '../plugins/stripe.js';
|
|
5
6
|
const bind = handlers();
|
|
7
|
+
/** A Stripe delivery — only a managed gateway receives one; its secret is the `owner`'s stored one. */
|
|
6
8
|
export const webhook = bind.params(paymentGate.webhook, async ({ paygate }, context, request) => {
|
|
7
9
|
if (paygate !== STRIPE_PAYGATE_ALIAS)
|
|
8
10
|
throw new UnknownPaygate(paygate);
|
|
9
|
-
|
|
11
|
+
const service = gateway(context);
|
|
12
|
+
if (!service.managed)
|
|
13
|
+
throw new PaygateError('unmanaged');
|
|
14
|
+
await handleStripeWebhook(context, await service.stripe(context), request);
|
|
10
15
|
});
|
|
11
16
|
//# sourceMappingURL=webhook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/actions/webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/actions/webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAG1D,MAAM,IAAI,GAAG,QAAQ,EAAW,CAAA;AAEhC,uGAAuG;AACvG,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IAC9F,IAAI,OAAO,KAAK,oBAAoB;QAAE,MAAM,IAAI,cAAc,CAAC,OAAO,CAAC,CAAA;IACvE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAChC,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,MAAM,IAAI,YAAY,CAAC,WAAW,CAAC,CAAA;IACzD,MAAM,mBAAmB,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAA;AAC5E,CAAC,CAAC,CAAA"}
|
package/build/config.d.ts
CHANGED
|
@@ -1,8 +1,63 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ConsumerRightsPolicy } from '@owlmeans/payment';
|
|
2
|
+
import type { Config, ConsumerRightsDef, PaymentPlan, PaymentPlanDef, PaymentProductDef, PortalBrandingDef, PricingDef, StripeSecretsDef } from './types.js';
|
|
2
3
|
export declare const declarePaymentProduct: (cfg: Config, def: PaymentProductDef) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Declare a plan into the configuration catalogue.
|
|
6
|
+
*
|
|
7
|
+
* Validated before anything is pushed: `rank` a safe integer `>= 0`; a `free` plan costs nothing
|
|
8
|
+
* and is sold through no gateway; no capability set under the reserved `limit` scope; every limit
|
|
9
|
+
* well-formed (a `window` limit names its window, the others do not, the ceiling is a safe
|
|
10
|
+
* integer, a promo ends at a real `Date`). Amount and quantity policies are asserted as before.
|
|
11
|
+
*/
|
|
3
12
|
export declare const declarePaymentPlan: (cfg: Config, def: PaymentPlanDef) => void;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
13
|
+
/** Every plan declared into a configuration. */
|
|
14
|
+
export declare const declaredPlansOf: (cfg: Config) => PaymentPlan[];
|
|
15
|
+
/**
|
|
16
|
+
* Cross-plan rules a single declaration cannot see:
|
|
17
|
+
*
|
|
18
|
+
* - at most one free plan per rank;
|
|
19
|
+
* - no two paid plans of one product at the same rank (one-time `consumable` plans are never an
|
|
20
|
+
* entity's plan and are not ranked against each other).
|
|
21
|
+
*
|
|
22
|
+
* A limit key MAY change kind between plans (lifetime on one, a monthly window on another): counters
|
|
23
|
+
* are keyed by `(entity, key, window)` and the window is derived from the kind, so each kind keeps its
|
|
24
|
+
* own counter and a lifetime count still sticks to the entity across plan changes.
|
|
25
|
+
*
|
|
26
|
+
* @throws PlanRankConflict
|
|
27
|
+
*/
|
|
28
|
+
export declare const assertPlanDeclarations: (cfg: Config) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Where the Stripe secrets live. A value that looks like a path is read into the configuration at
|
|
31
|
+
* boot. The webhook secret is an optional override of the one the managed endpoint stores.
|
|
32
|
+
*/
|
|
33
|
+
export declare const stripeSecrets: (cfg: Config, paths: StripeSecretsDef) => void;
|
|
34
|
+
/** Branding and the default return URL of the managed customer portal configuration. */
|
|
35
|
+
export declare const portalBranding: (cfg: Config, def: PortalBrandingDef) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Declare the pricing policy: whether checkout collects tax and a VAT/GST id, what `tax_behavior`
|
|
38
|
+
* synced prices are given, Adaptive Pricing, and whether the estimate endpoints are served. A
|
|
39
|
+
* config never carries more than one — a second call replaces the first, so re-declaring (a test, a
|
|
40
|
+
* config module re-run) is safe rather than silently ignored (a config resource resolves an id to
|
|
41
|
+
* its FIRST match).
|
|
42
|
+
*
|
|
43
|
+
* `def.stripe` (the FX Quotes preview version, the unspecified-price migration switch) is
|
|
44
|
+
* Stripe-only and goes to a backend plugin, never the advertised `PricingPolicy` record.
|
|
45
|
+
*
|
|
46
|
+
* @throws PaymentError (`assertPricingPolicy`) when an estimate is declared without the tax or
|
|
47
|
+
* currency capability it requires.
|
|
48
|
+
*/
|
|
49
|
+
export declare const declarePaymentPricing: (cfg: Config, def: PricingDef) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Declare the consumer-rights policy (EU withdrawal, spend consent, start requests, cancellation,
|
|
52
|
+
* country lock) — a singleton config record like the pricing policy: `DEFAULT_CONSUMER_RIGHTS`
|
|
53
|
+
* filled in, asserted, and replacing any earlier declaration. It is ADVERTISED to the browser; the
|
|
54
|
+
* `mail` options (mailer alias, sender, archive copies) go to a backend-only plugin config.
|
|
55
|
+
*
|
|
56
|
+
* `trader` (who the consumer contracts with: `name` for the statements, `legalName`/`address`/`email`
|
|
57
|
+
* for the mails and the withdrawal information) is backend-only as well.
|
|
58
|
+
*
|
|
59
|
+
* @throws ConsumerRightsError (`policy:<field>`) — see `assertConsumerRightsPolicy`; `policy:trader`
|
|
60
|
+
* when a mechanism is on and no trader `name` and `legalName` are declared.
|
|
61
|
+
*/
|
|
62
|
+
export declare const declareConsumerRights: (cfg: Config, def: ConsumerRightsDef) => ConsumerRightsPolicy;
|
|
8
63
|
//# sourceMappingURL=config.d.ts.map
|
package/build/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkd,KAAK,oBAAoB,EAAuD,MAAM,mBAAmB,CAAA;AAKlkB,OAAO,KAAK,EACV,MAAM,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAkB,iBAAiB,EAAE,iBAAiB,EAC5G,UAAU,EAAE,gBAAgB,EAC7B,MAAM,YAAY,CAAA;AAGnB,eAAO,MAAM,qBAAqB,QAAS,MAAM,OAAO,iBAAiB,KAAG,IAS3E,CAAA;AA4BD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,QAAS,MAAM,OAAO,cAAc,KAAG,IA+CrE,CAAA;AA8CD,gDAAgD;AAChD,eAAO,MAAM,eAAe,QAAS,MAAM,KAAG,WAAW,EACiD,CAAA;AAE1G;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,QAAS,MAAM,KAAG,IAmBpD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAS,MAAM,SAAS,gBAAgB,KAAG,IAIpE,CAAA;AAED,wFAAwF;AACxF,eAAO,MAAM,cAAc,QAAS,MAAM,OAAO,iBAAiB,KAAG,IAOpE,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,QAAS,MAAM,OAAO,UAAU,KAAG,IAqCpE,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,QAAS,MAAM,OAAO,iBAAiB,KAAG,oBAsC3E,CAAA"}
|
package/build/config.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { toConfigRecord } from '@owlmeans/server-app';
|
|
2
|
-
import { plugin } from '@owlmeans/config';
|
|
3
|
-
import { assertAmountCheckoutPolicy, assertQuantityCheckoutPolicy, CheckoutPricingMode, PLAN_RECORD_PREFIX, PLAN_RECORD_TYPE, PlanStatus, PRODUCT_RECORD_PREFIX, PRODUCT_RECORD_TYPE, } from '@owlmeans/payment';
|
|
4
|
-
import { STRIPE_PAYGATE_ALIAS, STRIPE_PLUGIN_CONFIG } from './consts.js';
|
|
2
|
+
import { plugin, PLUGIN_RECORD } from '@owlmeans/config';
|
|
3
|
+
import { assertAmountCheckoutPolicy, assertPricingPolicy, assertQuantityCheckoutPolicy, CAPABILITY_LIMIT_SCOPE, CheckoutPricingMode, CONSUMER_RIGHTS_RECORD_ID, CONSUMER_RIGHTS_RECORD_TYPE, ConsumerRightsError, LimitKind, LimitMisdeclared, makeConsumerRightsPolicy, PLAN_RECORD_PREFIX, PLAN_RECORD_TYPE, PaymentError, PlanDuration, PlanRankConflict, PlanStatus, PRICING_POLICY_RECORD_ID, PRICING_POLICY_RECORD_TYPE, PRODUCT_RECORD_PREFIX, PRODUCT_RECORD_TYPE, ProductError } from '@owlmeans/payment';
|
|
4
|
+
import { CONSUMER_RIGHTS_MAIL_PLUGIN_CONFIG, STRIPE_PAYGATE_ALIAS, STRIPE_PLUGIN_CONFIG, STRIPE_PORTAL_PLUGIN_CONFIG, STRIPE_PRICING_PLUGIN_CONFIG, } from './consts.js';
|
|
5
|
+
import { CURRENCY, LIMIT_KINDS, LIMIT_WINDOWS } from './consts.local.js';
|
|
5
6
|
export const declarePaymentProduct = (cfg, def) => {
|
|
6
7
|
cfg.records = cfg.records ?? [];
|
|
7
8
|
const product = {
|
|
@@ -12,8 +13,50 @@ export const declarePaymentProduct = (cfg, def) => {
|
|
|
12
13
|
};
|
|
13
14
|
cfg.records.push({ ...toConfigRecord(product), recordType: PRODUCT_RECORD_TYPE, id: `${PRODUCT_RECORD_PREFIX}:${def.sku}` });
|
|
14
15
|
};
|
|
16
|
+
const isSafeCount = (value) => typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;
|
|
17
|
+
const assertLimitDeclaration = (key, limit) => {
|
|
18
|
+
if (!LIMIT_KINDS.includes(limit.kind)) {
|
|
19
|
+
throw new LimitMisdeclared(`${key}:kind`);
|
|
20
|
+
}
|
|
21
|
+
if (limit.kind === LimitKind.Window) {
|
|
22
|
+
if (limit.window == null) {
|
|
23
|
+
throw new LimitMisdeclared(`${key}:window-missing`);
|
|
24
|
+
}
|
|
25
|
+
if (!LIMIT_WINDOWS.includes(limit.window)) {
|
|
26
|
+
throw new LimitMisdeclared(`${key}:window`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else if (limit.window != null) {
|
|
30
|
+
throw new LimitMisdeclared(`${key}:window-forbidden`);
|
|
31
|
+
}
|
|
32
|
+
if (!isSafeCount(limit.limit)) {
|
|
33
|
+
throw new LimitMisdeclared(`${key}:limit`);
|
|
34
|
+
}
|
|
35
|
+
if (limit.promo != null && !(limit.promo.until instanceof Date && !Number.isNaN(limit.promo.until.getTime()))) {
|
|
36
|
+
throw new LimitMisdeclared(`${key}:promo-until`);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Declare a plan into the configuration catalogue.
|
|
41
|
+
*
|
|
42
|
+
* Validated before anything is pushed: `rank` a safe integer `>= 0`; a `free` plan costs nothing
|
|
43
|
+
* and is sold through no gateway; no capability set under the reserved `limit` scope; every limit
|
|
44
|
+
* well-formed (a `window` limit names its window, the others do not, the ceiling is a safe
|
|
45
|
+
* integer, a promo ends at a real `Date`). Amount and quantity policies are asserted as before.
|
|
46
|
+
*/
|
|
15
47
|
export const declarePaymentPlan = (cfg, def) => {
|
|
16
|
-
|
|
48
|
+
if (def.rank != null && !isSafeCount(def.rank)) {
|
|
49
|
+
throw new PlanRankConflict(`rank:${def.sku}`);
|
|
50
|
+
}
|
|
51
|
+
if (def.free === true && (def.price !== 0 || (def.gateways ?? []).length > 0)) {
|
|
52
|
+
throw new PlanRankConflict(`free:${def.sku}`);
|
|
53
|
+
}
|
|
54
|
+
if ((def.capabilities ?? []).some(set => set.scope === CAPABILITY_LIMIT_SCOPE)) {
|
|
55
|
+
throw new LimitMisdeclared(`${def.sku}:reserved-scope`);
|
|
56
|
+
}
|
|
57
|
+
for (const [key, limit] of Object.entries(def.limits ?? {})) {
|
|
58
|
+
assertLimitDeclaration(key, limit);
|
|
59
|
+
}
|
|
17
60
|
const pricingMode = def.pricingMode;
|
|
18
61
|
if (pricingMode === CheckoutPricingMode.Amount) {
|
|
19
62
|
if (def.amountPolicy == null)
|
|
@@ -29,18 +72,218 @@ export const declarePaymentPlan = (cfg, def) => {
|
|
|
29
72
|
: undefined);
|
|
30
73
|
if (quantityPolicy != null)
|
|
31
74
|
assertQuantityCheckoutPolicy(quantityPolicy);
|
|
75
|
+
const currencyPrices = currencyPricesOf(def);
|
|
76
|
+
assertWithdrawalComponents(def);
|
|
77
|
+
cfg.records = cfg.records ?? [];
|
|
32
78
|
const plan = {
|
|
33
79
|
productSku: def.productSku, sku: def.sku, status: PlanStatus.Active,
|
|
80
|
+
...(def.rank != null ? { rank: def.rank } : {}),
|
|
81
|
+
...(def.free === true ? { free: true, gateways: [] } : def.gateways != null ? { gateways: def.gateways } : {}),
|
|
34
82
|
duration: def.duration, price: def.price, currency: def.currency ?? def.amountPolicy?.currency ?? 'usd',
|
|
35
83
|
order: def.order ?? 0, title: def.title ?? def.sku, capabilities: def.capabilities,
|
|
36
84
|
limits: def.limits, recurring: def.recurring, pricingMode, amountPolicy: def.amountPolicy,
|
|
37
85
|
quantityPolicy,
|
|
38
86
|
minQuantity: quantityPolicy?.minimum, maxQuantity: quantityPolicy?.maximum,
|
|
39
87
|
defaultQuantity: quantityPolicy?.default,
|
|
88
|
+
...(currencyPrices != null ? { currencyPrices } : {}),
|
|
89
|
+
...(def.withdrawal != null ? { withdrawal: { components: def.withdrawal.components.map(item => ({ ...item })) } } : {}),
|
|
40
90
|
};
|
|
41
91
|
cfg.records.push({ ...toConfigRecord(plan), recordType: PLAN_RECORD_TYPE, id: `${PLAN_RECORD_PREFIX}:${def.sku}` });
|
|
42
92
|
};
|
|
93
|
+
/** `currencyPrices` normalized to lowercase codes; each a positive amount of whole minor units. */
|
|
94
|
+
const currencyPricesOf = (def) => {
|
|
95
|
+
if (def.currencyPrices == null) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
if (def.pricingMode === CheckoutPricingMode.Amount || def.free === true) {
|
|
99
|
+
throw new ProductError(`currency-prices:${def.sku}:mode`);
|
|
100
|
+
}
|
|
101
|
+
const prices = {};
|
|
102
|
+
for (const [raw, amount] of Object.entries(def.currencyPrices)) {
|
|
103
|
+
const currency = raw.toLowerCase();
|
|
104
|
+
const minor = Math.round(amount * 100);
|
|
105
|
+
if (!CURRENCY.test(currency) || !Number.isFinite(amount) || amount <= 0 || !Number.isSafeInteger(minor)
|
|
106
|
+
|| Math.abs(minor - amount * 100) > 1e-6 || prices[currency] != null) {
|
|
107
|
+
throw new ProductError(`currency-prices:${def.sku}:${raw}`);
|
|
108
|
+
}
|
|
109
|
+
prices[currency] = amount;
|
|
110
|
+
}
|
|
111
|
+
return prices;
|
|
112
|
+
};
|
|
113
|
+
/** The components' shares must add up to the plan's price in minor units. */
|
|
114
|
+
const assertWithdrawalComponents = (def) => {
|
|
115
|
+
const components = def.withdrawal?.components;
|
|
116
|
+
if (components == null) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const keys = new Set();
|
|
120
|
+
let sum = 0;
|
|
121
|
+
for (const component of components) {
|
|
122
|
+
if (typeof component.key !== 'string' || component.key === '' || keys.has(component.key)
|
|
123
|
+
|| (component.basis !== 'time' && component.basis !== 'units')
|
|
124
|
+
|| !Number.isSafeInteger(component.shareMinor) || component.shareMinor < 0) {
|
|
125
|
+
throw new ProductError(`withdrawal:${def.sku}:component`);
|
|
126
|
+
}
|
|
127
|
+
keys.add(component.key);
|
|
128
|
+
sum += component.shareMinor;
|
|
129
|
+
}
|
|
130
|
+
if (components.length === 0 || sum !== Math.round(def.price * 100)) {
|
|
131
|
+
throw new ProductError(`withdrawal:${def.sku}:shares`);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
/** Every plan declared into a configuration. */
|
|
135
|
+
export const declaredPlansOf = (cfg) => (cfg.records ?? []).filter(record => record.recordType === PLAN_RECORD_TYPE);
|
|
136
|
+
/**
|
|
137
|
+
* Cross-plan rules a single declaration cannot see:
|
|
138
|
+
*
|
|
139
|
+
* - at most one free plan per rank;
|
|
140
|
+
* - no two paid plans of one product at the same rank (one-time `consumable` plans are never an
|
|
141
|
+
* entity's plan and are not ranked against each other).
|
|
142
|
+
*
|
|
143
|
+
* A limit key MAY change kind between plans (lifetime on one, a monthly window on another): counters
|
|
144
|
+
* are keyed by `(entity, key, window)` and the window is derived from the kind, so each kind keeps its
|
|
145
|
+
* own counter and a lifetime count still sticks to the entity across plan changes.
|
|
146
|
+
*
|
|
147
|
+
* @throws PlanRankConflict
|
|
148
|
+
*/
|
|
149
|
+
export const assertPlanDeclarations = (cfg) => {
|
|
150
|
+
const plans = declaredPlansOf(cfg);
|
|
151
|
+
const freeRanks = new Set();
|
|
152
|
+
const paidRanks = new Set();
|
|
153
|
+
for (const plan of plans) {
|
|
154
|
+
const rank = plan.rank ?? 0;
|
|
155
|
+
if (plan.free === true) {
|
|
156
|
+
if (freeRanks.has(rank)) {
|
|
157
|
+
throw new PlanRankConflict(`free:${rank}`);
|
|
158
|
+
}
|
|
159
|
+
freeRanks.add(rank);
|
|
160
|
+
}
|
|
161
|
+
else if (plan.duration !== PlanDuration.Consumable) {
|
|
162
|
+
const key = `${plan.productSku}:${rank}`;
|
|
163
|
+
if (paidRanks.has(key)) {
|
|
164
|
+
throw new PlanRankConflict(key);
|
|
165
|
+
}
|
|
166
|
+
paidRanks.add(key);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Where the Stripe secrets live. A value that looks like a path is read into the configuration at
|
|
172
|
+
* boot. The webhook secret is an optional override of the one the managed endpoint stores.
|
|
173
|
+
*/
|
|
43
174
|
export const stripeSecrets = (cfg, paths) => {
|
|
44
|
-
plugin(cfg, {
|
|
175
|
+
plugin(cfg, {
|
|
176
|
+
api: paths.api, ...(paths.webhook != null && paths.webhook !== '' ? { webhook: paths.webhook } : {}),
|
|
177
|
+
}, STRIPE_PLUGIN_CONFIG);
|
|
178
|
+
};
|
|
179
|
+
/** Branding and the default return URL of the managed customer portal configuration. */
|
|
180
|
+
export const portalBranding = (cfg, def) => {
|
|
181
|
+
plugin(cfg, {
|
|
182
|
+
returnUrl: def.returnUrl,
|
|
183
|
+
...(def.headline != null ? { headline: def.headline } : {}),
|
|
184
|
+
...(def.privacyPolicyUrl != null ? { privacyPolicyUrl: def.privacyPolicyUrl } : {}),
|
|
185
|
+
...(def.termsOfServiceUrl != null ? { termsOfServiceUrl: def.termsOfServiceUrl } : {}),
|
|
186
|
+
}, STRIPE_PORTAL_PLUGIN_CONFIG);
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Declare the pricing policy: whether checkout collects tax and a VAT/GST id, what `tax_behavior`
|
|
190
|
+
* synced prices are given, Adaptive Pricing, and whether the estimate endpoints are served. A
|
|
191
|
+
* config never carries more than one — a second call replaces the first, so re-declaring (a test, a
|
|
192
|
+
* config module re-run) is safe rather than silently ignored (a config resource resolves an id to
|
|
193
|
+
* its FIRST match).
|
|
194
|
+
*
|
|
195
|
+
* `def.stripe` (the FX Quotes preview version, the unspecified-price migration switch) is
|
|
196
|
+
* Stripe-only and goes to a backend plugin, never the advertised `PricingPolicy` record.
|
|
197
|
+
*
|
|
198
|
+
* @throws PaymentError (`assertPricingPolicy`) when an estimate is declared without the tax or
|
|
199
|
+
* currency capability it requires.
|
|
200
|
+
*/
|
|
201
|
+
export const declarePaymentPricing = (cfg, def) => {
|
|
202
|
+
const { stripe, ...policy } = def;
|
|
203
|
+
assertPricingPolicy(policy);
|
|
204
|
+
cfg.records = (cfg.records ?? []).filter(record => record.id !== PRICING_POLICY_RECORD_ID);
|
|
205
|
+
cfg.records.push({
|
|
206
|
+
...toConfigRecord(policy), recordType: PRICING_POLICY_RECORD_TYPE, id: PRICING_POLICY_RECORD_ID,
|
|
207
|
+
});
|
|
208
|
+
if (stripe != null) {
|
|
209
|
+
const settlementCurrency = stripe.settlementCurrency?.toLowerCase();
|
|
210
|
+
if (settlementCurrency != null && !/^[a-z]{3}$/.test(settlementCurrency)) {
|
|
211
|
+
throw new PaymentError('pricing-policy:settlement-currency');
|
|
212
|
+
}
|
|
213
|
+
const normalizeMethods = (methods) => {
|
|
214
|
+
const normalized = methods.map(type => type.toLowerCase());
|
|
215
|
+
if (normalized.length === 0 || normalized.some(type => !/^[a-z][a-z0-9_]*$/.test(type))
|
|
216
|
+
|| new Set(normalized).size !== normalized.length) {
|
|
217
|
+
throw new PaymentError('pricing-policy:subscription-payment-methods');
|
|
218
|
+
}
|
|
219
|
+
return normalized;
|
|
220
|
+
};
|
|
221
|
+
const subscriptionPaymentMethodTypes = stripe.subscriptionPaymentMethodTypes != null
|
|
222
|
+
? normalizeMethods(stripe.subscriptionPaymentMethodTypes) : undefined;
|
|
223
|
+
const subscriptionPaymentMethodTypesByCurrency = {};
|
|
224
|
+
for (const [key, methods] of Object.entries(stripe.subscriptionPaymentMethodTypesByCurrency ?? {})) {
|
|
225
|
+
const currency = key.toLowerCase();
|
|
226
|
+
if (!/^[a-z]{3}$/.test(currency) || Object.hasOwn(subscriptionPaymentMethodTypesByCurrency, currency)) {
|
|
227
|
+
throw new PaymentError('pricing-policy:subscription-payment-methods-currency');
|
|
228
|
+
}
|
|
229
|
+
subscriptionPaymentMethodTypesByCurrency[currency] = normalizeMethods(methods);
|
|
230
|
+
}
|
|
231
|
+
plugin(cfg, {
|
|
232
|
+
...stripe,
|
|
233
|
+
...(settlementCurrency != null ? { settlementCurrency } : {}),
|
|
234
|
+
...(subscriptionPaymentMethodTypes != null ? { subscriptionPaymentMethodTypes } : {}),
|
|
235
|
+
...(stripe.subscriptionPaymentMethodTypesByCurrency != null ? { subscriptionPaymentMethodTypesByCurrency } : {}),
|
|
236
|
+
}, STRIPE_PRICING_PLUGIN_CONFIG);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Declare the consumer-rights policy (EU withdrawal, spend consent, start requests, cancellation,
|
|
241
|
+
* country lock) — a singleton config record like the pricing policy: `DEFAULT_CONSUMER_RIGHTS`
|
|
242
|
+
* filled in, asserted, and replacing any earlier declaration. It is ADVERTISED to the browser; the
|
|
243
|
+
* `mail` options (mailer alias, sender, archive copies) go to a backend-only plugin config.
|
|
244
|
+
*
|
|
245
|
+
* `trader` (who the consumer contracts with: `name` for the statements, `legalName`/`address`/`email`
|
|
246
|
+
* for the mails and the withdrawal information) is backend-only as well.
|
|
247
|
+
*
|
|
248
|
+
* @throws ConsumerRightsError (`policy:<field>`) — see `assertConsumerRightsPolicy`; `policy:trader`
|
|
249
|
+
* when a mechanism is on and no trader `name` and `legalName` are declared.
|
|
250
|
+
*/
|
|
251
|
+
export const declareConsumerRights = (cfg, def) => {
|
|
252
|
+
const { mail, trader, ...declaration } = def;
|
|
253
|
+
const policy = makeConsumerRightsPolicy(declaration);
|
|
254
|
+
const anyMechanism = Object.values(policy.mechanisms).some(on => on === true);
|
|
255
|
+
if (anyMechanism && (trader?.name == null || trader.name.trim() === '' || trader.legalName == null
|
|
256
|
+
|| trader.legalName.trim() === '')) {
|
|
257
|
+
throw new ConsumerRightsError('policy:trader');
|
|
258
|
+
}
|
|
259
|
+
if (mail?.bcc?.some(address => !/^[^\s@]+@[^\s@]+$/.test(address)) === true) {
|
|
260
|
+
throw new ConsumerRightsError('policy:mail-bcc');
|
|
261
|
+
}
|
|
262
|
+
cfg.records = (cfg.records ?? []).filter(record => record.id !== CONSUMER_RIGHTS_RECORD_ID);
|
|
263
|
+
cfg.records.push({
|
|
264
|
+
...toConfigRecord(policy), recordType: CONSUMER_RIGHTS_RECORD_TYPE, id: CONSUMER_RIGHTS_RECORD_ID,
|
|
265
|
+
});
|
|
266
|
+
const plugins = cfg[PLUGIN_RECORD];
|
|
267
|
+
if (plugins != null) {
|
|
268
|
+
cfg[PLUGIN_RECORD] = plugins
|
|
269
|
+
.filter(record => record.id !== CONSUMER_RIGHTS_MAIL_PLUGIN_CONFIG);
|
|
270
|
+
}
|
|
271
|
+
if (mail != null || trader != null) {
|
|
272
|
+
plugin(cfg, {
|
|
273
|
+
...(trader != null ? {
|
|
274
|
+
trader: {
|
|
275
|
+
name: trader.name.trim(), legalName: trader.legalName.trim(),
|
|
276
|
+
...(trader.address != null && trader.address.trim() !== '' ? { address: trader.address.trim() } : {}),
|
|
277
|
+
...(trader.email != null && trader.email.trim() !== '' ? { email: trader.email.trim() } : {}),
|
|
278
|
+
...(trader.website != null && trader.website.trim() !== '' ? { website: trader.website.trim() } : {}),
|
|
279
|
+
},
|
|
280
|
+
} : {}),
|
|
281
|
+
...(mail?.alias != null ? { alias: mail.alias } : {}),
|
|
282
|
+
...(mail?.from != null ? { from: mail.from } : {}),
|
|
283
|
+
...(mail?.replyTo != null ? { replyTo: mail.replyTo } : {}),
|
|
284
|
+
...(mail?.bcc != null && mail.bcc.length > 0 ? { bcc: [...mail.bcc] } : {}),
|
|
285
|
+
}, CONSUMER_RIGHTS_MAIL_PLUGIN_CONFIG);
|
|
286
|
+
}
|
|
287
|
+
return policy;
|
|
45
288
|
};
|
|
46
289
|
//# sourceMappingURL=config.js.map
|
package/build/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EACL,0BAA0B,EAAE,4BAA4B,EAAE,mBAAmB,EAC7E,kBAAkB,EAAE,gBAAgB,EAAE,UAAU,EAAE,qBA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