docs(openspec): archive add-event-tickets and sync its specs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
This commit is contained in:
1 parent
96ab8e6f5b
commit
e1902074ba
11 files changed
+211
-6
No files matched your search
@@ -0,0 +1,2 @@
|
||||
schema: spec-driven
|
||||
created: 2026-12-04
|
||||
@@ -0,0 +1,130 @@
|
||||
# Design
|
||||
|
||||
Product design: `docs/superpowers/specs/2026-12-04-event-ticketing-design.md` (approved 2026-12-04). This file holds the technical contracts. Change 1 (`add-event-ticket-orders`) already built the `ticket` table with `code`, the attendee columns, `event_lead_uuid` and the `checked_in_*` columns, so this change mostly fills them in.
|
||||
|
||||
## Context
|
||||
|
||||
- **Tickets and orders:**
|
||||
- Orders and tickets live in services-counter: `TicketOrderService` handles the request and `byToken`; `TicketOrderStaffService` handles mark paid, cancel and resend; `TicketOrderMailer` sends the order emails; `TicketOrderExpiryJob` expires holds.
|
||||
- mobile-api's `PublicPageService` holds the public order endpoints and `AdminTicketService` the staff ones.
|
||||
- The gateway's `JWTAuthFilter` lists the counter paths that are public.
|
||||
- **Venue self check-in:**
|
||||
- `EventCheckInService.lookup` returns `CHECKED_IN` or `FORM`.
|
||||
- The walk-in form posts to the existing register path with `attend=true`.
|
||||
- **Capacity:** "a registered invite counts toward capacity" already holds. `EventGuestService.register`, `TicketOrderService.create` and `EventHeadcountService` all add registered guests, walk-ins and held tickets. No work here.
|
||||
- **Leads:** `RegistrationService.register(RegisterRequest)` does the QR-registration matching and takes `source`, `consentNoticeId`, `consentAt` and `attend`. It returns the event lead uuid.
|
||||
- **Portal:**
|
||||
- `clientApi` redirects to `/login` on a 401.
|
||||
- `/api/auth/session` does not redirect, and tells whether a staff session exists.
|
||||
- `qrcode.react` draws QRs in the browser only.
|
||||
|
||||
## Goals / Non-Goals
|
||||
|
||||
**Goals:**
|
||||
- Ticket codes on payment.
|
||||
- The `/t/<code>` page with its public and staff views.
|
||||
- Attendee naming on the order page.
|
||||
- Attendee consent.
|
||||
- The paid email with the tickets, the ticket email, and resend ticket.
|
||||
- Door check-in.
|
||||
- Self check-in rules on ticketed events.
|
||||
- The ticket counts.
|
||||
|
||||
**Non-Goals:**
|
||||
- Payment gateway.
|
||||
- Merch.
|
||||
- Member accounts.
|
||||
- WhatsApp ticket delivery: an attendee named with a mobile only gets no message; the buyer forwards the link.
|
||||
- Transferring a ticket to another order.
|
||||
- Printing tickets.
|
||||
|
||||
## Decisions
|
||||
|
||||
1. **Codes are issued when the order becomes Paid.** This happens inside the same transaction as the status change, at three places: `TicketOrderService.create` (free order), `TicketOrderStaffService.markPaid` (Awaiting payment or Expired), and nowhere else. Codes use the existing 22-character `RegistrationLinkService.newToken()`; `uk_ticket_code` guards uniqueness. Cancelling keeps the code, and validity is computed: the order is `PAID` and the ticket is `ACTIVE`.
|
||||
- *Alternative:* codes at request time. Rejected, because an unpaid order would then carry QRs that look real.
|
||||
2. **Ticket state, computed in one place.** `TicketState.of(order, ticket)` returns `VALID`, `CHECKED_IN`, `AWAITING`, `ORDER_CANCELLED`, `ORDER_EXPIRED` or `TICKET_CANCELLED`. The public page, the staff view, check-in and self check-in all use it.
|
||||
3. **Renaming replaces the code.** The attendee save is `POST ticket/attendee` with the order token, ticket id, name, mobile, email and `permission`. In one transaction it:
|
||||
- checks the order token and that the order is `PAID`;
|
||||
- checks the ticket is `ACTIVE` and not checked in;
|
||||
- sets a new code, `attendee_named_at`, the attendee fields, and clears `attendee_consent_at`, `attendee_notice_id` and `event_lead_uuid`;
|
||||
- after commit, sends the Ticket email when an email is set.
|
||||
- Normalisation and the `MOBILE_OR_EMAIL_REQUIRED`, name-length and email-format errors reuse the QR registration helpers in mobile-api.
|
||||
4. **Consent creates the lead through `RegistrationService.register`.** It is called with source `TICKET`, no salesperson, the company's current notice and `attend=false`. At check-in it is called with `attend=true`. The returned event lead uuid is stored on the ticket. An attendee whose details match a lead is linked to it, as QR registration already does.
|
||||
- **Unnamed tickets:** the consent needs a name and contact, so on the public page it is offered only for a named ticket. At the door, staff enter them first.
|
||||
5. **Staff view detection.** The `/t/[code]` page first calls the portal's `/api/tickets/{code}`, which answers 401 at once when there is no session and otherwise calls `GET /api/admin/tickets/{code}`. Only when that fails does it load the public view (`GET /api/public/tickets/{code}`), so a door scan never counts toward the public `tkt:load` limit. That call is guarded by `@AdminModule("BO_EVENTS")` and scoped by company in mobile-api with `loadEvent(uuid, null)`, so another company's event is a 404. On 401, 403 or 404 the page stays public. The admin call uses a plain `fetch`, not `clientApi`, so a signed-out visitor is never bounced to login.
|
||||
6. **Check-in.** `POST /api/admin/tickets/{code}/checkin` takes optional `{name, mobile, email, consent}`, which are required when the ticket is unnamed. Refusals are 409 with the codes `ALREADY_CHECKED_IN|<time>`, `NOT_VALID|<state>` and `NOT_EVENT_DAY`. The update is conditional (`checked_in_at IS NULL`), so two scanners cannot both check a ticket in; the loser gets `ALREADY_CHECKED_IN`. The action is `@Audited`.
|
||||
7. **Self check-in on a ticketed event.** For `tickets_enabled` events only, `EventCheckInService.lookup` checks, in order:
|
||||
1. the oldest `ACTIVE` ticket on a `PAID` order of the event, not checked in, whose attendee mobile or email matches, or whose attendee is blank and whose order's buyer mobile or email matches. It is checked in with `checked_in_by = 'self'`, and the lead is marked attended when the ticket has one;
|
||||
2. a registered guest of the event, as today;
|
||||
3. otherwise the result is `SHOW_TICKET`.
|
||||
|
||||
The walk-in register path refuses a ticketed event with 409 `TICKETS_ONLY`. The welcome uses the attendee's first name, or the buyer's for an unnamed ticket.
|
||||
8. **QR PNG in mobile-api.** `GET /api/public/tickets/{code}/qr.png`:
|
||||
- checks the code shape and validity through counter `ticket/byCode`; an invalid or unknown code is 404;
|
||||
- encodes `<admin-portal-base>/t/<code>` with zxing `QRCodeWriter` at 300 px, written by `ImageIO`;
|
||||
- responds `Cache-Control: private, max-age=300`;
|
||||
- counts toward the `tkt:load` limit.
|
||||
|
||||
The portal proxies it like the page images. Emails use the absolute portal URL in `<img src>`.
|
||||
9. **Order page tickets.** Counter `byToken` adds `tickets: [{id, typeName, attendeeName, code, state, checkedInAt}]` only when the order is PAID. mobile-api passes them through without attendee mobile or email: the counter does not return those to the public call at all.
|
||||
10. **Emails.** `TicketOrderMailer`:
|
||||
- **PAID:** gains one block per active ticket: the type, the QR `<img>` and the link. It ends with "Name your attendees: <order link>".
|
||||
- **New kind TICKET:** sends one ticket to its attendee (or to the buyer, when staff resend an unnamed ticket), with the consent invitation link pointing to the ticket page.
|
||||
- All of them are sent after commit and are best effort, as today.
|
||||
11. **Counts.** `EventHeadcountService.Headcount` gains `ticketsAwaiting`, `ticketsPaid` and `ticketsCheckedIn`, from one grouped query over active tickets joined to their order status. The portal's GuestsCard shows them when the event sells tickets.
|
||||
12. **Limits.**
|
||||
- `tkt:load:<ip>` allows 120 per 10 minutes, for the ticket page and the QR together.
|
||||
- `tkt:submit:<ip>:<event>` allows 60 per 10 minutes, for naming and consent. Naming first looks up the order by its token, which counts toward the order page's `ord:load:<ip>` limit (120 per 10 minutes).
|
||||
- Staff check-in has no IP limit: it is an authenticated admin call.
|
||||
|
||||
## Data
|
||||
|
||||
`sql/01-ticket-attendees.sql` (services-counter, additive):
|
||||
|
||||
```sql
|
||||
ALTER TABLE `ticket`
|
||||
ADD COLUMN `attendee_named_at` datetime NULL,
|
||||
ADD COLUMN `attendee_consent_at` datetime NULL,
|
||||
ADD COLUMN `attendee_notice_id` bigint NULL,
|
||||
ADD KEY `idx_ticket_event_mobile` (`event_uuid`, `attendee_mobile_e164`),
|
||||
ADD KEY `idx_ticket_event_email` (`event_uuid`, `attendee_email`);
|
||||
```
|
||||
|
||||
- `sql/02-ticket-labels.sql` holds the labels, cut from `npm run i18n:sql`.
|
||||
- `sql/99-rollback.sql` drops the three columns and two keys. Codes stay, because change 1 owns the column.
|
||||
|
||||
## Endpoints
|
||||
|
||||
| Layer | Method and path | Auth |
|
||||
|---|---|---|
|
||||
| counter | `GET ticket/byCode/{code}` | public via gateway |
|
||||
| counter | `POST ticket/attendee` (order token, ticket id, attendee, permission) | public via gateway |
|
||||
| counter | `POST ticket/consent` (code, notice id) | public via gateway |
|
||||
| counter | `POST ticket/staff` and `POST ticket/checkin` (company id and code in the body) | JWT (from mobile-api admin) |
|
||||
| counter | `POST ticketOrder/resendTicket` (company, event, order and ticket ids in the body) | JWT |
|
||||
| mobile-api | `GET /api/public/tickets/{code}`, `GET .../qr.png`, `POST .../consent` | public |
|
||||
| mobile-api | `POST /api/public/orders/{token}/tickets/{ticketId}/attendee` | public |
|
||||
| mobile-api | `GET /api/admin/tickets/{code}`, `POST /api/admin/tickets/{code}/checkin` | `BO_EVENTS` |
|
||||
| mobile-api | `POST /api/admin/events/{uuid}/orders/{orderId}/tickets/{ticketId}/resend` | `BO_EVENT_TICKETS` |
|
||||
| gateway | public: `GET /counter/ticket/byCode/[A-Za-z0-9_-]{22}`, `POST /counter/ticket/attendee`, `POST /counter/ticket/consent` | |
|
||||
| portal | `/t/[code]` page (public in the route guard); proxies for each mobile-api path above | |
|
||||
|
||||
## Risks / Trade-offs
|
||||
|
||||
- **Mobile-only attendees get no ticket message.** The buyer shares the link. *Mitigation:* the order page shows each ticket's link with a copy button. WhatsApp delivery can follow once the business account is linked.
|
||||
- **A forwarded ticket link works for whoever holds it.** This is the same as any paper ticket; check-in is one-time. *Mitigation:* renaming replaces the code.
|
||||
- **Staff view on a phone needs a signed-in session in that phone's browser.** That is the existing portal login; the door staff sign in once.
|
||||
- **New dependency** `com.google.zxing:core`, MIT-style Apache 2.0, no transitive dependencies, used only for the email PNG.
|
||||
- **Self check-in matching an unnamed ticket to its buyer** lets the buyer check in once per unnamed ticket. Each lookup takes one ticket, which matches the buyer bringing friends whose names were never given. ponytail: no per-person cap; add one if abuse is seen.
|
||||
|
||||
## Migration Plan
|
||||
|
||||
1. Run `sql/01-ticket-attendees.sql` before the new services-counter starts. It is additive, and the old images ignore the columns.
|
||||
2. Deploy services-counter, mobile-api, api-gateway and the portal.
|
||||
3. Run `sql/02-ticket-labels.sql`.
|
||||
4. Orders paid before this release have tickets without codes. A one-off statement in `01` gives every active ticket on a PAID order a code, using `REPLACE(TO_BASE64(RANDOM_BYTES(16)), ...)` trimmed to the 22-character URL-safe form.
|
||||
5. **Rollback:** the previous images, then `99`.
|
||||
|
||||
## Open Questions
|
||||
|
||||
None for the owner. Builder calls are recorded above (decisions 4, 5 and 7) and in the release note.
|
||||
@@ -0,0 +1,85 @@
|
||||
# Proposal
|
||||
|
||||
## Why
|
||||
|
||||
Change 1 (`add-event-ticket-orders`, merged 2026-12-04) lets visitors request tickets and staff mark orders paid. A paid order still gives the buyer nothing to show at the door, and the venue's self check-in still offers the walk-in form, so anyone can walk into a paid event. This change adds the ticket itself: a QR code per seat, attendees, and check-in at the door.
|
||||
|
||||
The product design was approved on 2026-12-04: `docs/superpowers/specs/2026-12-04-event-ticketing-design.md`. This is the second and last change from that design.
|
||||
|
||||
## What Changes
|
||||
|
||||
- **Ticket codes:**
|
||||
- When an order becomes Paid, each of its active tickets gets an unguessable code. This includes free orders, which are Paid at once, and expired orders that staff mark paid.
|
||||
- The ticket's link is `/t/<code>`.
|
||||
- Unpaid, cancelled and expired tickets have no valid QR.
|
||||
- **Ticket page** `/t/<code>`:
|
||||
- **Public view:**
|
||||
- the event and ticket type;
|
||||
- the attendee's first name;
|
||||
- the ticket's state;
|
||||
- the QR image while the ticket is valid;
|
||||
- "This ticket is not valid" otherwise.
|
||||
- **Staff view:** for signed-in staff with `BO_EVENTS` in the event's company, on an event day, a large state banner and **Check in**. An unnamed ticket first asks for the attendee's name and mobile or email.
|
||||
- **Refusals:** a second check-in shows "Already checked in at <time>"; an unpaid, cancelled or expired ticket shows a red refusal.
|
||||
- **Naming attendees on the order page:**
|
||||
- Once an order is Paid, the order page lists its tickets, each with its link.
|
||||
- Per ticket, the buyer can name or rename the attendee (a name plus mobile or email). The save needs the tick "I have permission to share these details so their ticket can be sent".
|
||||
- Naming issues a new code, so the old QR stops working, and emails the attendee their ticket.
|
||||
- Naming is refused once the ticket is checked in.
|
||||
- **Attendee consent:**
|
||||
- A named attendee is not a lead.
|
||||
- The ticket page, and the staff view at check-in, offer an optional "Keep me updated about <company> events" with the company's privacy notice. Ticking it records the consent and makes the attendee an event lead with source `TICKET`, matched as in QR registration. The ticket email links to that page.
|
||||
- An attendee who never ticks it can still attend.
|
||||
- **Emails:**
|
||||
- "Order paid" now carries each ticket's QR image and link, plus a "Name your attendees" link to the order page.
|
||||
- A new **Ticket** email goes to a named attendee who has an email.
|
||||
- Staff can **Resend ticket** from the order detail.
|
||||
- **Door check-in:** checking a ticket in records who did it and when. An attendee who consented, now or earlier, has their event lead marked attended.
|
||||
- **Venue self check-in on a ticketed event:**
|
||||
- It checks in the attendee of a Paid ticket that is not yet checked in. If several match, it takes the oldest. An unnamed ticket counts as its buyer's.
|
||||
- It also checks in a registered invited guest, as today.
|
||||
- Anything else shows "Please show your ticket at the entrance" instead of the walk-in form.
|
||||
- Events without tickets keep today's flow unchanged.
|
||||
- **Event attendance numbers:** on a ticketed event they add tickets awaiting payment, tickets paid and tickets checked in.
|
||||
- **QR image for emails:** a public PNG at `/api/public/tickets/<code>/qr.png`. It encodes the ticket's `/t/<code>` link.
|
||||
- **Already done in change 1, so not repeated here:** a registered invite counts toward capacity alongside held tickets ("Capacity before the event").
|
||||
|
||||
## Capabilities
|
||||
|
||||
### New Capabilities
|
||||
|
||||
None. Tickets belong to the existing `event-ticketing` capability.
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
- `event-ticketing`:
|
||||
- **Order Emails:** the paid email carries the tickets.
|
||||
- **New requirements:** ticket codes, the ticket page and invalid links, tickets on the order page, naming attendees, attendee consent, the ticket email, the staff ticket view, door check-in, resend ticket, and the ticket abuse limits.
|
||||
- `event-attendance`:
|
||||
- **Self check-in of a known person** and **Self check-in of a walk-in** now apply to events without tickets.
|
||||
- **New requirements:** self check-in on a ticketed event, no walk-ins on a ticketed event, and the ticket attendance numbers.
|
||||
|
||||
## Impact
|
||||
|
||||
- **services-counter:**
|
||||
- ticket code issuing on Paid;
|
||||
- ticket lookup, naming, consent and check-in services;
|
||||
- `EventCheckInService.lookup` on ticketed events;
|
||||
- headcount;
|
||||
- `TicketOrderMailer` (the paid email with tickets, and the ticket email).
|
||||
- **mobile-api:**
|
||||
- public endpoints for the ticket page, the QR PNG, naming attendees and attendee consent;
|
||||
- admin endpoints for the staff ticket view, check-in and resend ticket.
|
||||
- **api-gateway:** public path patterns for the new endpoints.
|
||||
- **admin-portal:**
|
||||
- `/t/[code]` page (public view and staff view);
|
||||
- the order page gains its tickets section;
|
||||
- a Resend ticket button on the order detail;
|
||||
- the guests card shows the ticket counts;
|
||||
- proxies and the route guard;
|
||||
- labels in English and zh-CN.
|
||||
- **Database:** `ticket` gains the attendee consent time, privacy notice id, and naming time.
|
||||
- **New dependency:**
|
||||
- **What:** `com.google.zxing:core` in mobile-api, to draw the email QR as a PNG. It has no transitive dependencies; the PNG is written with the JDK's `ImageIO`.
|
||||
- **Why it is needed:** nothing in the repo draws a QR server-side. The portal's `qrcode.react` renders in the browser only. Email clients block SVG and data-URI images, so the email needs a hosted PNG.
|
||||
- **No change for events without tickets.**
|
||||
@@ -0,0 +1,61 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Self check-in on a ticketed event
|
||||
|
||||
On an event that sells tickets, the check-in page SHALL match the mobile or email only to the attendee of a valid ticket that is not checked in, or to a registered guest. An unnamed ticket SHALL count as its buyer's, and the oldest ticket SHALL be used when several match. A matched ticket SHALL be checked in, and the attendee's event lead marked attended when they have consented. A matched registered guest SHALL be handled as on other events.
|
||||
|
||||
#### Scenario: Ticket holder checks in
|
||||
|
||||
- **GIVEN** `KL Hotel Tech Day` sells tickets and `Lim Wei` holds a valid ticket named with his mobile
|
||||
- **WHEN** he enters that mobile on the check-in page on the event day
|
||||
- **THEN** the page welcomes `Lim` and his ticket is checked in
|
||||
|
||||
### Requirement: No walk-ins on a ticketed event
|
||||
|
||||
On an event that sells tickets, when the value matches no valid unchecked ticket and no registered guest, the check-in page SHALL show "Please show your ticket at the entrance." It SHALL NOT offer or accept a walk-in submission.
|
||||
|
||||
#### Scenario: No walk-ins on a paid event
|
||||
|
||||
- **GIVEN** `KL Hotel Tech Day` sells tickets
|
||||
- **WHEN** a visitor whose mobile matches no valid ticket and no registered guest enters it
|
||||
- **THEN** the page says "Please show your ticket at the entrance." and shows no form
|
||||
- **AND** a walk-in submission sent directly is refused
|
||||
|
||||
### Requirement: Ticket attendance numbers
|
||||
|
||||
When the event sells tickets, the event page SHALL also show tickets awaiting payment, tickets paid and tickets checked in, counting active tickets only. The numbers SHALL agree with the event's orders.
|
||||
|
||||
#### Scenario: Ticket counts
|
||||
|
||||
- **GIVEN** `KL Hotel Tech Day` has 2 tickets awaiting payment and 5 paid tickets, 3 of them checked in
|
||||
- **WHEN** an admin opens the event page
|
||||
- **THEN** the page shows tickets awaiting payment 2, paid 5, checked in 3
|
||||
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: Self check-in of a known person
|
||||
|
||||
On the event days, the check-in page SHALL ask for one mobile or email, normalised as in staff capture. On an event that does not sell tickets, when the value matches a registered guest or an event lead of this event, that event lead SHALL be marked attended. After a check-in the page SHALL show "Welcome, <first name>. You're checked in." Checking in again SHALL show the same welcome and change nothing. The page SHALL show no personal details other than the first name.
|
||||
|
||||
#### Scenario: Registered guest checks in
|
||||
|
||||
- **GIVEN** `Tan Mei Ling` registered by invitation for `KL Expo`
|
||||
- **WHEN** she enters `012-555 0101` on the check-in page on the event day
|
||||
- **THEN** the page welcomes `Tan` and her event lead is attended
|
||||
- **AND** the guest list shows her as Attended
|
||||
|
||||
### Requirement: Self check-in of a walk-in
|
||||
|
||||
On an event that does not sell tickets, when the value matches an invited guest who has not registered, or no one, the check-in page SHALL show the walk-in form, blank, with the privacy consent. An accepted submission SHALL capture the person with the QR registration rules and no salesperson, link a matching guest, mark the event lead attended, and show the checked-in page.
|
||||
|
||||
#### Scenario: Invited but not registered
|
||||
|
||||
- **GIVEN** `Lim Wei` is Invited but never registered
|
||||
- **WHEN** he enters his mobile on the check-in page
|
||||
- **THEN** a blank walk-in form with the consent is shown, not his details
|
||||
- **AND** after he submits, he is Attended on the guest list
|
||||
|
||||
#### Scenario: Unknown walk-in
|
||||
|
||||
- **WHEN** a visitor whose mobile matches no one enters it and submits the walk-in form
|
||||
- **THEN** an event lead is captured for them and marked attended
|
||||
@@ -0,0 +1,191 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Ticket Codes
|
||||
|
||||
When an order becomes Paid, the system SHALL give each of its active tickets an unguessable code of 22 URL-safe characters, unique across all tickets. This SHALL apply when staff mark an order paid (also an Expired one) and when a free order is Paid at once. The ticket's link SHALL be `/t/<code>`. A ticket SHALL be valid only while its order is Paid and the ticket is active.
|
||||
|
||||
#### Scenario: Codes on payment
|
||||
|
||||
- **GIVEN** order `T-7K3M9Q` holds 2 `General` tickets and is Awaiting payment
|
||||
- **WHEN** staff mark it paid
|
||||
- **THEN** each ticket has its own code and link
|
||||
|
||||
#### Scenario: Free order
|
||||
|
||||
- **WHEN** a visitor requests 1 free `Community pass`
|
||||
- **THEN** the order is Paid and its ticket has a code at once
|
||||
|
||||
### Requirement: Ticket Page
|
||||
|
||||
The ticket link `/t/<code>` SHALL be public. It SHALL show the event name, dates and location, the ticket type, the attendee's first name (or "Not named yet") and the ticket's state. It SHALL show the QR image of its own link only while the ticket is valid and not checked in; a checked-in ticket SHALL show "Checked in at <time>". It SHALL never show the buyer's details, the attendee's mobile or email, or other tickets.
|
||||
|
||||
#### Scenario: Valid ticket
|
||||
|
||||
- **GIVEN** the ticket of `Tan Mei Ling` for `KL Hotel Tech Day` is valid
|
||||
- **WHEN** she opens its link
|
||||
- **THEN** the page shows the event, `General`, `Tan` and the QR image
|
||||
|
||||
### Requirement: Invalid Ticket Links
|
||||
|
||||
A ticket whose order is not Paid, or which is cancelled, SHALL show "This ticket is not valid" with no QR. An unknown code SHALL show "This ticket link is not valid." and nothing else.
|
||||
|
||||
#### Scenario: Cancelled ticket
|
||||
|
||||
- **GIVEN** a Paid order's ticket was cancelled by staff
|
||||
- **WHEN** someone opens that ticket's link
|
||||
- **THEN** the page says the ticket is not valid and shows no QR
|
||||
|
||||
#### Scenario: Unknown link
|
||||
|
||||
- **WHEN** a visitor opens `/t/` with an unknown code
|
||||
- **THEN** the page says the ticket link is not valid
|
||||
|
||||
### Requirement: Tickets On The Order Page
|
||||
|
||||
Once an order is Paid, its order page SHALL list each active ticket with its type, attendee name (or "Not named yet"), state and ticket link. It SHALL NOT show any attendee's mobile or email.
|
||||
|
||||
#### Scenario: Paid order page
|
||||
|
||||
- **GIVEN** order `T-7K3M9Q` is Paid with 2 tickets, one named `Tan Mei Ling`
|
||||
- **WHEN** the buyer opens its link
|
||||
- **THEN** the page lists both tickets with their links, `Tan Mei Ling` and "Not named yet", without Tan's email
|
||||
|
||||
### Requirement: Naming Attendees
|
||||
|
||||
On a Paid order's page, the buyer SHALL be able to name or rename the attendee of each ticket on its own: a name of up to 100 characters and a mobile or an email, normalised as in QR registration. The save SHALL need the tick "I have permission to share these details so their ticket can be sent"; without it the save SHALL be refused with "Tick the box to confirm you may share these details."
|
||||
|
||||
#### Scenario: Permission not ticked
|
||||
|
||||
- **WHEN** the buyer saves an attendee without the permission tick
|
||||
- **THEN** the save is refused and nothing changes
|
||||
|
||||
### Requirement: Naming Effects
|
||||
|
||||
Saving an attendee SHALL replace the ticket's code, so the old link becomes unknown. It SHALL record the naming time, clear any earlier attendee consent and lead link on that ticket, and email the new attendee their ticket when an email was given.
|
||||
|
||||
#### Scenario: Name an attendee
|
||||
|
||||
- **GIVEN** `Aisyah`'s order `T-7K3M9Q` is Paid with 2 unnamed tickets
|
||||
- **WHEN** she names `Tan Mei Ling`, `tan@example.com`, on the first ticket and ticks the permission
|
||||
- **THEN** that ticket shows `Tan Mei Ling` with a new link
|
||||
- **AND** Tan receives the ticket email
|
||||
- **AND** the old link of that ticket says the ticket link is not valid
|
||||
|
||||
### Requirement: Naming Refusals
|
||||
|
||||
Naming SHALL be refused for a ticket that is checked in ("This ticket is already checked in."), cancelled, or on an order that is not Paid.
|
||||
|
||||
#### Scenario: Checked-in ticket
|
||||
|
||||
- **GIVEN** a ticket is checked in
|
||||
- **WHEN** the buyer tries to rename its attendee
|
||||
- **THEN** the save is refused with "This ticket is already checked in."
|
||||
|
||||
### Requirement: Attendee Is Not A Lead Without Consent
|
||||
|
||||
A named attendee SHALL NOT be an event lead, and SHALL NOT appear in event leads, lead lists, exports or the dashboard, until they consent themselves. Their details SHALL be used only to deliver and check the ticket. An attendee who never consents SHALL still be able to attend.
|
||||
|
||||
#### Scenario: Attendee never opts in
|
||||
|
||||
- **GIVEN** `Lim Wei` was named on a Paid ticket and never ticked the consent
|
||||
- **WHEN** staff open the event leads listing
|
||||
- **THEN** Lim does not appear
|
||||
|
||||
### Requirement: Attendee Consent
|
||||
|
||||
A valid ticket's page SHALL offer an optional "Keep me updated about <company> events" with the company's privacy notice in English and Bahasa Malaysia. Ticking it SHALL record the consent time and notice version on the ticket. It SHALL capture the attendee as an event lead with source `TICKET` and no salesperson, matched and normalised as in QR registration, and link the ticket to that event lead.
|
||||
|
||||
#### Scenario: Attendee opts in
|
||||
|
||||
- **GIVEN** `Tan Mei Ling` was named on a valid ticket
|
||||
- **WHEN** she ticks "Keep me updated about INS events" on her ticket page
|
||||
- **THEN** she is an event lead of `KL Hotel Tech Day` with source Ticket
|
||||
|
||||
### Requirement: Ticket Email
|
||||
|
||||
A named attendee with an email SHALL get a Ticket email in English and Bahasa Malaysia. It SHALL hold the event name, dates and location, the ticket type, the attendee name, the QR image, and the ticket link, which also offers the consent. The QR image SHALL be a PNG of the ticket link served at `/api/public/tickets/<code>/qr.png`. Each email SHALL be recorded in Emails, and a failed send SHALL NOT undo the naming.
|
||||
|
||||
#### Scenario: Ticket email
|
||||
|
||||
- **WHEN** the buyer names `Tan Mei Ling`, `tan@example.com`
|
||||
- **THEN** Tan receives an email with the QR image and her ticket link
|
||||
|
||||
### Requirement: Staff Ticket View
|
||||
|
||||
On the ticket page, a signed-in user with `BO_EVENTS` in the event's company (any company for super admins) SHALL see the staff view: the ticket's state as a large banner and, for a valid ticket that is not checked in, **Check in**. An unnamed ticket SHALL first ask for the attendee's name and a mobile or email. The staff view SHALL offer the same optional consent as the ticket page. Everyone else SHALL see only the public view.
|
||||
|
||||
#### Scenario: Another company's staff
|
||||
|
||||
- **WHEN** CV staff open a ticket of an INS event
|
||||
- **THEN** they see only the public view
|
||||
|
||||
### Requirement: Door Check-In
|
||||
|
||||
Check-in from the staff view SHALL record the time and the staff user on the ticket, and SHALL be written to the admin audit log. When the attendee has consented, now or earlier, their event lead SHALL be marked attended. An unnamed ticket SHALL take the name and contact entered by staff, normalised as in QR registration.
|
||||
|
||||
#### Scenario: Staff check in a named ticket
|
||||
|
||||
- **GIVEN** `Tan Mei Ling`'s ticket is valid and it is the event day
|
||||
- **WHEN** event staff scan her QR and tap Check in
|
||||
- **THEN** the ticket is checked in with their name and the time
|
||||
|
||||
#### Scenario: Unnamed ticket at the door
|
||||
|
||||
- **GIVEN** a valid ticket was never named
|
||||
- **WHEN** staff enter `Lim Wei` and his mobile and tap Check in
|
||||
- **THEN** the ticket is checked in with Lim as its attendee
|
||||
- **AND** no lead is created unless he ticked the consent
|
||||
|
||||
### Requirement: Door Check-In Refusals
|
||||
|
||||
Check-in SHALL change nothing and the staff view SHALL show:
|
||||
|
||||
- "Already checked in at <time>" for a checked-in ticket;
|
||||
- a red "Not valid: <reason>" banner for an invalid ticket, the reason being "awaiting payment", "order cancelled", "order expired" or "ticket cancelled";
|
||||
- "Check-in is only open on the event days." outside the event days.
|
||||
|
||||
#### Scenario: Second scan
|
||||
|
||||
- **WHEN** staff scan a checked-in ticket again
|
||||
- **THEN** the page shows "Already checked in at" the first time and nothing changes
|
||||
|
||||
#### Scenario: Unpaid ticket at the door
|
||||
|
||||
- **GIVEN** an order is Awaiting payment
|
||||
- **WHEN** staff open one of its ticket links
|
||||
- **THEN** the page shows "Not valid: awaiting payment" and no Check in button
|
||||
|
||||
### Requirement: Resend Ticket
|
||||
|
||||
Users with `BO_EVENT_TICKETS` SHALL be able to resend one valid ticket from the order detail. It SHALL go to its attendee's email when named with an email, otherwise to the buyer. The action SHALL be written to the admin audit log.
|
||||
|
||||
#### Scenario: Resend a ticket
|
||||
|
||||
- **GIVEN** a valid ticket is named `Tan Mei Ling`, `tan@example.com`
|
||||
- **WHEN** staff resend that ticket
|
||||
- **THEN** Tan receives the ticket email again
|
||||
|
||||
### Requirement: Ticket Abuse Limits
|
||||
|
||||
The public ticket page and its QR image SHALL be limited to 120 loads per client IP per 10 minutes. Naming attendees and attendee consent SHALL be limited to 60 submissions per client IP per event per 10 minutes. Above a limit the answer SHALL be "Too many requests from this device. Try again later." The QR image SHALL be served only for a valid code.
|
||||
|
||||
#### Scenario: Too many ticket loads
|
||||
|
||||
- **WHEN** one IP loads ticket pages 121 times within 10 minutes
|
||||
- **THEN** the 121st is refused with "Too many requests from this device. Try again later."
|
||||
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: Order Emails
|
||||
|
||||
The buyer SHALL get an email when their order is created (lines, total, payment instructions, hold expiry and order link), becomes Paid (lines, total, each ticket's QR image and link, and a "Name your attendees" link to the order page), Expires, or is Cancelled by staff. Each email SHALL be recorded in Emails. A failed send SHALL NOT undo the order change, and staff SHALL be able to resend the latest email of an order.
|
||||
|
||||
#### Scenario: Order received email
|
||||
|
||||
- **WHEN** `Aisyah` requests tickets
|
||||
- **THEN** she receives an email with the order reference, payment instructions, hold expiry and order link
|
||||
|
||||
#### Scenario: Paid email
|
||||
|
||||
- **WHEN** staff mark her order of 2 tickets Paid
|
||||
- **THEN** she receives a confirmation email with 2 QR images, their ticket links and a link to name her attendees
|
||||
@@ -0,0 +1,15 @@
|
||||
-- Co-Lite change add-event-tickets: attendee naming and consent on tickets, and the keys self check-in matches on.
|
||||
-- Target: `service-counter`. Additive only. Run before the new services-counter starts. Needs a user that may alter tables.
|
||||
USE `service-counter`;
|
||||
|
||||
ALTER TABLE `ticket`
|
||||
ADD COLUMN `attendee_named_at` datetime NULL COMMENT 'when the buyer last named the attendee',
|
||||
ADD COLUMN `attendee_consent_at` datetime NULL COMMENT 'when the attendee agreed to be kept updated',
|
||||
ADD COLUMN `attendee_notice_id` bigint NULL COMMENT 'privacy notice version they agreed to',
|
||||
ADD KEY `idx_ticket_event_mobile` (`event_uuid`, `attendee_mobile_e164`),
|
||||
ADD KEY `idx_ticket_event_email` (`event_uuid`, `attendee_email`);
|
||||
|
||||
-- Tickets of orders paid before this release get their code now (22 URL-safe characters, like the new ones).
|
||||
UPDATE `ticket` t JOIN `shop_order` o ON o.id = t.order_id
|
||||
SET t.code = LEFT(REPLACE(REPLACE(REPLACE(TO_BASE64(RANDOM_BYTES(16)), '+', '-'), '/', '_'), '=', ''), 22)
|
||||
WHERE o.status = 'PAID' AND t.status = 'ACTIVE' AND t.code IS NULL;
|
||||
@@ -0,0 +1,94 @@
|
||||
-- The labels added by add-event-tickets, cut from the output of `npm run i18n:sql`. Run it only in an environment that already ran add-zh-cn-messages/sql/03-zh-cn-messages.sql; otherwise run that 03 file, which includes these labels.
|
||||
SET NAMES utf8mb4;
|
||||
USE `service-system`;
|
||||
INSERT INTO message (code, content, area) SELECT 'TktTicketInvalid', JSON_OBJECT('en_US', 'This ticket link is not valid.', 'zh_CN', '此门票链接无效。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketInvalid') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此门票链接无效。') WHERE LOWER(code) = LOWER('TktTicketInvalid') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktTicketFor', JSON_OBJECT('en_US', 'Ticket for {name}', 'zh_CN', '{name} 的门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketFor') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '{name} 的门票') WHERE LOWER(code) = LOWER('TktTicketFor') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktQrAlt', JSON_OBJECT('en_US', 'Ticket QR code', 'zh_CN', '门票二维码'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktQrAlt') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票二维码') WHERE LOWER(code) = LOWER('TktQrAlt') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktShowQr', JSON_OBJECT('en_US', 'Show this QR code at the entrance.', 'zh_CN', '请在入口出示此二维码。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktShowQr') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请在入口出示此二维码。') WHERE LOWER(code) = LOWER('TktShowQr') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktCheckedInAt', JSON_OBJECT('en_US', 'Checked in at {when}', 'zh_CN', '已于 {when} 签到'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCheckedInAt') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已于 {when} 签到') WHERE LOWER(code) = LOWER('TktCheckedInAt') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktNotValid', JSON_OBJECT('en_US', 'This ticket is not valid', 'zh_CN', '此门票无效'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNotValid') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此门票无效') WHERE LOWER(code) = LOWER('TktNotValid') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktReasonAWAITING', JSON_OBJECT('en_US', 'awaiting payment', 'zh_CN', '等待付款'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReasonAWAITING') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '等待付款') WHERE LOWER(code) = LOWER('TktReasonAWAITING') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktReasonORDER_CANCELLED', JSON_OBJECT('en_US', 'order cancelled', 'zh_CN', '订单已取消'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReasonORDER_CANCELLED') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单已取消') WHERE LOWER(code) = LOWER('TktReasonORDER_CANCELLED') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktReasonORDER_EXPIRED', JSON_OBJECT('en_US', 'order expired', 'zh_CN', '订单已过期'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReasonORDER_EXPIRED') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '订单已过期') WHERE LOWER(code) = LOWER('TktReasonORDER_EXPIRED') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktReasonTICKET_CANCELLED', JSON_OBJECT('en_US', 'ticket cancelled', 'zh_CN', '门票已取消'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktReasonTICKET_CANCELLED') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票已取消') WHERE LOWER(code) = LOWER('TktReasonTICKET_CANCELLED') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktKeepUpdated', JSON_OBJECT('en_US', 'Keep me updated about {company} events', 'zh_CN', '向我发送 {company} 的活动资讯'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktKeepUpdated') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '向我发送 {company} 的活动资讯') WHERE LOWER(code) = LOWER('TktKeepUpdated') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktConsentSave', JSON_OBJECT('en_US', 'Save', 'zh_CN', '保存'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktConsentSave') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存') WHERE LOWER(code) = LOWER('TktConsentSave') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktConsentDone', JSON_OBJECT('en_US', 'Thank you. We will keep you updated.', 'zh_CN', '谢谢,我们会向您发送最新资讯。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktConsentDone') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '谢谢,我们会向您发送最新资讯。') WHERE LOWER(code) = LOWER('TktConsentDone') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktStaffView', JSON_OBJECT('en_US', 'Staff check-in', 'zh_CN', '工作人员签到'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStaffView') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '工作人员签到') WHERE LOWER(code) = LOWER('TktStaffView') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktStaffValid', JSON_OBJECT('en_US', 'Valid', 'zh_CN', '有效'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktStaffValid') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '有效') WHERE LOWER(code) = LOWER('TktStaffValid') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktAlreadyCheckedIn', JSON_OBJECT('en_US', 'Already checked in at {when}', 'zh_CN', '已于 {when} 签到过'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAlreadyCheckedIn') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已于 {when} 签到过') WHERE LOWER(code) = LOWER('TktAlreadyCheckedIn') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktNotValidReason', JSON_OBJECT('en_US', 'Not valid: {reason}', 'zh_CN', '无效:{reason}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNotValidReason') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '无效:{reason}') WHERE LOWER(code) = LOWER('TktNotValidReason') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktNotEventDay', JSON_OBJECT('en_US', 'Check-in is only open on the event days.', 'zh_CN', '仅在活动日开放签到。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNotEventDay') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '仅在活动日开放签到。') WHERE LOWER(code) = LOWER('TktNotEventDay') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktCheckIn', JSON_OBJECT('en_US', 'Check in', 'zh_CN', '签到'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCheckIn') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '签到') WHERE LOWER(code) = LOWER('TktCheckIn') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktCheckedInNow', JSON_OBJECT('en_US', 'Checked in.', 'zh_CN', '签到成功。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCheckedInNow') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '签到成功。') WHERE LOWER(code) = LOWER('TktCheckedInNow') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktUnnamed', JSON_OBJECT('en_US', 'No attendee named yet', 'zh_CN', '尚未填写参加者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktUnnamed') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '尚未填写参加者') WHERE LOWER(code) = LOWER('TktUnnamed') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktAttendeeName', JSON_OBJECT('en_US', 'Attendee name', 'zh_CN', '参加者姓名'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAttendeeName') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '参加者姓名') WHERE LOWER(code) = LOWER('TktAttendeeName') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktContactRequired', JSON_OBJECT('en_US', 'Enter a mobile number or an email.', 'zh_CN', '请输入手机号码或电子邮件。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktContactRequired') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入手机号码或电子邮件。') WHERE LOWER(code) = LOWER('TktContactRequired') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'ChkShowTicket', JSON_OBJECT('en_US', 'Please show your ticket at the entrance.', 'zh_CN', '请在入口出示您的门票。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('ChkShowTicket') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请在入口出示您的门票。') WHERE LOWER(code) = LOWER('ChkShowTicket') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'GuestTicketsAwaiting', JSON_OBJECT('en_US', 'Tickets awaiting payment', 'zh_CN', '待付款门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('GuestTicketsAwaiting') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '待付款门票') WHERE LOWER(code) = LOWER('GuestTicketsAwaiting') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'GuestTicketsPaid', JSON_OBJECT('en_US', 'Tickets paid', 'zh_CN', '已付款门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('GuestTicketsPaid') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已付款门票') WHERE LOWER(code) = LOWER('GuestTicketsPaid') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'GuestTicketsCheckedIn', JSON_OBJECT('en_US', 'Tickets checked in', 'zh_CN', '已签到门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('GuestTicketsCheckedIn') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已签到门票') WHERE LOWER(code) = LOWER('GuestTicketsCheckedIn') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktErrTicketNotValid', JSON_OBJECT('en_US', 'This ticket is not valid, so it cannot be sent.', 'zh_CN', '此门票无效,无法发送。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktErrTicketNotValid') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此门票无效,无法发送。') WHERE LOWER(code) = LOWER('TktErrTicketNotValid') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktResendTicket', JSON_OBJECT('en_US', 'Resend ticket', 'zh_CN', '重新发送门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktResendTicket') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '重新发送门票') WHERE LOWER(code) = LOWER('TktResendTicket') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktTicketSent', JSON_OBJECT('en_US', 'Ticket sent.', 'zh_CN', '门票已发送。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktTicketSent') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票已发送。') WHERE LOWER(code) = LOWER('TktTicketSent') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktYourTickets', JSON_OBJECT('en_US', 'Your tickets', 'zh_CN', '您的门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktYourTickets') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '您的门票') WHERE LOWER(code) = LOWER('TktYourTickets') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktNameAttendeesHelp', JSON_OBJECT('en_US', 'Name each attendee so their ticket can be emailed to them, or share each ticket''s link.', 'zh_CN', '填写每位参加者,以便通过电子邮件将门票发送给他们,或分享每张门票的链接。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNameAttendeesHelp') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '填写每位参加者,以便通过电子邮件将门票发送给他们,或分享每张门票的链接。') WHERE LOWER(code) = LOWER('TktNameAttendeesHelp') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktAttendeeSaved', JSON_OBJECT('en_US', 'Saved. The ticket has a new link; the old one no longer works.', 'zh_CN', '已保存。门票已有新链接,旧链接已失效。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAttendeeSaved') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '已保存。门票已有新链接,旧链接已失效。') WHERE LOWER(code) = LOWER('TktAttendeeSaved') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktNotNamed', JSON_OBJECT('en_US', 'Not named yet', 'zh_CN', '尚未填写'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNotNamed') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '尚未填写') WHERE LOWER(code) = LOWER('TktNotNamed') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktOpenTicket', JSON_OBJECT('en_US', 'Open ticket', 'zh_CN', '打开门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktOpenTicket') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '打开门票') WHERE LOWER(code) = LOWER('TktOpenTicket') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktCopyLink', JSON_OBJECT('en_US', 'Copy link', 'zh_CN', '复制链接'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktCopyLink') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '复制链接') WHERE LOWER(code) = LOWER('TktCopyLink') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktLinkCopied', JSON_OBJECT('en_US', 'Link copied.', 'zh_CN', '链接已复制。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktLinkCopied') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '链接已复制。') WHERE LOWER(code) = LOWER('TktLinkCopied') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktNameAttendee', JSON_OBJECT('en_US', 'Name attendee', 'zh_CN', '填写参加者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktNameAttendee') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '填写参加者') WHERE LOWER(code) = LOWER('TktNameAttendee') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktChangeAttendee', JSON_OBJECT('en_US', 'Change attendee', 'zh_CN', '更改参加者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktChangeAttendee') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '更改参加者') WHERE LOWER(code) = LOWER('TktChangeAttendee') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktAttendeeRequired', JSON_OBJECT('en_US', 'Enter the attendee''s name and a mobile number or an email.', 'zh_CN', '请输入参加者姓名,以及手机号码或电子邮件。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktAttendeeRequired') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请输入参加者姓名,以及手机号码或电子邮件。') WHERE LOWER(code) = LOWER('TktAttendeeRequired') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktPermissionRequired', JSON_OBJECT('en_US', 'Tick the box to confirm you have permission.', 'zh_CN', '请勾选以确认您已获得许可。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPermissionRequired') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '请勾选以确认您已获得许可。') WHERE LOWER(code) = LOWER('TktPermissionRequired') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktPermission', JSON_OBJECT('en_US', 'I have permission to share these details so their ticket can be sent', 'zh_CN', '我已获得许可分享这些资料,以便发送其门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktPermission') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '我已获得许可分享这些资料,以便发送其门票') WHERE LOWER(code) = LOWER('TktPermission') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktRenameWarning', JSON_OBJECT('en_US', 'Saving gives this ticket a new link and QR code. The old ones stop working.', 'zh_CN', '保存后此门票将获得新的链接和二维码,旧的将失效。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktRenameWarning') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存后此门票将获得新的链接和二维码,旧的将失效。') WHERE LOWER(code) = LOWER('TktRenameWarning') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktSaveAttendee', JSON_OBJECT('en_US', 'Save attendee', 'zh_CN', '保存参加者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSaveAttendee') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存参加者') WHERE LOWER(code) = LOWER('TktSaveAttendee') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'LeadSourceTicket', JSON_OBJECT('en_US', 'Ticket', 'zh_CN', '门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('LeadSourceTicket') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票') WHERE LOWER(code) = LOWER('LeadSourceTicket') AND area = 'A';
|
||||
UPDATE catalog_meta SET version = version + 1, updated_at = NOW() WHERE id = 1;
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Co-Lite change add-event-tickets: rollback. Drops attendee naming times and consent records. Ticket codes stay (add-event-ticket-orders owns that column).
|
||||
USE `service-counter`;
|
||||
ALTER TABLE `ticket`
|
||||
DROP KEY `idx_ticket_event_mobile`,
|
||||
DROP KEY `idx_ticket_event_email`,
|
||||
DROP COLUMN `attendee_named_at`,
|
||||
DROP COLUMN `attendee_consent_at`,
|
||||
DROP COLUMN `attendee_notice_id`;
|
||||
@@ -0,0 +1,156 @@
|
||||
# Tasks
|
||||
|
||||
Design: `design.md` (technical contracts) and `docs/superpowers/specs/2026-12-04-event-ticketing-design.md` (product).
|
||||
|
||||
**Mode:** all tasks run serially in the main session (the owner asked for no worker subagents). Each task starts with failing tests (TDD).
|
||||
|
||||
## 1. Data
|
||||
|
||||
- [x] 1.1 Write the SQL:
|
||||
- `sql/01-ticket-attendees.sql`: the three `ticket` columns, the two keys, and codes for active tickets on Paid orders that have none;
|
||||
- `sql/99-rollback.sql`.
|
||||
|
||||
Mirror 01 in `local/seed/03-colite.sql` and apply it to the local database.
|
||||
- Depends on: none
|
||||
- Scope: `local/seed/**`, `openspec/changes/add-event-tickets/sql/**`
|
||||
- Verify: `SHOW CREATE TABLE ticket` shows the columns and keys; local Paid tickets have 22-character codes.
|
||||
|
||||
## 2. services-counter
|
||||
|
||||
- [x] 2.1 Ticket codes, ticket state and the ticket lookups.
|
||||
- Depends on: 1.1
|
||||
- Tests first:
|
||||
- **Codes:**
|
||||
- a free order's tickets get codes at creation;
|
||||
- mark paid (from Awaiting payment and from Expired) gives each active ticket a distinct 22-character code;
|
||||
- an Awaiting-payment order has none.
|
||||
- **`TicketState.of`:** valid, checked in, awaiting, order cancelled, order expired and ticket cancelled.
|
||||
- **`ticket/byCode`:**
|
||||
- returns the event, type, attendee first name, state and check-in time;
|
||||
- never returns mobile, email or buyer details;
|
||||
- an unknown code is 404 `TICKET_NOT_FOUND`.
|
||||
- **`byToken`:** lists tickets (id, type, attendee name, code, state) only when Paid, without contacts.
|
||||
- Scope: `solvway-services-counter/src/**`
|
||||
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
|
||||
- [x] 2.2 Naming attendees, consent and ticket emails.
|
||||
- Depends on: 2.1
|
||||
- Tests first:
|
||||
- **Naming:**
|
||||
- refused without `permission`, when the order is not Paid, when the ticket is cancelled, and when it is checked in (`ALREADY_CHECKED_IN`);
|
||||
- an unknown token or a ticket of another order is 404;
|
||||
- a save sets a new code and `attendee_named_at`, and clears consent and the lead link.
|
||||
- **Consent:**
|
||||
- refused on an invalid or unnamed ticket;
|
||||
- calls registration with source `TICKET`, the notice and no salesperson, and stores consent time, notice id and lead uuid.
|
||||
- **Mailer:**
|
||||
- PAID lists every active ticket with its QR `<img>` URL, its link and the "Name your attendees" link;
|
||||
- TICKET goes to the attendee's email;
|
||||
- naming with only a mobile sends nothing.
|
||||
- **Resend ticket:** goes to the attendee's email, else the buyer; refused for an invalid ticket.
|
||||
- Scope: `solvway-services-counter/src/**`
|
||||
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
|
||||
- [x] 2.3 Door check-in, self check-in rules and the counts.
|
||||
- Depends on: 2.2
|
||||
- Tests first:
|
||||
- **Staff check-in:**
|
||||
- records the time and user;
|
||||
- a second check-in gives `ALREADY_CHECKED_IN|<time>`;
|
||||
- each invalid state gives `NOT_VALID|<state>`;
|
||||
- outside the event days gives `NOT_EVENT_DAY`;
|
||||
- an unnamed ticket needs a name and contact;
|
||||
- consent creates the lead and marks it attended;
|
||||
- another company's ticket is 404.
|
||||
- **Self check-in on a ticketed event:**
|
||||
- a named attendee's ticket is checked in;
|
||||
- an unnamed ticket matches its buyer, oldest first;
|
||||
- a registered guest still works;
|
||||
- anything else gives `SHOW_TICKET`;
|
||||
- walk-in register is refused with `TICKETS_ONLY`.
|
||||
- On an event without tickets, the old results are unchanged.
|
||||
- **Headcount:** tickets awaiting, paid and checked in, counting active tickets only.
|
||||
- Scope: `solvway-services-counter/src/**`
|
||||
- Verify: `mvn -T 1C -q -pl solvway-services-counter verify`
|
||||
|
||||
## 3. mobile-api and gateway
|
||||
|
||||
- [x] 3.1 Public ticket endpoints, the QR PNG and gateway paths.
|
||||
- Depends on: 2.3
|
||||
- Tests first:
|
||||
- **`GET /api/public/tickets/{code}`:**
|
||||
- a bad shape is 404 `TICKET_INVALID`;
|
||||
- the `tkt:load` limit applies;
|
||||
- the event fields are added.
|
||||
- **`qr.png`:**
|
||||
- the PNG decodes back to `<portal>/t/<code>`;
|
||||
- an invalid ticket is 404;
|
||||
- the response is `image/png`, `private`.
|
||||
- **Attendee save:**
|
||||
- name, mobile and email normalised as in QR registration;
|
||||
- a missing permission gives a field error;
|
||||
- counter refusals map to public messages;
|
||||
- the `tkt:submit` limit applies.
|
||||
- **Consent:** the current notice id is sent.
|
||||
- **Order view:** carries the tickets when Paid.
|
||||
- **Gateway:** the three counter paths are public, other shapes are not.
|
||||
- Adds `com.google.zxing:core` to `solvway-mobile-api/pom.xml`. This hotspot runs alone.
|
||||
- Scope: `solvway-mobile-api/**`, `solvway-api-gateway/src/**`
|
||||
- Verify: `mvn -T 1C -q -pl solvway-mobile-api,solvway-api-gateway verify`
|
||||
- [x] 3.2 Admin ticket endpoints.
|
||||
- Depends on: 3.1
|
||||
- Tests first:
|
||||
- **`GET /api/admin/tickets/{code}`:** `BO_EVENTS` and company-scoped (another company's ticket is 404).
|
||||
- **`checkin`:** passes the body, maps 409 codes, is `@Audited`.
|
||||
- **Resend ticket:** under `BO_EVENT_TICKETS`, `@Audited`.
|
||||
- **Headcount:** passes the ticket counts.
|
||||
- **Check-in lookup:** passes `SHOW_TICKET`, and walk-in `TICKETS_ONLY` maps to its message.
|
||||
- Scope: `solvway-mobile-api/src/**`
|
||||
- Verify: `mvn -T 1C -q -pl solvway-mobile-api verify`
|
||||
|
||||
## 4. admin-portal
|
||||
|
||||
- [x] 4.1 The ticket page `/t/[code]`.
|
||||
- Depends on: 3.2
|
||||
- Tests first:
|
||||
- **Public view:** valid, checked in, not valid and unknown.
|
||||
- **Consent:** only on a valid named ticket, with the notice.
|
||||
- **Staff view:**
|
||||
- shown only when the session and admin call succeed;
|
||||
- a 401, 403 or 404 keeps the public view and never redirects;
|
||||
- Check in;
|
||||
- the unnamed form;
|
||||
- the refusal banners.
|
||||
- **Routes:**
|
||||
- the route guard lets `/t/x` through;
|
||||
- the proxies send one X-Forwarded-For hop;
|
||||
- the PNG proxy passes bytes and content type.
|
||||
- Scope: `solvway-admin-portal/app/**`
|
||||
- Verify: `npx vitest run` (check the exit code), `npx tsc --noEmit`, `npm run lint`
|
||||
- [x] 4.2 Order page tickets, staff resend, counts, venue check-in message and labels.
|
||||
- Depends on: 4.1
|
||||
- Tests first:
|
||||
- **Order page:**
|
||||
- a Paid order lists tickets with links and copy buttons;
|
||||
- the naming form, with the permission tick, mobile or email, and field errors;
|
||||
- a refusal for a checked-in ticket.
|
||||
- **Order detail:** Resend ticket per valid ticket.
|
||||
- **GuestsCard:** the three ticket counts on a ticketed event.
|
||||
- **`/c/[token]`:** shows "Please show your ticket at the entrance." for `SHOW_TICKET`, with no form.
|
||||
- **Labels:** English and zh-CN, plus `sql/02-ticket-labels.sql`; seed regenerated.
|
||||
- Scope: `solvway-admin-portal/app/**`, `openspec/changes/add-event-tickets/sql/**`, `local/seed/04-zh-cn-messages.sql`
|
||||
- Verify: `npx vitest run` (check the exit code), `npx tsc --noEmit`, `npm run lint`
|
||||
|
||||
## 5. Verify and ship
|
||||
|
||||
- [x] 5.1 Rebuild the local stack, then check in Playwright, signing in through the form and clicking through.
|
||||
- On LC CV Expo, use the owner-approved test buyer "Tiket Test", tickets-test@example.com, and ask before any new order.
|
||||
- Open T-EKBD2K's order page and name an attendee. See the new link and that the old link is not valid.
|
||||
- On the ticket page, tick the consent and see the lead.
|
||||
- In the staff view, check a ticket in, then scan it again.
|
||||
- Check an unpaid ticket's refusal, and an unnamed ticket at the door.
|
||||
- Venue self check-in: a ticket holder, and a stranger who gets "show your ticket".
|
||||
- Check the counts on the event page and resend a ticket.
|
||||
- Take screenshots.
|
||||
- Depends on: 4.2
|
||||
- Done 2026-12-04. Not reachable: an unpaid ticket at the door, because an Awaiting order's tickets have no code yet. The staff banner for that state is covered by the page tests. Fixed during the check: the event leads list crashed on source Ticket, and order detail did not show which ticket is whose.
|
||||
- [x] 5.2 Write the release note in `docs/deployment.md`. Open the PR to main and merge it, then archive the change in its own PR and republish the blueprint.
|
||||
- Depends on: 5.1
|
||||
Reference in new issue
Block a user