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:
@@ -42,6 +42,9 @@ def get_menu(site_slug: str, db: Session = Depends(get_db)):
|
||||
|
||||
import json
|
||||
data = json.loads(snapshot.snapshot_json)
|
||||
from services.checkout import delivery_areas
|
||||
data["delivery_areas"] = delivery_areas(data) # S.3: what the customer picks from
|
||||
data.pop("fees", None) # the rules and postcodes stay on the cloud
|
||||
data["menu_mode"] = site.menu_mode
|
||||
data["restaurant"] = {
|
||||
"name": site.menu_display_name,
|
||||
|
||||
Reference in New Issue
Block a user