Files
co-lite/openspec/changes/add-event-ticket-orders/proposal.md
T

71 lines
4.2 KiB
Markdown

# Proposal
## Why
Co-Lite is growing from an event lead-capture tool into an event hosting platform. Some events are free and some are paid. Paid events need tickets: an organiser sets ticket types and prices, and visitors request tickets on the event's landing page. There is no payment gateway yet. Buyers pay outside Co-Lite and staff mark the order paid. Every buyer still becomes a lead on the event, so paid events feed the sales pipeline just as free ones do.
The product design was approved on 2026-12-04: `docs/superpowers/specs/2026-12-04-event-ticketing-design.md`. This is the first of two changes. It covers the order side. The second change, `add-event-tickets`, covers QR tickets, naming attendees, consent and check-in at the door.
## What Changes
- **Event ticket settings:**
- Events gain a Tickets switch, which is off by default. While it is off, the event behaves exactly as today.
- Ticketed events also gain payment instructions and hold days (1 to 14, default 3).
- **Ticket types per event:** each has a name, a price in MYR (0 or more), a quantity, an optional sales end date, a sort order and an enabled flag.
- A type with orders cannot be deleted, only disabled.
- A type's quantity cannot drop below the seats it already holds.
- **New landing-page block TICKETS:**
- It shows the event's ticket types with price and seats left.
- It takes quantities, up to 10 per order, and the buyer's details with the privacy consent.
- It creates an order and shows a thank-you with the payment instructions and the order link.
- **Orders:**
- An order holds lines, one per ticket type, and one ticket row per seat. The line has a `kind` column, `TICKET` for now, so merch can be added later.
- Order states: Awaiting payment, Paid, Cancelled and Expired. Orders that total RM 0 are Paid at once.
- Seats are locked so ticket types never oversell. Held tickets count toward event capacity before the event days.
- At most 3 orders per email per event may await payment at once.
- **Order page:** a public page at `/o/<token>` shows the order's status, lines, total, payment instructions and hold expiry.
- **Expiry job:** a scheduled job expires unpaid orders after the hold and frees their seats.
- **Emails:** order received, order paid, order expired and order cancelled. "Order paid" confirms payment only; the tickets come with change 2.
- **Staff Tickets section on the event, under the new permission `BO_EVENT_TICKETS`:**
- the ticket settings and ticket types;
- an orders list and an order detail page, with these actions: mark paid (with an optional payment reference), cancel order, cancel ticket, and resend email.
- Every action is audited.
- **Buyer as a lead:** the buyer becomes an event lead with the new source `TICKET`, matched as in QR registration.
- **Capacity:** "Capacity before the event" now also counts held tickets.
## Capabilities
### New Capabilities
- `event-ticketing`: ticket types, ticket orders, the order page, order emails, hold expiry and the staff order screens.
### Modified Capabilities
- `landing-pages`: new TICKETS block.
- `event-invitations`: "Capacity before the event" counts held tickets.
- `event-attendance`: walk-ins leave out ticket buyers; the numbers show held tickets, and the total includes them.
## Impact
- **SQL:**
- service-counter: new tables `ticket_type`, `shop_order`, `shop_order_line` and `ticket`; new event columns `tickets_enabled`, `payment_instructions` and `hold_days`.
- service-system: new module `BO_EVENT_TICKETS`.
- **solvway-services-counter:**
- ticket entities and services;
- order creation with seat locking;
- the expiry job;
- `CmsBlockValidator` (TICKETS);
- the capacity count in `EventHeadcountService` and the invite registration.
- **solvway-mobile-api:**
- admin ticket endpoints;
- public TICKETS submit and order page endpoints, with their limits;
- order emails;
- public page data for TICKETS.
- **solvway-api-gateway:** open the new public counter paths.
- **solvway-admin-portal:**
- the Tickets section on the event, plus the order list and detail pages;
- the TICKETS block in the renderer and both editors;
- the `/o/[token]` page and its proxy;
- labels in English and zh-CN.
- **No new dependencies.**