Booking — Overview
Booking (here, normal booking — regular session booking) is the flow where customers / admins book individual sessions within a term: select sessions → submit request → confirm into an actual booking, with pricing, discounts, and combine-booking rules.
This is a different flow from Subscription (long-term recurring billing). Both share many tables (Billing, Invoice, TermAttendance) and intersect on the double-booking guard, but their lifecycles and entry points are separate.
Quick mental model
Think of a centre that lets you book per session / per care week:
- Customer (or admin) opens Booking Flow, picks sessions for one or more attendees.
- The system creates a TermBookingOrder (in-flight request) — like a cart.
- Submit → creates
Billing, validates (double-booking, capacity, height/weight, pay-later). - Confirm (or Quote → Accept) → creates the actual TermBooking +
TermAttendance, triggers invoicing. - Along the way: apply automatic discount rules, optionally combine bookings by program category.
Normal booking vs Subscription booking
| Normal booking | Subscription booking | |
|---|---|---|
| Entry point | ConsumerBooking (Booking Flow) | ConsumerEnrollment (Enrollment) |
| Record | TermBookingOrder → TermBooking | Enrollment (+ internal booking) |
TypeId | Booking (0) | Subscription (4) |
| Payment | Chosen at checkout (PayNow/PayLater/Direct Debit) | Recurring per billing schedule |
| Lifecycle | Submit → Confirm (2 steps) | Driven by enrollment schedule |
| Pricing rules | Discount rule + combine booking rule | Per-period discounts |
⚠️ Order types
SubscriptionandWaitingListare not treated as a "normal booking conflict" by the double-booking guard — subscriptions are validated through the Enrollment path.
Key entities
| Name | One line |
|---|---|
| Term / ProgramCategory / Program | Setup objects that define the period, program type, and concrete program before booking. |
| TermProgramSet (TPS) | Offering/course within a term; holds schedule, price, capacity, and available discounts. |
| TermProduct / Session | Concrete session/slot selected by the user; booking lines record this level. |
| Holiday / Activity | Holiday is a special category/program type; Activity is a holiday day theme, not the main priced session. |
| TermBookingOrder | In-flight booking request, has a status lifecycle. |
| TermBooking | Confirmed booking (the actual runtime record). |
| TermBookingLine / Extra / Discount | A booking's session / add-on / discount rows. |
| Discount (rule) | Automatic discount rule (sibling, early bird, attendee, profile…). |
| CombinedBookingOption | Config to combine same-ActionLogId bookings across courses in a category. |
| TermAttendance | Roll-call record created when a booking is confirmed. |
See the hierarchy and terminology details in Core concepts.
Suggested reading order
- End-user view — what customers and admins do.
- Core concepts — Order vs Booking, status, confirmation type.
- Architecture & data — tables and relationships.
- Codebase flow — controller, service, validation.
- Discount rule — discount rules & how they apply.
- Combine booking rule — combining bookings on edit.
- Data & external links — read/write tables, external concepts.
- Common cases — double-booking, cancel, quote…
- References — specs, invariants, APIs.