Slice C2: online ordering + simulated checkout - #17
Merged
Merged
Conversation
Add a public takeaway flow: a themed order page (menu + qty + name/phone), a public POST that places a table-less order straight into the kitchen queue, and a token-gated confirmation. The checkout is a clearly-labelled DEMO — no real payment, no processor, no card data. - Order model (folded into the unreleased 002_orders): table_id nullable, a channel enum (dine_in/online), customer_name/phone, and a confirm_token; plus a tiny per-IP rate table. Dine-in unchanged. - Orders::placeOnline() snapshots name+price from the menu (client prices never trusted), computes the total server-side, caps qty + line count, requires a name + phone, and creates a paid 'sent' online order in one transaction. onlineForConfirmation()/confirmToken() make the confirmation non-enumerable. - Public surface (plugin-owned auth per ADR 0017): themed page /order (ADR 0023, JS-free) + POST /ext/restaurant/order, guarded by a honeypot + per-IP throttle (RateLimiter) + order-size caps. Kitchen shows online tickets as 'Online · name'; Reports counts online sales automatically. - Nav gains Order; seed adds one sample online order. Design + 3-hat + full Attacker/Defender/QA security review in docs/design/slice-c2-online-ordering.md. Tests: placeOnline (snapshot/caps/ table-less/kitchen/token) + RateLimiter; 89 plugin tests green, PHPStan L6 + cs-fixer clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The first public write surface in the app: a takeaway ordering flow that drops orders into the existing kitchen queue, with a simulated payment (no real money, no processor, no card capture).
What
002_orders):table_idnullable,channelenum (dine_in/online),customer_name/customer_phone,confirm_token, and a tiny per-IP rate table. Dine-in unchanged.Orders::placeOnline()— snapshots name + price from the published menu (client prices never trusted), computes the total server-side, caps qty + line count, requires name + phone, creates a paidsenttable-less order in one transaction.confirmToken()/onlineForConfirmation()make the confirmation non-enumerable (token-gated, constant-time)./order(ADR 0023) +POST /ext/restaurant/order, guarded by a honeypot + per-IP throttle (RateLimiter) + order-size caps.Security
Full Attacker/Defender/QA review in
docs/design/slice-c2-online-ordering.md. Key controls: server-snapshotted prices (no total tampering), escape-on-render for guest name, token-gated confirmation (no IDOR), throttle+honeypot+caps for the public write, and a payment that is a labelled simulation (payment_method='online-demo') that never touches money or card data.Tests
OrdersTest(snapshot-not-posted-price, unknown-item-dropped, empty rejected, name/phone required, reaches kitchen, token-gated confirmation) +RateLimiterTest(limit/reset/per-IP). 89 plugin tests green, PHPStan L6 + cs-fixer clean.🤖 Generated with Claude Code