This payment engine is a toy I built during a mini hackathon a Sunday night.
It handles various types of transactions, including deposits, withrawals, disputes, resolutions, and chargebacks.
It's also got some basic error handling with it's custom EngineError
.
Rust and Cargo (latest stable version recommended). See Rust's installation guide for instructions.
- Clone the repo
git clone https://example.com/toy-payments-engine.git && cd toy-payments-engine
- Run it with either
cargo run -- <your-file.csv>
or build withcargo build --release
, then run it with the same argument.
The input CSV file should have the following cols, type
, client
, tx
, and amount
. See integration tests for inspiration.
The app outputs csv, which you can pipe to whichever app or redirect to file. E.g.
cat many_transactions.csv | target/debug/paymentengine | vim -
or
cargo run -- transactions.csv > accounts.csv
You can run the test suite with cargo test
.
Given the short time-frame for this little toy there are plenty of things I'd like to improve. However, all tests are green and it's fully functional. If I find more time I'd like to continue with the list below.
- Add unit tests
- Add benchmark testing (maybe with criterion)
- Look into threading and/or async for web server. E.g. we could use one thread for reading, one for processing, one for writing, and use send the data between them through channels.
- Optimize memory usage.
- Add more logging
- Add dockerfile
- Set up cicd pipeline