feat(cloud): delivery fees and minimum orders at checkout (platform-v2 3S, S.3)

- services/fees.py: the site's fee engine, byte-identical (the site's tests check it);
  tests/fixtures/fee_cases.json: the shared cases, run here too.
- checkout: the snapshot's fees (areas, rules) at the venue's time zone; refused
  order.area_not_served / order.minimum_not_met {minimum, subtotal}; quote and order take
  area_id / postcode and return area_name, fee_rules; the order stores delivery_area.
- GET /api/menu/{site}: delivery_areas [{id, name}] for the customer; the rules and
  postcodes are never sent to the browser.
- Alembic 0003 (unreleased) gains online_orders.delivery_area.
- Tests: test_fees.py (22 shared cases + checkout fees, refusals, public menu, clock).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 12:28:15 +02:00
co-authored by Claude Opus 5.5
parent 5bdd19d9fb
commit 96f16e948d
9 changed files with 387 additions and 10 deletions
+1
View File
@@ -25,6 +25,7 @@ class OnlineOrder(Base):
customer_address = Column(Text, nullable=True) # required for delivery
customer_notes = Column(Text, nullable=True)
table_label = Column(String, nullable=True) # the QR menu's table, as the customer gave it
delivery_area = Column(String, nullable=True) # the delivery area's name (S.3)
sales_point = Column(String, nullable=True) # the site's sales point (phase 3S, S.2)
# Order content — JSON array of ordered items