services.py
- place_order: validates against live menu, prices line items
authoritatively from DB (modifier ids resolved server-side, not
trusted from input), creates LNbits invoice, persists order +
items. Order id := payment_hash for zero-metadata listener
lookups.
- mark_order_paid: idempotent paid -> [accepted if auto-accept] +
stock decrement + queues a print job.
- transition_order: explicit state-machine guard for accept/ready/
complete/cancel/refund.
- quote_balance_required: pre-flight total for the webapp's
multi-restaurant balance check (per the user's requirement to
verify funds before opening any per-restaurant invoice).
tasks.py
- Single invoice listener filtered on extra.tag == 'restaurant',
looks up order by payment_hash, delegates to mark_order_paid.
Wrapped in try/except so one bad payment doesn't kill the loop.