Reverse engineering transaction behavior from a transaction log in csv format.
- Use a csv based log file for transactions to track account balances and transaction history.
- The accounts should be initialized with a given log file.
- New changes to the accounts should log the transaction details to the log file.
The types of interactions are simple:
- Deposit: The amount is added to the account balance.
- Withdrawal: The amount is subtracted from the account balance.
- Dispute: The transaction is marked as disputed and does not count towards the account balance.
- Resolve: The disputed transaction is resolved and the original transaction is put in effect again.
- Chargeback: The disputed transaction is voided and the transaction has no impact on the account balance.
This leads to a simple state machine of transactions:
flowchart TD
created -- Dispute --> disputed
disputed -- Resolve --> resolved
disputed -- Chargeback --> voided
- API for generating transactions based on the accounts
- Tests