@pithy-sh/payments 0.1.1 → 0.1.3
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/dist/admin/coverage.d.ts +35 -0
- package/dist/admin/coverage.d.ts.map +1 -0
- package/dist/admin/coverage.js +56 -0
- package/dist/admin/read.d.ts +222 -0
- package/dist/admin/read.d.ts.map +1 -0
- package/dist/admin/read.js +159 -0
- package/dist/audit/actions.d.ts +211 -0
- package/dist/audit/actions.d.ts.map +1 -0
- package/dist/audit/actions.js +211 -0
- package/dist/capability.d.ts +72 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +228 -0
- package/dist/client/api.d.ts +435 -0
- package/dist/client/api.d.ts.map +1 -0
- package/dist/client/api.js +415 -0
- package/dist/client/checkout.d.ts +144 -0
- package/dist/client/checkout.d.ts.map +1 -0
- package/dist/client/checkout.js +173 -0
- package/dist/client/fixtures/price-preview-de.js +89 -0
- package/dist/client/fixtures/price-preview-gb.js +89 -0
- package/dist/client/fixtures/price-preview-jp-yen.js +89 -0
- package/dist/client/fixtures/price-preview-us-country-only.js +89 -0
- package/dist/client/fixtures/price-preview-us-new-york.js +89 -0
- package/dist/client/fixtures/pricePreview.d.ts +54 -0
- package/dist/client/fixtures/pricePreview.d.ts.map +1 -0
- package/dist/client/fixtures/pricePreview.js +61 -0
- package/dist/client/hooks.d.ts +235 -0
- package/dist/client/hooks.d.ts.map +1 -0
- package/dist/client/hooks.js +428 -0
- package/dist/client/paddle.d.ts +433 -0
- package/dist/client/paddle.d.ts.map +1 -0
- package/dist/client/paddle.js +391 -0
- package/dist/client/paddleCache.d.ts +123 -0
- package/dist/client/paddleCache.d.ts.map +1 -0
- package/dist/client/paddleCache.js +159 -0
- package/dist/client/paddlePrices.d.ts +94 -0
- package/dist/client/paddlePrices.d.ts.map +1 -0
- package/dist/client/paddlePrices.js +55 -0
- package/dist/client/paddlePricesTag.d.ts +127 -0
- package/dist/client/paddlePricesTag.d.ts.map +1 -0
- package/dist/client/paddlePricesTag.js +207 -0
- package/dist/client/projection.d.ts +128 -0
- package/dist/client/projection.d.ts.map +1 -0
- package/dist/client/projection.js +0 -0
- package/dist/client/test-utils/cacheStore.d.ts +18 -0
- package/dist/client/test-utils/cacheStore.d.ts.map +1 -0
- package/dist/client/test-utils/cacheStore.js +42 -0
- package/dist/client/wholeUnits.d.ts +18 -0
- package/dist/client/wholeUnits.d.ts.map +1 -0
- package/dist/client/wholeUnits.js +120 -0
- package/dist/config/config.d.ts +238 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +249 -0
- package/dist/data/discount.d.ts +127 -0
- package/dist/data/discount.d.ts.map +1 -0
- package/dist/data/discount.js +91 -0
- package/dist/data/entitlement.d.ts +43 -0
- package/dist/data/entitlement.d.ts.map +1 -0
- package/dist/data/entitlement.js +43 -0
- package/dist/data/money.d.ts +15 -0
- package/dist/data/money.d.ts.map +1 -0
- package/dist/data/money.js +76 -0
- package/dist/data/pause.d.ts +133 -0
- package/dist/data/pause.d.ts.map +1 -0
- package/dist/data/pause.js +63 -0
- package/dist/data/providerAccount.d.ts +40 -0
- package/dist/data/providerAccount.d.ts.map +1 -0
- package/dist/data/providerAccount.js +34 -0
- package/dist/data/purchase.d.ts +107 -0
- package/dist/data/purchase.d.ts.map +1 -0
- package/dist/data/purchase.js +77 -0
- package/dist/data/rail.d.ts +74 -0
- package/dist/data/rail.d.ts.map +1 -0
- package/dist/data/rail.js +74 -0
- package/dist/data/reconcileRun.d.ts +120 -0
- package/dist/data/reconcileRun.d.ts.map +1 -0
- package/dist/data/reconcileRun.js +120 -0
- package/dist/data/renderMoney.d.ts +85 -0
- package/dist/data/renderMoney.d.ts.map +1 -0
- package/dist/data/renderMoney.js +146 -0
- package/dist/data/status.d.ts +58 -0
- package/dist/data/status.d.ts.map +1 -0
- package/dist/data/status.js +68 -0
- package/dist/data/subject.d.ts +111 -0
- package/dist/data/subject.d.ts.map +1 -0
- package/dist/data/subject.js +125 -0
- package/dist/data/subscription.d.ts +624 -0
- package/dist/data/subscription.d.ts.map +1 -0
- package/dist/data/subscription.js +497 -0
- package/dist/data/syncCursor.d.ts +33 -0
- package/dist/data/syncCursor.d.ts.map +1 -0
- package/dist/data/syncCursor.js +29 -0
- package/dist/data/tables.d.ts +37 -0
- package/dist/data/tables.d.ts.map +1 -0
- package/dist/data/tables.js +44 -0
- package/dist/data/webhookEvent.d.ts +134 -0
- package/dist/data/webhookEvent.d.ts.map +1 -0
- package/dist/data/webhookEvent.js +128 -0
- package/dist/entitlement/manual.d.ts +101 -0
- package/dist/entitlement/manual.d.ts.map +1 -0
- package/dist/entitlement/manual.js +84 -0
- package/dist/entitlement/resolver.d.ts +60 -0
- package/dist/entitlement/resolver.d.ts.map +1 -0
- package/dist/entitlement/resolver.js +101 -0
- package/dist/entitlement/subjectSeam.d.ts +102 -0
- package/dist/entitlement/subjectSeam.d.ts.map +1 -0
- package/dist/entitlement/subjectSeam.js +85 -0
- package/dist/error/errors.d.ts +247 -0
- package/dist/error/errors.d.ts.map +1 -0
- package/dist/error/errors.js +326 -0
- package/dist/grants/apply.d.ts +74 -0
- package/dist/grants/apply.d.ts.map +1 -0
- package/dist/grants/apply.js +148 -0
- package/dist/grants/clawback.d.ts +43 -0
- package/dist/grants/clawback.d.ts.map +1 -0
- package/dist/grants/clawback.js +71 -0
- package/dist/grants/ledgerSeam.d.ts +89 -0
- package/dist/grants/ledgerSeam.d.ts.map +1 -0
- package/dist/grants/ledgerSeam.js +66 -0
- package/dist/http/dispatch.d.ts +35 -0
- package/dist/http/dispatch.d.ts.map +1 -0
- package/dist/http/dispatch.js +40 -0
- package/dist/http/guards.d.ts +43 -0
- package/dist/http/guards.d.ts.map +1 -0
- package/dist/http/guards.js +52 -0
- package/dist/http/manifestConfig.d.ts +38 -0
- package/dist/http/manifestConfig.d.ts.map +1 -0
- package/dist/http/manifestConfig.js +49 -0
- package/dist/http/responses.d.ts +1455 -0
- package/dist/http/responses.d.ts.map +1 -0
- package/dist/http/responses.js +728 -0
- package/dist/http/routes.d.ts +315 -0
- package/dist/http/routes.d.ts.map +1 -0
- package/dist/http/routes.js +1966 -0
- package/dist/http/schemas.d.ts +404 -0
- package/dist/http/schemas.d.ts.map +1 -0
- package/dist/http/schemas.js +359 -0
- package/dist/http/scopes.d.ts +160 -0
- package/dist/http/scopes.d.ts.map +1 -0
- package/dist/http/scopes.js +240 -0
- package/dist/http/view.d.ts +96 -0
- package/dist/http/view.d.ts.map +1 -0
- package/dist/http/view.js +170 -0
- package/dist/http/webhookGuard.d.ts +109 -0
- package/dist/http/webhookGuard.d.ts.map +1 -0
- package/dist/http/webhookGuard.js +206 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/migrations/0001_purchases.d.ts +35 -0
- package/dist/migrations/0001_purchases.d.ts.map +1 -0
- package/dist/migrations/0001_purchases.js +80 -0
- package/dist/pricing/location.d.ts +138 -0
- package/dist/pricing/location.d.ts.map +1 -0
- package/dist/pricing/location.js +81 -0
- package/dist/pricing/visitor.d.ts +56 -0
- package/dist/pricing/visitor.d.ts.map +1 -0
- package/dist/pricing/visitor.js +35 -0
- package/dist/projection/event.d.ts +66 -0
- package/dist/projection/event.d.ts.map +1 -0
- package/dist/projection/event.js +45 -0
- package/dist/projection/orphans.d.ts +114 -0
- package/dist/projection/orphans.d.ts.map +1 -0
- package/dist/projection/orphans.js +162 -0
- package/dist/projection/owner.d.ts +121 -0
- package/dist/projection/owner.d.ts.map +1 -0
- package/dist/projection/owner.js +114 -0
- package/dist/projection/resolve.d.ts +30 -0
- package/dist/projection/resolve.d.ts.map +1 -0
- package/dist/projection/resolve.js +42 -0
- package/dist/projection/writer.d.ts +103 -0
- package/dist/projection/writer.d.ts.map +1 -0
- package/dist/projection/writer.js +280 -0
- package/dist/provision/resolvePaymentsConfig.d.ts +48 -0
- package/dist/provision/resolvePaymentsConfig.d.ts.map +1 -0
- package/dist/provision/resolvePaymentsConfig.js +41 -0
- package/dist/rails/apple/certs.d.ts +7 -0
- package/dist/rails/apple/certs.d.ts.map +1 -0
- package/dist/rails/apple/certs.js +8 -0
- package/dist/rails/apple/der.d.ts +107 -0
- package/dist/rails/apple/der.d.ts.map +1 -0
- package/dist/rails/apple/der.js +217 -0
- package/dist/rails/apple/fixtures/chain.d.ts +117 -0
- package/dist/rails/apple/fixtures/chain.d.ts.map +1 -0
- package/dist/rails/apple/fixtures/chain.js +289 -0
- package/dist/rails/apple/http.d.ts +74 -0
- package/dist/rails/apple/http.d.ts.map +1 -0
- package/dist/rails/apple/http.js +32 -0
- package/dist/rails/apple/jws.d.ts +17 -0
- package/dist/rails/apple/jws.d.ts.map +1 -0
- package/dist/rails/apple/jws.js +75 -0
- package/dist/rails/apple/notification.d.ts +116 -0
- package/dist/rails/apple/notification.d.ts.map +1 -0
- package/dist/rails/apple/notification.js +199 -0
- package/dist/rails/apple/rail.d.ts +25 -0
- package/dist/rails/apple/rail.d.ts.map +1 -0
- package/dist/rails/apple/rail.js +68 -0
- package/dist/rails/apple/serverApi.d.ts +120 -0
- package/dist/rails/apple/serverApi.d.ts.map +1 -0
- package/dist/rails/apple/serverApi.js +244 -0
- package/dist/rails/apple/verify.d.ts +36 -0
- package/dist/rails/apple/verify.d.ts.map +1 -0
- package/dist/rails/apple/verify.js +46 -0
- package/dist/rails/apple/x509.d.ts +85 -0
- package/dist/rails/apple/x509.d.ts.map +1 -0
- package/dist/rails/apple/x509.js +273 -0
- package/dist/rails/contract.d.ts +871 -0
- package/dist/rails/contract.d.ts.map +1 -0
- package/dist/rails/contract.js +60 -0
- package/dist/rails/google/fixtures/push.d.ts +71 -0
- package/dist/rails/google/fixtures/push.d.ts.map +1 -0
- package/dist/rails/google/fixtures/push.js +107 -0
- package/dist/rails/google/http.d.ts +77 -0
- package/dist/rails/google/http.d.ts.map +1 -0
- package/dist/rails/google/http.js +39 -0
- package/dist/rails/google/jwt.d.ts +53 -0
- package/dist/rails/google/jwt.d.ts.map +1 -0
- package/dist/rails/google/jwt.js +94 -0
- package/dist/rails/google/oidc.d.ts +112 -0
- package/dist/rails/google/oidc.d.ts.map +1 -0
- package/dist/rails/google/oidc.js +179 -0
- package/dist/rails/google/playApi.d.ts +188 -0
- package/dist/rails/google/playApi.d.ts.map +1 -0
- package/dist/rails/google/playApi.js +350 -0
- package/dist/rails/google/rail.d.ts +57 -0
- package/dist/rails/google/rail.d.ts.map +1 -0
- package/dist/rails/google/rail.js +70 -0
- package/dist/rails/google/rtdn.d.ts +105 -0
- package/dist/rails/google/rtdn.d.ts.map +1 -0
- package/dist/rails/google/rtdn.js +179 -0
- package/dist/rails/google/verify.d.ts +20 -0
- package/dist/rails/google/verify.d.ts.map +1 -0
- package/dist/rails/google/verify.js +76 -0
- package/dist/rails/lemonSqueezy/api.d.ts +92 -0
- package/dist/rails/lemonSqueezy/api.d.ts.map +1 -0
- package/dist/rails/lemonSqueezy/api.js +121 -0
- package/dist/rails/lemonSqueezy/checkout.d.ts +52 -0
- package/dist/rails/lemonSqueezy/checkout.d.ts.map +1 -0
- package/dist/rails/lemonSqueezy/checkout.js +84 -0
- package/dist/rails/lemonSqueezy/discounts.d.ts +50 -0
- package/dist/rails/lemonSqueezy/discounts.d.ts.map +1 -0
- package/dist/rails/lemonSqueezy/discounts.js +75 -0
- package/dist/rails/lemonSqueezy/fixtures/events.d.ts +56 -0
- package/dist/rails/lemonSqueezy/fixtures/events.d.ts.map +1 -0
- package/dist/rails/lemonSqueezy/fixtures/events.js +144 -0
- package/dist/rails/lemonSqueezy/objects.d.ts +229 -0
- package/dist/rails/lemonSqueezy/objects.d.ts.map +1 -0
- package/dist/rails/lemonSqueezy/objects.js +379 -0
- package/dist/rails/lemonSqueezy/portal.d.ts +35 -0
- package/dist/rails/lemonSqueezy/portal.d.ts.map +1 -0
- package/dist/rails/lemonSqueezy/portal.js +18 -0
- package/dist/rails/lemonSqueezy/pricing.d.ts +25 -0
- package/dist/rails/lemonSqueezy/pricing.d.ts.map +1 -0
- package/dist/rails/lemonSqueezy/pricing.js +54 -0
- package/dist/rails/lemonSqueezy/rail.d.ts +41 -0
- package/dist/rails/lemonSqueezy/rail.d.ts.map +1 -0
- package/dist/rails/lemonSqueezy/rail.js +67 -0
- package/dist/rails/lemonSqueezy/read.d.ts +28 -0
- package/dist/rails/lemonSqueezy/read.d.ts.map +1 -0
- package/dist/rails/lemonSqueezy/read.js +37 -0
- package/dist/rails/lemonSqueezy/refresh.d.ts +42 -0
- package/dist/rails/lemonSqueezy/refresh.d.ts.map +1 -0
- package/dist/rails/lemonSqueezy/refresh.js +40 -0
- package/dist/rails/lemonSqueezy/signature.d.ts +56 -0
- package/dist/rails/lemonSqueezy/signature.d.ts.map +1 -0
- package/dist/rails/lemonSqueezy/signature.js +92 -0
- package/dist/rails/lemonSqueezy/verify.d.ts +33 -0
- package/dist/rails/lemonSqueezy/verify.d.ts.map +1 -0
- package/dist/rails/lemonSqueezy/verify.js +41 -0
- package/dist/rails/lemonSqueezy/webhook.d.ts +53 -0
- package/dist/rails/lemonSqueezy/webhook.d.ts.map +1 -0
- package/dist/rails/lemonSqueezy/webhook.js +179 -0
- package/dist/rails/paddle/adjustments.d.ts +60 -0
- package/dist/rails/paddle/adjustments.d.ts.map +1 -0
- package/dist/rails/paddle/adjustments.js +66 -0
- package/dist/rails/paddle/api.d.ts +138 -0
- package/dist/rails/paddle/api.d.ts.map +1 -0
- package/dist/rails/paddle/api.js +152 -0
- package/dist/rails/paddle/checkout.d.ts +69 -0
- package/dist/rails/paddle/checkout.d.ts.map +1 -0
- package/dist/rails/paddle/checkout.js +100 -0
- package/dist/rails/paddle/discounts.d.ts +67 -0
- package/dist/rails/paddle/discounts.d.ts.map +1 -0
- package/dist/rails/paddle/discounts.js +73 -0
- package/dist/rails/paddle/events.d.ts +140 -0
- package/dist/rails/paddle/events.d.ts.map +1 -0
- package/dist/rails/paddle/events.js +183 -0
- package/dist/rails/paddle/fixtures/browserForged.d.ts +42 -0
- package/dist/rails/paddle/fixtures/browserForged.d.ts.map +1 -0
- package/dist/rails/paddle/fixtures/browserForged.js +52 -0
- package/dist/rails/paddle/fixtures/pausedSubscription.d.ts +78 -0
- package/dist/rails/paddle/fixtures/pausedSubscription.d.ts.map +1 -0
- package/dist/rails/paddle/fixtures/pausedSubscription.js +76 -0
- package/dist/rails/paddle/objects.d.ts +519 -0
- package/dist/rails/paddle/objects.d.ts.map +1 -0
- package/dist/rails/paddle/objects.js +588 -0
- package/dist/rails/paddle/portal.d.ts +45 -0
- package/dist/rails/paddle/portal.d.ts.map +1 -0
- package/dist/rails/paddle/portal.js +42 -0
- package/dist/rails/paddle/rail.d.ts +55 -0
- package/dist/rails/paddle/rail.d.ts.map +1 -0
- package/dist/rails/paddle/rail.js +117 -0
- package/dist/rails/paddle/read.d.ts +53 -0
- package/dist/rails/paddle/read.d.ts.map +1 -0
- package/dist/rails/paddle/read.js +66 -0
- package/dist/rails/paddle/recorded.d.ts +49 -0
- package/dist/rails/paddle/recorded.d.ts.map +1 -0
- package/dist/rails/paddle/recorded.js +79 -0
- package/dist/rails/paddle/refresh.d.ts +54 -0
- package/dist/rails/paddle/refresh.d.ts.map +1 -0
- package/dist/rails/paddle/refresh.js +94 -0
- package/dist/rails/paddle/refund.d.ts +82 -0
- package/dist/rails/paddle/refund.d.ts.map +1 -0
- package/dist/rails/paddle/refund.js +175 -0
- package/dist/rails/paddle/signature.d.ts +83 -0
- package/dist/rails/paddle/signature.d.ts.map +1 -0
- package/dist/rails/paddle/signature.js +163 -0
- package/dist/rails/paddle/subscription.d.ts +137 -0
- package/dist/rails/paddle/subscription.d.ts.map +1 -0
- package/dist/rails/paddle/subscription.js +538 -0
- package/dist/rails/paddle/verify.d.ts +46 -0
- package/dist/rails/paddle/verify.d.ts.map +1 -0
- package/dist/rails/paddle/verify.js +43 -0
- package/dist/rails/paddle/webhook.d.ts +98 -0
- package/dist/rails/paddle/webhook.d.ts.map +1 -0
- package/dist/rails/paddle/webhook.js +181 -0
- package/dist/rails/providers.d.ts +73 -0
- package/dist/rails/providers.d.ts.map +1 -0
- package/dist/rails/providers.js +62 -0
- package/dist/rails/stripe/api.d.ts +118 -0
- package/dist/rails/stripe/api.d.ts.map +1 -0
- package/dist/rails/stripe/api.js +153 -0
- package/dist/rails/stripe/checkout.d.ts +60 -0
- package/dist/rails/stripe/checkout.d.ts.map +1 -0
- package/dist/rails/stripe/checkout.js +86 -0
- package/dist/rails/stripe/discounts.d.ts +50 -0
- package/dist/rails/stripe/discounts.d.ts.map +1 -0
- package/dist/rails/stripe/discounts.js +87 -0
- package/dist/rails/stripe/fixtures/events.d.ts +64 -0
- package/dist/rails/stripe/fixtures/events.d.ts.map +1 -0
- package/dist/rails/stripe/fixtures/events.js +67 -0
- package/dist/rails/stripe/objects.d.ts +237 -0
- package/dist/rails/stripe/objects.d.ts.map +1 -0
- package/dist/rails/stripe/objects.js +389 -0
- package/dist/rails/stripe/portal.d.ts +29 -0
- package/dist/rails/stripe/portal.d.ts.map +1 -0
- package/dist/rails/stripe/portal.js +41 -0
- package/dist/rails/stripe/pricing.d.ts +25 -0
- package/dist/rails/stripe/pricing.d.ts.map +1 -0
- package/dist/rails/stripe/pricing.js +68 -0
- package/dist/rails/stripe/rail.d.ts +28 -0
- package/dist/rails/stripe/rail.d.ts.map +1 -0
- package/dist/rails/stripe/rail.js +81 -0
- package/dist/rails/stripe/refresh.d.ts +33 -0
- package/dist/rails/stripe/refresh.d.ts.map +1 -0
- package/dist/rails/stripe/refresh.js +21 -0
- package/dist/rails/stripe/signature.d.ts +71 -0
- package/dist/rails/stripe/signature.d.ts.map +1 -0
- package/dist/rails/stripe/signature.js +92 -0
- package/dist/rails/stripe/verify.d.ts +15 -0
- package/dist/rails/stripe/verify.d.ts.map +1 -0
- package/dist/rails/stripe/verify.js +63 -0
- package/dist/rails/stripe/webhook.d.ts +26 -0
- package/dist/rails/stripe/webhook.d.ts.map +1 -0
- package/dist/rails/stripe/webhook.js +31 -0
- package/dist/secret/registry.d.ts +192 -0
- package/dist/secret/registry.d.ts.map +1 -0
- package/dist/secret/registry.js +154 -0
- package/dist/seeds/example.d.ts +3 -0
- package/dist/seeds/example.d.ts.map +1 -0
- package/dist/seeds/example.js +171 -0
- package/dist/version.generated.d.ts +5 -0
- package/dist/version.generated.d.ts.map +1 -0
- package/dist/version.generated.js +7 -0
- package/dist/workflows/paddleSweep.d.ts +175 -0
- package/dist/workflows/paddleSweep.d.ts.map +1 -0
- package/dist/workflows/paddleSweep.js +433 -0
- package/dist/workflows/railAccess.d.ts +48 -0
- package/dist/workflows/railAccess.d.ts.map +1 -0
- package/dist/workflows/railAccess.js +36 -0
- package/dist/workflows/reconcile.d.ts +161 -0
- package/dist/workflows/reconcile.d.ts.map +1 -0
- package/dist/workflows/reconcile.js +352 -0
- package/dist/workflows/report.d.ts +28 -0
- package/dist/workflows/report.d.ts.map +1 -0
- package/dist/workflows/report.js +54 -0
- package/dist/workflows/retryPolicy.d.ts +29 -0
- package/dist/workflows/retryPolicy.d.ts.map +1 -0
- package/dist/workflows/retryPolicy.js +37 -0
- package/dist/workflows/specs.d.ts +102 -0
- package/dist/workflows/specs.d.ts.map +1 -0
- package/dist/workflows/specs.js +84 -0
- package/dist/workflows/worker.d.ts +62 -0
- package/dist/workflows/worker.d.ts.map +1 -0
- package/dist/workflows/worker.js +92 -0
- package/dist/workflows/workerConfig.d.ts +46 -0
- package/dist/workflows/workerConfig.d.ts.map +1 -0
- package/dist/workflows/workerConfig.js +38 -0
- package/package.json +22 -13
- package/pithy.manifest.json +19 -13
- package/src/version.generated.ts +1 -1
- package/src/client/paddlePrices.iife.ts +0 -43
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import type { D1Database } from "@cloudflare/workers-types";
|
|
2
|
+
import type { PithyHonoEnv } from "@pithy-sh/core/src/capability/capability";
|
|
3
|
+
import type { Hono } from "hono";
|
|
4
|
+
import { type PaymentsConfig } from "../config/config";
|
|
5
|
+
import { PaymentsPurchase } from "../data/purchase";
|
|
6
|
+
import { type PaymentsSubject } from "../data/subject";
|
|
7
|
+
import { type PaymentsSubjectSeam } from "../entitlement/subjectSeam";
|
|
8
|
+
import { type RailTrustOptions } from "../rails/providers";
|
|
9
|
+
/**
|
|
10
|
+
* The payments routes, their declared verification strategies, and what each accepts.
|
|
11
|
+
*
|
|
12
|
+
* **This list is prose, and it had rotted.** It named sixteen of the twenty-one routes mounted before #465 —
|
|
13
|
+
* `GET /pricing`, two webhook rails and both discount routes had landed without a line here — which is the
|
|
14
|
+
* same failure the README's Routes table had before a gate held it, and for the same reason: a list that is
|
|
15
|
+
* merely *near* the code is a list nothing compares. It was brought level with the registrations as part of
|
|
16
|
+
* #465 and every mounted route is below, but **nothing holds it there**: the gated inventories are the
|
|
17
|
+
* README's Routes table and the `mountedRoutes` pin in `routeContract.test.ts`, checked in both directions
|
|
18
|
+
* against the real registrations. Read those as the record; edit this one by hand and expect it to rot again.
|
|
19
|
+
*
|
|
20
|
+
* POST /payments/purchases → verify a receipt, project it (bearer | session) json: PurchaseSubmission
|
|
21
|
+
* GET /payments/entitlements → the caller's entitlements (bearer | session) —
|
|
22
|
+
* POST /payments/restore → rebind store history (bearer | session) json: RestoreRequest
|
|
23
|
+
* GET /payments/pricing → what the caller's subscription pays, and when that changes
|
|
24
|
+
* (bearer | session) —
|
|
25
|
+
* POST /payments/checkout → a hosted checkout, on whichever rail sells the product
|
|
26
|
+
* (bearer | session) json: CheckoutRequest
|
|
27
|
+
* POST /payments/portal → a billing-portal session (bearer | session) —
|
|
28
|
+
* GET /payments/subscription → where the caller's subscription stands, read live
|
|
29
|
+
* (bearer | session) —
|
|
30
|
+
* POST /payments/subscription/preview → what a move would cost (bearer | session) json: SubscriptionPreviewRequest
|
|
31
|
+
* POST /payments/subscription/change → move it onto a catalog product (bearer | session) json: SubscriptionChangeRequest
|
|
32
|
+
* POST /payments/subscription/cancel → stop it renewing (bearer | session) json: SubscriptionCancelRequest
|
|
33
|
+
* POST /payments/subscription/keep → withdraw a scheduled cancel (bearer | session) —
|
|
34
|
+
* POST /payments/subscription/refund → ask for its payments back (bearer | session) —
|
|
35
|
+
* POST /payments/webhooks/apple → ASSN V2 (signed-webhook) json: AppleWebhookNotification
|
|
36
|
+
* POST /payments/webhooks/google → Play RTDN via Pub/Sub push (signed-webhook) json: GoogleWebhookNotification
|
|
37
|
+
* POST /payments/webhooks/stripe → Stripe events (signed-webhook) json: StripeWebhookNotification
|
|
38
|
+
* POST /payments/webhooks/lemon-squeezy → Lemon Squeezy events (signed-webhook) json: LemonSqueezyWebhookNotification
|
|
39
|
+
* POST /payments/webhooks/paddle → Paddle events (signed-webhook) json: PaddleWebhookNotification
|
|
40
|
+
* POST /payments/entitlements/grant → comp or repair an entitlement (control-plane) json: EntitlementGrantRequest
|
|
41
|
+
* POST /payments/entitlements/revoke → take one back (control-plane) json: EntitlementRevokeRequest
|
|
42
|
+
*
|
|
43
|
+
* GET /payments/admin/catalog → what this project sells (control-plane: payments:catalog:read) —
|
|
44
|
+
* GET /payments/admin/purchases → the purchase log, paged (control-plane: payments:purchases:read) query: AdminPurchasesQuery
|
|
45
|
+
* GET /payments/admin/subscriptions → the purchases that renew (control-plane: payments:subscriptions:read) query: AdminSubscriptionsQuery
|
|
46
|
+
* GET /payments/admin/entitlements → the entitlement model, paged (control-plane: payments:entitlements:read) query: AdminEntitlementsQuery
|
|
47
|
+
* GET /payments/admin/entitlements/:subjectType/:subjectId
|
|
48
|
+
* → one subject's entitlements (control-plane: payments:entitlements:read) param: AdminSubjectParam
|
|
49
|
+
* GET /payments/admin/reconcile-runs → the reconciliation run log (control-plane: payments:reconcile:read) query: AdminReconcileRunsQuery
|
|
50
|
+
* GET /payments/admin/discounts → the codes this project issued (control-plane: payments:discounts:read) query: AdminDiscountsQuery
|
|
51
|
+
* POST /payments/admin/discounts → mint one at a store (control-plane: payments:discounts:create) json: DiscountCreateRequest
|
|
52
|
+
*
|
|
53
|
+
* **The reads exist because the writes did.** Payments shipped `entitlements/grant` and
|
|
54
|
+
* `entitlements/revoke` with no read beside them, so a management client could comp an entitlement and take
|
|
55
|
+
* one back and could never list one — and a dashboard's Purchases, Entitlements and Subscriptions panes
|
|
56
|
+
* computed *absent* against a live manifest and dropped out of the rail entirely. Not blocked, not refused:
|
|
57
|
+
* absent, which no grant and no seed can repair, because there was no route to grant a scope to (#247).
|
|
58
|
+
*
|
|
59
|
+
* **They sit under `admin/` because the player surface owns the bare paths.** `GET ${base}/entitlements` is
|
|
60
|
+
* already a bearer route reading the caller's own; a control-plane read at the same address would sit behind
|
|
61
|
+
* whichever Hono matched first, with a route's gate decided by registration order. The extra segment makes
|
|
62
|
+
* the two sets disjoint by construction.
|
|
63
|
+
*
|
|
64
|
+
* **One `POST` among them, and it is the exception that states the rule.** Every `admin/` route is a read
|
|
65
|
+
* except `POST ${base}/admin/discounts`, which mints a code at a store — a write with a cost attached, so it
|
|
66
|
+
* carries its own scope, `payments:discounts:create`, granted separately from the `payments:discounts:read`
|
|
67
|
+
* on the listing beside it, and its own audit event. The three writes this capability offers a management
|
|
68
|
+
* client are grant, revoke and mint; each is separately scoped, and nothing here widens any of them.
|
|
69
|
+
*
|
|
70
|
+
* That one path serving two methods is also why `routeContract.test.ts` pins `METHOD /path` rather than the
|
|
71
|
+
* path: a `POST ${base}/admin/purchases` mounted beside the read would be a write nobody declared, sitting
|
|
72
|
+
* on a path the pin already contained.
|
|
73
|
+
*
|
|
74
|
+
* **The two control-plane routes are the only way an entitlement appears without money moving**, and that is
|
|
75
|
+
* the whole reason they are gated the way they are. Each wears core's `requireControlPlane()` and nothing
|
|
76
|
+
* else: an EdDSA-signed token on the `pithy-control-plane` header, verified against a public key the adopter
|
|
77
|
+
* registered, bound to one connection, one environment, one request body and one use — and carrying the single
|
|
78
|
+
* scope that route needs, `payments:entitlements:grant` or `payments:entitlements:revoke`. The two are granted
|
|
79
|
+
* separately, so a refund tool cannot comp and a comp tool cannot revoke.
|
|
80
|
+
*
|
|
81
|
+
* **`requireAuth()` is deliberately absent from those two lines, and adding it would break them.** A
|
|
82
|
+
* management client is not a user of this app; the seam never populates `c.var.auth`, precisely so that a
|
|
83
|
+
* control-plane credential cannot satisfy an ordinary `requireAuth()` anywhere in the tree. An auth gate here
|
|
84
|
+
* would deny every legitimate management call and no credential could fix it. With the seam not composed at
|
|
85
|
+
* all the gate raises `controlplane/not_connected`, so the routes are shut rather than open. Both writes are
|
|
86
|
+
* audited to the management client, because the trail is the only record of who decided an account should have
|
|
87
|
+
* something nobody paid for.
|
|
88
|
+
*
|
|
89
|
+
* `POST /payments/purchases` and `/restore` serve every rail with no branch of their own: the rail a caller names
|
|
90
|
+
* selects a verifier through `resolveRailProvider`, and everything past that point is the normalized event. A
|
|
91
|
+
* rail arriving is one entry in `rails/providers.ts`, not a case in a handler.
|
|
92
|
+
*
|
|
93
|
+
* **No `public` routes, ever.** Every caller is either an authenticated user acting on their own purchases or a
|
|
94
|
+
* machine proving authenticity. Turnstile has nothing to gate here.
|
|
95
|
+
*
|
|
96
|
+
* **`signed-webhook` is one strategy over three unrelated mechanisms** — Apple signs a JWS against its
|
|
97
|
+
* certificate chain, Google's Pub/Sub push carries an OIDC token verified with an audience check, Stripe sends
|
|
98
|
+
* an HMAC. Each has its own verifier, which is why these are literal routes rather than one `:rail`: a single
|
|
99
|
+
* route line could not carry three of them, and the rail a caller *claims* is not something to route on.
|
|
100
|
+
*
|
|
101
|
+
* **`/checkout` and `/portal` are Stripe's alone, and they are not a fourth strategy.** Apple and Google
|
|
102
|
+
* purchases happen inside a store SDK before the server hears of them, so there is no session for Pithy to
|
|
103
|
+
* create; Stripe's are ones Pithy initiates. The routes narrow to {@link CheckoutRail} rather than branching on
|
|
104
|
+
* the rail name, so a rail is never asked for something it does not do — and with Stripe off they raise
|
|
105
|
+
* `payments/rail_not_configured`, which reads as "that payment method is not available here" rather than as a
|
|
106
|
+
* broken endpoint.
|
|
107
|
+
*
|
|
108
|
+
* **The five subscription routes are one surface with one rule: nothing a caller sends names anything.**
|
|
109
|
+
* The subscription comes from that caller's own purchase rows, the rail from the row it found, and the
|
|
110
|
+
* store's price from the catalog by logical product id. A body-named subscription moves somebody else's — a
|
|
111
|
+
* claim this capability could not check, because it holds no members table by design — and a body-named
|
|
112
|
+
* price moves a customer onto a plan this project does not sell, at a price it did not set. Neither is
|
|
113
|
+
* refused by a check; both are unreachable because there is nowhere to write them.
|
|
114
|
+
*
|
|
115
|
+
* **The read shipped before the four verbs, deliberately and in its own step.** `GET ${base}/subscription`
|
|
116
|
+
* is the answer to the #247 paragraph below, applied before the mistake could repeat: a capability that can
|
|
117
|
+
* cancel a subscription and cannot report the cancellation ships the half that creates the support ticket,
|
|
118
|
+
* and Paddle leaves `status` at `active` with a blank next billing date when one is scheduled.
|
|
119
|
+
*
|
|
120
|
+
* **None of the four writes touches the projection.** The webhook owns the purchase row; a route that wrote
|
|
121
|
+
* it too would be a second producer of one row, and the two disagree the first time a webhook is late. So
|
|
122
|
+
* each verb answers the *store's* own report of where the subscription now stands, rather than a prediction
|
|
123
|
+
* of it — a prediction is how a customer sees a plan they are not on.
|
|
124
|
+
*
|
|
125
|
+
* **Validators sit after the guards on every route line.** A validator ahead of a guard turns a 401 into a 400
|
|
126
|
+
* and tells an unauthenticated caller which of its requests were well-formed. Config-backed resolution stays in
|
|
127
|
+
* the handler and raises its own domain 404 — a schema constrains a string, it never replaces a lookup.
|
|
128
|
+
*
|
|
129
|
+
* ## What the handlers never trust
|
|
130
|
+
*
|
|
131
|
+
* The **product** comes from the verified payload's SKU, never from the request. A client-supplied product id
|
|
132
|
+
* would let a caller present a cheap receipt as an expensive product. The **owner** comes from the subject
|
|
133
|
+
* seam on the authed routes and from the provider-account map on the webhook, never from a body. The
|
|
134
|
+
* **environment** comes from this deployment's own `ENVIRONMENT` var, never from the payload: inferring it
|
|
135
|
+
* from what the store said is exactly what lets a sandbox purchase grant a real entitlement.
|
|
136
|
+
*
|
|
137
|
+
* ## Who a request is about: one question, one implementation
|
|
138
|
+
*
|
|
139
|
+
* Every route here that touches a holder asks the subject seam, and asks it in one of exactly two ways.
|
|
140
|
+
* A **read** calls {@link resolvePaymentsSubject}: nobody resolved is an empty or denied read, never a 500 and
|
|
141
|
+
* never a guess, because a gate that resolved *something* when it could not tell who was asking would hand one
|
|
142
|
+
* holder's plan to whoever asked next. A **write** calls {@link requirePaymentsSubject}, which refuses with
|
|
143
|
+
* `payments/subject_unresolved` (403): a purchase, a restore, a checkout and a portal session each need a row
|
|
144
|
+
* key, and a guessed key attributes real money to the wrong holder.
|
|
145
|
+
*
|
|
146
|
+
* **Nothing here falls back to `c.var.auth.userId`, in either mode.** Under `billingSubject: "user"` the
|
|
147
|
+
* fallback would be identical to the seam's own default and would therefore look harmless; under
|
|
148
|
+
* `"organization"` it would silently key a company's subscription to whichever employee happened to be signed
|
|
149
|
+
* in. One expression, in `entitlement/subjectSeam.ts`, is what keeps the gate and the routes answering the
|
|
150
|
+
* same question — a second copy is a second policy, and the two disagree the day one of them is edited.
|
|
151
|
+
*
|
|
152
|
+
* **No player-facing request names a subject, and no player-facing response publishes one.** A body or a query
|
|
153
|
+
* that could name a holder is a body that could name somebody else's, and this capability has nothing to check
|
|
154
|
+
* that claim against: it has no members table, by design. The control-plane surfaces are the deliberate
|
|
155
|
+
* exception, and the exception is the feature — support acting on another holder's account is what they are
|
|
156
|
+
* for, which is why each sits behind a default-denied scoped credential and is audited. `schemas.ts` states
|
|
157
|
+
* the same rule from the request side, and `routeContract.test.ts` asserts it as a property over every schema
|
|
158
|
+
* and every response this capability declares, rather than route by route.
|
|
159
|
+
*/
|
|
160
|
+
export interface PaymentsRoutesOptions {
|
|
161
|
+
/** The resolved catalog. */
|
|
162
|
+
config: PaymentsConfig;
|
|
163
|
+
/** Where the routes mount. Defaults to the config's own `basePath`. */
|
|
164
|
+
basePath?: string;
|
|
165
|
+
/** The clock. Injected so verification windows and stored timestamps are deterministic in tests. */
|
|
166
|
+
now?: () => Date;
|
|
167
|
+
/**
|
|
168
|
+
* Certificate roots to accept *in addition to* each rail's pinned ones. Absent in production, and additive
|
|
169
|
+
* only — no caller can narrow the trust set. See {@link RailTrustOptions} for the two callers that need it.
|
|
170
|
+
*/
|
|
171
|
+
trust?: RailTrustOptions;
|
|
172
|
+
/**
|
|
173
|
+
* Which subject a caller is acting for: the mode, and the adopter's resolver. See
|
|
174
|
+
* `entitlement/subjectSeam.ts`.
|
|
175
|
+
*
|
|
176
|
+
* **Handed in whole rather than assembled here**, because `payments()` builds exactly one of these and
|
|
177
|
+
* gives the same object to the entitlement middleware and to these routes. Two constructions are two
|
|
178
|
+
* policies, and the two disagree the day one of them is edited.
|
|
179
|
+
*
|
|
180
|
+
* **The resolver rides on this rather than on `PaymentsConfig`, and that is a hard constraint rather than a
|
|
181
|
+
* preference.** `provision/resolvePaymentsConfig.ts` serializes the resolved config into the
|
|
182
|
+
* `PAYMENTS_CONFIG` var and `workflows/worker.ts` parses it back, so a function cannot survive the round
|
|
183
|
+
* trip. The serializable half of the decision — `billingSubject`, which mode this project bills in — is
|
|
184
|
+
* config; the callable half is a composition-time option.
|
|
185
|
+
*
|
|
186
|
+
* The consequence is worth stating out loud: **a Workflow runs with no adopter resolver.** The reconcile and
|
|
187
|
+
* Paddle sweep hosts parse the config and never see this, so anything in them needing a holder reads it from
|
|
188
|
+
* the stored row that already carries the pair, and never from the seam.
|
|
189
|
+
*
|
|
190
|
+
* Omitted means the config's own mode with no adopter resolver — the authenticated caller under
|
|
191
|
+
* `billingSubject: "user"`, and nobody at all under `"organization"`. The default is the *same* derivation
|
|
192
|
+
* `payments()` makes for a project that supplies none, never a different one, and `payments()` refuses to
|
|
193
|
+
* compose organization billing without a resolver rather than reaching this state.
|
|
194
|
+
*/
|
|
195
|
+
subject?: PaymentsSubjectSeam;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Which subscription a change verb may act on — none, exactly one, or more than one.
|
|
199
|
+
*
|
|
200
|
+
* **A discriminated answer rather than `PaymentsPurchase | undefined`**, because the three cases are three
|
|
201
|
+
* different sentences to a caller: nothing to change, here it is, and *this server will not choose for you*.
|
|
202
|
+
* Collapsing the last into either of the others is the defect this whole helper exists to make impossible —
|
|
203
|
+
* silently picking one of two live subscriptions moves a plan the customer did not name.
|
|
204
|
+
*/
|
|
205
|
+
export type SubscriptionTarget = {
|
|
206
|
+
/** The caller holds no subscription this server can act on. */
|
|
207
|
+
found: "none";
|
|
208
|
+
} | {
|
|
209
|
+
/** Exactly one, and it is theirs. */
|
|
210
|
+
found: "one";
|
|
211
|
+
/** The row a {@link SubscriptionRail} is handed. The whole row — see `SubscriptionChangeInput.purchase`. */
|
|
212
|
+
purchase: PaymentsPurchase;
|
|
213
|
+
} | {
|
|
214
|
+
/** More than one, so no verb can proceed without being told which. */
|
|
215
|
+
found: "many";
|
|
216
|
+
/** Every candidate, newest event first — so a refusal can say how many and on which rails. */
|
|
217
|
+
purchases: readonly PaymentsPurchase[];
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* The one subscription this subject may change, cancel or keep — resolved from their own rows, never from a
|
|
221
|
+
* request.
|
|
222
|
+
*
|
|
223
|
+
* ## Why neither existing answer was reusable
|
|
224
|
+
*
|
|
225
|
+
* `ownSubscriptionIds` returns *every* subscription row a subject holds, at any status, and that is right for
|
|
226
|
+
* what it feeds: a portal request hands the whole list to Paddle, which sorts out which are live. A write
|
|
227
|
+
* verb cannot hand a list to anything — it needs one — and expired, refunded and superseded rows are all in
|
|
228
|
+
* that list.
|
|
229
|
+
*
|
|
230
|
+
* `GET {base}/pricing` takes `rows.find(r => r.role === "state") ?? rows[0]` from an unfiltered, time-ordered
|
|
231
|
+
* read. Two things are wrong with that here. The order is not a filter, so the newest row of a holder who
|
|
232
|
+
* canceled a year ago is still a year-old cancellation; and `?? rows[0]` can land on a money row, whose
|
|
233
|
+
* `providerTransactionId` is Paddle's `txn_…` rather than a `sub_…`. Pricing survives it because
|
|
234
|
+
* `readPricing` answers `undefined` for a row it cannot address. A cancel verb would not: it would ask a
|
|
235
|
+
* store to end a subscription by a transaction id, and the useful outcome is the one where that fails.
|
|
236
|
+
*
|
|
237
|
+
* ## The three rules
|
|
238
|
+
*
|
|
239
|
+
* **One: the head row, never a period of it.** A subscription's money rows carry the family in
|
|
240
|
+
* `originalTransactionId` and their own invoice or transaction id in `providerTransactionId`; the row that
|
|
241
|
+
* *is* the subscription carries the same value in both — Paddle's and Lemon Squeezy's state builders say so
|
|
242
|
+
* at the field, and it is what `subscriptionIdOf` relies on when it demands a `sub_` prefix. So the predicate
|
|
243
|
+
* is `originalTransactionId = providerTransactionId`, compared in SQL, which also excludes a one-off (whose
|
|
244
|
+
* family is null, and `null = anything` is not true) without a second clause. It is structural rather than a
|
|
245
|
+
* prefix test, so it needs no edit when a rail is added — and a rail whose rows never satisfy it resolves to
|
|
246
|
+
* `none`, which is an honest "there is nothing here this server can change" rather than a wrong row handed
|
|
247
|
+
* to a store.
|
|
248
|
+
*
|
|
249
|
+
* `UNIQUE (rail, providerTransactionId)` then does the rest of the work: a family has at most one head row,
|
|
250
|
+
* so surviving rows are subscriptions one-for-one and there is no de-duplication to get wrong.
|
|
251
|
+
*
|
|
252
|
+
* **Two: a cancellation whose period has run out is over.** `canceled` is in the actionable set because the
|
|
253
|
+
* holder still has what they paid for — but only until `expiresAt`, and the `expired` webhook that would
|
|
254
|
+
* overwrite the row can be late or dropped. Without this, every resubscriber is permanently ambiguous:
|
|
255
|
+
* their old, dead cancellation competes with the subscription they are currently paying for, and they are
|
|
256
|
+
* locked out of managing it. The check is deliberately **only** on `canceled`, because that is the one
|
|
257
|
+
* status whose `expiresAt` is a final date the store has already committed to. On every other actionable
|
|
258
|
+
* status the date is a rolling period end that each renewal moves, and dropping a row on it would tell a
|
|
259
|
+
* paying customer they have no subscription for as long as one renewal webhook is late.
|
|
260
|
+
*
|
|
261
|
+
* **Three: both halves of the subject, always.** `user:acme` and `organization:acme` are two holders and
|
|
262
|
+
* nothing in the kit keeps the id namespaces disjoint, so an id-only filter would let either act on the
|
|
263
|
+
* other's subscription. The pair arrives resolved from the seam, under whichever mode the project bills in.
|
|
264
|
+
*
|
|
265
|
+
* @param d1 The purchases database.
|
|
266
|
+
* @param subject The holder, as the subject seam resolved them — both halves.
|
|
267
|
+
* @param now The clock, for rule two. Passed rather than read, so a test can stand either side of an expiry.
|
|
268
|
+
*/
|
|
269
|
+
export declare function changeableSubscription(d1: D1Database, subject: PaymentsSubject, now: Date): Promise<SubscriptionTarget>;
|
|
270
|
+
/**
|
|
271
|
+
* Every payment made on one subscription, as this holder's own rows record them — what a refund acts on.
|
|
272
|
+
*
|
|
273
|
+
* ## Why a refund needs a different query from every other verb
|
|
274
|
+
*
|
|
275
|
+
* The other four act on the subscription, and {@link changeableSubscription} resolves *the* row that is one.
|
|
276
|
+
* A refund cannot: **no store refunds a subscription.** Every refund attaches to a transaction, and a
|
|
277
|
+
* subscription is a family of them — so this returns the money rows, which is a set, and the caller raises
|
|
278
|
+
* one refund each.
|
|
279
|
+
*
|
|
280
|
+
* The set is ordinary rather than exotic. A customer who joined on Solo at 6.00, upgraded to Team on day 10
|
|
281
|
+
* for a 65.82 proration and cancels on day 13 has paid twice. An adopter whose policy gives them their money
|
|
282
|
+
* back owes both, and a query returning one would quietly keep 65.82 of somebody's money.
|
|
283
|
+
*
|
|
284
|
+
* ## The three rules
|
|
285
|
+
*
|
|
286
|
+
* **One: money rows only, stated twice.** `role = 'charge'` is the discriminator Lemon Squeezy forced into
|
|
287
|
+
* existence, and the second clause — `providerTransactionId <> originalTransactionId` — is the structural
|
|
288
|
+
* form of the same statement for the rails that write `charge` for everything: the row that *is* the
|
|
289
|
+
* subscription carries its family key in both columns. Either alone is right on some rail and wrong on
|
|
290
|
+
* another, and what they exclude is the head row, whose provider id is a `sub_…`. Sending that to a store is
|
|
291
|
+
* asking it to refund a subscription, which is not a thing it can do.
|
|
292
|
+
*
|
|
293
|
+
* **Two: both halves of the subject, always.** `user:acme` and `organization:acme` are two holders and
|
|
294
|
+
* nothing keeps the id namespaces disjoint, so an id-only filter would refund one holder's payments on the
|
|
295
|
+
* other's request. The same rule every query here follows, and here it is the difference between a refund
|
|
296
|
+
* and a theft.
|
|
297
|
+
*
|
|
298
|
+
* **Three: the family, and only this rail.** A holder may have paid on two stores; the rail comes from the
|
|
299
|
+
* subscription row that was resolved, never from a request.
|
|
300
|
+
*
|
|
301
|
+
* ## What is deliberately absent
|
|
302
|
+
*
|
|
303
|
+
* **A window, and a status filter.** How long a customer has to ask for their money back is the *adopter's*
|
|
304
|
+
* policy — the kit must not hard-code fourteen days, or any number — so every payment on the subscription is
|
|
305
|
+
* returned and the adopter's screen decides which button exists. And nothing here filters on a status of
|
|
306
|
+
* *ours*: whether a payment can still be refunded is the **store's** answer, read live from the transaction's
|
|
307
|
+
* own adjustments, and a projected row is a lagging copy of it. Filtering here would drop a payment on a
|
|
308
|
+
* stale row and call the result a complete refund.
|
|
309
|
+
*
|
|
310
|
+
* Ordered oldest first and tie-broken by id, so the report a caller gets back is in the order the money was
|
|
311
|
+
* taken and is reproducible across two identical requests.
|
|
312
|
+
*/
|
|
313
|
+
export declare function refundablePayments(d1: D1Database, subject: PaymentsSubject, subscription: PaymentsPurchase): Promise<readonly PaymentsPurchase[]>;
|
|
314
|
+
export declare function registerPaymentsRoutes(options: PaymentsRoutesOptions): (app: Hono<PithyHonoEnv>) => void;
|
|
315
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/http/routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAS7E,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAC;AAG1C,OAAO,EAEL,KAAK,cAAc,EAKpB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,EAGL,KAAK,eAAe,EAGrB,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EAAE,KAAK,mBAAmB,EAAkD,MAAM,4BAA4B,CAAC;AA0BtH,OAAO,EAAE,KAAK,gBAAgB,EAAuB,MAAM,oBAAoB,CAAC;AA2EhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsJG;AACH,MAAM,WAAW,qBAAqB;IACpC,4BAA4B;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oGAAoG;IACpG,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AA2JD;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IACE,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IACE,qCAAqC;IACrC,KAAK,EAAE,KAAK,CAAC;IACb,4GAA4G;IAC5G,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,GACD;IACE,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd,8FAA8F;IAC9F,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACxC,CAAC;AAEN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAsB,sBAAsB,CAC1C,EAAE,EAAE,UAAU,EACd,OAAO,EAAE,eAAe,EACxB,GAAG,EAAE,IAAI,GACR,OAAO,CAAC,kBAAkB,CAAC,CA4B7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,UAAU,EACd,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,gBAAgB,GAC7B,OAAO,CAAC,SAAS,gBAAgB,EAAE,CAAC,CAmBtC;AAkPD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,qBAAqB,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,CAm9DxG"}
|