Skip to content

Commit

Permalink
OrcaFares: charge full price for senior cash on CT
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-heppner-ibigroup committed Dec 12, 2023
1 parent bd92f7e commit a850eaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private static void assertLegFareEquals(
void calculateFareForSingleAgency() {
List<Leg> 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);
Expand All @@ -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(
Expand Down Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,12 @@ private Optional<Money> 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)
Expand Down

0 comments on commit a850eaf

Please sign in to comment.