Giving Refunds and Transfers Different Budget Semantics

Dalrymple Ramos
table of contents

A finance dashboard can add every numeric value correctly and still tell the wrong story. The meaning of each transaction type determines which total it should affect.

In Budgio, the query helpers distinguish balance impact from category expense flow. This article describes the application's rules, rather than offering financial advice.

Define balance impact first#

Income and refunds increase the recorded balance. Expenses decrease it. Transfers contribute zero net impact in the current tracker model.

That zero is meaningful: moving money is not automatically the same as earning it. It also defines the scope of this model. An application that tracked multiple account balances would need to represent the transfer's effect on each account separately.

Define spending with a different calculation#

Category expense flow adds expenses and subtracts refunds. A recorded expense of 100 followed by a refund of 20 contributes 80 to net spending under that rule.

The refund also adds 20 to the recorded balance. Those two effects are consistent, but they answer different dashboard questions. Reusing one generic sum for both could hide the distinction.

Keep validation close to persistence#

The transaction actions validate amount, type, category, description, and date before writing. They derive the authenticated owner for insertion and filter changes by both transaction ID and user ID.

A correct chart cannot compensate for an invalid transaction or a mutation aimed at another user's record. The data boundary and calculation boundary both need review.

Explain the model's scope#

These totals describe manually recorded transactions and the configured opening balance. They do not establish a reconciled bank balance. Naming that scope helps a person interpret the dashboard and helps a developer identify which future features would require additional data relationships.