Skip to main content

Betfair provider declines persist as declined, through the shared refund+netting path

A Betfair placement that the provider rejects currently persists as cancelled (the catch at orderService.ts:2018 always calls reversePlacementBet(..., 'cancelled'), even though orderService.ts:1785 detected palResponse.order.status === 'declined'). This is wrong — declined ("provider rejected") is a distinct, actively-used status (Bifrost FAILED, Pinnacle REJECTED); collapsing Betfair declines into cancelled loses the distinction in reports, netting exclusion, and the UI.

Decision (in scope for this PR): a provider decline persists as declined. The accounting is unchanged and already correctreversePlacementBet(orderId, cancellationStatus, …) (orderService.ts:319) is already parameterized on the status label and performs the full reversal regardless of it: netting reversal via onCancel/onReverseAcceptAndMatch (+ win-side mirrors, :407-425) and a full refund (balancePoints increment + bet_refund transaction, :451/:513). The fix is only to pass 'declined' at the call site when the cause is a provider decline; the money path is the same shared, tested path.

Consequence

Verified: declined orders route through netting + process the refund identically to cancelled — no separate accounting branch is introduced. Financial-guardian review still required because it touches the placement-failure money path.