Skip to content

Commit

Permalink
Add contactless payment (#2155)
Browse files Browse the repository at this point in the history
* add contactless payment

* tests
  • Loading branch information
anthonyshull authored Aug 22, 2024
1 parent b6bd18b commit 106fe52
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/fares/fare_info.ex
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ defmodule Fares.FareInfo do
%{
base
| duration: :single_trip,
media: [:charlie_card, :charlie_ticket, :cash],
media: [:charlie_card, :charlie_ticket, :contactless_payment, :cash],
reduced: nil,
cents: dollars_to_cents(charlie_card_price),
additional_valid_modes: [:bus]
Expand Down Expand Up @@ -439,7 +439,7 @@ defmodule Fares.FareInfo do
%{
base
| duration: :single_trip,
media: [:charlie_card, :charlie_ticket, :cash],
media: [:charlie_card, :charlie_ticket, :contactless_payment, :cash],
reduced: nil,
cents: dollars_to_cents(charlie_card_price)
},
Expand Down
7 changes: 4 additions & 3 deletions lib/fares/format.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ defmodule Fares.Format do
|> Util.AndOr.join(:or)
end

def media(:cash), do: "cash"
def media(:charlie_card), do: "CharlieCard"
def media(:charlie_ticket), do: "CharlieTicket"
def media(:commuter_ticket), do: "CharlieTicket"
def media(:contactless_payment), do: "contactless payment"
def media(:mticket), do: "mTicket App"
def media(:cash), do: "cash"
def media(:senior_card), do: "Senior CharlieCard or TAP ID"
def media(:student_card), do: "Student CharlieCard"
def media(:paper_ferry), do: "paper ferry ticket"
def media(:senior_card), do: "Senior CharlieCard or TAP ID"
def media(:special_event), do: "Special Event Ticket"
def media(:student_card), do: "Student CharlieCard"

@doc "Formats the duration of the Fare"
@spec duration(Fare.t() | Summary.t()) :: String.t()
Expand Down
2 changes: 1 addition & 1 deletion test/dotcom_web/trip_info_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ defmodule TripInfoTest do
additional_valid_modes: [],
cents: 170,
duration: :single_trip,
media: [:charlie_card, :charlie_ticket, :cash],
media: [:charlie_card, :charlie_ticket, :contactless_payment, :cash],
mode: :bus,
name: :local_bus,
reduced: nil
Expand Down
2 changes: 1 addition & 1 deletion test/dotcom_web/views/paragraph_view_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ defmodule DotcomWeb.CMS.ParagraphViewTest do
assert rendered =~ "Subway"
assert rendered =~ "One-Way"
assert rendered =~ "$2.40"
assert rendered =~ "with CharlieCard, CharlieTicket, or cash"
assert rendered =~ "with CharlieCard, CharlieTicket, contactless payment, or cash"
assert rendered =~ "/fares/subway"

assert rendered =~ "Local Bus"
Expand Down
4 changes: 2 additions & 2 deletions test/dotcom_web/views/trip_plan_view_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule DotcomWeb.TripPlanViewTest do
additional_valid_modes: [:bus],
cents: 240,
duration: :single_trip,
media: [:charlie_card, :charlie_ticket, :cash],
media: [:charlie_card, :charlie_ticket, :contactless_payment, :cash],
mode: :subway,
name: :subway,
price_label: nil,
Expand All @@ -26,7 +26,7 @@ defmodule DotcomWeb.TripPlanViewTest do
additional_valid_modes: [:bus],
cents: 240,
duration: :single_trip,
media: [:charlie_card, :charlie_ticket, :cash],
media: [:charlie_card, :charlie_ticket, :contactless_payment, :cash],
mode: :subway,
name: :subway,
price_label: nil,
Expand Down

0 comments on commit 106fe52

Please sign in to comment.