This module provides functions for managing bank account resources in the Humaans API.
Summary
Functions
Creates a new bank_account.
Deletes a specific bank_account by ID.
Lists all bank_accounts.
Retrieves a specific bank_account by ID.
Updates a specific bank_account by ID.
Types
@type delete_response() :: {:ok, %{id: String.t(), deleted: bool()}} | {:error, Humaans.Error.t()}
@type list_response() :: {:ok, [ %Humaans.Resources.BankAccount{ account_number: term(), bank_name: term(), created_at: term(), id: term(), name_on_account: term(), person_id: term(), routing_number: term(), sort_code: term(), swift_code: term(), updated_at: term() } ]} | {:error, Humaans.Error.t()}
Functions
@spec create(client :: map(), params :: map() | keyword()) :: {:ok, Humaans.Resources.BankAccount.t()} | {:error, Humaans.Error.t()}
Creates a new bank_account.
Parameters
client- Client created withHumaans.new/1params- Map of attributes for the new bank_account
Examples
client = Humaans.new(access_token: "your_access_token")
params = %{personId: "person_abc", bankName: "Barclays", accountNumber: "12345678", sortCode: "20-00-00"}
{:ok, bank_account} = Humaans.BankAccounts.create(client, params)
@spec delete(client :: map(), id :: String.t()) :: {:ok, %{id: String.t(), deleted: boolean()}} | {:error, Humaans.Error.t()}
Deletes a specific bank_account by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the bank_account to delete
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, %{id: "bank_account_id", deleted: true}} = Humaans.BankAccounts.delete(client, "bank_account_id")
@spec list(client :: map(), params :: map() | keyword()) :: {:ok, [Humaans.Resources.BankAccount.t()]} | {:error, Humaans.Error.t()}
Lists all bank_accounts.
Returns a list of bank_accounts matching the optional filter params.
Parameters
client- Client created withHumaans.new/1params- Optional map of filter parameters (default:%{})
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, bank_accounts} = Humaans.BankAccounts.list(client)
{:ok, bank_accounts} = Humaans.BankAccounts.list(client, %{})
@spec retrieve(client :: map(), id :: String.t()) :: {:ok, Humaans.Resources.BankAccount.t()} | {:error, Humaans.Error.t()}
Retrieves a specific bank_account by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the bank_account to retrieve
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, bank_account} = Humaans.BankAccounts.retrieve(client, "bank_account_id")
@spec update(client :: map(), id :: String.t(), params :: map() | keyword()) :: {:ok, Humaans.Resources.BankAccount.t()} | {:error, Humaans.Error.t()}
Updates a specific bank_account by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the bank_account to updateparams- Map of attributes to update
Examples
client = Humaans.new(access_token: "your_access_token")
params = %{bankName: "HSBC"}
{:ok, bank_account} = Humaans.BankAccounts.update(client, "bank_account_id", params)