starkbank v0.0.3 StarkBank.Balance View Source

Groups Balance related functions

Balance struct:

The Balance struct displays the current balance of the workspace, which is the result of the sum of all transactions within this workspace. The balance is never generated by the user, but it can be retrieved to see the information available.

Attributes (return-only):

  • id [string, default nil]: unique id returned when Boleto is created. ex: "5656565656565656"
  • amount [integer, default nil]: current balance amount of the workspace in cents. ex: 200 (= R$ 2.00)
  • currency [string, default nil]: currency of the current workspace. Expect others to be added eventually. ex: "BRL"
  • updated [DateTime, default nil]: update datetime for the balance. ex: ~U[2020-03-26 19:32:35.418698Z]

Link to this section Summary

Functions

Retrieve the Balance entity

Receive the Balance entity linked to your workspace in the Stark Bank API

Same as get(), but it will unwrap the error tuple and raise in case of errors.

Link to this section Types

Link to this type

t()

View Source
t() :: %StarkBank.Balance{
  amount: term(),
  currency: term(),
  id: term(),
  updated: term()
}

Link to this section Functions

Link to this function

get(user)

View Source
get(StarkBank.User.Project.t()) ::
  {:ok, StarkBank.Balance.t()} | {:error, [StarkBank.Error]}

Retrieve the Balance entity

Receive the Balance entity linked to your workspace in the Stark Bank API

Parameters (required):

  • user [Project]: Project struct returned from StarkBank.project().

Return:

  • Balance struct with updated attributes
Link to this function

get!(user)

View Source
get!(StarkBank.User.Project.t()) :: StarkBank.Balance.t()

Same as get(), but it will unwrap the error tuple and raise in case of errors.