@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,624 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* An amount of money a provider quoted: an integer in the currency's minor unit, and the currency.
|
|
4
|
+
*
|
|
5
|
+
* **The amount is signed, and that is the correction.** Paddle sends amounts as strings in the lowest
|
|
6
|
+
* denomination and it sends negative ones freely — `"-380"` for the credit half of an upgrade, `"-6045"`
|
|
7
|
+
* for a downgrade's subtotal. A `.nonnegative()` here refuses the recorded response of every plan change
|
|
8
|
+
* this package exists to make. Parsing the string is `minorAmount`'s job in the Paddle rail, which
|
|
9
|
+
* already answers `null` rather than a guess for anything that is not a plain integer string; this
|
|
10
|
+
* schema is the other end of that, and refuses the `null`.
|
|
11
|
+
*
|
|
12
|
+
* **A fraction is refused.** `65.82` is what somebody reaches for having read "$65.82" on the screen the
|
|
13
|
+
* quote produced. The wire says `"6582"` and means 6582, and a float here would be a rounding error
|
|
14
|
+
* arriving later, in a currency whose minor unit is not a hundredth. `data/money.ts` holds which
|
|
15
|
+
* currencies those are; nothing in this module needs to know, because nothing here scales.
|
|
16
|
+
*
|
|
17
|
+
* **`rendered` is the sentence, and it never replaces the number** (#465, 2026-08-28). The shape shipped
|
|
18
|
+
* with minor units alone, and nothing downstream could turn 6582 into `$65.82`: five of six planned screens
|
|
19
|
+
* could not state the figure the customer was being asked to confirm, and the adopter dashboard refuses a
|
|
20
|
+
* bare digit string outright rather than render minor units as a price. So the string sits *beside* the
|
|
21
|
+
* integer — a consumer comparing amounts still reads `amountMinor`, and a consumer showing one reads
|
|
22
|
+
* `rendered`. `data/renderMoney.ts` holds how, and holds the measurement that corrected the rule against it.
|
|
23
|
+
*/
|
|
24
|
+
export declare const QuotedMoney: z.ZodObject<{
|
|
25
|
+
amountMinor: z.ZodNumber;
|
|
26
|
+
currency: z.ZodString;
|
|
27
|
+
rendered: z.ZodString;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export type QuotedMoney = z.output<typeof QuotedMoney>;
|
|
30
|
+
/**
|
|
31
|
+
* The three members, declared once because two unions below are built from them.
|
|
32
|
+
*
|
|
33
|
+
* **Sharing them is not tidiness.** {@link SubscriptionSettlement} and
|
|
34
|
+
* {@link DeferredSubscriptionSettlement} differ by exactly one member, and two hand-written lists that
|
|
35
|
+
* differ by one member are two lists that will differ by two the next time somebody adds an outcome —
|
|
36
|
+
* with the newer one reachable today and unreachable on a customer's next invoice.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* The two halves a settled amount is the reconciliation of — what the new plan costs for the rest of the
|
|
40
|
+
* period, and what the old one gives back for that same unused time.
|
|
41
|
+
*
|
|
42
|
+
* **Added 2026-08-31 (#96) against a recording, because the net alone is a figure nobody can check.**
|
|
43
|
+
* Previewing Solo → Team mid-period answered `charge: "5116"`, `credit: "-233"`, `result: 4883`. A screen
|
|
44
|
+
* showing only 4883 states a number a customer cannot arrive at from the two prices on the same page, and
|
|
45
|
+
* the reasonable conclusion is that the store is wrong. The halves are what make the net legible.
|
|
46
|
+
*
|
|
47
|
+
* **`credit` is negative and stays negative.** `update_summary.credit.amount` came back `"-380"` on the
|
|
48
|
+
* recorded upgrade and `"-6961"` on the downgrade; flipping it here would put the sign in one place and the
|
|
49
|
+
* word "credit" in another, and a reader who trusted either would be right half the time. It reads as money
|
|
50
|
+
* coming off, which is what it is.
|
|
51
|
+
*
|
|
52
|
+
* **Nothing here is derived, and nothing is checked.** `charge + credit` is Paddle's arithmetic, not this
|
|
53
|
+
* package's: the two figures and the net are three things Paddle stated, reported as stated. Summing them to
|
|
54
|
+
* verify the net would produce a second answer to what a change costs, and the module header says why there
|
|
55
|
+
* is only ever one.
|
|
56
|
+
*/
|
|
57
|
+
declare const SettlementParts: z.ZodObject<{
|
|
58
|
+
charge: z.ZodObject<{
|
|
59
|
+
amountMinor: z.ZodNumber;
|
|
60
|
+
currency: z.ZodString;
|
|
61
|
+
rendered: z.ZodString;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
credit: z.ZodObject<{
|
|
64
|
+
amountMinor: z.ZodNumber;
|
|
65
|
+
currency: z.ZodString;
|
|
66
|
+
rendered: z.ZodString;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export type SubscriptionSettlementParts = z.output<typeof SettlementParts>;
|
|
70
|
+
/**
|
|
71
|
+
* What settles at one moment — the thing a confirmation screen states, with the day it happens supplied
|
|
72
|
+
* by whichever part of a quote holds it.
|
|
73
|
+
*
|
|
74
|
+
* **A discriminated union rather than an amount with a sign**, because the direction has to be
|
|
75
|
+
* unreadable without being read. `update_summary.result` states `{ action: "credit", amount: "6581" }`:
|
|
76
|
+
* the magnitude is positive and the direction lives in the action. A shape carrying only the number
|
|
77
|
+
* renders a 6581 credit as a 6581 charge, which is the same characters and the opposite meaning, and
|
|
78
|
+
* nothing in a type system would object. Here `amount` cannot be reached without matching `outcome`
|
|
79
|
+
* first.
|
|
80
|
+
*
|
|
81
|
+
* **`nothing` is a member, not a zero.** With `prorated_next_billing_period` there is no immediate
|
|
82
|
+
* transaction at all — recorded null, 2026-08-28 — and the credit lands on the next invoice instead.
|
|
83
|
+
* "Nothing to pay today" and "a charge of zero" are different sentences, and only one of them is true.
|
|
84
|
+
* It carries no amount because there is no amount, and one smuggled in does not survive the parse.
|
|
85
|
+
*
|
|
86
|
+
* **`nothing` says nothing about whether the change is free.** That is the trap this union alone cannot
|
|
87
|
+
* close, and why {@link SubscriptionChangeQuote} has three parts: the recorded deferred downgrade settles
|
|
88
|
+
* `nothing` today *and* owes the customer 6558. Which moment a settlement describes is the field it is
|
|
89
|
+
* read from, never the settlement itself.
|
|
90
|
+
*
|
|
91
|
+
* The alternative that was tried and refuted: reading the immediate transaction's totals. Recorded
|
|
92
|
+
* downgrade, 2026-08-28 — `grand_total: "0"`, `credit_to_balance: "6581"`. The totals are how a screen
|
|
93
|
+
* says nothing happened while 65.81 dollars moved.
|
|
94
|
+
*/
|
|
95
|
+
export declare const SubscriptionSettlement: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
96
|
+
outcome: z.ZodLiteral<"charge">;
|
|
97
|
+
amount: z.ZodObject<{
|
|
98
|
+
amountMinor: z.ZodNumber;
|
|
99
|
+
currency: z.ZodString;
|
|
100
|
+
rendered: z.ZodString;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
madeUpOf: z.ZodNullable<z.ZodObject<{
|
|
103
|
+
charge: z.ZodObject<{
|
|
104
|
+
amountMinor: z.ZodNumber;
|
|
105
|
+
currency: z.ZodString;
|
|
106
|
+
rendered: z.ZodString;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
credit: z.ZodObject<{
|
|
109
|
+
amountMinor: z.ZodNumber;
|
|
110
|
+
currency: z.ZodString;
|
|
111
|
+
rendered: z.ZodString;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
}, z.core.$strip>>;
|
|
114
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
115
|
+
outcome: z.ZodLiteral<"credit">;
|
|
116
|
+
amount: z.ZodObject<{
|
|
117
|
+
amountMinor: z.ZodNumber;
|
|
118
|
+
currency: z.ZodString;
|
|
119
|
+
rendered: z.ZodString;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
madeUpOf: z.ZodNullable<z.ZodObject<{
|
|
122
|
+
charge: z.ZodObject<{
|
|
123
|
+
amountMinor: z.ZodNumber;
|
|
124
|
+
currency: z.ZodString;
|
|
125
|
+
rendered: z.ZodString;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
credit: z.ZodObject<{
|
|
128
|
+
amountMinor: z.ZodNumber;
|
|
129
|
+
currency: z.ZodString;
|
|
130
|
+
rendered: z.ZodString;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
}, z.core.$strip>>;
|
|
133
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
134
|
+
outcome: z.ZodLiteral<"nothing">;
|
|
135
|
+
}, z.core.$strip>], "outcome">;
|
|
136
|
+
export type SubscriptionSettlement = z.output<typeof SubscriptionSettlement>;
|
|
137
|
+
/**
|
|
138
|
+
* The same settlement, minus `nothing` — what lands on an invoice that is not today's.
|
|
139
|
+
*
|
|
140
|
+
* **The two members are shared declarations, not a second copy**, so a fourth outcome cannot exist in
|
|
141
|
+
* one union and not the other. What differs is the absence, and the absence is the point.
|
|
142
|
+
*
|
|
143
|
+
* `nothing` is unrepresentable here because the block that holds this is nullable, and null already says
|
|
144
|
+
* it. Two spellings of one fact is how a screen ends up checking the block for presence, finding it, and
|
|
145
|
+
* rendering "$— credit on 15 Sep" — a row about no money, dated. A deferred settlement exists precisely
|
|
146
|
+
* when there is something to defer.
|
|
147
|
+
*/
|
|
148
|
+
export declare const DeferredSubscriptionSettlement: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
149
|
+
outcome: z.ZodLiteral<"charge">;
|
|
150
|
+
amount: z.ZodObject<{
|
|
151
|
+
amountMinor: z.ZodNumber;
|
|
152
|
+
currency: z.ZodString;
|
|
153
|
+
rendered: z.ZodString;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
madeUpOf: z.ZodNullable<z.ZodObject<{
|
|
156
|
+
charge: z.ZodObject<{
|
|
157
|
+
amountMinor: z.ZodNumber;
|
|
158
|
+
currency: z.ZodString;
|
|
159
|
+
rendered: z.ZodString;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
credit: z.ZodObject<{
|
|
162
|
+
amountMinor: z.ZodNumber;
|
|
163
|
+
currency: z.ZodString;
|
|
164
|
+
rendered: z.ZodString;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
}, z.core.$strip>>;
|
|
167
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
168
|
+
outcome: z.ZodLiteral<"credit">;
|
|
169
|
+
amount: z.ZodObject<{
|
|
170
|
+
amountMinor: z.ZodNumber;
|
|
171
|
+
currency: z.ZodString;
|
|
172
|
+
rendered: z.ZodString;
|
|
173
|
+
}, z.core.$strip>;
|
|
174
|
+
madeUpOf: z.ZodNullable<z.ZodObject<{
|
|
175
|
+
charge: z.ZodObject<{
|
|
176
|
+
amountMinor: z.ZodNumber;
|
|
177
|
+
currency: z.ZodString;
|
|
178
|
+
rendered: z.ZodString;
|
|
179
|
+
}, z.core.$strip>;
|
|
180
|
+
credit: z.ZodObject<{
|
|
181
|
+
amountMinor: z.ZodNumber;
|
|
182
|
+
currency: z.ZodString;
|
|
183
|
+
rendered: z.ZodString;
|
|
184
|
+
}, z.core.$strip>;
|
|
185
|
+
}, z.core.$strip>>;
|
|
186
|
+
}, z.core.$strip>], "outcome">;
|
|
187
|
+
export type DeferredSubscriptionSettlement = z.output<typeof DeferredSubscriptionSettlement>;
|
|
188
|
+
/**
|
|
189
|
+
* What a change costs, as a screen shows it before the customer confirms — the provider's own preview,
|
|
190
|
+
* normalized and nothing more.
|
|
191
|
+
*
|
|
192
|
+
* **Three facts, because a downgrade has three.** They are what happens **today**, what happens on the
|
|
193
|
+
* **next invoice**, and what the subscription pays **from then on**. Collapsing any two is how a customer
|
|
194
|
+
* reads a proration as their new monthly price, or is told about money on a day it does not move.
|
|
195
|
+
*
|
|
196
|
+
* The third part is the correction of 2026-08-28, and the recording that forced it is the downgrade under
|
|
197
|
+
* `prorated_next_billing_period` — **the mode a downgrade ships with**:
|
|
198
|
+
*
|
|
199
|
+
* | Recorded | Value | Part |
|
|
200
|
+
* | --- | --- | --- |
|
|
201
|
+
* | `immediate_transaction` | `null` | `settlesToday: { outcome: "nothing" }` |
|
|
202
|
+
* | `update_summary.result` | `{ action: "credit", amount: "6558" }` | `nextInvoice.settlement` |
|
|
203
|
+
* | `next_billed_at` | `2026-09-15T11:42:21.789736Z` | `nextInvoice.at` |
|
|
204
|
+
* | `recurring_transaction_details.totals.grand_total` | `"653"` | `recurring.amount` |
|
|
205
|
+
*
|
|
206
|
+
* With two parts that response is unwritable. `settlesToday` taken from `result` says "credited today" of
|
|
207
|
+
* a change that takes and gives nothing today; `settlesToday` taken from the missing immediate
|
|
208
|
+
* transaction is honest and drops 65.58 dollars out of the quote. The sentence the customer is owed —
|
|
209
|
+
* *"Nothing today. $65.58 credit on your next invoice, 15 Sep. Then $6.53/month."* — needs all three, and
|
|
210
|
+
* a shape that can hold only two guarantees one of them is a lie or a silence.
|
|
211
|
+
*
|
|
212
|
+
* The upgrade is the other side of the same rule and needs no third part: `immediate_transaction` is
|
|
213
|
+
* present, `result` is a charge of 6582, it settles today, and `nextInvoice` is null.
|
|
214
|
+
*
|
|
215
|
+
* A quote is never stored. It is a provider's answer to "if I did this now", it goes stale the moment
|
|
216
|
+
* the billing period moves, and a persisted one is a price nobody is bound by.
|
|
217
|
+
*/
|
|
218
|
+
/**
|
|
219
|
+
* What a recurring price is made of: the plan's own rate, and the tax on it.
|
|
220
|
+
*
|
|
221
|
+
* **Added 2026-08-31 (#96) against the same recording as {@link SettlementParts}, and for a defect the
|
|
222
|
+
* screen was already showing.** The plans table states Team at $110 a month; the quote beside it states
|
|
223
|
+
* $119.76. Both are that plan's price — one before tax and one after — and nothing on the page said so.
|
|
224
|
+
* The recording carries the split whole: `subtotal: "11000"`, `tax: "976"`, `grand_total: "11976"`, at a
|
|
225
|
+
* `tax_rate` of `0.08875`.
|
|
226
|
+
*
|
|
227
|
+
* **`subtotal`, not `total` minus `tax`.** Paddle states the base directly, and it is the figure after
|
|
228
|
+
* any discount rather than before it — so a screen deriving it from the other two would be right today
|
|
229
|
+
* and wrong the first time a coupon exists. Nothing here is computed, for the reason the module header
|
|
230
|
+
* gives: the provider is the authority on every amount, and a second answer is a second number for a
|
|
231
|
+
* customer to hold against their statement.
|
|
232
|
+
*
|
|
233
|
+
* **The rate itself is deliberately absent.** `0.08875` renders as *8.875%*, which is one rounding
|
|
234
|
+
* decision away from a figure that does not reproduce the tax beside it, and a customer reading a
|
|
235
|
+
* percentage against two amounts is being invited to check arithmetic this package does not do.
|
|
236
|
+
*/
|
|
237
|
+
declare const RecurringParts: z.ZodObject<{
|
|
238
|
+
beforeTax: z.ZodObject<{
|
|
239
|
+
amountMinor: z.ZodNumber;
|
|
240
|
+
currency: z.ZodString;
|
|
241
|
+
rendered: z.ZodString;
|
|
242
|
+
}, z.core.$strip>;
|
|
243
|
+
tax: z.ZodObject<{
|
|
244
|
+
amountMinor: z.ZodNumber;
|
|
245
|
+
currency: z.ZodString;
|
|
246
|
+
rendered: z.ZodString;
|
|
247
|
+
}, z.core.$strip>;
|
|
248
|
+
}, z.core.$strip>;
|
|
249
|
+
export type SubscriptionRecurringParts = z.output<typeof RecurringParts>;
|
|
250
|
+
export declare const SubscriptionChangeQuote: z.ZodObject<{
|
|
251
|
+
settlesToday: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
252
|
+
outcome: z.ZodLiteral<"charge">;
|
|
253
|
+
amount: z.ZodObject<{
|
|
254
|
+
amountMinor: z.ZodNumber;
|
|
255
|
+
currency: z.ZodString;
|
|
256
|
+
rendered: z.ZodString;
|
|
257
|
+
}, z.core.$strip>;
|
|
258
|
+
madeUpOf: z.ZodNullable<z.ZodObject<{
|
|
259
|
+
charge: z.ZodObject<{
|
|
260
|
+
amountMinor: z.ZodNumber;
|
|
261
|
+
currency: z.ZodString;
|
|
262
|
+
rendered: z.ZodString;
|
|
263
|
+
}, z.core.$strip>;
|
|
264
|
+
credit: z.ZodObject<{
|
|
265
|
+
amountMinor: z.ZodNumber;
|
|
266
|
+
currency: z.ZodString;
|
|
267
|
+
rendered: z.ZodString;
|
|
268
|
+
}, z.core.$strip>;
|
|
269
|
+
}, z.core.$strip>>;
|
|
270
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
271
|
+
outcome: z.ZodLiteral<"credit">;
|
|
272
|
+
amount: z.ZodObject<{
|
|
273
|
+
amountMinor: z.ZodNumber;
|
|
274
|
+
currency: z.ZodString;
|
|
275
|
+
rendered: z.ZodString;
|
|
276
|
+
}, z.core.$strip>;
|
|
277
|
+
madeUpOf: z.ZodNullable<z.ZodObject<{
|
|
278
|
+
charge: z.ZodObject<{
|
|
279
|
+
amountMinor: z.ZodNumber;
|
|
280
|
+
currency: z.ZodString;
|
|
281
|
+
rendered: z.ZodString;
|
|
282
|
+
}, z.core.$strip>;
|
|
283
|
+
credit: z.ZodObject<{
|
|
284
|
+
amountMinor: z.ZodNumber;
|
|
285
|
+
currency: z.ZodString;
|
|
286
|
+
rendered: z.ZodString;
|
|
287
|
+
}, z.core.$strip>;
|
|
288
|
+
}, z.core.$strip>>;
|
|
289
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
290
|
+
outcome: z.ZodLiteral<"nothing">;
|
|
291
|
+
}, z.core.$strip>], "outcome">;
|
|
292
|
+
nextInvoice: z.ZodNullable<z.ZodObject<{
|
|
293
|
+
settlement: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
294
|
+
outcome: z.ZodLiteral<"charge">;
|
|
295
|
+
amount: z.ZodObject<{
|
|
296
|
+
amountMinor: z.ZodNumber;
|
|
297
|
+
currency: z.ZodString;
|
|
298
|
+
rendered: z.ZodString;
|
|
299
|
+
}, z.core.$strip>;
|
|
300
|
+
madeUpOf: z.ZodNullable<z.ZodObject<{
|
|
301
|
+
charge: z.ZodObject<{
|
|
302
|
+
amountMinor: z.ZodNumber;
|
|
303
|
+
currency: z.ZodString;
|
|
304
|
+
rendered: z.ZodString;
|
|
305
|
+
}, z.core.$strip>;
|
|
306
|
+
credit: z.ZodObject<{
|
|
307
|
+
amountMinor: z.ZodNumber;
|
|
308
|
+
currency: z.ZodString;
|
|
309
|
+
rendered: z.ZodString;
|
|
310
|
+
}, z.core.$strip>;
|
|
311
|
+
}, z.core.$strip>>;
|
|
312
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
313
|
+
outcome: z.ZodLiteral<"credit">;
|
|
314
|
+
amount: z.ZodObject<{
|
|
315
|
+
amountMinor: z.ZodNumber;
|
|
316
|
+
currency: z.ZodString;
|
|
317
|
+
rendered: z.ZodString;
|
|
318
|
+
}, z.core.$strip>;
|
|
319
|
+
madeUpOf: z.ZodNullable<z.ZodObject<{
|
|
320
|
+
charge: z.ZodObject<{
|
|
321
|
+
amountMinor: z.ZodNumber;
|
|
322
|
+
currency: z.ZodString;
|
|
323
|
+
rendered: z.ZodString;
|
|
324
|
+
}, z.core.$strip>;
|
|
325
|
+
credit: z.ZodObject<{
|
|
326
|
+
amountMinor: z.ZodNumber;
|
|
327
|
+
currency: z.ZodString;
|
|
328
|
+
rendered: z.ZodString;
|
|
329
|
+
}, z.core.$strip>;
|
|
330
|
+
}, z.core.$strip>>;
|
|
331
|
+
}, z.core.$strip>], "outcome">;
|
|
332
|
+
at: z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodDate]>, z.ZodDate>;
|
|
333
|
+
}, z.core.$strip>>;
|
|
334
|
+
recurring: z.ZodNullable<z.ZodObject<{
|
|
335
|
+
amount: z.ZodObject<{
|
|
336
|
+
amountMinor: z.ZodNumber;
|
|
337
|
+
currency: z.ZodString;
|
|
338
|
+
rendered: z.ZodString;
|
|
339
|
+
}, z.core.$strip>;
|
|
340
|
+
startsAt: z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodDate]>, z.ZodDate>;
|
|
341
|
+
madeUpOf: z.ZodNullable<z.ZodObject<{
|
|
342
|
+
beforeTax: z.ZodObject<{
|
|
343
|
+
amountMinor: z.ZodNumber;
|
|
344
|
+
currency: z.ZodString;
|
|
345
|
+
rendered: z.ZodString;
|
|
346
|
+
}, z.core.$strip>;
|
|
347
|
+
tax: z.ZodObject<{
|
|
348
|
+
amountMinor: z.ZodNumber;
|
|
349
|
+
currency: z.ZodString;
|
|
350
|
+
rendered: z.ZodString;
|
|
351
|
+
}, z.core.$strip>;
|
|
352
|
+
}, z.core.$strip>>;
|
|
353
|
+
}, z.core.$strip>>;
|
|
354
|
+
}, z.core.$strip>;
|
|
355
|
+
export type SubscriptionChangeQuote = z.output<typeof SubscriptionChangeQuote>;
|
|
356
|
+
/**
|
|
357
|
+
* What a scheduled change will do. Paddle's three, and the set is closed for the reason every other
|
|
358
|
+
* enum in this package is: an action this build has never seen is a shape change worth failing on, not
|
|
359
|
+
* a value to render as itself.
|
|
360
|
+
*/
|
|
361
|
+
export declare const ScheduledSubscriptionChangeAction: z.ZodEnum<{
|
|
362
|
+
cancel: "cancel";
|
|
363
|
+
pause: "pause";
|
|
364
|
+
resume: "resume";
|
|
365
|
+
}>;
|
|
366
|
+
export type ScheduledSubscriptionChangeAction = z.output<typeof ScheduledSubscriptionChangeAction>;
|
|
367
|
+
/**
|
|
368
|
+
* A change the provider will apply later — the thing that makes an `active` subscription's future
|
|
369
|
+
* different from its present.
|
|
370
|
+
*
|
|
371
|
+
* **This is the object that distinguishes "renews on the 15th" from "ends on the 15th",** and after the
|
|
372
|
+
* recordings it is clear nothing else does: with a cancellation scheduled, Paddle reports
|
|
373
|
+
* `status: "active"`, `canceled_at: null` and `next_billed_at: null`. Two of those three say the
|
|
374
|
+
* subscription is fine and the third says nothing at all. Only this object says what is coming.
|
|
375
|
+
*
|
|
376
|
+
* `resumesAt` sits beside `effectiveAt` rather than replacing it because they are different instants on
|
|
377
|
+
* a pause: the pause begins at `effective_at` and the subscription comes back at `resume_at`, and Paddle
|
|
378
|
+
* leaves the second null for an open-ended one. `data/pause.ts` holds the longer argument about that
|
|
379
|
+
* null — on a pause it means *indefinitely*, never *we did not look*.
|
|
380
|
+
*/
|
|
381
|
+
export declare const ScheduledSubscriptionChange: z.ZodObject<{
|
|
382
|
+
action: z.ZodEnum<{
|
|
383
|
+
cancel: "cancel";
|
|
384
|
+
pause: "pause";
|
|
385
|
+
resume: "resume";
|
|
386
|
+
}>;
|
|
387
|
+
effectiveAt: z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodDate]>, z.ZodDate>;
|
|
388
|
+
resumesAt: z.ZodNullable<z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodDate]>, z.ZodDate>>;
|
|
389
|
+
}, z.core.$strip>;
|
|
390
|
+
export type ScheduledSubscriptionChange = z.output<typeof ScheduledSubscriptionChange>;
|
|
391
|
+
/**
|
|
392
|
+
* Where a subscription stands — the read that ships beside the writes.
|
|
393
|
+
*
|
|
394
|
+
* A capability that can cancel a subscription and not report the cancellation has shipped the half that
|
|
395
|
+
* creates the support ticket. The two sentences this exists to make writable are "Team, renews 15 Sep"
|
|
396
|
+
* and "Team until 15 Sep, then ends", and until #465 they were the same shape: `status` is `active` in
|
|
397
|
+
* both, `canceled_at` is null in both, and the only difference is the scheduled change. Read the status
|
|
398
|
+
* alone and a customer who canceled is told they will be billed again.
|
|
399
|
+
*
|
|
400
|
+
* **Every field is stated, none is optional.** Null means the provider answered that there is none;
|
|
401
|
+
* absent would mean nobody looked, and the two are not the same claim about somebody's money. So a
|
|
402
|
+
* partial object does not parse into a standing.
|
|
403
|
+
*
|
|
404
|
+
* The money is not here. What the subscription costs is `SubscriptionPricing` in `data/discount.ts`,
|
|
405
|
+
* which already answers it together with any discount and when that discount lapses — and a second
|
|
406
|
+
* price on a second object is two numbers to keep in step. `currency` is here so a screen can format
|
|
407
|
+
* that price without a second lookup, and it is nullable for the same reason it is there: some stores do
|
|
408
|
+
* not state one on the subscription itself, and a whole standing must not fail to load over it.
|
|
409
|
+
*/
|
|
410
|
+
export declare const SubscriptionStanding: z.ZodObject<{
|
|
411
|
+
status: z.ZodEnum<{
|
|
412
|
+
active: "active";
|
|
413
|
+
canceled: "canceled";
|
|
414
|
+
expired: "expired";
|
|
415
|
+
in_grace: "in_grace";
|
|
416
|
+
never_paid: "never_paid";
|
|
417
|
+
on_hold: "on_hold";
|
|
418
|
+
paused: "paused";
|
|
419
|
+
refunded: "refunded";
|
|
420
|
+
revoked: "revoked";
|
|
421
|
+
}>;
|
|
422
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
423
|
+
currentPeriodEndsAt: z.ZodNullable<z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodDate]>, z.ZodDate>>;
|
|
424
|
+
nextBilledAt: z.ZodNullable<z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodDate]>, z.ZodDate>>;
|
|
425
|
+
scheduledChange: z.ZodNullable<z.ZodObject<{
|
|
426
|
+
action: z.ZodEnum<{
|
|
427
|
+
cancel: "cancel";
|
|
428
|
+
pause: "pause";
|
|
429
|
+
resume: "resume";
|
|
430
|
+
}>;
|
|
431
|
+
effectiveAt: z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodDate]>, z.ZodDate>;
|
|
432
|
+
resumesAt: z.ZodNullable<z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodDate]>, z.ZodDate>>;
|
|
433
|
+
}, z.core.$strip>>;
|
|
434
|
+
}, z.core.$strip>;
|
|
435
|
+
export type SubscriptionStanding = z.output<typeof SubscriptionStanding>;
|
|
436
|
+
/**
|
|
437
|
+
* The next thing that happens to a subscription, and when — the answer a screen prints beside a date.
|
|
438
|
+
*
|
|
439
|
+
* `at` is null on exactly one kind, so a caller that has narrowed to any other has a date without
|
|
440
|
+
* checking for one.
|
|
441
|
+
*/
|
|
442
|
+
export type SubscriptionNextEvent = {
|
|
443
|
+
/** What happens next. */
|
|
444
|
+
readonly kind: "renews" | "ends" | "pauses" | "resumes";
|
|
445
|
+
/** When it happens. */
|
|
446
|
+
readonly at: Date;
|
|
447
|
+
} | {
|
|
448
|
+
/** Nothing is scheduled and nothing is due. The provider has not said what comes next. */
|
|
449
|
+
readonly kind: "unknown";
|
|
450
|
+
/** There is no date, because there is no event. */
|
|
451
|
+
readonly at: null;
|
|
452
|
+
};
|
|
453
|
+
/**
|
|
454
|
+
* What happens to this subscription next.
|
|
455
|
+
*
|
|
456
|
+
* **The scheduled change wins, and that ordering is the point of the function.** Paddle blanks
|
|
457
|
+
* `next_billed_at` when a cancellation is scheduled, so a screen reading it first would say nothing at
|
|
458
|
+
* all about a subscription that ends in eighteen days; a screen reading the status first would say it
|
|
459
|
+
* renews. The date the customer is owed is `scheduled_change.effective_at`, and it is the only place it
|
|
460
|
+
* exists (recorded 2026-08-28).
|
|
461
|
+
*
|
|
462
|
+
* `unknown` rather than a fallback, for a subscription with nothing scheduled and nothing due. An
|
|
463
|
+
* expired subscription and one whose provider went quiet both land here, and neither of them renews. A
|
|
464
|
+
* screen that prints a date it was not given is how a customer learns a wrong one.
|
|
465
|
+
*/
|
|
466
|
+
export declare function nextSubscriptionEvent(standing: SubscriptionStanding): SubscriptionNextEvent;
|
|
467
|
+
/**
|
|
468
|
+
* When a cancellation takes effect, in the customer's terms.
|
|
469
|
+
*
|
|
470
|
+
* **Named for what the customer gets, not for what Paddle calls it.** Paddle's values are `immediately`
|
|
471
|
+
* and `next_billing_period`, and the second is the one an adopter reads too quickly: it does not mean
|
|
472
|
+
* "cancel next month", it means "stop renewing, and keep what has been paid for until it runs out".
|
|
473
|
+
* `at_period_end` says that. The rail translates; a value in Paddle's spelling does not parse here, so a
|
|
474
|
+
* rail that stopped translating fails loudly rather than sending a string Paddle happens to accept.
|
|
475
|
+
*
|
|
476
|
+
* **The settled policy is `at_period_end` for a cancellation and for a downgrade to free** (2026-08-28):
|
|
477
|
+
* the tier holds to the end of the period the customer paid for. `now` exists because support sometimes
|
|
478
|
+
* genuinely has to end a subscription today, and because a policy that cannot be departed from in the
|
|
479
|
+
* one case that needs it gets departed from by a direct provider call nothing audits.
|
|
480
|
+
*/
|
|
481
|
+
export declare const SubscriptionCancelTiming: z.ZodEnum<{
|
|
482
|
+
at_period_end: "at_period_end";
|
|
483
|
+
now: "now";
|
|
484
|
+
}>;
|
|
485
|
+
export type SubscriptionCancelTiming = z.output<typeof SubscriptionCancelTiming>;
|
|
486
|
+
/**
|
|
487
|
+
* ## The refund half, and why it is in this module
|
|
488
|
+
*
|
|
489
|
+
* A refund is the money side of a cancellation. It is resolved from the same subscription the four verbs
|
|
490
|
+
* above act on, rendered on the same screen beside a standing, and — the reason it is not a module of its
|
|
491
|
+
* own — it is written *against* the settlement vocabulary declared here. {@link SubscriptionSettlement}
|
|
492
|
+
* says money moved. {@link RefundRequest} says it has not, and may never. Putting the two shapes a screen
|
|
493
|
+
* must never confuse in two files is how one of them gets rendered with the other's sentence.
|
|
494
|
+
*
|
|
495
|
+
* **Nothing here says money moved, and nothing here can be made to.** There is no amount in any of these
|
|
496
|
+
* shapes. That is deliberate: a figure would be read as what the customer is getting back, and at the
|
|
497
|
+
* moment these are produced nobody has decided that yet.
|
|
498
|
+
*/
|
|
499
|
+
/**
|
|
500
|
+
* Where a refund request stands at the store — and **none of these five values means the customer has
|
|
501
|
+
* their money.**
|
|
502
|
+
*
|
|
503
|
+
* A refund is a request. Paddle holds most live ones at `pending_approval` until a person at Paddle
|
|
504
|
+
* reviews them (sandbox approves on its own, roughly ten minutes later), so the request returning is not
|
|
505
|
+
* the refund happening. Even `approved` is only what the store said at the instant it was asked: money
|
|
506
|
+
* reaching a card is the store's later business, it arrives as an `adjustment.updated` webhook, and the
|
|
507
|
+
* projection is what acts on it. Nothing on this side revokes anything.
|
|
508
|
+
*
|
|
509
|
+
* **`unknown` is here, and it is the one place this package reports a value it does not understand.**
|
|
510
|
+
* Everywhere else — `subscriptionStatus`, `ScheduledSubscriptionChangeAction`, `settlementOf` — a value
|
|
511
|
+
* this build has never seen is a shape change worth failing on. That rule assumes failing costs nothing
|
|
512
|
+
* but the read. Here the read follows a write that cannot be taken back: the adjustment exists, and
|
|
513
|
+
* throwing would discard the only handle anybody has on money already in flight. So an unmapped status is
|
|
514
|
+
* reported as `unknown` rather than as itself — a screen cannot render it as a decision, an operator has
|
|
515
|
+
* the adjustment id, and the fact that the store said something new is visible instead of swallowed.
|
|
516
|
+
*/
|
|
517
|
+
export declare const RefundRequestStatus: z.ZodEnum<{
|
|
518
|
+
approved: "approved";
|
|
519
|
+
awaiting_review: "awaiting_review";
|
|
520
|
+
rejected: "rejected";
|
|
521
|
+
reversed: "reversed";
|
|
522
|
+
unknown: "unknown";
|
|
523
|
+
}>;
|
|
524
|
+
export type RefundRequestStatus = z.output<typeof RefundRequestStatus>;
|
|
525
|
+
/** What became of one payment. Three outcomes, and every payment asked about has exactly one. */
|
|
526
|
+
export declare const RefundRequestOutcome: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
527
|
+
outcome: z.ZodLiteral<"requested">;
|
|
528
|
+
purchaseId: z.ZodString;
|
|
529
|
+
adjustmentId: z.ZodString;
|
|
530
|
+
status: z.ZodEnum<{
|
|
531
|
+
approved: "approved";
|
|
532
|
+
awaiting_review: "awaiting_review";
|
|
533
|
+
rejected: "rejected";
|
|
534
|
+
reversed: "reversed";
|
|
535
|
+
unknown: "unknown";
|
|
536
|
+
}>;
|
|
537
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
538
|
+
outcome: z.ZodLiteral<"already_requested">;
|
|
539
|
+
purchaseId: z.ZodString;
|
|
540
|
+
adjustmentId: z.ZodString;
|
|
541
|
+
status: z.ZodEnum<{
|
|
542
|
+
approved: "approved";
|
|
543
|
+
awaiting_review: "awaiting_review";
|
|
544
|
+
rejected: "rejected";
|
|
545
|
+
reversed: "reversed";
|
|
546
|
+
unknown: "unknown";
|
|
547
|
+
}>;
|
|
548
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
549
|
+
outcome: z.ZodLiteral<"failed">;
|
|
550
|
+
purchaseId: z.ZodString;
|
|
551
|
+
reason: z.ZodString;
|
|
552
|
+
}, z.core.$strip>], "outcome">;
|
|
553
|
+
export type RefundRequestOutcome = z.output<typeof RefundRequestOutcome>;
|
|
554
|
+
/**
|
|
555
|
+
* What came of asking for a subscription's payments back — **one outcome per payment asked about, always.**
|
|
556
|
+
*
|
|
557
|
+
* ## Refunds attach to transactions, so the seam takes a set
|
|
558
|
+
*
|
|
559
|
+
* There is no such thing as refunding a subscription. Every store raises a refund against a *transaction*,
|
|
560
|
+
* and a subscription is a family of them. The case is ordinary rather than exotic: a customer who joined on
|
|
561
|
+
* Solo at 6.00, upgraded to Team on day 10 for a 65.82 proration, and cancels on day 13 has paid twice, and
|
|
562
|
+
* an adopter's refund policy owes them both. One adjustment per transaction, one report covering all of them.
|
|
563
|
+
*
|
|
564
|
+
* ## All-or-nothing before the first write; a complete report after it
|
|
565
|
+
*
|
|
566
|
+
* The obvious ask is all-or-nothing over the whole set, and **it cannot be built**: no store offers a batch
|
|
567
|
+
* adjustment and none offers a delete, so once the first adjustment is at `pending_approval` there is
|
|
568
|
+
* nothing that un-raises it. Pretending otherwise would mean choosing which lie to tell when the third of
|
|
569
|
+
* four fails.
|
|
570
|
+
*
|
|
571
|
+
* So the guarantee is split at the one line that is real — has this call written anything yet:
|
|
572
|
+
*
|
|
573
|
+
* - **Before the first write, all-or-nothing.** Every payment is checked at the store first. Anything that
|
|
574
|
+
* makes one unrefundable refuses the *whole request*, sends nothing, and throws
|
|
575
|
+
* `payments/subscription_change_refused`. A set too large to issue inside one request refuses the same
|
|
576
|
+
* way, for the same reason: a call that runs out of budget half way through is a partial by another name.
|
|
577
|
+
* - **After the first write, nothing throws.** The remaining failures become {@link RefundNotRaised}
|
|
578
|
+
* entries. The caller is told exactly which payments came back and which did not, because the alternative
|
|
579
|
+
* — an error over a state where money is already moving — is the silent partial success this whole shape
|
|
580
|
+
* is designed against.
|
|
581
|
+
*
|
|
582
|
+
* **What makes a partial impossible to miss is that this report is total.** One entry per payment asked
|
|
583
|
+
* about, in a deterministic order, so a caller counting entries and a caller counting payments get the same
|
|
584
|
+
* number. There is no shape of this answer that omits a payment.
|
|
585
|
+
*
|
|
586
|
+
* ## Nothing here revokes anything
|
|
587
|
+
*
|
|
588
|
+
* Not the entitlement, not the purchase row, not a projection. A refund that is approved arrives as a
|
|
589
|
+
* webhook, and `rails/paddle/adjustments.ts` and the projection writer already act on it — they are the
|
|
590
|
+
* only things that do. Revoking on the *request* would take a paying customer's access away over a refund
|
|
591
|
+
* Paddle then rejects, and the customer would have neither the money nor the product.
|
|
592
|
+
*/
|
|
593
|
+
export declare const RefundRequest: z.ZodObject<{
|
|
594
|
+
outcomes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
595
|
+
outcome: z.ZodLiteral<"requested">;
|
|
596
|
+
purchaseId: z.ZodString;
|
|
597
|
+
adjustmentId: z.ZodString;
|
|
598
|
+
status: z.ZodEnum<{
|
|
599
|
+
approved: "approved";
|
|
600
|
+
awaiting_review: "awaiting_review";
|
|
601
|
+
rejected: "rejected";
|
|
602
|
+
reversed: "reversed";
|
|
603
|
+
unknown: "unknown";
|
|
604
|
+
}>;
|
|
605
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
606
|
+
outcome: z.ZodLiteral<"already_requested">;
|
|
607
|
+
purchaseId: z.ZodString;
|
|
608
|
+
adjustmentId: z.ZodString;
|
|
609
|
+
status: z.ZodEnum<{
|
|
610
|
+
approved: "approved";
|
|
611
|
+
awaiting_review: "awaiting_review";
|
|
612
|
+
rejected: "rejected";
|
|
613
|
+
reversed: "reversed";
|
|
614
|
+
unknown: "unknown";
|
|
615
|
+
}>;
|
|
616
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
617
|
+
outcome: z.ZodLiteral<"failed">;
|
|
618
|
+
purchaseId: z.ZodString;
|
|
619
|
+
reason: z.ZodString;
|
|
620
|
+
}, z.core.$strip>], "outcome">>;
|
|
621
|
+
}, z.core.$strip>;
|
|
622
|
+
export type RefundRequest = z.output<typeof RefundRequest>;
|
|
623
|
+
export {};
|
|
624
|
+
//# sourceMappingURL=subscription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/data/subscription.ts"],"names":[],"mappings":"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"}
|