Files
vmall/openspec/specs/cart/spec.md
T
james 2136a48fbe chore(openspec): archive the mock-migration waves and green the spec set
Archive the three completed changes behind replace-mock-api-wave-1/2/3. Each
merge applied cleanly to the main specs:

- catalog gains the Public product browse requirement (subtree filtering and
  price sort)
- frontend-mall picks up the per-domain adapter, the pinned home page, the
  discovery-page changes, the live auth panels and the live transaction flows
- cart's Server-side cart requirement now documents the shop and stock carried
  by every line

Also replace the TBD Purpose placeholder in all eleven specs with a one-line
description of what each capability covers. Those placeholders predate this
work and were the only reason `openspec validate --all --strict` reported
0 passed / 11 failed; it now reports 11 passed / 0 failed.
2026-09-17 16:36:10 +00:00

22 lines
1.2 KiB
Markdown

# cart Specification
## Purpose
A per-user Redis cart holding SKU quantities, read back with product, price, stock and shop snapshots.
## Requirements
### Requirement: Server-side cart
Authenticated shoppers SHALL have a Redis-backed cart keyed by user id, containing sku_id + qty entries. Reading the cart SHALL return, for every line, the SKU's current price, currency and stock together with the product's name, image and owning shop, so the storefront can group lines by shop and cap quantity without reading the fixed-data catalog. Lines whose SKU has become inactive or unpurchasable SHALL be omitted from the view.
#### Scenario: add and update
- **WHEN** a shopper POSTs sku + qty, then PUTs a new qty
- **THEN** GET /api/cart reflects the latest qty with current price/name snapshot
#### Scenario: unpurchasable SKU rejected
- **WHEN** adding a SKU that is inactive or whose product is not published
- **THEN** the API returns 400
#### Scenario: cart view carries shop and stock
- **WHEN** a shopper reads a cart holding SKUs from more than one shop
- **THEN** each line reports its shop and the SKU's current stock, so the storefront can group the lines per shop and cap quantity from the response alone