E4: Ticket Purchase Flow - Tasks¶
Epic: E4: Ticket Purchase Flow
E4-F1: Match Listing API¶
Feature: E4-F1: Match Listing API
| Status | Task | Verification |
|---|---|---|
| Implement GET /matches endpoint (public) | Returns upcoming matches | |
| Sort by kick_off_time ascending | Matches ordered correctly | |
| Include sale_status field (not_on_sale, on_sale, sold_out) | Status accurate | |
| Include pricing preview (pre-sale and regular) | Prices shown |
E4-F2: Zone Selection & Availability¶
Feature: E4-F2: Zone Selection & Availability
| Status | Task | Verification |
|---|---|---|
| Implement GET /matches/{id}/zones endpoint | Returns zones with availability | |
| Calculate availability from seat inventory (Available status count) | Count accurate | |
| Apply pre-sale discount if before day of match | Discounted price shown | |
| Apply full price on match day | Full price shown on match day | |
| Limit quantity to min(4, available) | Cannot select more than available |
E4-F3: Snake Algorithm Seat Assignment¶
Feature: E4-F3: Snake Algorithm Seat Assignment
| Status | Task | Verification |
|---|---|---|
| Create SectorSnakeConfig database migration (sector_id, stadium_template_id, best_row_index, traversal_direction, within_row_strategy, subsector_grouping_json) | Run migrations | |
| Implement snake algorithm function (zone_id, quantity) -> seat_ids[] | Unit test returns adjacent seats | |
| Support TOP_TO_BOTTOM traversal direction (configurable per sector) | Seats assigned from top row | |
| Support BOTTOM_TO_TOP traversal direction (configurable per sector) | Seats assigned from bottom row | |
| Fill rows alternating direction within row (L-to-R, then R-to-L snake pattern) | Seat IDs follow snake pattern | |
| Skip non-available seats | Only Available seats returned | |
| Implement fallback to single-seat allocation when adjacency impossible | Single seats allocated with warning | |
| Handle irregular stadium geometries via subsector grouping | Subsectors traverse correctly | |
| Return error if not enough seats available | Insufficient seats returns error |
E4-F4: Cart Management & TTL¶
Feature: E4-F4: Cart Management & TTL
| Status | Task | Verification |
|---|---|---|
| Create cart data structure in Redis (user_id -> {seats[], match_id, is_adjacent, expires_at}) | Can set and get cart | |
| Implement POST /cart/add endpoint using snake algorithm | Seats assigned and reserved | |
| Set TTL from queue entry time (or current time if no queue) | TTL correct | |
| Implement GET /cart endpoint returning items and remaining TTL | TTL countdown accurate | |
| Implement DELETE /cart endpoint to clear cart | Seats released | |
| Implement Redis expiration callback to release seats | Expired carts release seats |
E4-F5: Checkout Ticket Holder Entry¶
Feature: E4-F5: Checkout Ticket Holder Entry
| Status | Task | Verification |
|---|---|---|
| Implement POST /checkout/ticket-holders endpoint | Accepts ticket holder data | |
| Auto-populate first ticket holder from user's default profile | Data pre-filled | |
| Lock first ticket holder to logged-in user (cannot change) | Change attempt returns 400 | |
| Allow saved profile selection for additional tickets | Profile IDs accepted | |
| Allow manual entry for additional tickets | Manual data accepted | |
| Disable email field for minors (DOB < 18 years) | Minor email forced to buyer email |
E4-F6: Blacklist Validation at Checkout¶
Feature: E4-F6: Blacklist Validation at Checkout
| Status | Task | Verification |
|---|---|---|
| Call blacklist check service for all ticket holder OIBs at checkout | All OIBs checked | |
| Block checkout if any OIB blacklisted | Blacklisted OIB returns 403 | |
| Return MUP referral message on block | Message includes MUP contact | |
| Log blocked attempt with user/IP details | ViolationLog record created |
E4-F7: Payment Processing (Stripe)¶
Feature: E4-F7: Payment Processing (Stripe)
| Status | Task | Verification |
|---|---|---|
| Create payment_intent with Stripe API on checkout submit | payment_intent_id returned | |
| Store payment_intent_id in Order record | Order has stripe reference | |
| Implement Stripe webhook handler for payment_intent.succeeded | Webhook processes successfully | |
| Update order status to COMPLETED on payment success | Order status changed | |
| Handle payment_intent.payment_failed webhook | Order remains pending |
E4-F8: Order Confirmation & Ticket Generation¶
Feature: E4-F8: Order Confirmation & Ticket Generation
| Status | Task | Verification |
|---|---|---|
| Create tickets after payment success (one per seat) | Ticket records created | |
| Set ticket status to SOLD | Tickets have SOLD status | |
| Send order confirmation email with order details | Email sent | |
| Push notification: "Your tickets are ready" | Push sent |
Last Updated: January 2026