starkbank v2.1.0 StarkBank.PaymentRequest View Source

Groups PaymentRequest related functions

Link to this section Summary

Functions

A PaymentRequest is an indirect request to access a specific cash-out service (such as Transfer, BoletoPayments, etc.) which goes through the cost center approval flow on our web banking. To emit a PaymentRequest, you must direct it to a specific cost center by its ID, which can be retrieved on our web banking at the cost center page.

Sends a list of PaymentRequests structs for creating in the Stark Bank API

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

Receive a stream of PaymentRequest structs previously created by this user in the Stark Bank API

Same as query(), 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.PaymentRequest{
  actions: term(),
  amount: term(),
  center_id: term(),
  created: term(),
  due: term(),
  id: term(),
  payment: term(),
  status: term(),
  tags: term(),
  type: term(),
  updated: term()
}

Link to this section Functions

Link to this function

%StarkBank.PaymentRequest{}

View Source (struct)

A PaymentRequest is an indirect request to access a specific cash-out service (such as Transfer, BoletoPayments, etc.) which goes through the cost center approval flow on our web banking. To emit a PaymentRequest, you must direct it to a specific cost center by its ID, which can be retrieved on our web banking at the cost center page.

Parameters (required):

  • :center_id [string]: target cost center ID. ex: "5656565656565656"
  • :payment [Transfer, BoletoPayment, UtilityPayment, Transaction or map]: payment entity that should be approved and executed.

Parameters (conditionally required):

  • :type [string]: payment type, inferred from the payment parameter if it is not a map. ex: "transfer", "boleto-payment"

Parameters (optional):

  • :due [Date, DateTime, Time or string]: Payment target date in ISO format. ex: 2020-12-31
  • :tags [list of strings]: list of strings for tagging

Attributes (return-only):

  • :id [string, default nil]: unique id returned when PaymentRequest is created. ex: "5656565656565656"
  • :amount [integer, default nil]: PaymentRequest amount. ex: 100000 = R$1.000,00
  • :status [string, default nil]: current PaymentRequest status.ex: "pending" or "approved"
  • :actions [list of maps, default nil]: list of actions that are affecting this PaymentRequest. ex: [%{"type": "member", "id": "56565656565656, "action": "requested"}]
  • :updated [DateTime, default nil]: latest update datetime for the PaymentRequest. ex: 2020-12-31
  • :created [DateTime, default nil]: creation datetime for the PaymentRequest. ex: 2020-12-31
Link to this function

create(payment_requests, options \\ [])

View Source
create([StarkBank.PaymentRequest.t() | map()], [
  {:user, StarkBank.User.Project.t() | nil}
]) :: {:ok, [StarkBank.PaymentRequest.t()]} | {:error, [StarkBank.Error.t()]}

Sends a list of PaymentRequests structs for creating in the Stark Bank API

Paramenters (required):

  • payment_requests [list of PaymentRequest structs]: list of PaymentRequest objects to be created in the API

Options:

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

Return:

  • list of PaymentRequest structs with updated attributes
Link to this function

create!(payment_requests, options \\ [])

View Source
create!([StarkBank.PaymentRequest.t() | map()], [
  {:user, StarkBank.User.Project.t() | nil}
]) :: any()

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

Link to this function

query(options \\ [])

View Source
query(
  limit: integer(),
  after: Date.t() | DateTime.t() | binary(),
  before: Date.t() | DateTime.t() | binary(),
  sort: binary(),
  status: binary(),
  type: binary(),
  tags: [binary()],
  ids: [binary()],
  user: StarkBank.User.Project.t()
) ::
  ({:cont, {:ok, [StarkBank.PaymentRequest.t()]}}
   | {:error, [StarkBank.Error.t()]}
   | {:halt, any()}
   | {:suspend, any()},
   any() ->
     any())

Receive a stream of PaymentRequest structs previously created by this user in the Stark Bank API

Options:

- `:limit` [integer, default nil]: maximum number of structs to be retrieved. Unlimited if nil. ex: 35
- `:after` [Date, DateTime or string, default nil]: date filter for structs created only after specified date. ex: ~D[2020-03-25]
- `:before` [Date, DateTime or string, default nil]: date filter for structs created only before specified date. ex: ~D[2020-03-25]
- `:sort` [string, default "-created"]: sort order considered in response. Valid options are "-created" or "-due".
- `:status` [string, default nil]: filter for status of retrieved structs. ex: "paid" or "registered"
- `:type` [string, default nil]: payment type, inferred from the payment parameter if it is not a dictionary. ex: "transfer", "boleto-payment"
- `:tags` [list of strings, default nil]: tags to filter retrieved structs. ex: ["tony", "stark"]
- `:ids` [list of strings, default nil]: list of ids to filter retrieved structs. ex: ["5656565656565656", "4545454545454545"]
- `:user` [Project]: Project struct returned from StarkBank.project(). Only necessary if default project has not been set in configs.

Return:

- stream of PaymentRequest structs with updated attributes
Link to this function

query!(options \\ [])

View Source
query!(
  limit: integer(),
  after: Date.t() | DateTime.t() | binary(),
  before: Date.t() | DateTime.t() | binary(),
  sort: binary(),
  status: binary(),
  type: binary(),
  tags: [binary()],
  ids: [binary()],
  user: StarkBank.User.Project.t()
) ::
  ({:cont, [StarkBank.PaymentRequest.t()]}
   | {:halt, any()}
   | {:suspend, any()},
   any() ->
     any())

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