Outstanding Balances actions: per-currency settlement when directions diverge #19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
With the multi-currency per-direction display landed, the Outstanding Balances row can now correctly show that the same user simultaneously owes the org in some currencies and is owed by the org in others. Example (CircularPenguin from the test):
The action column, however, still picks one button based on the net sats balance — in this case the "Pay user" (send) icon, because in sats terms the org is net-payable to the user. That's a reasonable headline action, but it loses the per-currency reality:
/settle-receivableor/pay-userendpoints, which operate on a single currency at a time — so even invoking the visible button requires the dialog to disambiguate currency.Proposed shape
Two reasonable options, both worth evaluating before implementing:
A. Two action buttons per row when both directions are present. Show the "Settle receivable" button if the user owes the org in any currency, and the "Pay user" button if the org owes the user in any currency. Each opens a dialog that lets the admin pick the currency to settle. With CircularPenguin's row, both buttons render.
B. Single "Settle…" menu button that opens a list. The row shows one icon; clicking it lists each non-zero per-currency line and lets the admin pick which to act on. Visually less cluttered, more clicks deep. Better when many users have multi-direction balances.
In either case the dialog flow should:
POST /api/v1/settle-receivableandPOST /api/v1/pay-userendpoints — those already acceptcurrencyandamountper call.Backend touch (small)
The backend endpoints already work per-currency. What's missing on the data side is making the per-account/per-currency breakdown available to the row UI without an extra request — the
/balances/allresponse already includesfiat_balances(signed dict) used by the new display, so the action handlers have everything they need. Theaccountsarray is also returned per-user and would let an even more granular UI (e.g., "settle Receivable from this specific income entry") work without further API changes.Open questions
Severity
Quality-of-life — the data is correct and visible; the friction is admin workflow. Today admin would have to use the per-currency endpoints directly via API (or wait for a multi-currency-aware dialog) to actually settle any one of the four divergent currencies on CircularPenguin's row.
Related: #16 (cross-user debt assumption), #18 (unit-of-account convention).