feat(cloud): the QR menu at the table, ordering only with a table's QR code
Plan phase 3S, step S.7.
- services/qr.py: the snapshot's `qr` {ordering, tables: [{id, label, token_hash}]} (sha256
of each table's token; the cloud never holds the tokens). A table order (dine_in) needs
the venue's ordering on, the site's menu_mode "order" and a valid table token: otherwise
order.service_unavailable / 403 order.table_invalid (a forged, old or typed-in table is
refused). The order keeps the table's id and label (online_orders.table_id, migration 0006).
- Public menu: ?t=<token> → `table` {id, label} or `table_invalid`; `table_ordering`; `qr`
never leaves the cloud.
- Heartbeat returns `apps_url` (new setting PUBLIC_APPS_URL: where /menu/ and /order/ are
served) so sites can print table QR codes that open the right address.
- Menu app: the table from its QR code (kept for the visit), a "Table 5" banner, ordering
only at a real table (otherwise read-only, with a notice for an invalid code); checkout
without a typed table number; prices are the QR menu's (sales point qr_table — it showed
in-store prices since S.1 removed digital_price) and only products sold there; the
confirmation page for table orders (in the kitchen); the delivery/takeaway leftovers
removed (they have their own app since S.4); test ids for e2e.
- Tests: tests/test_qr.py (3); test_checkout's typed-table case moved there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -81,13 +81,8 @@ def test_a_tampered_order_is_refused_and_a_correct_one_stored_at_the_clouds_pric
|
||||
assert _order(client, site).status_code == 201
|
||||
|
||||
|
||||
def test_the_qr_menus_table_and_delivery_details(client, admin_h):
|
||||
site, numeric = _venue(client, admin_h)
|
||||
r = _order(client, site, "dine_in", customer_table="5", items=[{"product_id": PIE, "quantity": 1}])
|
||||
assert r.status_code == 201
|
||||
stored = next(o for o in client.get(f"/api/orders/pending/{numeric}", headers=_h(site)).json()
|
||||
if o["public_ref"] == r.json()["public_ref"])
|
||||
assert (stored["table_label"], stored["sales_point"]) == ("5", "qr_table")
|
||||
def test_delivery_details(client, admin_h):
|
||||
site, numeric = _venue(client, admin_h) # table orders: tests/test_qr.py (S.7)
|
||||
assert _code(_order(client, site, "delivery")) == "order.details_missing"
|
||||
assert _order(client, site, "delivery", customer_address="Main square 3").status_code == 201
|
||||
|
||||
|
||||
Reference in New Issue
Block a user