Order Fulfillment
Ship the right coffee, in the right order
First-expiry-first-out allocation, shortfalls reported as shortfalls, and orders that cannot be double-promised.
The problem
Roasted coffee has a usable window measured in weeks. Shipping whatever was roasted earliest is not the same as shipping what goes stale first, and the difference is what your customer tastes.
FEFO, not FIFO
Allocation takes the lot that expires soonest. Once two batches are roasted on different days with different best-before dates, those stop being the same thing.
A partial allocation is not a success
When stock cannot cover an order, the response says how much is short. An order that looks allocated and is not is how a warehouse ships short.
Re-importing is a no-op
Webstore orders carry your system's own id, unique per channel, so the integration that polls every five minutes cannot create the same order twice.
Everything here is in the API
This area is orders.* — the same operations the console calls.