View Source StarkBank.Balance (starkbankpublish v0.0.1)

Groups Balance related functions

Summary

Functions

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.

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.

Types

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

Functions

Link to this function

%StarkBank.Balance{}

View Source (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 Balance 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]
@spec get([
  {:user, StarkBank.User.Project.t() | StarkBank.User.Organization.t() | nil}
]) ::
  {:ok, t()} | {:error, [StarkBank.Error]}

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

Options:

  • :user [Organization/Project, default nil]: Organization or Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.

Return:

  • Balance struct with updated attributes
@spec get!([
  {:user, StarkBank.User.Project.t() | StarkBank.User.Organization.t() | nil}
]) :: t()

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