diff --git a/config/config.exs b/config/config.exs index e50373d4b0..aade1085fb 100644 --- a/config/config.exs +++ b/config/config.exs @@ -133,7 +133,8 @@ config :laboratory, {:new_timetables, "New timetables", "Uses the new timetable component and logic for all timetables"}, {:use_smartling_translations, "Smartling translations", - "Uses Smartling's translation workflows"} + "Uses Smartling's translation workflows"}, + {:fares_v2, "Fares v2", "Exposes information from GTFS Fares V2 in trip plans"} ], cookie: [ # one month, diff --git a/config/test.exs b/config/test.exs index 7676886273..b1e7f3a2c0 100644 --- a/config/test.exs +++ b/config/test.exs @@ -71,7 +71,8 @@ config :laboratory, features: [ {:test_flag, "Cool Bean", "cool bean for test"}, {:use_smartling_translations, "Smartling translations", - "Uses Smartling's translation workflows"} + "Uses Smartling's translation workflows"}, + {:fares_v2, "Fares v2", "Exposes information from GTFS Fares V2 in trip plans"} ], cookie: [ # one month, diff --git a/lib/dotcom_web/components/trip_planner/itinerary_summary.ex b/lib/dotcom_web/components/trip_planner/itinerary_summary.ex index dbc0b23ad1..384dd16a78 100644 --- a/lib/dotcom_web/components/trip_planner/itinerary_summary.ex +++ b/lib/dotcom_web/components/trip_planner/itinerary_summary.ex @@ -33,6 +33,7 @@ defmodule DotcomWeb.Components.TripPlanner.ItinerarySummary do attr :itinerary, Itinerary, required: true attr :show_accessible, :boolean, default: false attr :summarized_legs, :list, doc: "If not provided, will be derived from the itinerary" + attr :fares_v2, :any, default: nil def itinerary_summary(assigns) do itinerary_fare = fare(assigns.itinerary) @@ -92,6 +93,29 @@ defmodule DotcomWeb.Components.TripPlanner.ItinerarySummary do {@price} +
+
Enum.map(& &1.fare_products) + }> +
+
+

{product_fare.name}

+ {product_fare.usd_price} ({product_fare.medium_name}) +
+

With prior fare

+
    +
  • + {dependency.name} ({dependency.medium_name}) +
  • +
