4 ms·
What happens if you need to split that $100 from payer_id 1 into 2 payer_id 2's? I.e. that $100 is actually: $99 from 1 to 2 and $1(let's say in taxes) to pay
by zie 4y ago
What happens if you need to split that $100 from payer_id 1 into 2 payer_id 2's?
I.e. that $100 is actually:
$99 from 1 to 2 and $1(let's say in taxes) to payer_id 3.
The easy answer is, make it 2 transaction, $99 to 2 and $1 to 3, but then you can't tell that the $1 in taxes is from the $99 transaction. That leads to headaches when you need to balance your taxes.
- skipants 4y agoThis is just the ledger table. In your case you would have a payment event table with one row and a join table that connects that event with all the ledger rows. That's what Airbnb seems to do: https://medium.com/airbnb-engineering/tracking-the-money-scaling-financial-reporting-at-airbnb-6d742b80f040 https://medium.com/airbnb-engineering/tracking-the-money-sca...
- zie 4y agoOr just go full double entry and allow multiple accounts per transaction, which is what anyone with an accounting degree would tell you to do. The bonus of doing it this way, everyone with an accounting degree won't gasp in horror when they understand what it is you did. The events table in your example is basically the same as a transaction table and dump the transaction_id into the ledger table. The bonus of doing it with a 'transaction_id' is accountants, auditors and the rest won't be confused.