feat(admin): move Stripe checkout knobs into DB admin settings (BUNYIP-351) #352
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/BUNYIP-351-stripe-checkout-db-config"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Phase 3 (final) of BUNYIP-351: move the non-secret Stripe checkout knobs (
STRIPE_SUCCESS_URL,STRIPE_CANCEL_URL,BUNYIP_BILLING_TRIAL_PERIOD_DAYS) into the existingstripe_configsingleton so an admin can tune them from the Stripe settings page without a redeploy.Previously these were env-only and
StripeConfig::from_db_modelalways took them from env even when the secrets came from the DB. Now they are nullablesuccess_url/cancel_url/trial_period_dayscolumns; NULL falls back to the env default at load time, matching the DB-overrides-env pattern the Stripe secrets already use.How
stripe_config.CORS_ORIGINorigin for the URLs, 30-day trial fallback) is extracted into sharedsuccess_url_from_env/cancel_url_from_env/trial_period_days_from_envhelpers, so the runtimeStripeConfigand the admin read model (StripeConfigResponse) resolve the fallback through one source and cannot diverge.StripeConfig::from_db_modelreads the three columns (DB-over-env). The adminGET/PUT /v1/admin/stripesurface + hot-reload already carry the resolved config through, so a change applies without a restart.updategains the three args (COALESCE = "no change" on NULL); the two other callers (key-rotation re-encrypt, webhook secret auto-save) passNone.success_url/cancel_url/trial_period_dayswith validation (trial 0-365); bunyip-web Stripe form gains the inputs + a "Checkout" section.Not moved
free_price_idis intentionally left out: it is already admin-configurable viatier_config(the Tier Settings page). Adding it tostripe_configwould create a third source for the same value.Tests
fmt --check,clippy -D warnings, and the fulltest --workspacesuite are green in the pinned container. A new unit test coversfrom_db_modelresolving DB-over-env for the knobs (DB value wins, NULL falls back to env); the existing Stripe model tests were updated for the new row fields.Scope
Closes the BUNYIP-351 series: phase 1 (auto-ban) merged, phase 2 (email/SMTP) is #351, this is phase 3. Stripe secrets and tier config were already DB-backed before the series.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CTpxCd1SvpE8sk82aGikkz