Part of #493 (Phase 2 — payout money-accuracy).
Problem
markPayoutPaid is a one-way ratchet — once a payout is recorded, nothing re-checks whether the underlying transactions it was based on later flip to refunded/failed. If a PayPal sale gets refunded after you've already paid the school their share, /platform/payouts has no way to reflect that you're now effectively owed money back — it'll just show $0 owed going forward for that tenant, silently absorbing the loss with no record of it.
Wanted
When computing netOwed in computeOwedBalances, subtract refunded-transaction amounts (scaled by the split, same as any other transaction) from grossCollected/grossOwed, so a refund after payout is reflected as a negative adjustment on the next payout cycle rather than disappearing. Surface it in the UI (e.g. a "clawback" line) rather than silently netting it into netOwed.
Acceptance
Part of #493 (Phase 2 — payout money-accuracy).
Problem
markPayoutPaidis a one-way ratchet — once a payout is recorded, nothing re-checks whether the underlyingtransactionsit was based on later flip torefunded/failed. If a PayPal sale gets refunded after you've already paid the school their share,/platform/payoutshas no way to reflect that you're now effectively owed money back — it'll just show $0 owed going forward for that tenant, silently absorbing the loss with no record of it.Wanted
When computing
netOwedincomputeOwedBalances, subtract refunded-transaction amounts (scaled by the split, same as any other transaction) fromgrossCollected/grossOwed, so a refund after payout is reflected as a negative adjustment on the next payout cycle rather than disappearing. Surface it in the UI (e.g. a "clawback" line) rather than silently netting it intonetOwed.Acceptance
computeOwedBalancescall reflects the clawback.