+
+
+
+
+
""" end diff --git a/lib/dotcom_web/components/trip_planner/results.ex b/lib/dotcom_web/components/trip_planner/results.ex index c18f6a47a8..df7a9eb1be 100644 --- a/lib/dotcom_web/components/trip_planner/results.ex +++ b/lib/dotcom_web/components/trip_planner/results.ex @@ -19,6 +19,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do attr :results, :any attr :class, :string, default: "" attr :accessible_grouping?, :boolean + attr :fares_v2, :any, default: nil def results(assigns) do ~H""" @@ -46,6 +47,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do results={@results} accessible_grouping?={@accessible_grouping?} feedback_url={@feedback_url} + fares_v2={@fares_v2} /> @@ -55,6 +57,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do attr :feedback_url, :string, default: nil attr :results, :any attr :accessible_grouping?, :boolean + attr :fares_v2, :any, default: nil defp itinerary_panel(%{results: %{loading?: true}} = assigns) do ~H""" @@ -73,6 +76,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do <.itinerary_groups feedback_url={@feedback_url} indexed_groups={Enum.with_index(@results.itinerary_groups)} + fares_v2={@fares_v2} /> """ end @@ -123,19 +127,20 @@ defmodule DotcomWeb.Components.TripPlanner.Results do class="mb-md" show_accessible feedback_url={@feedback_url} + fares_v2={@fares_v2} /> <% end %> <%= if @accessible_count > 0 do %> <.group_header text={ ~t(1 Accessible Route | %{count} Accessible Routes | #{@accessible_count})p } /> - <.itinerary_groups indexed_groups={@accessible_groups} show_accessible /> + <.itinerary_groups indexed_groups={@accessible_groups} show_accessible fares_v2={@fares_v2} /> <% end %> <%= if @inaccessible_count > 0 do %> <.group_header text={ ~t(1 Inaccessible Route | %{count} Inaccessible Routes | #{@inaccessible_count})p } /> - <.itinerary_groups indexed_groups={@inaccessible_groups} show_accessible /> + <.itinerary_groups indexed_groups={@inaccessible_groups} show_accessible fares_v2={@fares_v2} /> <% end %> """ end @@ -187,6 +192,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do attr :show_accessible, :boolean, default: false attr :class, :string, default: "" attr :feedback_url, :string, default: nil + attr :fares_v2, :any, default: nil defp itinerary_groups(assigns) do assigns = @@ -203,6 +209,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do index={index} show_accessible={@show_accessible} feedback_url={@feedback_url} + fares_v2={@fares_v2} /> @@ -274,6 +281,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do summarized_legs={@group.summary} itinerary={@group.representative_itinerary} show_accessible={@show_accessible} + fares_v2={@fares_v2} />
diff --git a/lib/dotcom_web/live/trip_planner_live.ex b/lib/dotcom_web/live/trip_planner_live.ex index d8888d759e..3c211568e9 100644 --- a/lib/dotcom_web/live/trip_planner_live.ex +++ b/lib/dotcom_web/live/trip_planner_live.ex @@ -138,6 +138,7 @@ defmodule DotcomWeb.TripPlannerLive do results={@results} accessible_grouping?={@accessible_grouping?} feedback_url={@trip_planner_feedback_url} + fares_v2={@fares_v2} /> <.live_component module={MbtaMetro.Live.Map} diff --git a/mix.exs b/mix.exs index a93112a419..90d9a4f417 100644 --- a/mix.exs +++ b/mix.exs @@ -128,7 +128,7 @@ defmodule DotCom.Mixfile do {:ex_machina, "2.8.0", only: [:dev, :test]}, {:ex_unit_summary, "0.2.0", only: [:dev, :test]}, {:excoveralls, "0.18.5", only: :test}, - {:faker, "0.19.0-alpha.1"}, + {:faker, "0.19.0-alpha.1", override: true}, {:floki, "0.38.0"}, {:flame_on, "~> 1.0", only: [:dev]}, {:gen_stage, "1.3.2"}, @@ -152,7 +152,8 @@ defmodule DotCom.Mixfile do {:nebulex_redis_adapter, "2.4.2"}, { :open_trip_planner_client, - [github: "mbta/open_trip_planner_client", tag: "v0.18.0"] + [github: "mbta/open_trip_planner_client", branch: "cbj/add-fares"] + # [github: "mbta/open_trip_planner_client", tag: "v0.18.0"] }, {:parallel_stream, "1.1.0"}, {:phoenix, "1.8.6", override: true}, diff --git a/mix.lock b/mix.lock index 4a09c65202..fe30f9f3ef 100644 --- a/mix.lock +++ b/mix.lock @@ -101,7 +101,7 @@ "nimble_ownership": {:hex, :nimble_ownership, "1.0.2", "fa8a6f2d8c592ad4d79b2ca617473c6aefd5869abfa02563a77682038bf916cf", [:mix], [], "hexpm", "098af64e1f6f8609c6672127cfe9e9590a5d3fcdd82bc17a377b8692fd81a879"}, "nimble_parsec": {:hex, :nimble_parsec, "1.4.2", "8efba0122db06df95bfaa78f791344a89352ba04baedd3849593bfce4d0dc1c6", [:mix], [], "hexpm", "4b21398942dda052b403bbe1da991ccd03a053668d147d53fb8c4e0efe09c973"}, "nimble_pool": {:hex, :nimble_pool, "1.1.0", "bf9c29fbdcba3564a8b800d1eeb5a3c58f36e1e11d7b7fb2e084a643f645f06b", [:mix], [], "hexpm", "af2e4e6b34197db81f7aad230c1118eac993acc0dae6bc83bac0126d4ae0813a"}, - "open_trip_planner_client": {:git, "https://github.com/mbta/open_trip_planner_client.git", "f2f961dd2d0a8989c8ed7297230de985d16711d4", [tag: "v0.18.0"]}, + "open_trip_planner_client": {:git, "https://github.com/mbta/open_trip_planner_client.git", "5ca0647ddb65cc151bddb1ef88e746a14282a9d7", [branch: "cbj/add-fares"]}, "parallel_stream": {:hex, :parallel_stream, "1.1.0", "f52f73eb344bc22de335992377413138405796e0d0ad99d995d9977ac29f1ca9", [:mix], [], "hexpm", "684fd19191aedfaf387bbabbeb8ff3c752f0220c8112eb907d797f4592d6e871"}, "parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"}, "phoenix": {:hex, :phoenix, "1.8.6", "7106a0da114619c4b12b056bbaef39fdbc75d3d0cf9cf24af683364064c12dc3", [:mix], [{:bandit, "~> 1.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "d0d0b7931916c8196b6903a1efa118b5da28487e7a75ad32a54dfd77de59d421"},