Split a branching checkout handler
src/checkout/submitOrder.ts · line 42
Cyclomatic complexity 24 · high >15 · critical >20
Why it matters
Payment, inventory, and retry decisions share one function. A small change to one branch can affect another, and each new condition increases the paths a reviewer must reason about.
Suggested next step
Extract the payment and inventory decisions into named functions, then add tests for declined payment, out-of-stock items, and retry behavior before moving the branches.