Skip to content

Commit 88a1bc6

Browse files
committed
Add bank name
1 parent d5ab57f commit 88a1bc6

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"segment": {:hex, :segment, "0.1.1", "47bf9191590e7a533c105d1e21518e0d6da47c91e8d98ebb649c624db5dfc359", [:mix], [{:httpoison, "~> 0.8", [hex: :httpoison, optional: false]}, {:poison, "~> 1.3 or ~> 2.0", [hex: :poison, optional: false]}]},
5757
"sentry": {:hex, :sentry, "2.1.0", "51e7ca261b519294ac73b30763893c4a7ad2005205514aefa5bf37ccb83e44ea", [:mix], [{:hackney, "~> 1.6.1", [hex: :hackney, optional: false]}, {:plug, "~> 1.0", [hex: :plug, optional: true]}, {:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, optional: false]}, {:uuid, "~> 1.0", [hex: :uuid, optional: false]}]},
5858
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.0", "edee20847c42e379bf91261db474ffbe373f8acb56e9079acb6038d4e0bf414f", [:make, :rebar], []},
59-
"stripity_stripe": {:git, "https://github.com/code-corps/stripity_stripe.git", "f325778c8fb2af3bc04c9d894daef0c47c1500de", [branch: "2.0"]},
59+
"stripity_stripe": {:git, "https://github.com/code-corps/stripity_stripe.git", "f6ddf082a86f558e23789f24aea581add3ca8821", [branch: "2.0"]},
6060
"sweet_xml": {:hex, :sweet_xml, "0.6.3", "814265792baeb163421811c546581c522dfdcb9d1767b1e59959c52906414e80", [:mix], []},
6161
"timber": {:hex, :timber, "0.4.7", "df3fcd79bcb4eb4b53874d906ef5f3a212937b4bc7b7c5b244745202cc389443", [:mix], [{:ecto, "~> 2.0", [hex: :ecto, optional: true]}, {:phoenix, "~> 1.2", [hex: :phoenix, optional: true]}, {:plug, "~> 1.2", [hex: :plug, optional: true]}, {:poison, "~> 2.0 or ~> 3.0", [hex: :poison, optional: false]}]},
6262
"timex": {:hex, :timex, "3.1.5", "413d6d8d6f0162a5d47080cb8ca520d790184ac43e097c95191c7563bf25b428", [:mix], [{:combine, "~> 0.7", [hex: :combine, optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5", [hex: :tzdata, optional: false]}]},

test/views/stripe_connect_account_view_test.exs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,22 @@ defmodule CodeCorps.StripeConnectAccountViewTest do
1212
verification_disabled_reason: "fields_needed",
1313
verification_fields_needed: ["legal_entity.first_name", "legal_entity.last_name"]
1414
)
15+
insert(:stripe_external_account,
16+
stripe_connect_account: account,
17+
bank_name: "Wells Fargo",
18+
last4: "1234",
19+
routing_number: "123456789"
20+
)
1521

1622
rendered_json = render(CodeCorps.StripeConnectAccountView, "show.json-api", data: account)
1723

1824
expected_json = %{
1925
"data" => %{
2026
"attributes" => %{
27+
"bank-account-bank-name" => "Wells Fargo",
28+
"bank-account-last4" => "1234",
29+
"bank-account-routing-number" => "123456789",
2130
"bank-account-status" => "pending_requirement",
22-
"bank-account-last4" => nil,
23-
"bank-account-routing-number" => nil,
2431
"business-name" => account.business_name,
2532
"business-url" => account.business_url,
2633
"can-accept-donations" => true,

web/views/stripe_connect_account_view.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ defmodule CodeCorps.StripeConnectAccountView do
66
alias CodeCorps.StripeConnectAccount
77

88
attributes [
9-
:bank_account_status,
9+
:bank_account_bank_name,
1010
:bank_account_last4,
1111
:bank_account_routing_number,
12+
:bank_account_status,
1213
:business_name,
1314
:business_url,
1415
:can_accept_donations,
@@ -77,6 +78,9 @@ defmodule CodeCorps.StripeConnectAccountView do
7778
end
7879
end
7980

81+
def bank_account_bank_name(%{stripe_external_account: nil}, _conn), do: nil
82+
def bank_account_bank_name(%{stripe_external_account: %{bank_name: bank_name}}, _conn), do: bank_name
83+
8084
def bank_account_last4(%{stripe_external_account: nil}, _conn), do: nil
8185
def bank_account_last4(%{stripe_external_account: %{last4: last4}}, _conn), do: last4
8286

0 commit comments

Comments
 (0)