Repository navigation
Slice 4: Payment & turn - #9
Merged
Merged
Conversation
Closes the service loop — settle a bill, close the order, turn the table. - Schema: payment columns on rest_order (amount_paid, payment_method, paid_at) folded into its migration (unreleased; no deployed install to ALTER). - Orders::pay(orderId, method, now): the AMOUNT is the server-computed order total — never a caller value; only the method (allow-list cash/card/other) is chosen. Marks paid + closed and sets the table `dirty`, atomically. Rejects a bad method, a missing order, and a double payment. get()/all() now surface amount_paid / payment_method / paid_at. - Admin: a payment section on the order screen (shows total due + method select, no amount input; a receipt once settled). "served" no longer offers a Close button — payment closes the order. The floor's existing dirty→open quick action finishes the turn. - MCP: order_pay (id + method only). - Guide: payment note. - Tests: OrdersTest (computed-total charge, close, table turn, method allow-list, missing/double-pay rejected), OrdersAdminTest (pay form has total + no amount input; receipt after), RestaurantToolsetTest (order_pay listed; pays the computed total over MCP; bad method as data). Security: amount is never client-set (structurally — pay() takes no amount); the payment record carries no PII. cs-fixer + PHPStan green locally; phpunit runs in CI. 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.
Closes the service loop — settle a bill, close the order, turn the table for the next party. The money slice, with the payment-integrity controls the security review pinned.
What's here
rest_order(amount_paid,payment_method,paid_at), folded into its migration (unreleased; no deployed install to ALTER).Orders::pay(orderId, method, now)— the amount is the server-computed order total, never a caller value; only themethod(allow-listcash/card/other) is chosen. Marks the order paid + closed and sets its tabledirty, atomically. Rejects a bad method, a missing order, and a double payment. Reads now surfaceamount_paid/payment_method/paid_at.dirty→openquick action finishes the turn.order_pay(id + method only — no amount can be supplied).Security posture
The amount is never client-set —
pay()takes no amount parameter, so it's structurally impossible to charge anything but the computed total (tested over both the service and MCP). The payment record carries no guest PII.Tests
OrdersTest(charges the computed total, closes, turns the table, method allow-list, missing/double-pay rejected),OrdersAdminTest(pay form shows the total and has no amount input; receipt after),RestaurantToolsetTest(order_paylisted; pays the computed total over MCP; bad method comes back as data).cs-fixer + PHPStan L6 green locally; phpunit in CI (8.2 + 8.3).
🤖 Generated with Claude Code