Skip to content

yzha645/littlepay-coding-exercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Littlepay Trip Processor

Processes tap-on/tap-off events from a CSV file and generates trip records with fare calculations.

Build & Run

Requires Java 17+ and Maven.

# Build
mvn clean package

# Run
java -jar target/trip-processor-1.0-SNAPSHOT.jar ./src/test/resources/test-taps.csv trips.csv

Run Tests

mvn test

Assumptions

  1. Tap matching is scoped to (PAN, CompanyId, BusId) — a passenger's tap-on and tap-off are expected to occur on the same bus operated by the same company.
  2. Taps are matched chronologically — within each group, taps are sorted by time and matched in order (first ON pairs with the next OFF).
  3. Two consecutive ONs — if a passenger taps on twice without tapping off, the first tap is treated as an incomplete trip (charged the maximum fare from that stop).
  4. Orphan OFF (OFF with no preceding ON) — treated as an incomplete trip, charged the maximum fare from the OFF stop. The start time and from-stop are left empty.
  5. Input is well-formed — as stated in the exercise, the input CSV has no missing or malformed data.
  6. Test PANs — all PANs used in test data are standard test card numbers, not real credit card numbers.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages