Processes tap-on/tap-off events from a CSV file and generates trip records with fare calculations.
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.csvmvn test- 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.
- Taps are matched chronologically — within each group, taps are sorted by time and matched in order (first ON pairs with the next OFF).
- 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).
- 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.
- Input is well-formed — as stated in the exercise, the input CSV has no missing or malformed data.
- Test PANs — all PANs used in test data are standard test card numbers, not real credit card numbers.