feat: generic checkout system — products table, orders table, dynamic form fields #127
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#127
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 jersey order + Phase 14 → contracts/billing foundationRepo
forgejo_admin/basketball-apiUser Story
As an admin
I want a reusable checkout system where I define products with custom form fields
So that every future payment type (jerseys, contracts, tournament fees) uses the same flow without new code
Context
Currently jersey ordering is hardcoded in
jersey.pywith fixed options and no custom field collection (number, sizes). Contracts (Phase 14) will need their own payment flow. Instead of building one-offs, we're building a generic system:custom_fieldsspec that drives the frontend formcustom_datafor form responses/checkout?token=...&category=jerseyrenders products + form fields from the DBJersey ordering becomes the first consumer. Contracts and billing tiers will follow using the same system.
Decisions made:
custom_fieldsis JSON on products — no separate fields table. Each entry:{key, label, type, required, options?}custom_datais JSON on orders — stores form responses keyed by field keyjersey_option/jersey_order_statuson Player will be deprecated in favor of orders tableregistration_tokenauth pattern for tokenized linksFile Targets
Files the agent should modify or create:
src/basketball_api/models.py— add Product and Order models, ProductType/ProductCategory/OrderStatus enumsalembic/versions/xxx_generic_checkout.py— create products + orders tables, seed jersey products, migrate existing jersey data to orderssrc/basketball_api/routes/checkout.py— new generic checkout routes:GET /checkout/products?category=,POST /checkout/create-session,GET /checkout/orderssrc/basketball_api/routes/webhooks.py— updatecheckout.session.completedhandler to create/update orderssrc/basketball_api/main.py— register checkout routerFiles the agent should NOT touch:
src/basketball_api/routes/jersey.py— keep for backwards compat, deprecate latersrc/basketball_api/services/email.py— email changes are separateAcceptance Criteria
/checkout/create-sessionwith product_id + token + custom_data, a Stripe Checkout Session is created/checkout/orders, I see all orders with product info and custom_dataTest Expectations
pytest tests/ -vConstraints
sqlalchemy.dialects.postgresql.JSONBtofu plan -lock=falseN/A — pure API changeChecklist
Related
Westside Basketball— project