@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 @@
|
|
|
1
|
+
{"version":3,"file":"oidc.d.ts","sourceRoot":"","sources":["../../../src/rails/google/oidc.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,eAAe,EAA+B,MAAM,QAAQ,CAAC;AAG3E;;;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js";
|
|
2
|
+
import { googleHttpFetch, googleJson } from "./http.js";
|
|
3
|
+
import { base64UrlDecode, decodeJwtJson, splitJwt } from "./jwt.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region src/rails/google/oidc.ts
|
|
6
|
+
/**
|
|
7
|
+
* The authenticity boundary on Google's webhook: the OIDC token a Pub/Sub push carries.
|
|
8
|
+
*
|
|
9
|
+
* Play's Real-time Developer Notifications do not arrive from Google Play. They arrive from **Pub/Sub**, which
|
|
10
|
+
* POSTs to a URL an operator configured, carrying a Google-signed OIDC token in the `Authorization` header.
|
|
11
|
+
* So there is no signature over the body the way Apple signs a notification — the token is the proof, and what
|
|
12
|
+
* it proves is narrow.
|
|
13
|
+
*
|
|
14
|
+
* **The audience check is the actual boundary.** Google signs these tokens with the same handful of keys for
|
|
15
|
+
* every push subscription on the planet. A valid signature therefore says only *Google minted this*, which
|
|
16
|
+
* anyone can arrange for themselves in thirty seconds. What makes a token ours is the `aud` claim: Pub/Sub sets
|
|
17
|
+
* it to the audience configured on the push subscription, and that value is the endpoint the token was minted
|
|
18
|
+
* for. Verify the signature and skip the audience and you have built an endpoint that accepts notifications
|
|
19
|
+
* from any Google customer who points a subscription at it.
|
|
20
|
+
*
|
|
21
|
+
* Four checks, in this order, and the order is deliberate:
|
|
22
|
+
*
|
|
23
|
+
* 1. **Pin the algorithm before touching a key.** `alg` arrives in a header nobody has verified, so it is
|
|
24
|
+
* parsed against a literal `RS256` rather than looked up. That is what makes the two published confusions
|
|
25
|
+
* unreachable — `none`, which asks for the signature to be skipped, and `HS256`, which asks the verifier to
|
|
26
|
+
* HMAC with the public key as if it were a shared secret. Neither survives a literal.
|
|
27
|
+
* 2. **Resolve the key by `kid` from Google's published set.** Never from the token, which is why there is no
|
|
28
|
+
* `jwk`/`x5u` handling here: a token that carries its own key is a token that verifies itself.
|
|
29
|
+
* 3. **Verify the signature over the exact received segments** — `header.claims` as encoded.
|
|
30
|
+
* 4. **Then read the claims,** and only then, because a claim from an unverified token means nothing.
|
|
31
|
+
*
|
|
32
|
+
* A failure to *read* the token is `payments/invalid_receipt`; a token that is well-formed and does not check
|
|
33
|
+
* out is `payments/verification_failed`. On the webhook path the guard maps either to
|
|
34
|
+
* `payments/webhook_unverified` (401), so the distinction serves the operator reading `detail` rather than the
|
|
35
|
+
* caller — and a forger is told nothing about how close it got.
|
|
36
|
+
*/
|
|
37
|
+
/** Where Google publishes the keys that sign an OIDC token. Public, so it is pinned here rather than stored. */
|
|
38
|
+
const GOOGLE_JWKS_URL = "https://www.googleapis.com/oauth2/v3/certs";
|
|
39
|
+
/**
|
|
40
|
+
* The two spellings Google issues an OIDC token under. Both are current, and which one arrives is not ours to
|
|
41
|
+
* decide, so both are accepted and nothing else is.
|
|
42
|
+
*/
|
|
43
|
+
const GOOGLE_OIDC_ISSUERS = ["https://accounts.google.com", "accounts.google.com"];
|
|
44
|
+
/** How long a fetched key set is reused. Google rotates slowly, and an unknown `kid` forces a refresh anyway. */
|
|
45
|
+
const JWKS_TTL_MS = 36e5;
|
|
46
|
+
/** Tolerance on `exp` and `iat`. A minute covers clock drift; an hour would cover a replay. */
|
|
47
|
+
const DEFAULT_CLOCK_SKEW_SECONDS = 60;
|
|
48
|
+
/** RSASSA-PKCS1-v1_5 with SHA-256 — the one algorithm `alg: RS256` names, fixed here rather than derived. */
|
|
49
|
+
const RS256 = {
|
|
50
|
+
name: "RSASSA-PKCS1-v1_5",
|
|
51
|
+
hash: "SHA-256"
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* The header of a Pub/Sub push token, as tightly as it can be stated. `alg` is a literal for the reason in the
|
|
55
|
+
* module doc; `kid` is required because a key is resolved by it and a token that names no key cannot be
|
|
56
|
+
* checked against one.
|
|
57
|
+
*/
|
|
58
|
+
const GoogleOidcHeader = z.object({
|
|
59
|
+
alg: z.literal("RS256").describe("The signing algorithm. A literal, not a lookup: `alg` arrives in an unverified header, and accepting `none` or `HS256` from it is how JWS verifiers are bypassed."),
|
|
60
|
+
kid: z.string().min(1).describe("Which of Google's published keys signed the token. Resolved against Google's key endpoint.")
|
|
61
|
+
}).loose().describe("The header of a Google-signed OIDC token, constrained to the one shape Pub/Sub sends.");
|
|
62
|
+
/**
|
|
63
|
+
* One published RSA verification key, in the shape Google's key endpoint returns. `.loose()` because Google
|
|
64
|
+
* adds fields and a key set must not be rejected for carrying something new.
|
|
65
|
+
*/
|
|
66
|
+
const GoogleJwk = z.object({
|
|
67
|
+
kid: z.string().min(1).describe("The key id a token header names."),
|
|
68
|
+
kty: z.string().min(1).describe("The key type. Only `RSA` is accepted — Google signs these with RSA keys."),
|
|
69
|
+
n: z.string().min(1).describe("The RSA modulus, base64url."),
|
|
70
|
+
e: z.string().min(1).describe("The RSA public exponent, base64url."),
|
|
71
|
+
alg: z.string().min(1).optional().describe("The algorithm the key is published for, when stated."),
|
|
72
|
+
use: z.string().min(1).optional().describe("What the key is published for — `sig` for a signing key.")
|
|
73
|
+
}).loose().describe("One of Google's published OIDC verification keys.");
|
|
74
|
+
/** Google's published key set. At least one key: an empty set is an endpoint that is not answering properly. */
|
|
75
|
+
const GoogleJwks = z.object({ keys: z.array(GoogleJwk).min(1).describe("Every key currently signing Google OIDC tokens.") }).loose().describe("The response of Google's OIDC key endpoint.");
|
|
76
|
+
/**
|
|
77
|
+
* The claims a Pub/Sub push token carries, narrowed to the ones that decide anything. `.loose()` keeps the
|
|
78
|
+
* rest — the whole token is never stored, but a claim set must not be refused for being richer than expected.
|
|
79
|
+
*/
|
|
80
|
+
const GoogleOidcClaims = z.object({
|
|
81
|
+
iss: z.string().min(1).describe("Who issued the token. One of Google's two issuer spellings, and nothing else."),
|
|
82
|
+
aud: z.string().min(1).describe("Who the token was minted for — the audience configured on the push subscription. The claim that makes a token ours rather than merely Google's."),
|
|
83
|
+
exp: z.number().int().describe("When the token expires, in seconds since the epoch."),
|
|
84
|
+
iat: z.number().int().optional().describe("When the token was issued, in seconds since the epoch."),
|
|
85
|
+
email: z.string().min(1).optional().describe("The service account Pub/Sub used to mint the token. Checked against the configured one."),
|
|
86
|
+
email_verified: z.boolean().optional().describe("Whether Google vouches for that address. Always true on a real push token."),
|
|
87
|
+
sub: z.string().min(1).optional().describe("The service account's numeric id.")
|
|
88
|
+
}).loose().describe("The claims on a Pub/Sub push OIDC token, narrowed to the ones verification depends on.");
|
|
89
|
+
/**
|
|
90
|
+
* Google's published keys, cached per isolate.
|
|
91
|
+
*
|
|
92
|
+
* A cache of *public* keys is not the thing CLAUDE.md's secrets rule forbids — nothing here is confidential,
|
|
93
|
+
* and the whole point of the endpoint is that anyone may read it. What the cache buys is one round-trip per
|
|
94
|
+
* hour instead of one per notification, on a path that already has a mandatory Play API call in it.
|
|
95
|
+
*/
|
|
96
|
+
let publishedKeys = null;
|
|
97
|
+
/** Drop the cached key set. For tests, which must not inherit another suite's keys. */
|
|
98
|
+
function resetGoogleJwksCache() {
|
|
99
|
+
publishedKeys = null;
|
|
100
|
+
}
|
|
101
|
+
/** Fetch and validate Google's key set, replacing the cache. */
|
|
102
|
+
async function refreshPublishedKeys(transport, now) {
|
|
103
|
+
const body = await googleJson(transport, GOOGLE_JWKS_URL, { what: "Google's OIDC verification keys" });
|
|
104
|
+
const parsed = GoogleJwks.safeParse(body);
|
|
105
|
+
if (!parsed.success) throw new PaymentsVerificationFailedError({ detail: `Google: the OIDC key endpoint answered an unexpected shape — ${issues(parsed.error)}.` });
|
|
106
|
+
publishedKeys = {
|
|
107
|
+
keys: parsed.data.keys,
|
|
108
|
+
expiresAt: now.getTime() + JWKS_TTL_MS
|
|
109
|
+
};
|
|
110
|
+
return parsed.data.keys;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The key a token's `kid` names.
|
|
114
|
+
*
|
|
115
|
+
* A `kid` the cache does not hold triggers **exactly one** refresh, which is what makes Google's key rotation
|
|
116
|
+
* invisible: a new signing key appears in a token before anything tells us to look for it. Exactly one,
|
|
117
|
+
* because otherwise a stream of forged tokens naming random `kid`s is a way to make us hammer Google.
|
|
118
|
+
*/
|
|
119
|
+
async function resolveKey(kid, options) {
|
|
120
|
+
const configured = options.trustedKeys?.find((key) => key.kid === kid);
|
|
121
|
+
if (configured) return configured;
|
|
122
|
+
const transport = options.transport ?? googleHttpFetch;
|
|
123
|
+
if (publishedKeys !== null && publishedKeys.expiresAt > options.now.getTime()) {
|
|
124
|
+
const cached = publishedKeys?.keys.find((key) => key.kid === kid);
|
|
125
|
+
if (cached) return cached;
|
|
126
|
+
}
|
|
127
|
+
const found = (await refreshPublishedKeys(transport, options.now)).find((key) => key.kid === kid);
|
|
128
|
+
if (!found) throw new PaymentsVerificationFailedError({ detail: `Google: no published key matches the token's kid "${kid}".` });
|
|
129
|
+
return found;
|
|
130
|
+
}
|
|
131
|
+
/** Import one published JWK as a verification key. A non-RSA key is refused rather than handed to WebCrypto. */
|
|
132
|
+
async function importKey(jwk) {
|
|
133
|
+
if (jwk.kty !== "RSA") throw new PaymentsVerificationFailedError({ detail: `Google: published key "${jwk.kid}" is ${jwk.kty}, and only RSA keys sign an OIDC token.` });
|
|
134
|
+
try {
|
|
135
|
+
return await crypto.subtle.importKey("jwk", {
|
|
136
|
+
...jwk,
|
|
137
|
+
alg: "RS256"
|
|
138
|
+
}, RS256, false, ["verify"]);
|
|
139
|
+
} catch (cause) {
|
|
140
|
+
throw new PaymentsVerificationFailedError({ detail: `Google: published key "${jwk.kid}" could not be imported.` }, { cause });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Verify one Pub/Sub push OIDC token and return its claims.
|
|
145
|
+
*
|
|
146
|
+
* @throws {@link PaymentsInvalidReceiptError} when the token cannot be read — wrong segment count, a header
|
|
147
|
+
* Google would never send, a non-JSON segment.
|
|
148
|
+
* @throws {@link PaymentsVerificationFailedError} when it is well-formed and does not check out — an unknown
|
|
149
|
+
* key, a bad signature, the wrong audience, the wrong issuer, an expiry, the wrong service account.
|
|
150
|
+
*/
|
|
151
|
+
async function verifyGoogleOidcToken(token, options) {
|
|
152
|
+
const { head, body, mac } = splitJwt(token);
|
|
153
|
+
const header = GoogleOidcHeader.safeParse(decodeJwtJson(head, "the token header"));
|
|
154
|
+
if (!header.success) throw new PaymentsInvalidReceiptError({ detail: `Google: the token header is not one Pub/Sub sends — ${issues(header.error)}.` });
|
|
155
|
+
const key = await importKey(await resolveKey(header.data.kid, options));
|
|
156
|
+
if (!await crypto.subtle.verify(RS256.name, key, base64UrlDecode(mac, "the token signature"), new TextEncoder().encode(`${head}.${body}`))) throw new PaymentsVerificationFailedError({ detail: `Google: the token signature does not match the signed segments under key "${header.data.kid}".` });
|
|
157
|
+
const parsed = GoogleOidcClaims.safeParse(decodeJwtJson(body, "the token claims"));
|
|
158
|
+
if (!parsed.success) throw new PaymentsVerificationFailedError({ detail: `Google: the token claims are not those of a Pub/Sub push token — ${issues(parsed.error)}.` });
|
|
159
|
+
const claims = parsed.data;
|
|
160
|
+
const skew = options.clockSkewSeconds ?? DEFAULT_CLOCK_SKEW_SECONDS;
|
|
161
|
+
const seconds = Math.floor(options.now.getTime() / 1e3);
|
|
162
|
+
if (!GOOGLE_OIDC_ISSUERS.includes(claims.iss)) throw failed(`the token issuer is "${claims.iss}", not one of Google's.`);
|
|
163
|
+
if (claims.aud !== options.audience) throw failed(`the token audience is "${claims.aud}", and this endpoint expects "${options.audience}".`);
|
|
164
|
+
if (claims.exp + skew < seconds) throw failed(`the token expired at ${(/* @__PURE__ */ new Date(claims.exp * 1e3)).toISOString()}.`);
|
|
165
|
+
if (claims.iat !== void 0 && claims.iat - skew > seconds) throw failed(`the token was issued at ${(/* @__PURE__ */ new Date(claims.iat * 1e3)).toISOString()}, which is in the future.`);
|
|
166
|
+
if (claims.email !== options.serviceAccountEmail) throw failed(`the token names service account "${claims.email ?? "none"}", not the configured one.`);
|
|
167
|
+
if (claims.email_verified !== true) throw failed("the token's service-account address is not marked verified by Google.");
|
|
168
|
+
return claims;
|
|
169
|
+
}
|
|
170
|
+
/** A post-signature refusal. `Google:` prefixed, and the token itself never appears. */
|
|
171
|
+
function failed(detail) {
|
|
172
|
+
return new PaymentsVerificationFailedError({ detail: `Google: ${detail}` });
|
|
173
|
+
}
|
|
174
|
+
/** Zod issues as `path:code` pairs — never `message` or `received`, which would echo the token. */
|
|
175
|
+
function issues(error) {
|
|
176
|
+
return error.issues.map((issue) => `${issue.path.join(".") || "<root>"}:${issue.code}`).join(", ");
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
export { GOOGLE_JWKS_URL, GOOGLE_OIDC_ISSUERS, GoogleJwk, GoogleJwks, GoogleOidcClaims, resetGoogleJwksCache, verifyGoogleOidcToken };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { PaymentsPurchase } from "../../data/purchase";
|
|
3
|
+
import type { PurchaseStatus } from "../../data/status";
|
|
4
|
+
import type { PaymentsGoogleCredentials } from "../../secret/registry";
|
|
5
|
+
import type { UnboundProviderEvent } from "../contract";
|
|
6
|
+
import { type GoogleHttpFetch } from "./http";
|
|
7
|
+
import type { GoogleNotificationPointer } from "./rtdn";
|
|
8
|
+
/**
|
|
9
|
+
* The Play Developer API — the call that turns a purchase token into a state, and the mapping of Play's
|
|
10
|
+
* vocabulary into the normalized status set.
|
|
11
|
+
*
|
|
12
|
+
* This is the half of Google's rail that has no Apple equivalent. A StoreKit transaction *is* the state, signed;
|
|
13
|
+
* a Play purchase token is a pointer, so every Google projection costs a network round-trip. Two, in fact — the
|
|
14
|
+
* API is OAuth-protected, so a service-account assertion buys an access token first.
|
|
15
|
+
*
|
|
16
|
+
* ## Two statuses Play has and the other rails do not
|
|
17
|
+
*
|
|
18
|
+
* `on_hold` and `paused` are Play's own. **On hold** is a subscription whose billing retry window has run out:
|
|
19
|
+
* Google keeps trying for up to 30 days and access is withdrawn throughout, which is why `on_hold` never
|
|
20
|
+
* grants. **Paused** is a subscription the *user* suspended, usually with an `autoResumeTime` set; they will
|
|
21
|
+
* come back, and until they do they are not entitled — so that date lands on the row as `resumesAt`, and its
|
|
22
|
+
* absence is Play reporting an indefinite pause rather than this rail declining to look (`data/pause.ts`).
|
|
23
|
+
* Neither state has an Apple analog, and both would be lost by a status set built from Apple's
|
|
24
|
+
* notifications alone.
|
|
25
|
+
*
|
|
26
|
+
* ## What Play does not report, and what follows
|
|
27
|
+
*
|
|
28
|
+
* **No price.** Neither `purchases.subscriptionsv2.get` nor `purchases.products.get` returns an amount or a
|
|
29
|
+
* currency, so `amountMinor` and `currency` are null on every Google purchase. That is what those columns are
|
|
30
|
+
* nullable for. Revenue figures for the Play rail come from Google's own reporting, not from here.
|
|
31
|
+
*
|
|
32
|
+
* **No last-modified time.** So the caller supplies the event time: the notification's `eventTimeMillis` on the
|
|
33
|
+
* webhook path, and the clock on a client submission. Both are honest — a submission is a read of the current
|
|
34
|
+
* state, so treating it as the freshest fact is right — and both feed the monotonic write rule, which is why
|
|
35
|
+
* neither may be invented here.
|
|
36
|
+
*
|
|
37
|
+
* ## The environment check
|
|
38
|
+
*
|
|
39
|
+
* A test purchase is a real Play purchase made by a license-tested account, and it must never grant a
|
|
40
|
+
* production entitlement. Play marks one differently in each shape: `testPurchase` is present on a
|
|
41
|
+
* subscription, `purchaseType: 0` on a one-time product. Both are read, and anything unmarked is production —
|
|
42
|
+
* which is safe because Play only ever omits the marker on a real purchase.
|
|
43
|
+
*/
|
|
44
|
+
/** Google's OAuth token endpoint. The audience of the service-account assertion as well as its destination. */
|
|
45
|
+
export declare const GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
46
|
+
/** The Play Developer API's base. Public, so it is pinned here rather than configured. */
|
|
47
|
+
export declare const PLAY_API_BASE = "https://androidpublisher.googleapis.com/androidpublisher/v3";
|
|
48
|
+
/** The one OAuth scope payments asks for. Read-and-acknowledge on purchases, nothing else in the console. */
|
|
49
|
+
export declare const PLAY_SCOPE = "https://www.googleapis.com/auth/androidpublisher";
|
|
50
|
+
/**
|
|
51
|
+
* `purchases.subscriptionsv2.get`, as much of it as the projection reads. `.loose()` keeps the rest: Play adds
|
|
52
|
+
* fields, the whole response is stored for reconciliation, and a strict object would refuse a real purchase for
|
|
53
|
+
* carrying something new.
|
|
54
|
+
*/
|
|
55
|
+
export declare const PlaySubscriptionPurchase: z.ZodObject<{
|
|
56
|
+
subscriptionState: z.ZodString;
|
|
57
|
+
latestOrderId: z.ZodOptional<z.ZodString>;
|
|
58
|
+
startTime: z.ZodOptional<z.ZodString>;
|
|
59
|
+
linkedPurchaseToken: z.ZodOptional<z.ZodString>;
|
|
60
|
+
acknowledgementState: z.ZodOptional<z.ZodString>;
|
|
61
|
+
testPurchase: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
62
|
+
pausedStateContext: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
autoResumeTime: z.ZodOptional<z.ZodString>;
|
|
64
|
+
}, z.core.$loose>>;
|
|
65
|
+
externalAccountIdentifiers: z.ZodOptional<z.ZodObject<{
|
|
66
|
+
obfuscatedExternalAccountId: z.ZodOptional<z.ZodString>;
|
|
67
|
+
obfuscatedExternalProfileId: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.core.$loose>>;
|
|
69
|
+
lineItems: z.ZodArray<z.ZodObject<{
|
|
70
|
+
productId: z.ZodString;
|
|
71
|
+
expiryTime: z.ZodOptional<z.ZodString>;
|
|
72
|
+
autoRenewingPlan: z.ZodOptional<z.ZodObject<{
|
|
73
|
+
autoRenewEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
}, z.core.$loose>>;
|
|
75
|
+
}, z.core.$loose>>;
|
|
76
|
+
}, z.core.$loose>;
|
|
77
|
+
export type PlaySubscriptionPurchase = z.infer<typeof PlaySubscriptionPurchase>;
|
|
78
|
+
/** `purchases.products.get`, as much of it as the projection reads. `.loose()` for the same reason. */
|
|
79
|
+
export declare const PlayProductPurchase: z.ZodObject<{
|
|
80
|
+
purchaseState: z.ZodNumber;
|
|
81
|
+
purchaseTimeMillis: z.ZodOptional<z.ZodString>;
|
|
82
|
+
orderId: z.ZodOptional<z.ZodString>;
|
|
83
|
+
purchaseType: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
acknowledgementState: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
consumptionState: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
obfuscatedExternalAccountId: z.ZodOptional<z.ZodString>;
|
|
88
|
+
regionCode: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$loose>;
|
|
90
|
+
export type PlayProductPurchase = z.infer<typeof PlayProductPurchase>;
|
|
91
|
+
/** What a Play lookup needs: the credentials, a clock, and the transport. */
|
|
92
|
+
export interface PlayApiOptions {
|
|
93
|
+
/** Google's credential block. The package name is part of every URL; the key signs the assertion. */
|
|
94
|
+
credentials: PaymentsGoogleCredentials;
|
|
95
|
+
/** The clock. Injected so an assertion's `iat` is deterministic in tests. */
|
|
96
|
+
now: Date;
|
|
97
|
+
/** The HTTP seam. Defaults to the runtime's `fetch`. */
|
|
98
|
+
transport?: GoogleHttpFetch;
|
|
99
|
+
/**
|
|
100
|
+
* An access token already minted, so a batch of lookups pays for one.
|
|
101
|
+
*
|
|
102
|
+
* Deliberately a parameter rather than a module-level cache: an access token is a bearer credential derived
|
|
103
|
+
* from a secret, and CLAUDE.md is explicit that a resolved secret is never cached in a module variable. So a
|
|
104
|
+
* single webhook mints one and drops it, and the reconciliation Workflow — which is the caller that makes
|
|
105
|
+
* hundreds of calls — mints one and passes it down.
|
|
106
|
+
*/
|
|
107
|
+
accessToken?: string;
|
|
108
|
+
}
|
|
109
|
+
/** What one lookup resolved: the normalized transaction, and the store account to link it by. */
|
|
110
|
+
export interface PlayPurchaseState {
|
|
111
|
+
/** The transaction, normalized. The route binds the owner onto it. */
|
|
112
|
+
event: UnboundProviderEvent;
|
|
113
|
+
/** The identifier the app attached at purchase time, or null. */
|
|
114
|
+
providerAccountId: string | null;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Mint an access token for the Play Developer API from the service-account key.
|
|
118
|
+
*
|
|
119
|
+
* The JWT-bearer grant: we sign an assertion saying who we are and what we want, Google hands back a token. No
|
|
120
|
+
* refresh token, no user consent, nothing stored — which is why the credential bundle holds a private key
|
|
121
|
+
* rather than an OAuth client.
|
|
122
|
+
*/
|
|
123
|
+
export declare function mintPlayAccessToken(credentials: PaymentsGoogleCredentials, options: {
|
|
124
|
+
now: Date;
|
|
125
|
+
transport?: GoogleHttpFetch;
|
|
126
|
+
}): Promise<string>;
|
|
127
|
+
/**
|
|
128
|
+
* The current state of a subscription purchase token, or `undefined` when Play has no subscription under it.
|
|
129
|
+
*
|
|
130
|
+
* `undefined` is how a one-time purchase identifies itself: Play has no "what kind of purchase is this" call, so
|
|
131
|
+
* the subscription endpoint's 404 is the answer. That is why this is the probe and the product lookup is the
|
|
132
|
+
* fallback — the subscription call takes a token alone, while the product call needs a product id we would
|
|
133
|
+
* otherwise have to take on a client's word.
|
|
134
|
+
*/
|
|
135
|
+
export declare function fetchPlaySubscription(purchaseToken: string, options: PlayApiOptions): Promise<PlaySubscriptionPurchase | undefined>;
|
|
136
|
+
/**
|
|
137
|
+
* The current state of a one-time purchase token under one product id, or `undefined` when Play has none.
|
|
138
|
+
*
|
|
139
|
+
* The product id is part of the URL, which is what makes a client-declared one safe to use: Play answers 404
|
|
140
|
+
* when the token does not belong to that product, so presenting a cheap token under an expensive SKU fails at
|
|
141
|
+
* Google rather than being believed here.
|
|
142
|
+
*/
|
|
143
|
+
export declare function fetchPlayProduct(productId: string, purchaseToken: string, options: PlayApiOptions): Promise<PlayProductPurchase | undefined>;
|
|
144
|
+
/** The normalized status for a Play subscription state. An unmapped state is refused, never granted. */
|
|
145
|
+
export declare function playSubscriptionStatus(state: string): PurchaseStatus;
|
|
146
|
+
/** The normalized status for a Play one-time purchase state. An unmapped state is refused, never granted. */
|
|
147
|
+
export declare function playProductStatus(purchaseState: number): PurchaseStatus;
|
|
148
|
+
/** What both mappings need from their caller: the token, the event time, and any override. */
|
|
149
|
+
export interface PlayEventContext {
|
|
150
|
+
/** The purchase token, which is the subscription family's identity and the lookup's key. */
|
|
151
|
+
purchaseToken: string;
|
|
152
|
+
/** The provider event time — the notification's, or the clock on a client submission. Never invented here. */
|
|
153
|
+
eventAt: Date;
|
|
154
|
+
/**
|
|
155
|
+
* A status the notification knows and the API does not. Only ever `revoked`, from
|
|
156
|
+
* `SUBSCRIPTION_REVOKED` — see `rtdn.ts`.
|
|
157
|
+
*/
|
|
158
|
+
statusOverride?: PurchaseStatus | null;
|
|
159
|
+
}
|
|
160
|
+
/** One Play subscription purchase, normalized. */
|
|
161
|
+
export declare function playSubscriptionEvent(purchase: PlaySubscriptionPurchase, context: PlayEventContext): PlayPurchaseState;
|
|
162
|
+
/** One Play one-time purchase, normalized. */
|
|
163
|
+
export declare function playProductEvent(purchase: PlayProductPurchase, context: PlayEventContext & {
|
|
164
|
+
productId: string;
|
|
165
|
+
}): PlayPurchaseState;
|
|
166
|
+
/**
|
|
167
|
+
* Resolve one notification pointer to a state, or `undefined` when Play has no purchase under that token.
|
|
168
|
+
*
|
|
169
|
+
* The pointer says which lookup to make, so there is no probing on this path — the notification already told us
|
|
170
|
+
* whether it concerns a subscription or a one-time product.
|
|
171
|
+
*/
|
|
172
|
+
export declare function resolvePlayPointer(pointer: GoogleNotificationPointer, options: PlayApiOptions): Promise<PlayPurchaseState | undefined>;
|
|
173
|
+
/**
|
|
174
|
+
* Re-read one stored purchase at Play, normalized — the reconciliation path for this rail.
|
|
175
|
+
*
|
|
176
|
+
* **Subscriptions only, and the reason is what the row keeps.** A Play purchase is addressed by its *purchase
|
|
177
|
+
* token*, and only a subscription row stores one: `originalTransactionId` is the token, because the token is
|
|
178
|
+
* the family key every renewal shares. A one-time row is keyed on Play's order id and stores no token at all,
|
|
179
|
+
* and `purchases.products.get` takes a token — so there is no call this function could make for one. That is a
|
|
180
|
+
* real gap rather than a shortcut: a refunded one-time Play purchase reaches this deployment as a
|
|
181
|
+
* voided-purchase notification, which is recorded with its order id and its reason, and repairing it needs the
|
|
182
|
+
* token recovered from somewhere the row does not have it.
|
|
183
|
+
*
|
|
184
|
+
* A subscription that has never been paid has no order id yet and is keyed on its own token, so
|
|
185
|
+
* `originalTransactionId` is null and `providerTransactionId` is the token. Both spellings resolve.
|
|
186
|
+
*/
|
|
187
|
+
export declare function refreshPlayPurchase(purchase: PaymentsPurchase, options: PlayApiOptions): Promise<UnboundProviderEvent | undefined>;
|
|
188
|
+
//# sourceMappingURL=playApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playApi.d.ts","sourceRoot":"","sources":["../../../src/rails/google/playApi.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAuB,MAAM,qBAAqB,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,KAAK,eAAe,EAA+B,MAAM,QAAQ,CAAC;AAE3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,QAAQ,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,+GAA+G;AAC/G,eAAO,MAAM,gBAAgB,wCAAwC,CAAC;AAEtE,0FAA0F;AAC1F,eAAO,MAAM,aAAa,gEAAgE,CAAC;AAE3F,6GAA6G;AAC7G,eAAO,MAAM,UAAU,qDAAqD,CAAC;AAkF7E;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;iBA8D+C,CAAC;AACrF,MAAM,MAAM,wBAAwB,GAAG,CAA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