一句話:訂房散客直訂是 lodging 模組的成交 flow,前台或後台選旅宿 / 房型 / 日期區間,扣每晚庫存,建立 lodging order line,並接同一套金流分類帳。
/booking,只看 lodging 模組啟用且可直訂的旅宿。room_night_inventory,計算逐晚價格與可售數。orders(kind='lodging');order_lines(line_kind='lodging');lodging_booking_lines;lodging_nightly_snapshots;order_charge_lines(type='lodging_night');payment_schedules 與首個 payment_intents。後台 /admin/lodging/book 可替客戶建 lodging order。代訂可選立即手動入帳、ATM / credit card redirect,或先建立待付款單;無論入口如何,資料模型與前台自助一致。
訂房不走 trips/departures 席次模型;庫存以 property + room_type + date 為單位。
reserveNightsInTx 在同一交易中 conditional update 每晚 booked_count;room_night_inventory。Lodging order 不在 orders 外殼保存房型或金額。資料責任:
| 表 | 職責 |
|---|---|
orders | 營運外殼與三軸狀態快取。 |
order_lines | lodging 商品 line;保存顯示 snapshot。 |
lodging_booking_lines | 房型、入住退房區間、間數、入住人數、訂房人快照。 |
lodging_nightly_snapshots | 每晚售價與庫存快照,供稽核與重新顯示。 |
order_charge_lines | 每晚應收、折扣、費用等財務真相。 |
會員中心與訂單詳情必須 kind-aware 呈現 lodging 訂單;tour-only 管理頁面不得靜默把 lodging order 當 tour 處理。
payment_schedules 表達。payment_transactions。取消 lodging order:
booking_state 轉為 cancelled;退款需另走 refunds 工作流;取消本身不代表自動退款。
/booking 與後台 lodging routes fail closed。| 版本 | 日期 | 變更 | Commit |
|---|---|---|---|
| 5 | 2026-06-05 | 改為現行 order line + nightly snapshots + 金流分類帳模型;移除舊遷移敘述與請款單獨立 spec 依賴。 | — |
| 4 | 2026-05-31 | 前台自助訂房與付款橋接設計。 | — |
| 3 | 2026-05-31 | 後端與後台代訂設計。 | — |
| 2 | 2026-05-31 | 訂單重塑落地記錄。 | — |
| 1 | 2026-05-30 | 初版草案。 | — |