mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 18:37:24 +00:00
- migration 0008: plans, immutable plan_versions, plan_prices (Stripe mirror), entitlement_grants, entitlement_audit, entitlement_shadow_diffs, stripe_sync_state; subscriptions.seat_price_id - catalog/catalog.json (catalog-as-code: Team, Enterprise, Trial; no prices) + scripts/catalog-apply.ts - typed entitlement registry (entitlement-keys.ts) with sum/max/union/or aggregation - grants.ts: idempotent projection of each subscription (Stripe mirror) and trial into grants, hold/release/revoke, out-of-order guard, terminal revocation, audit; manual/promo grants - entitlements.ts: one builder fed by legacy terms or grant terms; ENTITLEMENTS_MODE off|shadow|on; shadow records every disagreement; lazy re-projection; cron backfill - trial hours come from the catalog's trial plan when on (granted trials keep their hours) - the whole suite runs in legacy, shadow (zero diffs enforced) and on modes
54 lines
3.1 KiB
JSON
54 lines
3.1 KiB
JSON
{
|
|
"$schema": "node_modules/wrangler/config-schema.json",
|
|
// DEV deployment only (workers.dev, no custom domain, Stripe TEST MODE). Deploy:
|
|
// wrangler d1 migrations apply BILLING_DB --remote -c wrangler.dev.jsonc
|
|
// wrangler deploy -c wrangler.dev.jsonc
|
|
// Secrets (wrangler secret put <NAME> -c wrangler.dev.jsonc, never here): STRIPE_SECRET_KEY (sk_test_/rk_test_),
|
|
// STRIPE_WEBHOOK_SECRET (the test-mode endpoint's whsec_), CONTROL_PLANE_TOKEN (shared with
|
|
// orca-sandbox-control-dev), BILLING_DEV_JWKS (operator key set for e2e until auth mints billing tokens).
|
|
"name": "orca-billing-dev",
|
|
"main": "src/index.ts",
|
|
"compatibility_date": "2026-11-01",
|
|
"workers_dev": true,
|
|
"d1_databases": [
|
|
{
|
|
"binding": "BILLING_DB",
|
|
"database_name": "orca-billing-dev",
|
|
"database_id": "12aa0820-642a-4174-8504-f42d32043959",
|
|
"migrations_dir": "migrations"
|
|
}
|
|
],
|
|
// Same-account Workers cannot call each other over workers.dev (error 1042): the GitHub install URL
|
|
// for the setup chain goes to the control plane through this binding (SANDBOX_CONTROL_URL names the origin).
|
|
"services": [{ "binding": "SANDBOX_CONTROL", "service": "orca-sandbox-control-dev" }],
|
|
// Retries Stripe meter reports that failed inline.
|
|
"triggers": { "crons": ["*/10 * * * *"] },
|
|
"vars": {
|
|
"BILLING_ENV": "dev",
|
|
// Plans & entitlements rollout (env.ts): 'shadow' serves the legacy terms and records every
|
|
// disagreement of the grant resolver in entitlement_shadow_diffs; 'on' once a full e2e run
|
|
// leaves that table empty. Needs migration 0008 and `tsx scripts/catalog-apply.ts --config wrangler.dev.jsonc`.
|
|
"ENTITLEMENTS_MODE": "shadow",
|
|
"STRIPE_API_VERSION": "2025-09-30.clover",
|
|
"STRIPE_METER_EVENT_NAME": "orca_sandbox_seconds",
|
|
// Stripe TEST MODE objects in acct_1Or7xeKb73TzRkjk (scripts/stripe-test-setup.ts).
|
|
"STRIPE_PRICE_TEAM_MONTHLY": "price_1UZmKpKb73TzRkjk33aiB2th",
|
|
"STRIPE_PRICE_TEAM_ANNUAL": "price_1UZmKpKb73TzRkjkS7qv85NI",
|
|
// $1.00 per sandbox hour, billed by the minute (unit_amount_decimal 1.666666666667, divide_by 60).
|
|
"STRIPE_PRICE_OVERAGE": "price_1UaDDzKb73TzRkjkznGWUEoC",
|
|
"STRIPE_PORTAL_CONFIGURATION": "bpc_1UZmKvKb73TzRkjk59rIuHbx",
|
|
"BILLING_RETURN_URL": "https://orca-billing-dev.lovecast.workers.dev/return",
|
|
"BILLING_JWT_AUDIENCE": "orca-billing",
|
|
"BILLING_JWKS_URL": "https://login.onorca.dev/.well-known/jwks.json",
|
|
"BILLING_AUTH_ISSUER": "https://login.onorca.dev",
|
|
// Dev only: also accept Orca Cloud auth STAGING tokens and pull seat counts from staging auth
|
|
// (secret MEMBERSHIP_SYNC_TOKEN must equal staging's ORCA_CLOUD_BILLING_MEMBERSHIP_TOKEN).
|
|
"BILLING_STAGING_JWKS_URL": "https://auth-staging.onorca.dev/.well-known/jwks.json",
|
|
"BILLING_STAGING_AUTH_ISSUER": "https://auth-staging.onorca.dev",
|
|
"AUTH_INTERNAL_URL": "https://auth-staging.onorca.dev",
|
|
// Cloud setup sessions: pages on staging auth, GitHub install URLs from the dev control plane.
|
|
"CLOUD_SETUP_PAGES_URL": "https://auth-staging.onorca.dev",
|
|
"SANDBOX_CONTROL_URL": "https://orca-sandbox-control-dev.lovecast.workers.dev"
|
|
}
|
|
}
|