feat: public cart domain + CartPort (ADR 0026) - #5
Merged
Merged
Conversation
Commerce gains the public shopping cart: commerce_cart (opaque-random
cart_token PK + per-cart csrf secret) + commerce_cart_line storing ONLY
{sku, qty} — never a price. A published CartPort (ADR 0019) the Storefront
drives: getOrCreate/add/setQty/remove/contents/checkout.
Security controls (ADR 0026): price + totals resolved SERVER-SIDE from the
Inventory item (CatalogReadPort) at render and checkout — the client sends
sku+qty only; add accepts only ACTIVE items + bounded whole quantities +
a line cap; the cart token is server-random (a client can't choose it);
csrf verified constant-time; checkout places via OrderBook (atomic stock
reservation) then clears the cart. Abandoned carts GC'd by a maintenance
task. PHPStan max, 37 tests, cs-fixer green.
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.
PR② of Commerce checkout (Foodmart Slice 4). Commerce gains the cart domain + a published
CartPort; the Storefront will drive it (next PR).Server-side price (cart stores only {sku,qty}), active-sku-only, bounded whole qty + line cap, server-random cart token (unguessable, client can't choose), constant-time CSRF check, checkout via the atomic
OrderBook.place, cart GC task. See ADR 0026. PHPStan max · 37 tests · cs-fixer clean.🤖 Generated with Claude Code