Orders V2
Create order
Changed onCreate a new order with variant-specific items
Creates an order by:
- Validating variant availability for each item
- Creating order record in V1 orders table
- Creating market_orders entries (V1 compatibility)
- Creating order_market_items_v2 entries with variant tracking
- Snapshotting variant prices at purchase time
- Allocating stock from variant-specific lots
- Notifying seller of new order
Uses database transaction for atomicity to ensure all-or-nothing behavior. Stock allocation uses listing_item_lots directly (V2).
Requirements:
- 25.1: POST /api/v2/orders endpoint
- 25.2: Accept array of items with listing_id, variant_id, quantity
- 25.3: Validate variant availability before order creation
- 25.4: Use variant-specific pricing in order calculations
- 25.5: Allocate stock from correct variant's stock lots
- 25.6: Use database transaction for atomicity
- 25.7: Snapshot variant prices at time of order creation
- 25.8: Prevent ordering unavailable variants with descriptive error
- 25.9: Create order_market_items_v2 entries for each item
- 25.10: Return order_id and order details on success
- 25.11: Notify seller of new order
- 25.12: Log order creation to Audit_Trail
post/orders
Request
- Base URL: /api/v2 (relative, and the document was published on a file host, not at the API’s origin)
- URL: /api/v2/orders
- Auth: loggedin (a scheme the document does not define)
Request body
Response
Created order with order_id and item details
Changes
- ▲
removed the required property
from the response with the status - ○
added the required property
to the response with the status
- ▲