**Not as written.** The code structure section is fine, and the scale assumptions are reasonable. You don't need queues, sharding or microservices at 2,000 orders a day. The problem is the payment flow in steps 3–6, which is the part that handles money. It has two ways to charge customers wrongly, and both will happen in normal operation, not just rare edge cases.

## Blockers (fix before building)

**1. Retrying on timeout can charge a customer twice (step 4).**
A timeout doesn't mean the charge failed. Often the provider charged the card and the response was lost. Retrying up to 3 times without an idempotency key means one order can be charged up to 4 times.
→ Generate one idempotency key per order (the order id works) and send it on every attempt. Check that your provider supports this; most do.

**2. The payment call sits inside an open database transaction (steps 3–6).**
- **Charged but no order:** if the charge succeeds but the commit fails, or the process dies or deploys before the commit, the `PENDING` row disappears. The customer has paid and you have no record of the order.
- **Failures leave no trace:** rolling back on failure deletes the evidence. That's what you'd need for support tickets and for reconciling with the provider.
- **Long-held connections:** worst case is 4 × 5 s = 20 s+ holding a connection and transaction open, on a single Postgres instance.

→ Restructure the flow:
- Commit `PENDING` first, in its own short transaction.
- Call the provider outside any transaction.
- Then update the row to `PAID` or `FAILED` in a second transaction.
- Never delete the order row.

**3. Payment outcomes that stay unknown aren't handled.**
If every retry times out, step 6 tells the client "error", but the customer may have been charged. You need an `UNKNOWN`/`PAYMENT_PENDING` state and a reconciler: a job that queries the provider by idempotency key and settles stuck orders. It can be a small cron job, but it has to exist.

**4. No idempotency on `POST /orders`.**
Mobile clients and impatient users resubmit, especially when a request can take 20 seconds. Each resubmit creates a new order with a new key, so you're back to double charges.
→ The client sends an `Idempotency-Key` header. The server stores it with a unique constraint and returns the existing order on a repeat.

## Gaps (decide now, cheap to fix)

**5. Inventory is never reserved or decremented.** Step 2 only reads a cache that can be up to 5 minutes old. Nothing in the flow tells the warehouse an order exists. Accepting the cache is a fair call, but the design has to say what happens when you oversell: refund, backorder, or manual handling. Today that path is undefined. Also confirm who decrements stock and when.

**6. The confirmation email goes out inline with the request.** If it's sent synchronously, an SMTP failure or slowdown either breaks the request or gets lost silently. Write an "email to send" row in the same transaction that marks the order `PAID`, and have a worker send it. This also keeps it consistent with fix #2.

**7. Tests cover only the success case, but the risk is in the failure cases.** Add integration tests for:
- a timeout after the provider has already charged
- a crash between charging and the `PAID` update
- a duplicate `POST`
- all retries exhausted

**8. Nightly backups risk losing up to 24 hours of paid orders.** The provider will have the charges and you won't have the orders. Turn on WAL archiving / point-in-time recovery (a setting on most managed Postgres) and write down your recovery target.

## Fine as is
- Module boundaries and the `OrderCheckout` service class
- Thin routes
- Order id on every log line. Also log the idempotency key and provider charge id, which you'll need for reconciliation.

The fixes are well understood and limited to steps 3–6, so redoing that part should take a few hours, not a full redesign. You can scaffold the modules tomorrow. Don't write `OrderCheckout` until the flow is rewritten around an order row that is never deleted, idempotency keys, and a reconciler.

VERDICT: NOT READY
