Ibanity.Sandbox.FinancialInstitutionAccount (ibanity v0.12.0)

Financial institution account API wrapper

Link to this section Summary

Functions

Deletes an account belonging to a user and a financial institution.

Deletes an account belonging to a user and a financial institution.

Fetches the financial institution user this account belongs to.

Retrieves an account belonging to a user and a financial institution.

Retrieves an account belonging to a user and a financial institution.

List all accounts belonging to a user, within a financial institution.

List all accounts belonging to a user, within a financial institution.

Fetches the transactions associated to this account.

Link to this section Functions

Link to this function

create(request)

Creates a new financial institution account.

Returns {:ok, account} when successful, {:error, reason} otherwise.

example

Example

iex> [
...>   subtype: "checking",
...>   reference: "BE456789012",
...>   reference_type: "IBAN",
...>   description: "Savings account",
...>   currency: "EUR"
...> ]
...> |> Request.attributes
...> |> Request.id(:financial_institution_id, "b5d6c5f9-e1d2-4cd1-a2aa-7baf964f7bf7")
...> |> Request.id(:financial_institution_user_id, "a64f42ec-c801-41a7-8801-0f815ca42e9e")
...> |> FinancialInstitutionAccount.create
{:ok, %Ibanity.FinancialInstitutionAccount{id: "3034fe85-29ee-4ebc-9a2d-33df4e2f4602", ...}}
Link to this function

delete(request)

Deletes an account belonging to a user and a financial institution.

Returns {:ok, account} when successful, {:error, reason} otherwise.

example

Example

iex> Request.id(:financial_institution_id, "b5d6c5f9-e1d2-4cd1-a2aa-7baf964f7bf7")
...> |> Request.id(:financial_institution_user_id, "a64f42ec-c801-41a7-8801-0f815ca42e9e")
...> |> Request.id(:id, "b1c1e046-309b-49b8-bc5d-c4b1f82f61a7")
...> |> FinancialInstitutionAccount.delete
{:ok, Ibanity.FinancialInstitutionAccount{id: "b1c1e046-309b-49b8-bc5d-c4b1f82f61a7", ...}}
Link to this function

delete(institution_id, user_id, account_id)

Deletes an account belonging to a user and a financial institution.

Returns {:ok, account} when successful, {:error, reason} otherwise.

example

Example

iex> Ibanity.FinancialInstitutionAccount.delete(
...>   "b5d6c5f9-e1d2-4cd1-a2aa-7baf964f7bf7",
...>   "a64f42ec-c801-41a7-8801-0f815ca42e9e",
...>   "b1c1e046-309b-49b8-bc5d-c4b1f82f61a7",
...> )
{:ok, FinancialInstitutionAccount{id: "b1c1e046-309b-49b8-bc5d-c4b1f82f61a7", ...}}
Link to this function

financial_institution_user(account)

Fetches the financial institution user this account belongs to.

Returns:

  • {:ok, institution} if successful,
  • nil if no financial institution user link was set on the structure
  • {:error, reason} otherwise

Retrieves an account belonging to a user and a financial institution.

Returns {:ok, account} when successful, {:error, reason} otherwise.

example

Example

iex> Request.id(:financial_institution_id, "b5d6c5f9-e1d2-4cd1-a2aa-7baf964f7bf7")
...> |> Request.id(:financial_institution_user_id, "a64f42ec-c801-41a7-8801-0f815ca42e9e")
...> |> Request.id(:id, "b1c1e046-309b-49b8-bc5d-c4b1f82f61a7")
...> |> FinancialInstitutionAccount.find
{:ok, Ibanity.FinancialInstitutionAccount{id: "b1c1e046-309b-49b8-bc5d-c4b1f82f61a7", ...}}
Link to this function

find(institution_id, user_id, account_id)

Retrieves an account belonging to a user and a financial institution.

Returns {:ok, account} when successful, {:error, reason} otherwise.

example

Example

iex> FinancialInstitutionAccount.find(
...>   "b5d6c5f9-e1d2-4cd1-a2aa-7baf964f7bf7",
...>   "a64f42ec-c801-41a7-8801-0f815ca42e9e",
...>   "b1c1e046-309b-49b8-bc5d-c4b1f82f61a7",
...> )
{:ok, Ibanity.FinancialInstitutionAccount{id: "b1c1e046-309b-49b8-bc5d-c4b1f82f61a7", ...}}

List all accounts belonging to a user, within a financial institution.

Returns {:ok, accounts} where accounts is a Ibanity.Collection where items are Ibanity.FinancialInstitutionAccount.

examples

Examples

iex> |> Request.id(:financial_institution_id, "b5d6c5f9-e1d2-4cd1-a2aa-7baf964f7bf7")
...> |> Request.id(:financial_institution_user_id, "a64f42ec-c801-41a7-8801-0f815ca42e9e")
...> |> FinancialInstitutionAccount.list
{:ok, %Ibanity.Collection{items: [%Ibanity.FinancialInstitutionAccount{...}], ...}}
Link to this function

list(institution_id, user_id)

List all accounts belonging to a user, within a financial institution.

Returns {:ok, accounts} where accounts is a Ibanity.Collection where items are Ibanity.FinancialInstitutionAccount.

Link to this function

transactions(account)

Fetches the transactions associated to this account.

Returns:

  • {:ok, transactions} if successful, where transactions is an Ibanity.Collection
  • nil if no transaction link was set on the structure
  • {:error, reason} otherwise