URD: Orders
| Module | CORE-07 | Version | v0.3 |
|---|---|---|---|
| Status | In-progress | Date | 2026-04-16 |
1. Purpose
Define user-facing requirements for order management — the sale order lifecycle from cart to checkout to payment, plus the F&B extensions a full-service venue needs: check splitting, kitchen tickets, POS shift sessions, table reservations, and loyalty point earning.
2. Scope
| Included | Excluded |
|---|---|
| Sale order lifecycle (DRAFT → PROCESSING → PARTIAL → COMPLETED / CANCELLED) | Refund / return flow (Planned) |
| Order items (product, combo fan-out, custom) | Stock mutation (Inventory) |
| Checkout and revert | Payment provider integration (Payment) |
| Order split and merge | Tax engine & e-invoice issuance |
| Check splitting (split the bill) | Delivery order tracking (Planned) |
| Kitchen tickets and stations (F&B) | Table-layout / seating management (Planned) |
| POS sessions (shifts) with X/Z reports | Dedicated kitchen display application (Planned) |
| Reservations | Order templates (Planned) |
| Loyalty point earning | Technical API specifications (see developer docs) |
| Real-time updates to kitchen & dashboards |
3. Definitions
| Term | Definition |
|---|---|
| Sale Order | A transaction containing items being sold; one entity serves as both cart (DRAFT) and committed order. |
| Order Item | A line item — a product variant (PRODUCT mode) or a manual entry (CUSTOM mode). |
| Combo | A product that fans out into priced child lines when added to the cart. |
| Sale Check | An independently-payable group within an order, used to split the bill. |
| Kitchen Ticket | A ticket sent to the kitchen for F&B preparation; contains items from a sale order. |
| Kitchen Station | A named preparation area (e.g., grill, bar) that receives tickets. |
| POS Session | A cashier's shift on a specific device; tracks opening / closing cash and generates reports. |
| X Report | Interim shift summary — can be generated multiple times. |
| Z Report | Final closing report — only one per session. |
| Reservation | A guest booking for a future date / time with a party size. |
4. Conceptual Model
Conceptual only — full schema lives in the developer domain model.
5. Functional Requirements
One table per functional area.
<AREA>codes match the test-case IDs. Priority = MoSCoW (Must / Should / Could / Won't).
5.1 Sale Order (ORD)
| ID | P | Requirement |
|---|---|---|
| URD-ORD-001 | M | Create draft orders (cart) with items |
| URD-ORD-002 | M | Add, update, remove items only while in DRAFT |
| URD-ORD-003 | M | Adding the same product merges quantity onto the existing line |
| URD-ORD-004 | M | Setting an item quantity to zero removes the line |
| URD-ORD-005 | M | Add a combo item that fans out into priced child lines |
| URD-ORD-006 | M | Checkout: DRAFT → PROCESSING (validates items, locks prices) |
| URD-ORD-007 | M | Checkout validates: non-empty cart, prices ≥ 0, quantity ≥ 1 |
| URD-ORD-008 | M | Revert: PROCESSING → DRAFT |
| URD-ORD-009 | M | Cancel from DRAFT, PROCESSING, or PARTIAL (with optional reason) |
| URD-ORD-010 | M | Partial payment → PARTIAL status |
| URD-ORD-011 | M | Full payment → COMPLETED status |
| URD-ORD-012 | S | Split one order into multiple (DRAFT only) |
| URD-ORD-013 | S | Merge multiple orders (DRAFT only) |
| URD-ORD-014 | S | Attach a customer to the order |
| URD-ORD-015 | S | Multi-currency with exchange rate (default VND) |
| URD-ORD-016 | C | Enforce a maximum number of items per order |
5.2 Check Splitting (CHK)
| ID | P | Requirement |
|---|---|---|
| URD-CHK-001 | S | Split an order into multiple payment checks |
| URD-CHK-002 | S | Allocate specific items and quantities to each check |
| URD-CHK-003 | S | Different customer per check |
| URD-CHK-004 | S | Order completes when all its checks complete |
| URD-CHK-005 | C | Roll back a split while no check is paid |
5.3 Kitchen Tickets (KIT)
| ID | P | Requirement |
|---|---|---|
| URD-KIT-001 | M | Send order items to kitchen (creates ticket + items) |
| URD-KIT-002 | M | Idempotent send — a duplicate send produces the same ticket |
| URD-KIT-003 | M | Ticket lifecycle: PENDING → PROCESSING → READY → COMPLETED / VOIDED |
| URD-KIT-004 | M | Item lifecycle: PENDING → COOKING → READY → SERVED / VOIDED |
| URD-KIT-005 | M | Ticket status auto-progresses from its item statuses |
| URD-KIT-006 | M | Changes use void-and-resend (sent items are not edited in place) |
| URD-KIT-007 | S | Rush flag and per-order sequence for ticket ordering |
| URD-KIT-008 | M | Real-time updates to kitchen displays and dashboards |
| URD-KIT-009 | S | Marking an item served triggers stock consumption |
5.4 Kitchen Stations (STA)
| ID | P | Requirement |
|---|---|---|
| URD-STA-001 | S | Create named stations per merchant (i18n) |
| URD-STA-002 | S | Route product categories to stations |
| URD-STA-003 | S | Per-station printer config with auto-print |
5.5 POS Sessions (POS)
| ID | P | Requirement |
|---|---|---|
| URD-POS-001 | M | Open a session on a device with an opening cash float |
| URD-POS-002 | M | Only one open session per device |
| URD-POS-003 | M | Close a session: count cash, record discrepancy |
| URD-POS-004 | M | Z report (closing) — one per session |
| URD-POS-005 | S | X report (interim) — repeatable |
| URD-POS-006 | S | Orders created during a shift attach to the session |
| URD-POS-007 | S | Track expected vs. actual for non-cash methods |
| URD-POS-008 | C | Recount support on close |
5.6 Reservations (RSV)
| ID | P | Requirement |
|---|---|---|
| URD-RSV-001 | S | Create a reservation: guest name, phone, party size, date / time |
| URD-RSV-002 | S | Lifecycle: PENDING → CONFIRMED → CHECKED_IN / CANCELLED |
| URD-RSV-003 | S | Source tracking: phone, walk-in, online, other |
| URD-RSV-004 | S | Occasion tagging: birthday, anniversary, business, etc. |
| URD-RSV-005 | S | On check-in, spawn and link a sale order |
5.7 Loyalty Points (PNT)
| ID | P | Requirement |
|---|---|---|
| URD-PNT-001 | S | Earn points on completed orders |
| URD-PNT-002 | S | Point award is idempotent per order |
| URD-PNT-003 | S | Point balance tracked per customer per merchant |
6. Acceptance Criteria
AC-ORD-01: Order lifecycle
| Given | When | Then |
|---|---|---|
| DRAFT order | Checkout | PROCESSING (prices locked) |
| PROCESSING | Full payment | COMPLETED |
| PROCESSING | Partial payment | PARTIAL |
| Any non-terminal status | Cancel | CANCELLED |
| Empty cart | Checkout | Rejected |
AC-ORD-02: Combo fan-out
| Given | When | Then |
|---|---|---|
| A combo product | Add to cart | One lead line + zero-priced child lines created |
| The same combo already in order | Add again | Rejected (already in order) |
AC-KIT-01: Kitchen
| Given | When | Then |
|---|---|---|
| Order items | Send to kitchen | Ticket created |
| Same idempotency key | Duplicate send | No duplicate ticket |
| All items READY/SERVED | — | Ticket auto-progresses |
| Item marked served | — | Stock consumption triggered |
AC-POS-01: Session
| Given | When | Then |
|---|---|---|
| No open session on device | Open | Session created |
| Existing open session on device | Open | Rejected |
| Open session | Close with cash count | Discrepancy computed, Z report generated |
AC-RSV-01: Reservation
| Given | When | Then |
|---|---|---|
| Guest info | Create | Status PENDING, table held |
| Confirmed reservation | Check in | Status CHECKED_IN, sale order spawned & linked |
7. Constraints & Non-Goals
Constraints
| ID | Constraint |
|---|---|
| C-01 | Items are modifiable only while the order is in DRAFT |
| C-02 | Order split / merge only in DRAFT |
| C-03 | At most one open POS session per device |
| C-04 | Exactly one Z report per session |
| C-05 | Kitchen ticket send is idempotent via key |
| C-06 | All records use soft-delete |
| C-07 | All operations require authentication and are scoped to the merchant |
Non-Goals
- Refund / return flow
- Delivery order tracking
- Table-layout / seating management
- Dedicated kitchen display application
- Order templates
8. Version History
| Date | Author | Description | Ver |
|---|---|---|---|
| 2026-02-26 | P. Do — Product Owner | Initial user stories | v0.1 |
| 2026-04-16 | P. Do — Product Owner | Restructured to functional-area requirement tables; added combo, check-splitting, station, reservation, points areas | v0.3 |