Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add us_bank_account & more debits to PaymentMethod #742

Conversation

justinludwig
Copy link
Contributor

Currently, the Stripe.PaymentMethod struct doesn't include a number of fields that the Stripe API uses for the type-specific details of a payment method. This change adds fields for the bank-debit payment types that are missing:

  • us_bank_account
  • acss_debit
  • bacs_debit

Retreiving a us_bank_account payment type should now populate its us_bank_account field:

iex> Stripe.PaymentMethod.retrieve("pm_1LHCTyLbyeJk2hS7DM11RAja")
{:ok,
 %Stripe.PaymentMethod{
   acss_debit: nil,
   au_becs_debit: nil,
   bacs_debit: nil,
   billing_details: %{...},
   card: nil,
   created: 1656791998,
   customer: "cus_KKy0ZBqhtEbzGT",
   id: "pm_1LHCTyLbyeJk2hS7DM11RAja",
   link: nil,
   livemode: false,
   metadata: %{},
   object: "payment_method",
   sepa_debit: nil,
   type: "us_bank_account",
   us_bank_account: %{
     account_holder_type: "individual",
     account_type: "checking",
     bank_name: "STRIPE TEST BANK",
     financial_connections_account: "fca_1LHCSdLhelJl1gS70hOa1j2X",
     fingerprint: "xxFq7llo9dS1Z7bU",
     last4: "6789",
     networks: %{preferred: "ach", supported: ["ach"]},
     routing_number: "110000000"
   }
 }}

And retreiving a acss_debit payment type should now populate its acss_debit field:

iex> Stripe.PaymentMethod.retrieve("pm_1LHHg4LbyeJtr2S7BRfSddnr")
{:ok,
 %Stripe.PaymentMethod{
   acss_debit: %{
     bank_name: "STRIPE TEST BANK",
     fingerprint: "22KHkQTs0hGFjFCw",
     institution_number: "000",
     last4: "6789",
     transit_number: "11000"
   },
   au_becs_debit: nil,
   bacs_debit: nil,
   billing_details: %{...},
   card: nil,
   created: 1656811968,
   customer: "cus_KKy0ZBqhtEbzGT",
   id: "pm_1LHHg4LbyeJtr2S7BRfSddnr",
   link: nil,
   livemode: false,
   metadata: %{},
   object: "payment_method",
   sepa_debit: nil,
   type: "acss_debit",
   us_bank_account: nil
 }}

And retreiving a bacs_debit payment type should now populate its bacs_debit field:

iex> Stripe.PaymentMethod.retrieve("pm_1JxiLYLbyeJp3tS7S6m9FXa0")
{:ok,
 %Stripe.PaymentMethod{
   acss_debit: nil,
   au_becs_debit: nil,
   bacs_debit: %{
     fingerprint: "3id8WkuR8aycGzht",
     last4: "2345",
     sort_code: "108800"
   },
   billing_details: %{...},
   card: nil,
   created: 1637371588,
   customer: "cus_KKy0ZBqhtEbzGT",
   id: "pm_1JxiLYLbyeJp3tS7S6m9FXa0",
   link: nil,
   livemode: false,
   metadata: %{},
   object: "payment_method",
   sepa_debit: nil,
   type: "bacs_debit",
   us_bank_account: nil
 }}

@snewcomer snewcomer merged commit dd89df6 into beam-community:master Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants