Commit graph

5 commits

Author SHA1 Message Date
Bruno BELANYI 211147db2c ledger: additional error-cases testing 2022-08-23 15:35:53 +02:00
Bruno BELANYI 12972a01c0 ledger: additional testing 2022-08-23 15:35:53 +02:00
Bruno BELANYI 6d98a05cee ledger: add dispute-related flow
It is unclear whether or deposits should be disputable, or only
withdrawals.

At the moment, both are disputable, but that does mean we can get into
"weird" states by disputing a deposit: the held funds being negative.

In turn, this means that there is relatively little error-checking for
those balance values, the only clear thing is that withdrawing more than
is currently available is absolutely an error. But is holding more than
is available also an error? What about having a negative held funds
balance? A negative total funds? Etc...
2022-08-23 15:35:53 +02:00
Bruno BELANYI 6df9c9d7a9 ledger: process deposits and withdrawals 2022-08-23 15:35:53 +02:00
Bruno BELANYI a00567cadc ledger: introduce 'Ledger' type
Unfortunately, rust-csv does not support serializing maps [1], so
instead of trying to write a `Deserialize` impl, the `dump_csv` method
takes care of formatting the output as expected.

[1]: https://github.com/BurntSushi/rust-csv/issues/98
2022-08-23 14:05:57 +02:00