Skip to content

xbollart/transaction-engin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transaction Engine

How to Run

# Build
cargo build

# Run
cargo run -- transactions.csv > accounts.csv


# Run with detailed logs locally
RUST_LOG=debug cargo run -- test_files/transactions.csv > accounts.csv

# Run tests
cargo test

Assumptions

  • Dispute, resolve and chargeback were only applied to deposits. In real life, withdrawals should probably be handled too.
  • Withdrawals and deposits are blocked once the account becomes locked. A unit test is covering this case.

Remarks

  • I believe I handled all the different use cases with unit tests covering their usage.
  • I encapsulated the accounts inside the transaction processor so accounts cannot be edited outside of it.
  • To handle large files I'm using a BufReader: this structure loads the file by chunks and processes them one after the other to avoid memory overflow.
  • I'm using HashMap to access accounts and transactions in constant time.

Coding Approach Using AI

My approach is quite the same every time with this kind of problem.

Phase 1 — Quick POC

I work on a quick proof of concept to understand how to tackle the various requirements. During this phase I use AI to speed up the process. I used it for custom format parsing with serde and the csv crate.

Prompt example: "Here is my input format x,y,z — generate a parsing function for this CSV file." Then I refactored it manually.

Phase 2 — Low-level system design

With a clearer view of my solution, I start designing the components and how they interact with each other.

During this phase, AI helped in three ways:

  • Unit test scaffolding — I used it to suggest the initial syntax of unit tests, then adapted the generated output.

    Prompt example: "Generate unit tests for method xyz."

  • Quick lookups — I used it as a replacement for Google searches on syntax or API questions, which is faster than browsing documentation.
  • Self code review — I used it to review the codebase with prompts such as:
  • "Search for typos in function and variable names."
  • "Give me an honest review of this repo."

Phase 3 — Code submission

In this phase I organise my code into meaningful commits to ease the code review. No AI needed on the code itself — I only used it to improve the wording of this README.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages