All financials related to publisher accounts are run through two tables (See Database Schema Diagram):
Each Financial Transaction has a foreign key to the Financial Transaction Type.
The type has a description and a boolean for "DirectionIsIncoming". Imagine each publisher has an account balance, like a bank account. When a Financial Transaction is created, "DirectionIsIncoming" = true, it means the transaction is moving in to the user's account. If "DirectionIsIncoming" = false, it means the transaction is moving out of the user's account. There are no negative amounts in transactions. Each amount should be positive. If you are removing money, it should be an out transaction!
The Financial Transaction Types that get added to the table should include the various types of transactions, not just "in" and "out". For example, if enough users scan pages of a publication and the publisher is charged, a Financial Transaction should be added of Type "Publication Scanned Bill" and direction out, because the publisher was charged or money was removed from the "account". If a publisher pays money to the sponsors to pay for the service, then a Financial Transaction should be added of Type "Publisher Service Payment" and direction in, because the publisher added money to the "account".
Some FinancialTransactionTypes might include:
- Publisher Service Payment
- Publication Scanned Bill
- Support Adjustment In
- Support Adjustment Out
- Monthly Service Fee