The finance team needs a payment-reconciliation dashboard with one row for every order.
The payments table records payment attempts and their statuses. Each order must have three Boolean flags:
01has_payment: TRUE when at least one payment attempt exists, regardless of status.
02has_captured: TRUE when at least one payment for the order has status captured.
03needs_review: TRUE when payment attempts exist but none has been captured.
Return explicit TRUE or FALSE values for all three flags, never NULL. Payments without a valid order reference must not affect any order's flags.
Ordering: Sort by order_id in ascending order.