Bug: jersey_option set on checkout creation, not payment confirmation #137
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/basketball-api#137
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Type
Bug
Lineage
plan-wkq→ Phase 11 (Girls Tryout) → discovered during jersey email blast 2026-03-21Repo
forgejo_admin/basketball-apiWhat Broke
POST /jersey/checkout(jersey.py:169-172) setsplayer.jersey_optionandplayer.jersey_order_status = pendingimmediately when the Stripe checkout session is created — before the parent even sees the payment page. If the parent abandons checkout (closes tab, card declined, navigates away), the DB retains the jersey option as if it were a real order.Found on 2026-03-21: 4 players had
jersey_optionset (reversible/jersey_warmup) with zero matching Stripe charges. Stripe showed all jersey checkout sessions asunpaid. Data was manually cleaned — fake orders cleared, only legitimate opt-outs retained.Repro Steps
/jersey?token={parent_token}SELECT jersey_option FROM players WHERE parent_id = {id}→ showsreversible(should be NULL)Expected Behavior
jersey_optionshould remain NULL until Stripe confirms payment via webhook. The webhook handler (webhooks.py:199-200) already reads the option from Stripe session metadata and sets it correctly oncheckout.session.completed. The checkout endpoint should only create the Stripe session, not pre-set the order.Opt-out is correct — no Stripe involved, sets
jersey_option = opt_outimmediately (jersey.py:116-120). No change needed there.Environment
a81d8817710bbce5a9da558a1af73db4ff25c3ddAcceptance Criteria
jersey_optionremains NULLjersey_optionandjersey_order_status = paidRelated
plan-wkq— Phase 11project-westside-basketball