feat(cloud): the online ordering app (takeaway, delivery) with hours, time slots and rate limits (platform-v2 3S, S.4)
- connect_frontend/order-app at /order/{site}: menu per service at that service's prices,
extras, basket (kept per tab), checkout priced by the cloud (fee, area by list or
postcode, minimum), name/phone/address/notes (remembered), as soon as possible or a time
slot, tracking page with steps, lines and totals; en/el; tokens in index.css. Logic in
src/logic.js, unit-tested; built and served by the connect image (npm test in the build).
- services/ordering.py: the venue's services, hours (past midnight), preparation, slot grid,
days ahead, ASAP; takeaway/delivery orders checked (order.service_unavailable,
order.closed, order.time_invalid) and need a phone; GET /api/orders/{site}/slots; the
public menu carries the ordering summary.
- services/ratelimit.py: per-caller limits on quote, order and track (429 rate.limited).
- online_orders.requested_for (0003, unreleased) stored as UTC; every datetime sent with its
offset (the database keeps no zone: a 12:00 Athens slot came back as 12:00 unzoned).
- Tracking returns what was ordered, the totals, the type and the time.
- Tests: test_ordering.py (5), checkout/fees updated; order-app unit (4).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from test_checkout import COLA, _code, _h, _menu, _order
|
||||
from test_checkout import COLA, ORDERING, _code, _h, _menu, _order
|
||||
from test_licensing_v2 import _heartbeat, _new_site
|
||||
|
||||
CASES = json.loads((Path(__file__).resolve().parent / "fixtures" / "fee_cases.json").read_text(encoding="utf-8"))
|
||||
@@ -36,7 +36,7 @@ def _venue_with_fees(client, admin_h):
|
||||
_menu(client, site, numeric)
|
||||
# the same menu plus the venue's fees, as the site pushes them since S.3
|
||||
menu = client.get(f"/api/menu/{site['site_id']}").json()
|
||||
snap = {"categories": menu["categories"], "fees": FEES, "timezone": "Europe/Athens"}
|
||||
snap = {"categories": menu["categories"], "fees": FEES, "ordering": ORDERING, "timezone": "Europe/Athens"}
|
||||
r = client.post("/api/menu/sync", headers=_h(site), json={"site_id": numeric, "snapshot_json": json.dumps(snap)})
|
||||
assert r.status_code == 200
|
||||
return site, numeric
|
||||
|
||||
Reference in New Issue
Block a user