@owlmeans/server-payment 0.1.22-rc.0 → 0.2.0-alpha.1
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 +52 -54
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/server-payment/SKILL.md +272 -330
- package/agent-meta/skills/server-payment/parts/reference.md +3 -3
- package/build/access/types.d.ts +7 -16
- package/build/access/types.d.ts.map +1 -1
- package/build/access.d.ts.map +1 -1
- package/build/access.js +6 -8
- package/build/access.js.map +1 -1
- package/build/actions/resync.d.ts +3 -3
- package/build/actions/resync.js +5 -5
- package/build/actions/resync.js.map +1 -1
- package/build/actions/webhook.d.ts +4 -1
- package/build/actions/webhook.d.ts.map +1 -1
- package/build/actions/webhook.js +8 -4
- package/build/actions/webhook.js.map +1 -1
- package/build/bootstrap/types.d.ts +13 -7
- package/build/bootstrap/types.d.ts.map +1 -1
- package/build/bootstrap.d.ts +4 -4
- package/build/bootstrap.d.ts.map +1 -1
- package/build/bootstrap.js +19 -10
- package/build/bootstrap.js.map +1 -1
- package/build/catalogue/types.d.ts +3 -3
- package/build/catalogue/types.d.ts.map +1 -1
- package/build/catalogue.d.ts.map +1 -1
- package/build/catalogue.js +4 -8
- package/build/catalogue.js.map +1 -1
- package/build/checkout/types.d.ts +21 -0
- package/build/checkout/types.d.ts.map +1 -0
- package/build/{plugins/stripe → checkout}/types.js.map +1 -1
- package/build/checkout.d.ts +6 -0
- package/build/checkout.d.ts.map +1 -0
- package/build/checkout.js +374 -0
- package/build/checkout.js.map +1 -0
- package/build/config.d.ts +10 -16
- package/build/config.d.ts.map +1 -1
- package/build/config.js +18 -59
- package/build/config.js.map +1 -1
- package/build/consts.d.ts +3 -49
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +3 -61
- package/build/consts.js.map +1 -1
- package/build/consumer/cancellation/types.d.ts +6 -4
- package/build/consumer/cancellation/types.d.ts.map +1 -1
- package/build/consumer/cancellation.d.ts.map +1 -1
- package/build/consumer/cancellation.js +11 -5
- package/build/consumer/cancellation.js.map +1 -1
- package/build/consumer/capture/types.d.ts +8 -12
- package/build/consumer/capture/types.d.ts.map +1 -1
- package/build/consumer/capture.d.ts.map +1 -1
- package/build/consumer/capture.js +48 -53
- package/build/consumer/capture.js.map +1 -1
- package/build/consumer/index.d.ts +4 -0
- package/build/consumer/index.d.ts.map +1 -1
- package/build/consumer/index.js +2 -0
- package/build/consumer/index.js.map +1 -1
- package/build/consumer/reconcile.d.ts.map +1 -1
- package/build/consumer/reconcile.js +82 -72
- package/build/consumer/reconcile.js.map +1 -1
- package/build/consumer/records/types.d.ts +4 -4
- package/build/consumer/records/types.d.ts.map +1 -1
- package/build/consumer/records.d.ts.map +1 -1
- package/build/consumer/records.js +16 -13
- package/build/consumer/records.js.map +1 -1
- package/build/consumer/service.d.ts +2 -2
- package/build/consumer/service.d.ts.map +1 -1
- package/build/consumer/service.js +28 -21
- package/build/consumer/service.js.map +1 -1
- package/build/consumer/types.d.ts +1 -4
- package/build/consumer/types.d.ts.map +1 -1
- package/build/consumer/types.local.d.ts +1 -9
- package/build/consumer/types.local.d.ts.map +1 -1
- package/build/consumer/withdrawal/types.d.ts +14 -12
- package/build/consumer/withdrawal/types.d.ts.map +1 -1
- package/build/consumer/withdrawal.d.ts.map +1 -1
- package/build/consumer/withdrawal.js +55 -71
- package/build/consumer/withdrawal.js.map +1 -1
- package/build/index.d.ts +12 -6
- package/build/index.d.ts.map +1 -1
- package/build/index.js +7 -4
- package/build/index.js.map +1 -1
- package/build/paygate/providers.d.ts +13 -0
- package/build/paygate/providers.d.ts.map +1 -0
- package/build/paygate/providers.js +38 -0
- package/build/paygate/providers.js.map +1 -0
- package/build/paygate/registry.d.ts +6 -0
- package/build/paygate/registry.d.ts.map +1 -0
- package/build/paygate/registry.js +37 -0
- package/build/paygate/registry.js.map +1 -0
- package/build/paygate/types.d.ts +577 -0
- package/build/paygate/types.d.ts.map +1 -0
- package/build/{plugins/session → paygate}/types.js.map +1 -1
- package/build/plan/types.d.ts +6 -1
- package/build/plan/types.d.ts.map +1 -1
- package/build/plan.d.ts.map +1 -1
- package/build/plan.js +16 -2
- package/build/plan.js.map +1 -1
- package/build/plugins/checkout-policy/types.d.ts +5 -3
- package/build/plugins/checkout-policy/types.d.ts.map +1 -1
- package/build/plugins/checkout-policy.d.ts.map +1 -1
- package/build/plugins/checkout-policy.js +5 -3
- package/build/plugins/checkout-policy.js.map +1 -1
- package/build/plugins/consts.local.d.ts +8 -10
- package/build/plugins/consts.local.d.ts.map +1 -1
- package/build/plugins/consts.local.js +2 -19
- package/build/plugins/consts.local.js.map +1 -1
- package/build/plugins/customer-lock/types.d.ts +2 -2
- package/build/plugins/customer-lock/types.d.ts.map +1 -1
- package/build/plugins/customer-lock.js +2 -2
- package/build/plugins/customer-lock.js.map +1 -1
- package/build/plugins/estimate/cache.js +1 -1
- package/build/plugins/estimate/cache.js.map +1 -1
- package/build/plugins/estimate/types.d.ts +10 -10
- package/build/plugins/estimate/types.d.ts.map +1 -1
- package/build/plugins/estimate.d.ts.map +1 -1
- package/build/plugins/estimate.js +48 -122
- package/build/plugins/estimate.js.map +1 -1
- package/build/plugins/events/types.d.ts +17 -10
- package/build/plugins/events/types.d.ts.map +1 -1
- package/build/plugins/events.d.ts +6 -5
- package/build/plugins/events.d.ts.map +1 -1
- package/build/plugins/events.js +162 -173
- package/build/plugins/events.js.map +1 -1
- package/build/plugins/fx/types.d.ts +10 -21
- package/build/plugins/fx/types.d.ts.map +1 -1
- package/build/plugins/fx.d.ts +1 -1
- package/build/plugins/fx.d.ts.map +1 -1
- package/build/plugins/fx.js +17 -54
- package/build/plugins/fx.js.map +1 -1
- package/build/plugins/portal/types.d.ts +8 -37
- package/build/plugins/portal/types.d.ts.map +1 -1
- package/build/plugins/portal.d.ts.map +1 -1
- package/build/plugins/portal.js +38 -208
- package/build/plugins/portal.js.map +1 -1
- package/build/plugins/refunds/types.d.ts +11 -11
- package/build/plugins/refunds/types.d.ts.map +1 -1
- package/build/plugins/refunds.d.ts.map +1 -1
- package/build/plugins/refunds.js +14 -39
- package/build/plugins/refunds.js.map +1 -1
- package/build/plugins/snapshot/types.d.ts +11 -0
- package/build/plugins/snapshot/types.d.ts.map +1 -0
- package/build/plugins/snapshot/types.js +2 -0
- package/build/plugins/snapshot/types.js.map +1 -0
- package/build/plugins/snapshot.d.ts +4 -0
- package/build/plugins/snapshot.d.ts.map +1 -0
- package/build/plugins/snapshot.js +19 -0
- package/build/plugins/snapshot.js.map +1 -0
- package/build/plugins/subscriptions/types.d.ts +17 -17
- package/build/plugins/subscriptions/types.d.ts.map +1 -1
- package/build/plugins/subscriptions.d.ts +4 -4
- package/build/plugins/subscriptions.d.ts.map +1 -1
- package/build/plugins/subscriptions.js +69 -77
- package/build/plugins/subscriptions.js.map +1 -1
- package/build/plugins/types.local.d.ts +9 -43
- package/build/plugins/types.local.d.ts.map +1 -1
- package/build/plugins/webhook-manager/types.d.ts +15 -43
- package/build/plugins/webhook-manager/types.d.ts.map +1 -1
- package/build/plugins/webhook-manager.d.ts +3 -3
- package/build/plugins/webhook-manager.d.ts.map +1 -1
- package/build/plugins/webhook-manager.js +21 -199
- package/build/plugins/webhook-manager.js.map +1 -1
- package/build/protocol.d.ts +1 -1
- package/build/protocol.d.ts.map +1 -1
- package/build/protocol.js +1 -1
- package/build/protocol.js.map +1 -1
- package/build/service.d.ts +11 -11
- package/build/service.d.ts.map +1 -1
- package/build/service.js +59 -23
- package/build/service.js.map +1 -1
- package/build/sync/types.d.ts +17 -13
- package/build/sync/types.d.ts.map +1 -1
- package/build/sync.d.ts.map +1 -1
- package/build/sync.js +22 -122
- package/build/sync.js.map +1 -1
- package/build/types.d.ts +46 -101
- package/build/types.d.ts.map +1 -1
- package/build/utils/types.d.ts +0 -8
- package/build/utils/types.d.ts.map +1 -1
- package/build/utils.d.ts +1 -4
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +1 -15
- package/build/utils.js.map +1 -1
- package/package.json +20 -22
- package/src/access/types.ts +7 -16
- package/src/access.ts +7 -15
- package/src/actions/resync.ts +5 -5
- package/src/actions/webhook.ts +8 -4
- package/src/bootstrap/types.ts +13 -7
- package/src/bootstrap.ts +23 -13
- package/src/catalogue/types.ts +3 -3
- package/src/catalogue.ts +4 -8
- package/src/checkout/types.ts +21 -0
- package/src/checkout.ts +414 -0
- package/src/config.ts +19 -66
- package/src/consts.ts +3 -69
- package/src/consumer/cancellation/types.ts +6 -4
- package/src/consumer/cancellation.ts +13 -7
- package/src/consumer/capture/types.ts +8 -12
- package/src/consumer/capture.ts +50 -59
- package/src/consumer/index.ts +4 -0
- package/src/consumer/reconcile.ts +69 -68
- package/src/consumer/records/types.ts +4 -4
- package/src/consumer/records.ts +19 -14
- package/src/consumer/service.ts +35 -22
- package/src/consumer/types.local.ts +1 -8
- package/src/consumer/types.ts +1 -4
- package/src/consumer/withdrawal/types.ts +14 -12
- package/src/consumer/withdrawal.ts +61 -77
- package/src/index.ts +12 -6
- package/src/paygate/providers.ts +48 -0
- package/src/paygate/registry.ts +53 -0
- package/src/paygate/types.ts +640 -0
- package/src/plan/types.ts +6 -1
- package/src/plan.ts +21 -3
- package/src/plugins/checkout-policy/types.ts +5 -3
- package/src/plugins/checkout-policy.ts +6 -5
- package/src/plugins/consts.local.ts +2 -26
- package/src/plugins/customer-lock/types.ts +2 -2
- package/src/plugins/customer-lock.ts +2 -2
- package/src/plugins/estimate/cache.ts +1 -1
- package/src/plugins/estimate/types.ts +10 -10
- package/src/plugins/estimate.ts +52 -128
- package/src/plugins/events/types.ts +17 -9
- package/src/plugins/events.ts +172 -190
- package/src/plugins/fx/types.ts +10 -23
- package/src/plugins/fx.ts +28 -64
- package/src/plugins/portal/types.ts +8 -38
- package/src/plugins/portal.ts +48 -229
- package/src/plugins/refunds/types.ts +11 -11
- package/src/plugins/refunds.ts +16 -40
- package/src/plugins/snapshot/types.ts +11 -0
- package/src/plugins/snapshot.ts +22 -0
- package/src/plugins/subscriptions/types.ts +17 -17
- package/src/plugins/subscriptions.ts +81 -81
- package/src/plugins/types.local.ts +9 -33
- package/src/plugins/webhook-manager/types.ts +15 -43
- package/src/plugins/webhook-manager.ts +24 -220
- package/src/protocol.ts +1 -1
- package/src/service.ts +66 -30
- package/src/sync/types.ts +17 -13
- package/src/sync.ts +25 -143
- package/src/types.ts +47 -97
- package/src/utils/types.ts +0 -9
- package/src/utils.ts +2 -20
- package/tests/capabilities.spec.ts +219 -0
- package/tests/entitlement.spec.ts +4 -4
- package/tests/gate-handlers.spec.ts +6 -6
- package/tests/gate.spec.ts +2 -2
- package/tests/grants.spec.ts +2 -2
- package/tests/internal-plan.spec.ts +2 -2
- package/tests/limit-gate.spec.ts +2 -2
- package/tests/paygates.spec.ts +132 -0
- package/tests/protocol.spec.ts +4 -5
- package/tests/usage.spec.ts +2 -2
- package/tests/webhook.spec.ts +137 -0
- package/build/plugins/session/types.d.ts +0 -34
- package/build/plugins/session/types.d.ts.map +0 -1
- package/build/plugins/session.d.ts +0 -4
- package/build/plugins/session.d.ts.map +0 -1
- package/build/plugins/session.js +0 -71
- package/build/plugins/session.js.map +0 -1
- package/build/plugins/status.d.ts +0 -8
- package/build/plugins/status.d.ts.map +0 -1
- package/build/plugins/status.js +0 -21
- package/build/plugins/status.js.map +0 -1
- package/build/plugins/stripe/types.d.ts +0 -20
- package/build/plugins/stripe/types.d.ts.map +0 -1
- package/build/plugins/stripe.d.ts +0 -6
- package/build/plugins/stripe.d.ts.map +0 -1
- package/build/plugins/stripe.js +0 -518
- package/build/plugins/stripe.js.map +0 -1
- package/src/plugins/session/types.ts +0 -30
- package/src/plugins/session.ts +0 -86
- package/src/plugins/status.ts +0 -22
- package/src/plugins/stripe/types.ts +0 -20
- package/src/plugins/stripe.ts +0 -571
- package/tests/checkout-consumer.spec.ts +0 -366
- package/tests/checkout-locks.spec.ts +0 -161
- package/tests/checkout-plugins.spec.ts +0 -164
- package/tests/checkout.spec.ts +0 -313
- package/tests/consumer-events.spec.ts +0 -215
- package/tests/consumer-fixtures.ts +0 -141
- package/tests/consumer-ops.spec.ts +0 -361
- package/tests/consumer-rights.integration.spec.ts +0 -147
- package/tests/consumer-rights.spec.ts +0 -606
- package/tests/context.ts +0 -110
- package/tests/estimate.spec.ts +0 -350
- package/tests/events.spec.ts +0 -367
- package/tests/fake-stripe.ts +0 -1004
- package/tests/gateway-options.spec.ts +0 -180
- package/tests/portal.spec.ts +0 -202
- package/tests/sync.spec.ts +0 -114
- package/tests/usage.integration.spec.ts +0 -165
- package/tests/webhook-manager.spec.ts +0 -149
- /package/build/{plugins/session → checkout}/types.js +0 -0
- /package/build/{plugins/stripe → paygate}/types.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/subscriptions/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/subscriptions/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAE1E,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8FAA8F;IAC9F,YAAY,CAAC,EAAE,IAAI,CAAA;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,wFAAwF;IACxF,MAAM,CAAC,EAAE,kBAAkB,CAAA;CAC5B;AAED,sEAAsE;AACtE,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,iBAAiB,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;IACrH,qGAAqG;IACrG,oBAAoB,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAA;IAC3F,iGAAiG;IACjG,aAAa,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;IAC9E;;;;;;OAMG;IACH,kBAAkB,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAC7D,iGAAiG;IACjG,SAAS,EAAE,MAAM,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC/D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context as ApiContext } from '@owlmeans/server-api';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const
|
|
4
|
-
/** The
|
|
5
|
-
export declare const
|
|
2
|
+
import type { PaygateSubscriptionsHelper } from './subscriptions/types.js';
|
|
3
|
+
export declare const makePaygateSubscriptionsHelper: (ctx: ApiContext) => PaygateSubscriptionsHelper;
|
|
4
|
+
/** The paygate subscriptions of a context — one per context. */
|
|
5
|
+
export declare const paygateSubscriptionsOf: (target: ApiContext<import("@owlmeans/server-api").Config>) => PaygateSubscriptionsHelper;
|
|
6
6
|
//# sourceMappingURL=subscriptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/plugins/subscriptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/plugins/subscriptions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAIjE,OAAO,KAAK,EAAgB,0BAA0B,EAAE,MAAM,0BAA0B,CAAA;AAcxF,eAAO,MAAM,8BAA8B,QAAS,UAAU,KAAG,0BA4KhE,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,sBAAsB,2FAAqD,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { SubscriptionStatus, TERMINAL_STATUSES } from '@owlmeans/payment';
|
|
1
|
+
import { INTERNAL_PAYGATE, SubscriptionStatus, TERMINAL_STATUSES } from '@owlmeans/payment';
|
|
2
2
|
import { memoHelper } from '@owlmeans/context';
|
|
3
|
-
import { STRIPE_PAYGATE_ALIAS } from '../consts.js';
|
|
4
3
|
import { log } from '../log.js';
|
|
5
4
|
import { RESYNC_PAGE } from './consts.local.js';
|
|
6
5
|
import { paymentAccessOf } from '../access.js';
|
|
@@ -8,29 +7,19 @@ import { paymentUtils } from '../utils.js';
|
|
|
8
7
|
import { catalogueOf } from '../catalogue.js';
|
|
9
8
|
import { planHelper } from '../plan.js';
|
|
10
9
|
import { subscriptionCommitOf } from '../commit.js';
|
|
10
|
+
import { paygatesOf } from '../paygate/registry.js';
|
|
11
11
|
import { customerLockHelper } from './customer-lock.js';
|
|
12
|
-
import { mapStatus } from './status.js';
|
|
13
12
|
import { captureOf } from '../consumer/capture.js';
|
|
14
|
-
const isPaused = (subscription) => subscription.status === 'paused'
|
|
15
|
-
|| (subscription.pause_collection != null && (subscription.status === 'active' || subscription.status === 'trialing'));
|
|
16
|
-
/**
|
|
17
|
-
* The current period. Top-level on the API version the client is pinned to; read through a narrow
|
|
18
|
-
* accessor because later versions move it onto the subscription items.
|
|
19
|
-
*/
|
|
20
|
-
const periodOf = (subscription) => {
|
|
21
|
-
const typed = subscription;
|
|
22
|
-
return { start: paymentUtils.dateOf(typed.current_period_start), end: paymentUtils.dateOf(typed.current_period_end) };
|
|
23
|
-
};
|
|
24
13
|
const secondsFloor = (at) => new Date(Math.floor(at.getTime() / 1000) * 1000);
|
|
25
|
-
export const
|
|
14
|
+
export const makePaygateSubscriptionsHelper = (ctx) => {
|
|
26
15
|
const access = paymentAccessOf(ctx);
|
|
27
|
-
const applySubscription = async (subscription, opts) => {
|
|
16
|
+
const applySubscription = async (paygate, subscription, opts) => {
|
|
28
17
|
const metadata = subscription.metadata ?? {};
|
|
29
|
-
const customerId =
|
|
30
|
-
const previous = await access.subscriptions().byExternalId(subscription.id,
|
|
18
|
+
const customerId = subscription.customerId;
|
|
19
|
+
const previous = await access.subscriptions().byExternalId(subscription.id, paygate.id);
|
|
31
20
|
let entityId = metadata.entityId ?? previous?.entityId;
|
|
32
21
|
if (entityId == null && customerId != null) {
|
|
33
|
-
entityId = (await access.paygateCustomers().loadByPgId(customerId,
|
|
22
|
+
entityId = (await access.paygateCustomers().loadByPgId(customerId, paygate.id))?.entityId ?? undefined;
|
|
34
23
|
}
|
|
35
24
|
if (entityId == null) {
|
|
36
25
|
log.warn('Subscription belongs to no known entity; ignored', { subscriptionId: subscription.id });
|
|
@@ -40,23 +29,21 @@ export const makeStripeSubscriptionsHelper = (ctx) => {
|
|
|
40
29
|
return { record: previous, change: null, updated: false };
|
|
41
30
|
}
|
|
42
31
|
const now = new Date();
|
|
43
|
-
const syncedAt = opts.eventCreated
|
|
32
|
+
const syncedAt = opts.eventCreated ?? secondsFloor(now);
|
|
44
33
|
if (opts.eventCreated != null && previous?.syncedAt != null
|
|
45
34
|
&& syncedAt.getTime() < new Date(previous.syncedAt).getTime()) {
|
|
46
35
|
return { record: previous, change: null, updated: false };
|
|
47
36
|
}
|
|
48
|
-
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
const planSku = item?.price?.lookup_key ?? item?.price?.metadata?.sku ?? metadata.planSku ?? previous?.planSku;
|
|
37
|
+
// A price recreated by the catalogue sync (an opposite tax behavior) may lose its lookup key; the
|
|
38
|
+
// paygate still names its plan, so a subscription switched to it in the portal resolves its plan.
|
|
39
|
+
const planSku = subscription.planSku ?? metadata.planSku ?? previous?.planSku;
|
|
52
40
|
if (planSku == null) {
|
|
53
41
|
log.warn('Subscription names no plan; ignored', { subscriptionId: subscription.id });
|
|
54
42
|
return { record: previous, change: null, updated: false };
|
|
55
43
|
}
|
|
56
44
|
const plan = await catalogueOf(ctx).findPlan(planSku);
|
|
57
45
|
const productSku = plan?.productSku ?? previous?.productSku ?? metadata.productSku ?? planSku;
|
|
58
|
-
const paused = opts.forced == null &&
|
|
59
|
-
const period = periodOf(subscription);
|
|
46
|
+
const paused = opts.forced == null && subscription.paused;
|
|
60
47
|
const terminal = opts.forced != null && TERMINAL_STATUSES.includes(opts.forced);
|
|
61
48
|
const next = paymentUtils.compact({
|
|
62
49
|
...(previous ?? {}),
|
|
@@ -64,24 +51,24 @@ export const makeStripeSubscriptionsHelper = (ctx) => {
|
|
|
64
51
|
planSku,
|
|
65
52
|
productSku,
|
|
66
53
|
service: metadata.service ?? previous?.service ?? productSku,
|
|
67
|
-
paygate:
|
|
54
|
+
paygate: paygate.id,
|
|
68
55
|
externalId: subscription.id,
|
|
69
|
-
itemId:
|
|
70
|
-
priceId:
|
|
71
|
-
status: opts.forced ??
|
|
72
|
-
externalStatus: subscription.
|
|
56
|
+
itemId: subscription.itemId,
|
|
57
|
+
priceId: subscription.priceId,
|
|
58
|
+
status: opts.forced ?? subscription.status,
|
|
59
|
+
externalStatus: subscription.externalStatus,
|
|
73
60
|
rank: plan != null ? planHelper.planRank(plan) : previous?.rank ?? 0,
|
|
74
|
-
periodStart:
|
|
75
|
-
periodEnd:
|
|
76
|
-
cancelAtPeriodEnd: subscription.
|
|
77
|
-
canceledAt:
|
|
78
|
-
endedAt:
|
|
61
|
+
periodStart: subscription.periodStart,
|
|
62
|
+
periodEnd: subscription.periodEnd,
|
|
63
|
+
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd === true,
|
|
64
|
+
canceledAt: subscription.canceledAt,
|
|
65
|
+
endedAt: subscription.endedAt ?? (terminal ? previous?.endedAt ?? now : undefined),
|
|
79
66
|
pausedAt: paused ? previous?.pausedAt ?? now : undefined,
|
|
80
|
-
trialEnd:
|
|
81
|
-
latestInvoiceId: opts.invoiceId ??
|
|
67
|
+
trialEnd: subscription.trialEnd,
|
|
68
|
+
latestInvoiceId: opts.invoiceId ?? subscription.latestInvoiceId ?? previous?.latestInvoiceId,
|
|
82
69
|
customerId,
|
|
83
70
|
currency: subscription.currency?.toLowerCase() ?? previous?.currency,
|
|
84
|
-
createdAt: previous?.createdAt ??
|
|
71
|
+
createdAt: previous?.createdAt ?? subscription.createdAt ?? now,
|
|
85
72
|
updatedAt: now,
|
|
86
73
|
syncedAt,
|
|
87
74
|
});
|
|
@@ -91,24 +78,14 @@ export const makeStripeSubscriptionsHelper = (ctx) => {
|
|
|
91
78
|
// The first invoice is a purchase: its window exists before an observer grants the bundle.
|
|
92
79
|
beforePropagate: async (record, change) => {
|
|
93
80
|
if (change === 'created') {
|
|
94
|
-
await captureOf(ctx).captureSubscriptionPurchase(
|
|
81
|
+
await captureOf(ctx).captureSubscriptionPurchase(paygate, subscription, record);
|
|
95
82
|
}
|
|
96
83
|
},
|
|
97
84
|
});
|
|
98
85
|
};
|
|
99
|
-
const retrieveSubscription = async (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
if (paymentUtils.isMissingObject(error)) {
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
throw error;
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
const cancelMissing = async (externalId) => {
|
|
111
|
-
const previous = await access.subscriptions().byExternalId(externalId, STRIPE_PAYGATE_ALIAS);
|
|
86
|
+
const retrieveSubscription = async (paygate, id) => paygate.subscriptions != null ? await paygate.subscriptions.retrieve(id) : null;
|
|
87
|
+
const cancelMissing = async (paygate, externalId) => {
|
|
88
|
+
const previous = await access.subscriptions().byExternalId(externalId, paygate.id);
|
|
112
89
|
if (previous == null || TERMINAL_STATUSES.includes(previous.status)) {
|
|
113
90
|
return { record: previous, change: null, updated: false };
|
|
114
91
|
}
|
|
@@ -118,52 +95,67 @@ export const makeStripeSubscriptionsHelper = (ctx) => {
|
|
|
118
95
|
syncedAt: secondsFloor(now),
|
|
119
96
|
});
|
|
120
97
|
};
|
|
121
|
-
|
|
122
|
-
|
|
98
|
+
/** A registered paygate that keeps subscriptions, or `null`. */
|
|
99
|
+
const subscribingPaygate = (id) => {
|
|
100
|
+
const paygate = id != null ? paygatesOf(ctx).find(id) : null;
|
|
101
|
+
return paygate?.subscriptions != null ? paygate : null;
|
|
102
|
+
};
|
|
103
|
+
const resyncOne = async (paygate, id) => {
|
|
104
|
+
const subscription = await retrieveSubscription(paygate, id);
|
|
105
|
+
const result = await customerLockHelper.withCustomerLock(paygate.id, subscription?.customerId, async () => subscription != null
|
|
106
|
+
? await applySubscription(paygate, subscription, { source: 'resync' })
|
|
107
|
+
: await cancelMissing(paygate, id));
|
|
108
|
+
return result.updated;
|
|
109
|
+
};
|
|
110
|
+
const resyncSubscription = async (ref) => {
|
|
111
|
+
const targets = new Map();
|
|
112
|
+
const add = (paygate, id) => {
|
|
113
|
+
if (paygate != null && !targets.has(`${paygate.id}:${id}`)) {
|
|
114
|
+
targets.set(`${paygate.id}:${id}`, { paygate, id });
|
|
115
|
+
}
|
|
116
|
+
};
|
|
123
117
|
if (ref.subscriptionId != null) {
|
|
124
|
-
|
|
118
|
+
const row = ref.paygate == null
|
|
119
|
+
? await access.subscriptions().load({ externalId: ref.subscriptionId, paygate: { $ne: INTERNAL_PAYGATE } })
|
|
120
|
+
: null;
|
|
121
|
+
add(subscribingPaygate(ref.paygate ?? row?.paygate)
|
|
122
|
+
?? (ref.paygate == null && row == null ? paygatesOf(ctx).all().find(paygate => paygate.subscriptions != null) ?? null : null), ref.subscriptionId);
|
|
125
123
|
}
|
|
126
124
|
if (ref.entityId != null) {
|
|
127
|
-
const { items } = await access.subscriptions().list({ entityId: ref.entityId, paygate:
|
|
128
|
-
items.forEach(row =>
|
|
125
|
+
const { items } = await access.subscriptions().list({ entityId: ref.entityId, paygate: ref.paygate ?? { $ne: INTERNAL_PAYGATE } }, { size: 0 });
|
|
126
|
+
items.forEach(row => { add(subscribingPaygate(row.paygate), row.externalId); });
|
|
129
127
|
}
|
|
130
128
|
let updated = 0;
|
|
131
|
-
for (const id of
|
|
132
|
-
|
|
133
|
-
const customerId = subscription != null ? paymentUtils.idOf(subscription.customer) : undefined;
|
|
134
|
-
const result = await customerLockHelper.withCustomerLock(customerId, async () => subscription != null
|
|
135
|
-
? await applySubscription(subscription, { source: 'resync', stripe })
|
|
136
|
-
: await cancelMissing(id));
|
|
137
|
-
if (result.updated) {
|
|
129
|
+
for (const { paygate, id } of targets.values()) {
|
|
130
|
+
if (await resyncOne(paygate, id)) {
|
|
138
131
|
updated++;
|
|
139
132
|
}
|
|
140
133
|
}
|
|
141
134
|
return updated;
|
|
142
135
|
};
|
|
143
|
-
const
|
|
144
|
-
const
|
|
136
|
+
const resyncAll = async () => {
|
|
137
|
+
const rows = [];
|
|
145
138
|
for (let page = 0;; page++) {
|
|
146
|
-
const { items } = await access.subscriptions().list({ paygate:
|
|
147
|
-
|
|
139
|
+
const { items } = await access.subscriptions().list({ paygate: { $ne: INTERNAL_PAYGATE }, status: { $nin: [...TERMINAL_STATUSES] } }, { size: RESYNC_PAGE, page, sort: ['createdAt'] });
|
|
140
|
+
rows.push(...items);
|
|
148
141
|
if (items.length < RESYNC_PAGE) {
|
|
149
142
|
break;
|
|
150
143
|
}
|
|
151
144
|
}
|
|
145
|
+
const targets = rows.filter(row => subscribingPaygate(row.paygate) != null);
|
|
152
146
|
let updated = 0;
|
|
153
|
-
for (const
|
|
147
|
+
for (const row of targets) {
|
|
154
148
|
try {
|
|
155
|
-
updated += await
|
|
149
|
+
updated += await resyncSubscription({ subscriptionId: row.externalId, paygate: row.paygate });
|
|
156
150
|
}
|
|
157
151
|
catch (error) {
|
|
158
|
-
log.error('Subscription resync failed', { subscriptionId, error });
|
|
152
|
+
log.error('Subscription resync failed', { subscriptionId: row.externalId, paygate: row.paygate, error });
|
|
159
153
|
}
|
|
160
154
|
}
|
|
161
|
-
return { scanned:
|
|
162
|
-
};
|
|
163
|
-
return {
|
|
164
|
-
applySubscription, retrieveSubscription, cancelMissing, resyncStripeSubscription, resyncStripeSubscriptions,
|
|
155
|
+
return { scanned: targets.length, updated };
|
|
165
156
|
};
|
|
157
|
+
return { applySubscription, retrieveSubscription, cancelMissing, resyncSubscription, resyncAll };
|
|
166
158
|
};
|
|
167
|
-
/** The
|
|
168
|
-
export const
|
|
159
|
+
/** The paygate subscriptions of a context — one per context. */
|
|
160
|
+
export const paygateSubscriptionsOf = memoHelper.oncePer(makePaygateSubscriptionsHelper);
|
|
169
161
|
//# sourceMappingURL=subscriptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../src/plugins/subscriptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../src/plugins/subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE3F,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAI9C,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE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umerRightsPolicy, TaxEstimate } from '@owlmeans/payment';
|
|
2
|
+
import type { FxQuote } from '../paygate/types.js';
|
|
3
3
|
export interface CacheEntry<T> {
|
|
4
4
|
value: T;
|
|
5
5
|
expiresAt: number;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
calculation: Stripe.Tax.Calculation;
|
|
10
|
-
} | {
|
|
11
|
-
ok: false;
|
|
12
|
-
code?: string;
|
|
13
|
-
};
|
|
7
|
+
/** A cached tax answer: the estimate, or `null` when the paygate could not place the buyer. */
|
|
8
|
+
export type TaxOutcome = TaxEstimate | null;
|
|
14
9
|
export type FxOutcome = {
|
|
15
10
|
currency: string;
|
|
16
11
|
exchangeRate: number;
|
|
17
12
|
fxFeeRate?: number;
|
|
18
13
|
} | null;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
exchange_rate?: number;
|
|
22
|
-
rate_details?: {
|
|
23
|
-
base_rate?: number;
|
|
24
|
-
fx_fee_rate?: number;
|
|
25
|
-
reference_rate?: number;
|
|
26
|
-
};
|
|
27
|
-
}>;
|
|
28
|
-
}
|
|
29
|
-
export type ConfigurationParams = Stripe.BillingPortal.ConfigurationCreateParams;
|
|
30
|
-
export type Claim = 'ours' | 'foreign' | 'unclaimed';
|
|
31
|
-
export interface CheckoutOptionsFlags {
|
|
32
|
-
/** The billing country is locked and the saved customer address carries it: never overwrite it. */
|
|
33
|
-
locked?: boolean;
|
|
34
|
-
/** Adaptive Pricing is allowed on this session (the charge currency is the settlement currency). */
|
|
35
|
-
adaptive?: boolean;
|
|
36
|
-
}
|
|
14
|
+
/** The quotes one run (a catalogue sync) shares, by `<from>:<to>`. */
|
|
15
|
+
export type FxQuoteCache = Map<string, Promise<FxQuote | null>>;
|
|
37
16
|
/** What the consumer-rights policy makes of this checkout's buyer. */
|
|
38
17
|
export interface BuyerContext {
|
|
39
18
|
policy: ConsumerRightsPolicy | null;
|
|
@@ -45,26 +24,13 @@ export interface BuyerContext {
|
|
|
45
24
|
/** `null`: the policy names no region currencies — the legacy settlement behaviour. */
|
|
46
25
|
chargeCurrency: string | null;
|
|
47
26
|
/**
|
|
48
|
-
* Checkout keeps the saved customer address (tax follows it, nothing typed at
|
|
49
|
-
* locked profile, or a
|
|
27
|
+
* Checkout keeps the saved customer address (tax follows it, nothing typed at the paygate moves
|
|
28
|
+
* it): a locked profile, or a pinned customer country, whose country it carries — tax-locatable.
|
|
50
29
|
*/
|
|
51
30
|
addressLocked: boolean;
|
|
52
|
-
/** The address is held by
|
|
31
|
+
/** The address is held by the paygate's customer country lock: the first completed purchase locks THIS country. */
|
|
53
32
|
countryPinned: boolean;
|
|
54
33
|
}
|
|
55
|
-
export interface StripeErrorShape {
|
|
56
|
-
type?: string;
|
|
57
|
-
rawType?: string;
|
|
58
|
-
code?: string;
|
|
59
|
-
param?: string;
|
|
60
|
-
message?: string;
|
|
61
|
-
raw?: {
|
|
62
|
-
type?: string;
|
|
63
|
-
code?: string;
|
|
64
|
-
param?: string;
|
|
65
|
-
message?: string;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
34
|
export interface WebhookRequest {
|
|
69
35
|
original?: {
|
|
70
36
|
rawBody?: string | Buffer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.local.d.ts","sourceRoot":"","sources":["../../src/plugins/types.local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.local.d.ts","sourceRoot":"","sources":["../../src/plugins/types.local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC9G,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,MAAM,WAAW,UAAU,CAAC,CAAC;IAAI,KAAK,EAAE,CAAC,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;AAE9D,+FAA+F;AAC/F,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,IAAI,CAAA;AAE3C,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAA;AAE7F,sEAAsE;AACtE,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAA;AAE/D,sEAAsE;AACtE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAA;IACnC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAA;IAClC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,cAAc,GAAG,IAAI,CAAA;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,uFAAuF;IACvF,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAA;IACtB,mHAAmH;IACnH,aAAa,EAAE,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACxC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAA;CACvD"}
|
|
@@ -1,62 +1,34 @@
|
|
|
1
|
-
import type Stripe from 'stripe';
|
|
2
1
|
import type { CommonServiceRoute } from '@owlmeans/route';
|
|
3
2
|
import type { PaymentWebhookRecord } from '../../types.js';
|
|
3
|
+
import type { Paygate, PaygateDeployment } from '../../paygate/types.js';
|
|
4
4
|
export interface EnsureWebhookOptions {
|
|
5
5
|
/** Verify the stored endpoint still exists even when nothing changed locally. */
|
|
6
6
|
force?: boolean;
|
|
7
7
|
}
|
|
8
|
-
/** A deployment's
|
|
8
|
+
/** A deployment's paygate webhooks: where they are served, the managed endpoints and their deliveries. */
|
|
9
9
|
export interface WebhookHelper {
|
|
10
10
|
/** The alias whose host and base form the webhook URL: the gateway's `webhookService`, else `cfg.service`. */
|
|
11
11
|
webhookServiceOf: () => string;
|
|
12
|
-
/** The key this deployment's
|
|
12
|
+
/** The key this deployment's paygate rows are stored under: the gateway's `owner`, else `cfg.service`. */
|
|
13
13
|
gatewayOwnerOf: () => string;
|
|
14
14
|
/** @throws WebhookSetupError('service:<alias>') when the webhook service is not declared in `cfg.services`. */
|
|
15
15
|
webhookRouteOf: (alias?: string) => CommonServiceRoute;
|
|
16
|
-
/** This deployment's public webhook URL for a paygate, on the webhook service's host and base. */
|
|
17
|
-
webhookUrlOf: (paygate
|
|
16
|
+
/** This deployment's public webhook URL for a paygate (`/<base>/webhook/<paygate>`), on the webhook service's host and base. */
|
|
17
|
+
webhookUrlOf: (paygate: string) => string;
|
|
18
|
+
/** The deployment a paygate keeps its endpoint and portal configuration for: the owner and the webhook URL. */
|
|
19
|
+
deploymentOf: (paygate: string) => PaygateDeployment;
|
|
18
20
|
/**
|
|
19
|
-
* Keep
|
|
20
|
-
* `
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* A deployment's identity is its webhook URL (`webhookUrlOf`: the `webhookService` alias's host and
|
|
24
|
-
* base); its rows are keyed by the gateway's `owner` (`gatewayOwnerOf`). Several deployments of one
|
|
25
|
-
* application may share a Stripe account — a test-mode account commonly serves every non-production
|
|
26
|
-
* deployment — each with its own database and URL, so a deployment deletes only the endpoints its
|
|
27
|
-
* own `payment-webhook` rows name.
|
|
28
|
-
*
|
|
29
|
-
* - A URL Stripe cannot deliver to (not https, a loopback or dotless host) is skipped.
|
|
30
|
-
* - An unchanged `{ url, apiVersion, events }` fingerprint makes no paygate call at all.
|
|
31
|
-
* - `force` first verifies the stored endpoint still exists; one deleted from outside loses its row
|
|
32
|
-
* and is created again.
|
|
33
|
-
* - Changed events on the same API version update the endpoint in place.
|
|
34
|
-
* - A changed API version (create-only on an endpoint) deletes and recreates it.
|
|
35
|
-
* - An endpoint already at this exact URL that no row names is replaced: its secret is unknown here.
|
|
36
|
-
* - A row of this paygate and owner at another URL is a URL this deployment has left — a moved host,
|
|
37
|
-
* or a new `webhookService`: once the endpoint at the current URL is in place, the endpoint that
|
|
38
|
-
* row names is deleted (already gone is fine), then the row.
|
|
39
|
-
* - An endpoint at another URL that no row of this deployment names belongs to another deployment
|
|
40
|
-
* and is never deleted — whatever its metadata says.
|
|
41
|
-
* - Replicas racing to persist one row: the endpoint created last is the live one.
|
|
42
|
-
* - A created endpoint carries `{ owlmeans: 'payment', service: <owner> }` metadata and the
|
|
43
|
-
* `owlmeans:<owner>` description for operators.
|
|
44
|
-
*/
|
|
45
|
-
ensureWebhookEndpoint: (stripe: Stripe, opts?: EnsureWebhookOptions) => Promise<PaymentWebhookRecord | null>;
|
|
46
|
-
/**
|
|
47
|
-
* The secrets a Stripe signature may be verified with, in order: the configured file secret (an
|
|
48
|
-
* override), then the one stored for the managed endpoint — the newest row of the gateway's `owner`,
|
|
49
|
-
* so a process receiving the webhook finds the secret whichever process of the owner stored it.
|
|
21
|
+
* Keep the paygate's webhook endpoint for this deployment at its own URL
|
|
22
|
+
* (`paygate.webhook.ensureEndpoint`). A deployment's identity is its webhook URL; its rows carry the
|
|
23
|
+
* gateway's `owner`. A URL a paygate cannot deliver to (not https, a loopback or dotless host) is
|
|
24
|
+
* skipped, and so is a paygate without `webhook`.
|
|
50
25
|
*/
|
|
51
|
-
|
|
52
|
-
/** The secret a Stripe signature is verified with. @throws WebhookSetupError('secret') */
|
|
53
|
-
stripeWebhookSecret: () => Promise<string>;
|
|
26
|
+
ensureWebhookEndpoint: (paygate: Paygate, opts?: EnsureWebhookOptions) => Promise<PaymentWebhookRecord | null>;
|
|
54
27
|
/**
|
|
55
|
-
* Verify a
|
|
56
|
-
* stored one, and dispatch it.
|
|
28
|
+
* Verify a delivery with the paygate (against the owner's secrets) and apply its events in order.
|
|
57
29
|
*
|
|
58
|
-
* @throws PaygateSignatureError | WebhookSetupError('secret')
|
|
30
|
+
* @throws PaygateError('capability:webhook') | PaygateSignatureError | WebhookSetupError('secret')
|
|
59
31
|
*/
|
|
60
|
-
|
|
32
|
+
handleDelivery: (paygate: Paygate, request: unknown) => Promise<void>;
|
|
61
33
|
}
|
|
62
34
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/webhook-manager/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/webhook-manager/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAExE,MAAM,WAAW,oBAAoB;IACnC,iFAAiF;IACjF,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,0GAA0G;AAC1G,MAAM,WAAW,aAAa;IAC5B,8GAA8G;IAC9G,gBAAgB,EAAE,MAAM,MAAM,CAAA;IAC9B,0GAA0G;IAC1G,cAAc,EAAE,MAAM,MAAM,CAAA;IAC5B,+GAA+G;IAC/G,cAAc,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,kBAAkB,CAAA;IACtD,gIAAgI;IAChI,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;IACzC,+GAA+G;IAC/G,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,iBAAiB,CAAA;IACpD;;;;;OAKG;IACH,qBAAqB,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,oBAAoB,KAAK,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAA;IAC9G;;;;OAIG;IACH,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACtE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Context as ApiContext } from '@owlmeans/server-api';
|
|
2
2
|
import type { WebhookHelper } from './webhook-manager/types.js';
|
|
3
3
|
export declare const makeWebhookHelper: (ctx: ApiContext) => WebhookHelper;
|
|
4
|
-
/** The
|
|
4
|
+
/** The paygate webhooks of a context — one per context. */
|
|
5
5
|
export declare const webhookOf: (target: ApiContext<import("@owlmeans/server-api").Config>) => WebhookHelper;
|
|
6
|
-
/** @deprecated compat:factory-refactor — use `webhookOf(ctx).webhookUrlOf(
|
|
7
|
-
export declare const webhookUrlOf: (ctx: ApiContext, paygate
|
|
6
|
+
/** @deprecated compat:factory-refactor — use `webhookOf(ctx).webhookUrlOf(paygate)` */
|
|
7
|
+
export declare const webhookUrlOf: (ctx: ApiContext, paygate: string) => string;
|
|
8
8
|
//# sourceMappingURL=webhook-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-manager.d.ts","sourceRoot":"","sources":["../../src/plugins/webhook-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webhook-manager.d.ts","sourceRoot":"","sources":["../../src/plugins/webhook-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAKjE,OAAO,KAAK,EAAwB,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAyBrF,eAAO,MAAM,iBAAiB,QAAS,UAAU,KAAG,aAoDnD,CAAA;AAED,2DAA2D;AAC3D,eAAO,MAAM,SAAS,8EAAwC,CAAA;AAE9D,uFAAuF;AACvF,eAAO,MAAM,YAAY,QAAS,UAAU,WAAW,MAAM,KAAG,MAA8C,CAAA"}
|