Skip to content

Commit

Permalink
Merge pull request #5416 from ibi-group/update-orca-fares
Browse files Browse the repository at this point in the history
Update ORCA model fares October 2023
  • Loading branch information
leonardehrenfried authored Oct 12, 2023
2 parents bc8db3a + 27699aa commit 3f6cf51
Show file tree
Hide file tree
Showing 3 changed files with 195 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ public class OrcaFareServiceTest {

private static final Money ONE_DOLLAR = usDollars(1f);
private static final Money TWO_DOLLARS = usDollars(2);
private static final Money FERRY_FARE = usDollars(6.10f);
private static final Money HALF_FERRY_FARE = usDollars(3.05f);
private static final Money ORCA_REGULAR_FARE = usDollars(2.50f);
private static final Money ORCA_SPECIAL_FARE = usDollars(1.50f);
private static final Money FERRY_FARE = usDollars(6.50f);
private static final Money HALF_FERRY_FARE = usDollars(3.25f);
private static final Money ORCA_SPECIAL_FARE = usDollars(1.00f);
private static final String FEED_ID = "A";
private static TestOrcaFareService orcaFareService;
public static final Money DEFAULT_TEST_RIDE_PRICE = usDollars(3.49f);
Expand Down Expand Up @@ -218,7 +217,7 @@ void calculateFareThatIncludesNoFreeTransfers() {
getLeg(WASHINGTON_STATE_FERRIES_AGENCY_ID, 30, "VashonIsland-Fauntelroy"),
getLeg(KITSAP_TRANSIT_AGENCY_ID, 60),
getLeg(SKAGIT_TRANSIT_AGENCY_ID, 90),
getLeg(KITSAP_TRANSIT_AGENCY_ID, 120),
getLeg(KITSAP_TRANSIT_AGENCY_ID, 121),
getLeg(WASHINGTON_STATE_FERRIES_AGENCY_ID, 150, "Fauntleroy-VashonIsland")
);
calculateFare(rides, regular, DEFAULT_TEST_RIDE_PRICE.times(4).plus(FERRY_FARE));
Expand All @@ -228,20 +227,17 @@ void calculateFareThatIncludesNoFreeTransfers() {
DEFAULT_TEST_RIDE_PRICE.times(3).plus(usDollars(.50f)).plus(HALF_FERRY_FARE)
);
calculateFare(rides, FareType.youth, Money.ZERO_USD);
calculateFare(
rides,
FareType.electronicSpecial,
ONE_DOLLAR.plus(DEFAULT_TEST_RIDE_PRICE).plus(ONE_DOLLAR).plus(FERRY_FARE)
);
// We don't get any fares for the skagit transit leg below here because they don't accept ORCA (electronic)
calculateFare(rides, FareType.electronicSpecial, ONE_DOLLAR.plus(ONE_DOLLAR).plus(FERRY_FARE));
calculateFare(
rides,
FareType.electronicRegular,
DEFAULT_TEST_RIDE_PRICE.times(3).plus(FERRY_FARE)
DEFAULT_TEST_RIDE_PRICE.times(2).plus(FERRY_FARE)
);
calculateFare(
rides,
FareType.electronicSenior,
ONE_DOLLAR.plus(usDollars(0.5f)).plus(ONE_DOLLAR).plus(HALF_FERRY_FARE)
ONE_DOLLAR.plus(ONE_DOLLAR).plus(HALF_FERRY_FARE)
);
calculateFare(rides, FareType.electronicYouth, ZERO_USD);
}
Expand Down Expand Up @@ -308,7 +304,7 @@ void calculateFareForKitsapFastFerryEastAgency() {
calculateFare(rides, regular, TWO_DOLLARS);
calculateFare(rides, FareType.senior, TWO_DOLLARS);
calculateFare(rides, FareType.youth, Money.ZERO_USD);
calculateFare(rides, FareType.electronicSpecial, DEFAULT_TEST_RIDE_PRICE);
calculateFare(rides, FareType.electronicSpecial, ONE_DOLLAR);
calculateFare(rides, FareType.electronicRegular, TWO_DOLLARS);
calculateFare(rides, FareType.electronicSenior, ONE_DOLLAR);
calculateFare(rides, FareType.electronicYouth, Money.ZERO_USD);
Expand Down Expand Up @@ -336,27 +332,27 @@ void calculateFareForWSFPtToTahlequah() {
*/
@Test
void calculateFareForLightRailLeg() {
var regularFare = usDollars(2.50f);
List<Leg> rides = List.of(
getLeg(SOUND_TRANSIT_AGENCY_ID, "1-Line", 0, "Roosevelt Station", "Int'l Dist/Chinatown")
);

calculateFare(rides, regular, ORCA_REGULAR_FARE);
calculateFare(rides, FareType.senior, ONE_DOLLAR);
calculateFare(rides, regular, regularFare);
calculateFare(rides, FareType.senior, regularFare);
calculateFare(rides, FareType.youth, Money.ZERO_USD);
calculateFare(rides, FareType.electronicSpecial, ORCA_SPECIAL_FARE);
calculateFare(rides, FareType.electronicRegular, ORCA_REGULAR_FARE);
calculateFare(rides, FareType.electronicRegular, regularFare);
calculateFare(rides, FareType.electronicSenior, ONE_DOLLAR);
calculateFare(rides, FareType.electronicYouth, Money.ZERO_USD);
// Ensure that it works in reverse
rides =
List.of(
getLeg(SOUND_TRANSIT_AGENCY_ID, "1-Line", 0, "Int'l Dist/Chinatown", "Roosevelt Station")
);
calculateFare(rides, regular, ORCA_REGULAR_FARE);
calculateFare(rides, FareType.senior, ONE_DOLLAR);
calculateFare(rides, regular, regularFare);
calculateFare(rides, FareType.senior, regularFare);
calculateFare(rides, FareType.youth, Money.ZERO_USD);
calculateFare(rides, FareType.electronicSpecial, ORCA_SPECIAL_FARE);
calculateFare(rides, FareType.electronicRegular, ORCA_REGULAR_FARE);
calculateFare(rides, FareType.electronicRegular, regularFare);
calculateFare(rides, FareType.electronicSenior, ONE_DOLLAR);
calculateFare(rides, FareType.electronicYouth, Money.ZERO_USD);
}
Expand All @@ -367,7 +363,7 @@ void calculateFareForSounderLeg() {
getLeg(SOUND_TRANSIT_AGENCY_ID, "S Line", 0, "King Street Station", "Auburn Station")
);
calculateFare(rides, regular, usDollars(4.25f));
calculateFare(rides, FareType.senior, ONE_DOLLAR);
calculateFare(rides, FareType.senior, usDollars(4.25f));
calculateFare(rides, FareType.youth, Money.ZERO_USD);
calculateFare(rides, FareType.electronicSpecial, ORCA_SPECIAL_FARE);
calculateFare(rides, FareType.electronicRegular, usDollars(4.25f));
Expand All @@ -379,7 +375,7 @@ void calculateFareForSounderLeg() {
getLeg(SOUND_TRANSIT_AGENCY_ID, "N Line", 0, "King Street Station", "Everett Station")
);
calculateFare(rides, regular, usDollars(5.00f));
calculateFare(rides, FareType.senior, ONE_DOLLAR);
calculateFare(rides, FareType.senior, usDollars(5.00f));
calculateFare(rides, FareType.youth, Money.ZERO_USD);
calculateFare(rides, FareType.electronicSpecial, ORCA_SPECIAL_FARE);
calculateFare(rides, FareType.electronicRegular, usDollars(5.00f));
Expand All @@ -400,9 +396,10 @@ void calculateSoundTransitBusFares() {
getLeg(KC_METRO_AGENCY_ID, "550", 240)
);
calculateFare(rides, regular, usDollars(9.75f));
calculateFare(rides, FareType.senior, usDollars(3));
// Sound Transit does not accept senior fares in cash
calculateFare(rides, FareType.senior, usDollars(9.75f));
calculateFare(rides, FareType.youth, Money.ZERO_USD);
calculateFare(rides, FareType.electronicSpecial, usDollars(4.50f));
calculateFare(rides, FareType.electronicSpecial, usDollars(3f));
calculateFare(rides, FareType.electronicRegular, usDollars(9.75f));
calculateFare(rides, FareType.electronicSenior, usDollars(3.00f));
calculateFare(rides, FareType.electronicYouth, Money.ZERO_USD);
Expand All @@ -416,7 +413,7 @@ void calculateSoundTransitBusFares() {
calculateFare(rides, regular, DEFAULT_TEST_RIDE_PRICE.times(2));
calculateFare(rides, FareType.senior, DEFAULT_TEST_RIDE_PRICE.times(2));
calculateFare(rides, FareType.youth, Money.ZERO_USD);
calculateFare(rides, FareType.electronicSpecial, DEFAULT_TEST_RIDE_PRICE);
calculateFare(rides, FareType.electronicSpecial, usDollars(1f));
calculateFare(rides, FareType.electronicRegular, DEFAULT_TEST_RIDE_PRICE);
calculateFare(rides, FareType.electronicSenior, ONE_DOLLAR);
calculateFare(rides, FareType.electronicYouth, Money.ZERO_USD);
Expand All @@ -432,9 +429,9 @@ void calculateCashFreeTransferKCMetro() {
getLeg(KC_METRO_AGENCY_ID, 130)
);
calculateFare(rides, regular, DEFAULT_TEST_RIDE_PRICE.times(3));
calculateFare(rides, FareType.senior, usDollars(3.25f));
calculateFare(rides, FareType.senior, DEFAULT_TEST_RIDE_PRICE.times(2).plus(usDollars(1.25f)));
calculateFare(rides, FareType.youth, Money.ZERO_USD);
calculateFare(rides, FareType.electronicSpecial, usDollars(3));
calculateFare(rides, FareType.electronicSpecial, usDollars(1.25f));
calculateFare(rides, FareType.electronicRegular, DEFAULT_TEST_RIDE_PRICE.times(2));
calculateFare(rides, FareType.electronicSenior, usDollars(1.25f)); // Transfer extended by CT ride
calculateFare(rides, FareType.electronicYouth, ZERO_USD);
Expand All @@ -447,8 +444,9 @@ void calculateTransferExtension() {
getLeg(SOUND_TRANSIT_AGENCY_ID, "1-Line", 60, "Roosevelt Station", "Angle Lake Station"), // 3.25, should extend transfer
getLeg(SOUND_TRANSIT_AGENCY_ID, "1-Line", 140, "Int'l Dist/Chinatown", "Angle Lake Station") // 3.00, should be free under extended transfer
);
calculateFare(rides, regular, ORCA_REGULAR_FARE.plus(usDollars(3.25f)).plus(usDollars(3.00f)));
calculateFare(rides, FareType.senior, usDollars(3));
var regularFare = usDollars(2.50f).plus(usDollars(3.25f)).plus(usDollars(3.00f));
calculateFare(rides, regular, regularFare);
calculateFare(rides, FareType.senior, regularFare);
calculateFare(rides, FareType.youth, Money.ZERO_USD);
calculateFare(rides, FareType.electronicSpecial, ORCA_SPECIAL_FARE.times(2));
calculateFare(rides, FareType.electronicRegular, usDollars(3.25f)); // transfer extended on second leg
Expand Down
Loading

0 comments on commit 3f6cf51

Please sign in to comment.