Files

18 lines
744 B
Markdown

# Tasks: cart-checkout-orders
## 1. Schema
- [x] Migration: orders, order_items; order status enum; order_no sequence
## 2. Cart (Redis)
- [x] GET /api/cart, POST /api/cart/items, PUT/DELETE /api/cart/items/{sku_id}
- [x] Cart read joins SKU/product snapshots; rejects inactive/unpublished SKUs
## 3. Checkout & orders
- [x] POST /api/orders/checkout (one order per shop, tx: stock decrement + order insert, cart clear)
- [x] GET /api/orders (mine, paged), GET /api/orders/{id}
- [x] POST /api/orders/{id}/pay (mock) and /cancel with state rules
- [x] GET /api/shop/orders for merchants; platform admin list
## 4. Tests
- [x] cargo test: multi-shop checkout splits orders, insufficient stock → 409, cancel rules, stock restored on cancel