8000 GitHub - daern91/payment-engine
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

daern91/payment-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Payment Engine

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.

Getting Started

Rust and Cargo (latest stable version recommended). See Rust's installation guide for instructions.

Getting Started

  1. Clone the repo git clone https://example.com/toy-payments-engine.git && cd toy-payments-engine
  2. Run it with either cargo run -- <your-file.csv> or build with cargo build --release, then run it with the same argument.

Input Format

The input CSV file should have the following cols, type, client, tx, and amount. See integration tests for inspiration.

Output Format

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

Tests

You can run the test suite with cargo test.

TODO

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0