Feature: Promo code for free registration + fix SPA submission #106
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#106
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
Feature
Lineage
plan-wkq→ Phase 11 (Girls Tryout — March 24)Repo
forgejo_admin/basketball-apiUser Story
As a coach or tester
I want to enter a promo code during registration
So that the tryout fee is waived and registration completes without Stripe
Context
Registration for the March 24 girls tryout needs to work end-to-end. Currently the SPA at
westsidekingsandqueens.tail5b443a.ts.net/registerhas a beautiful 4-step form but its submit handler sends JSON while the API expects multipart FormData — registration never actually reaches the database. The basketball-api has a working server-rendered form at/registerbut it lacks a promo/coupon mechanism.We need two things:
POST /registerreturns HTML)Decision: promo codes stored as a simple env var (
TRYOUT_PROMO_CODES=TESTFREE,COMP2026) checked server-side. No database table needed for v1.File Targets
Files to modify:
src/basketball_api/routes/register.py— addPOST /api/registerJSON endpoint accepting SPA payload, add promo code validationsrc/basketball_api/core/config.py— addTRYOUT_PROMO_CODESsetting (comma-separated env var)src/basketball_api/routes/upload.py— ensure photo upload works as a separate call (SPA uploads photo first, then sends URL)Files NOT to touch:
src/basketball_api/routes/admin.py— no admin changes neededPOST /register— keep working as-is for direct accessAcceptance Criteria
POST /api/registeraccepts JSON with fields:player_name,division,graduating_class,parent_first,parent_last,parent_email,parent_phone,waiver_accepted,signature_name,payment_method,promo_code,photo_urlRegistration.payment_status = paid,Registration.signup_method = promo{"error": "Invalid promo code"}payment_method = cash→Registration.payment_status = pendingpayment_method = card→ return Stripe checkout URL{"success": true, "email": "...", "password": "..."}Test Expectations
pytest tests/ -k test_promoConstraints
routes/register.pyParent,Player,Registrationmodel creation logic fromsubmit_registration()POST /upload/photocall — SPA uploads first, passesphoto_urlin registration payloadChecklist
Related
westside-basketball— projectforgejo_admin/westside-app #46— SPA false-success bug (frontend counterpart)plan-wkqPhase 11 — Girls Tryout March 24