From a850eaf084c375413c59a34ca37424a1e0c120d6 Mon Sep 17 00:00:00 2001 From: Daniel Heppner Date: Tue, 12 Dec 2023 15:09:03 -0800 Subject: [PATCH] OrcaFares: charge full price for senior cash on CT --- .../ext/fares/impl/OrcaFareServiceTest.java | 6 +++--- .../opentripplanner/ext/fares/impl/OrcaFareService.java | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java b/src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java index 624330ba443..4688c2d186f 100644 --- a/src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java +++ b/src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java @@ -125,7 +125,7 @@ private static void assertLegFareEquals( void calculateFareForSingleAgency() { List rides = List.of(getLeg(COMM_TRANS_AGENCY_ID, "400", 0)); calculateFare(rides, regular, DEFAULT_TEST_RIDE_PRICE); - calculateFare(rides, FareType.senior, TWO_DOLLARS); + calculateFare(rides, FareType.senior, DEFAULT_TEST_RIDE_PRICE); calculateFare(rides, FareType.youth, ZERO_USD); calculateFare(rides, FareType.electronicSpecial, TWO_DOLLARS); calculateFare(rides, FareType.electronicRegular, DEFAULT_TEST_RIDE_PRICE); @@ -148,7 +148,7 @@ void calculateFareWithNoFreeTransfer() { calculateFare( rides, FareType.senior, - DEFAULT_TEST_RIDE_PRICE.plus(DEFAULT_TEST_RIDE_PRICE).plus(usDollars(1.25f)) + DEFAULT_TEST_RIDE_PRICE.times(3) ); calculateFare(rides, FareType.youth, Money.ZERO_USD); calculateFare( @@ -429,7 +429,7 @@ void calculateCashFreeTransferKCMetro() { getLeg(KC_METRO_AGENCY_ID, 130) ); calculateFare(rides, regular, DEFAULT_TEST_RIDE_PRICE.times(3)); - calculateFare(rides, FareType.senior, DEFAULT_TEST_RIDE_PRICE.times(2).plus(usDollars(1.25f))); + calculateFare(rides, FareType.senior, DEFAULT_TEST_RIDE_PRICE.times(3)); calculateFare(rides, FareType.youth, Money.ZERO_USD); calculateFare(rides, FareType.electronicSpecial, usDollars(1.25f)); calculateFare(rides, FareType.electronicRegular, DEFAULT_TEST_RIDE_PRICE.times(2)); diff --git a/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareService.java b/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareService.java index 486362697b3..760ff5517bd 100644 --- a/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareService.java +++ b/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareService.java @@ -300,8 +300,12 @@ private Optional getSeniorFare( ) { var route = leg.getRoute(); return switch (rideType) { - case COMM_TRANS_LOCAL_SWIFT -> optionalUSD(1.25f); - case COMM_TRANS_COMMUTER_EXPRESS -> optionalUSD(2f); + case COMM_TRANS_LOCAL_SWIFT -> usesOrca(fareType) + ? optionalUSD(1.25f) + : getRegularFare(fareType, rideType, defaultFare, leg); + case COMM_TRANS_COMMUTER_EXPRESS -> usesOrca(fareType) + ? optionalUSD(2f) + : getRegularFare(fareType, rideType, defaultFare, leg); case EVERETT_TRANSIT, SKAGIT_TRANSIT, WHATCOM_LOCAL, SKAGIT_LOCAL -> optionalUSD(0.5f); case KITSAP_TRANSIT_FAST_FERRY_EASTBOUND -> fareType.equals(FareType.electronicSenior) // Kitsap only provide discounted senior fare for orca. ? optionalUSD(1f)