Investec Open API v0.1.0 InvestecOpenApi.Accounts.Transaction View Source

This module deals with listing the transactions for a specific account

Link to this section Summary

Functions

List all the transactions for a given user and account. This needs an authenticated client and account_id (or %InvestecOpenApi.Accounts{} object) as input parameters.

Link to this section Types

Specs

t() :: %InvestecOpenApi.Accounts.Transaction{
  account_id: binary(),
  action_date: binary(),
  amount: number(),
  card_number: binary(),
  description: binary(),
  posting_date: binary(),
  status: binary(),
  type: binary(),
  value_date: binary()
}

Link to this section Functions

Link to this function

call_list_transactions(client, account_id)

View Source

Specs

Link to this function

create_transaction_object(transaction)

View Source

Specs

create_transaction_object(map()) :: t()
Link to this function

list_transactions(client, account_id)

View Source

Specs

list_transactions(
  InvestecOpenApi.Client.t(),
  binary() | InvestecOpenApi.Accounts.t()
) ::
  {:error, binary() | Jason.DecodeError.t()}
  | {:ok, [t()], InvestecOpenApi.Client.t()}

List all the transactions for a given user and account. This needs an authenticated client and account_id (or %InvestecOpenApi.Accounts{} object) as input parameters.

It will return a list with %InvestecOpenApi.Accounts.Transaction{} objects.

With this it also returns an authenticated %InvestecOpenApi.Client{} again, because if the previous access_token has expired, a new one woule automatically be created again

Example

iex> {:ok, client} = InvestecOpenApi.new()
...> {:ok, [account | _], client} = InvestecOpenApi.Accounts.list_accounts(client)
...> {:ok, transactions, client} = InvestecOpenApi.Accounts.Transaction.list_transactions(client, account)
...> List.first(transactions)
%InvestecOpenApi.Accounts.Transaction{
  account_id: "172878438321553632224",
  action_date: "2020-06-18",
  amount: 535,
  card_number: "",
  description: "MONTHLY SERVICE CHARGE",
  posting_date: "2020-06-11",
  status: "POSTED",
  type: "DEBIT",
  value_date: "2020-06-10"
}