線稿索引所有 spec最後更新 2026-06-05
specs/trip-pricing.md

行程定價與付款政策

一句話:本檔擁有 tour 產品的價格政策(直客價、同業價、梯次覆寫價、訂金規則、團費包含 / 不包含、包團價);它不擁有收款狀態或付款分類帳,實際應收、訂金 / 尾款 schedule 與付款狀態由 order-money-model 產生。

1. 價格層級

Tour 成交單價由 resolveDeparturePrice 解析,順序如下:

  1. 梯次 promo 覆寫價(若啟用,見 control-finance);
  2. departure-level direct / agency price;
  3. trip-level direct / agency base price;
  4. fallback policy(若缺價則拒絕 checkout)。

解析結果必須包含:

  • unit_price_twd
  • price_channel(direct / agency / promo 等語意);
  • human-readable reason / snapshot,供 audit 與 UI 顯示。

成交時把單價與通路快照寫入 tour_booking_lines;之後 trip / departure 價格變更不回寫既有訂單。

2. 客戶分類與通路

member_profiles.customer_type 只表示客戶分類(直客或同業窗口)。它可作為 checkout 預設價格通路,但不是訂單事實。

訂單事實在 product line snapshot:

  • 這張單當時套用哪個通路;
  • 成交單價;
  • party size;
  • 使用的 fallback reason。

特殊人工改價不得直接改 product line 快照;應走 control-finance 的掛帳 / promo / audit 流程。

3. 訂金與尾款政策

Trip / departure 可定義付款政策:

欄位語意說明
deposit_modenone / fixed / percent。
deposit_amount_twdfixed 訂金金額。
deposit_percentpercent 訂金比例。
balance_due_days_before_departure尾款到期日相對出發日。

checkout 時,價格政策只輸出「應收要如何拆」。實際落地:

  • 全額:一筆 payment_schedules(purpose='full')
  • 訂金 / 尾款:deposit + balance 兩筆 current schedules。
  • 後續補款:由金流模型建立 adjustment schedule。

payment_state 由 money helper 派生;UI 不自行用訂金欄位判斷狀態。

4. 團費包含 / 不包含

fee_inclusions 是行程內容政策,供前台 tour detail 與後台編輯使用。它不參與付款計算;付款計算只看成交價格與 charge lines。

5. 包團價

包團是整梯議價,不是「一張 order 多 traveler」。

設計語意:

  • departures.booking_mode = regular | charter
  • charter_total_twd 表示整梯成交價;
  • 包團單仍建立 tour order line,party size 代表人數或名冊數;
  • 應收以一筆 base fare charge line 表達整梯價,必要時另加手動調整。

一般集體報名(一人代付多人)不另建模;現有 tour order 的 party size 已涵蓋。

6. 報表

  • 成交金額 / 應收:order_charge_lines 聚合。
  • 實收:payment_transactions 聚合。
  • 通路分析:讀 product line price-channel snapshot。
  • promo 分析:讀 departure promo audit 與 line snapshot。

任何報表若要「已收」語意,必須用金流 helper 或現金分類帳;不要用價格政策欄位推測。

Changelog

版本日期變更Commit
32026-06-05改為價格政策 SSOT;訂金 / 尾款落地改指向 payment_schedules,移除舊訂單付款欄位與單欄狀態敘述。
22026-06-03補直客 / 同業價、訂金、尾款、團費包含與包團設計。
12026-05-30初版:行程定價問題與設計方向。