test(e2e): un-fixme subscribe + billing-portal behind a staging-Stripe gate (BUNYIP-151) #227
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/bunyip-151-billing-specs-stripe-gate"
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
Un-fixme the two deterministic billing specs (
subscribe,billing-portal) behind a staging-Stripe gate, and document whycancelis deferred. Part of BUNYIP-151.Gate (mirrors the mail-sink pattern)
subscribe+billing-portalnowtest.skip(!env.stripeSecretKey, ...): they run when the operator provisionsE2E_STAGING_STRIPE_SECRET_KEY(set alongside staging Stripe test mode) and skip otherwise, so this is safe to land before staging Stripe exists. The production-apex skip stays as the hard backstop against a real charge.subscribe:POST /membership/subscribe-> assert the 30x redirect targetscheckout.stripe.com.billing-portal: read-onlyGET /checkout/success-> assert it does not error.cancel deferred (with reasons)
Investigation found
cancelis webhook-dependent:/membership/cancelearly-returns"No active membership to cancel"unlessmembership_statusis active (bunyip-api/src/handlers/membership.rs), which only flips active via thecustomer.subscription.createdwebhook; and the account'sstripe_customer_idis not exposed in/me. So a real cancel test needs a setup step that creates a Stripe test-mode subscription on the account's customer (found via the Stripe API by email) and waits for the webhook. That can't be validated until staging Stripe + the webhook are live, so it's deferred rather than shipped blind. The spec comment + dev-docs record exactly what it needs.Verification
tsc --noEmitclean;subscribe/billing-portalcollect as real tests,cancelstays fixme. e2e-only, no app change.Operator handoff (cannot be done from the agent)
STRIPE_SECRET_KEY(sk_test_...),STRIPE_WEBHOOK_SECRET(whsec_...), and the price id on staging bunyip-api (admin UI/admin/stripe, or env in the SOPScompose-secrets.yml). Point a Stripe test-mode webhook at the staging webhook route using thatwhsec_.sk_test_...as the Forgejo secretE2E_STAGING_STRIPE_SECRET_KEY.Then
subscribe/billing-portalactivate on the next staging e2e run.🤖 Generated with Claude Code