ibanity v0.6.0 Ibanity.Xs2a.FinancialInstitution

Financial institutions API wrapper

Link to this section Summary

Link to this section Functions

Link to this function

create(request)

Creates a new financial institution.

Note: work only in sandbox environment

Returns {:ok, institution} if sucessful, {:error, reason} otherwise.

Example

iex> [
...>   sandbox: true,
...>   name: "MetaBank"
...> ]
...> |> Request.attributes
...> |> FinancialInstitution.create
{:ok, %Ibanity.FinancialInstitution{id: "4b52d43c-433d-41e0-96f2-c2e38a24b25e", ...}}

Deletes a financial institution.

If the argument is a binary, it will create and empty request and assign the value of the id to that argument. If it's a request it will use it as-is.

Note: works only in sandbox environment

Returns {:ok, institution} if sucessful, {:error, reason} otherwise.

Examples

iex> Ibanity.FinancialInstitution.delete("55c09df6-0bdd-46ef-8e66-e5297e0e8a7f")
{:ok, %Ibanity.FinancialInstitution{id: "55c09df6-0bdd-46ef-8e66-e5297e0e8a7f", ...}}

iex> |> Request.id(:id, "55c09df6-0bdd-46ef-8e66-e5297e0e8a7f")
...> |> FinancialInstitution.delete
{:ok, %Ibanity.FinancialInstitution{id: "55c09df6-0bdd-46ef-8e66-e5297e0e8a7f", ...}}

Retrieves a financial institution.

If the argument is a binary, it will create and empty request and assign the value of the id to that argument.

If it's a request it will use it as-is. If the request has a valid customer access token set, it will reach the live endpoint of the API. If it's not set it will reach the sandbox endpoint.

Returns {:ok, institution} if sucessful, {:error, reason} otherwise.

Examples

iex> Ibanity.FinancialInstitution.find("55c09df6-0bdd-46ef-8e66-e5297e0e8a7f")
{:ok, %Ibanity.FinancialInstitution{id: "55c09df6-0bdd-46ef-8e66-e5297e0e8a7f", ...}}

iex> token
...> |> Request.customer_access_token
...> |> Request.id(:id, "55c09df6-0bdd-46ef-8e66-e5297e0e8a7f")
...> |> FinancialInstitution.find
{:ok, %Ibanity.FinancialInstitution{id: "55c09df6-0bdd-46ef-8e66-e5297e0e8a7f", ...}}

Lists all financial institutions in sandbox environment.

See list/1

Lists all financial institutions.

If the request has a valid customer access token set, it will reach the live endpoint of the API and list financial institutions the customer linked to this token belongs to. If it's not set it will reach the sandbox endpoint.

Returns {:ok, collection} where collection is a Ibanity.Collection where items are of type Ibanity.Xs2a.FinancialInstitution, otherwise it returns {:error, reason}.

Example

iex> FinancialInstitution.list
{:ok, %Ibanity.Collection{items: [%Ibanity.FinancialInstitution{...}], ...}
Link to this function

update(request)

Updates an existing financial institution.

Note: works only in sandbox environment

Returns {:ok, institution} if sucessful, {:error, reason} otherwise.

Example

iex> [
...>   sandbox: true,
...>   name: "metaBank"
...> ]
...> |> Request.attributes
...> |> Request.id(:id, "4b52d43c-433d-41e0-96f2-c2e38a24b25e")
...> |> FinancialInstitution.create
{:ok, %Ibanity.FinancialInstitution{id: "4b52d43c-433d-41e0-96f2-c2e38a24b25e", ...}}