Gocardlex.Behaviour.CustomerBankAccount behaviour (gocardlex v1.0.4)

Summary

Callbacks

Creates a new Customer Bank Account

Examples

iex> Gocardlex.Client.disable_customer_bank_account("BA000999999998")
{:ok,
%{"customer_bank_accounts" => %{"account_holder_name" => "FirstName LastName",
    "account_number_ending" => "11", "bank_name" => "BARCLAYS BANK PLC",
    "country_code" => "GB", "created_at" => "2017-06-23T13:37:09.967Z",
    "currency" => "GBP", "enabled" => false, "id" => "BA000999999998",
    "links" => %{"customer" => "CU000999999998"},
    "metadata" => %{}}}}

Gets a Customer Bank Account based on their ID in GoCardless

Lists Customer Bank Accounts from GoCardless

Updates a Customer Bank Account metadata based on their ID in GoCardless. Only the metadata parameter is allowed.

Callbacks

create_customer_bank_account(map)

@callback create_customer_bank_account(map()) :: tuple()

Creates a new Customer Bank Account

Examples

iex> params = %{
  customer_bank_accounts: %{
    account_holder_name: "FirstName LastName", 
    account_number: "55779911", 
    branch_code: "200000", 
    country_code: "GB", 
    links: %{
      customer: "CU000999999998"
    }
  }
}
iex> Gocardlex.Client.create_customer_bank_account(params)
{:ok,
%{"customer_bank_accounts" => %{"account_holder_name" => "FirstName LastName",
    "account_number_ending" => "11", "bank_name" => "BARCLAYS BANK PLC",
    "country_code" => "GB", "created_at" => "2017-06-23T13:37:09.967Z",
    "currency" => "GBP", "enabled" => true, "id" => "BA000999999998",
    "links" => %{"customer" => "CU000999999998"}, "metadata" => %{}}}}

disable_customer_bank_account(t)

@callback disable_customer_bank_account(String.t()) :: tuple()

Examples

iex> Gocardlex.Client.disable_customer_bank_account("BA000999999998")
{:ok,
%{"customer_bank_accounts" => %{"account_holder_name" => "FirstName LastName",
    "account_number_ending" => "11", "bank_name" => "BARCLAYS BANK PLC",
    "country_code" => "GB", "created_at" => "2017-06-23T13:37:09.967Z",
    "currency" => "GBP", "enabled" => false, "id" => "BA000999999998",
    "links" => %{"customer" => "CU000999999998"},
    "metadata" => %{}}}}

get_customer_bank_account(t)

@callback get_customer_bank_account(String.t()) :: tuple()

Gets a Customer Bank Account based on their ID in GoCardless

Examples

iex> Gocardlex.Client.get_customer_bank_account("BA000999999998")
{:ok,
%{"customer_bank_accounts" => %{"account_holder_name" => "FirstName LastName",
    "account_number_ending" => "11", "bank_name" => "BARCLAYS BANK PLC",
    "country_code" => "GB", "created_at" => "2017-06-23T13:37:09.967Z",
    "currency" => "GBP", "enabled" => true, "id" => "BA000999999998",
    "links" => %{"customer" => "CU000999999998"},
    "metadata" => %{"account_holder_name" => "FirstName LastName"}}}}

list_customer_bank_accounts(map)

@callback list_customer_bank_accounts(map()) :: tuple()

Lists Customer Bank Accounts from GoCardless

Examples

iex> Gocardlex.Client.list_customer_bank_accounts
{:ok,
%{"customer_bank_accounts" => [%{"account_holder_name" => "FirstName LastName",
      "account_number_ending" => "11", "bank_name" => "BARCLAYS BANK PLC",
      "country_code" => "GB", "created_at" => "2017-06-23T13:37:09.967Z",
      "currency" => "GBP", "enabled" => true, "id" => "BA000999999998",
      "links" => %{"customer" => "CU000999999998"},
      "metadata" => %{"account_holder_name" => "FirstName LastName"}}],
  "meta" => %{"cursors" => %{"after" => nil, "before" => nil}, "limit" => 50}}}

update_customer_bank_account(t, map)

@callback update_customer_bank_account(String.t(), map()) :: tuple()

Updates a Customer Bank Account metadata based on their ID in GoCardless. Only the metadata parameter is allowed.

Examples

iex> params = %{
  customer_bank_accounts: %{
    metadata: %{
      db_id: "1234"
    }
  }
}
iex> Gocardlex.Client.update_customer_bank_account("BA000999999998", params)
{:ok,
%{"customer_bank_accounts" => %{"account_holder_name" => "FirstName LastName",
    "account_number_ending" => "11", "bank_name" => "BARCLAYS BANK PLC",
    "country_code" => "GB", "created_at" => "2017-06-23T13:37:09.967Z",
    "currency" => "GBP", "enabled" => true, "id" => "BA000999999998",
    "links" => %{"customer" => "CU000999999998"},
    "metadata" => %{"db_id" => "1234"}}}}