Shipping
Shared deduction function for all shipping paths (ship_stock) — single transaction · idempotency · negative-stock prevention.
🚚 Stock Deduction (Atomic · Idempotent)
Re-running with the same idempotency key returns the prior result with no double deduction. If stock is insufficient, it blocks instead of going negative.
📅 Reservations (confirm → ship/cancel)
Confirming an order adds a reservation; cancelling releases it. A Postgres trigger keeps stock.reserved and the ledger in sync.
Results appear instantly in Stock Ledger and Inventory.