starkbank v0.0.3 StarkBank.BoletoPayment View Source

Groups BoletoPayment related functions

BoletoPayment struct:

When you initialize a BoletoPayment, the entity will not be automatically created in the Stark Bank API. The 'create' function sends the structs to the Stark Bank API and returns the list of created structs.

Parameters (conditionally required):

  • line [string, default nil]: Number sequence that describes the payment. Either 'line' or 'bar_code' parameters are required. If both are sent, they must match. ex: "34191.09008 63571.277308 71444.640008 5 81960000000062"
  • bar_code [string, default nil]: Bar code number that describes the payment. Either 'line' or 'barCode' parameters are required. If both are sent, they must match. ex: "34195819600000000621090063571277307144464000"

Parameters (required):

  • tax_id [string]: receiver tax ID (CPF or CNPJ) with or without formatting. ex: "01234567890" or "20.018.183/0001-80"
  • description [string]: Text to be displayed in your statement (min. 10 characters). ex: "payment ABC"

Parameters (optional):

  • scheduled [Date, default today]: payment scheduled date. ex: ~D[2020-03-25]
  • tags [list of strings]: list of strings for tagging

Attributes (return-only):

  • id [string, default nil]: unique id returned when payment is created. ex: "5656565656565656"
  • status [string, default nil]: current payment status. ex: "registered" or "paid"
  • amount [int, default nil]: amount automatically calculated from line or bar_code. ex: 23456 (= R$ 234.56)
  • fee [integer, default nil]: fee charged when a boleto payment is created. ex: 200 (= R$ 2.00)
  • created [DateTime, default nil]: creation datetime for the payment. ex: ~U[2020-03-26 19:32:35.418698Z]

Link to this section Summary

Functions

Create BoletoPayments

Send a list of BoletoPayment structs for creation in the Stark Bank API

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

Delete a BoletoPayment entity

Delete a BoletoPayment entity previously created in the Stark Bank API

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

Retrieve a specific BoletoPayment

Receive a single BoletoPayment struct previously created by the Stark Bank API by passing its id

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

Retrieve a specific BoletoPayment pdf file

Receive a single BoletoPayment pdf file generated in the Stark Bank API by passing its id. Only valid for boleto payments with "success" status.

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

Retrieve BoletoPayments

Receive a stream of BoletoPayment structs previously created 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.BoletoPayment{
  amount: term(),
  bar_code: term(),
  created: term(),
  description: term(),
  fee: term(),
  id: term(),
  line: term(),
  scheduled: term(),
  status: term(),
  tags: term(),
  tax_id: term()
}

Link to this section Functions

Link to this function

create(user, payments)

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

Create BoletoPayments

Send a list of BoletoPayment structs for creation in the Stark Bank API

Parameters (required):

  • user [Project]: Project struct returned from StarkBank.project().
  • payments [list of BoletoPayment structs]: list of BoletoPayment structs to be created in the API

Return:

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

create!(user, payments)

View Source
create!(StarkBank.User.Project.t(), [StarkBank.BoletoPayment.t()]) :: any()

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

Link to this function

delete(user, id)

View Source
delete(StarkBank.User.Project.t(), binary()) ::
  {:ok, StarkBank.BoletoPayment.t()}
  | {:error, [%StarkBank.Error{code: term(), message: term()}]}

Delete a BoletoPayment entity

Delete a BoletoPayment entity previously created in the Stark Bank API

Parameters (required):

  • user [Project]: Project struct returned from StarkBank.project().
  • id [string]: BoletoPayment unique id. ex: "5656565656565656"

Return:

  • deleted BoletoPayment struct with updated attributes
Link to this function

delete!(user, id)

View Source
delete!(StarkBank.User.Project.t(), binary()) :: StarkBank.BoletoPayment.t()

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

Link to this function

get(user, id)

View Source
get(StarkBank.User.Project.t(), binary()) ::
  {:ok, StarkBank.BoletoPayment.t()}
  | {:error, [%StarkBank.Error{code: term(), message: term()}]}

Retrieve a specific BoletoPayment

Receive a single BoletoPayment struct previously created by the Stark Bank API by passing its id

Parameters (required):

  • user [Project]: Project struct returned from StarkBank.project().
  • id [string]: struct unique id. ex: "5656565656565656"

Return:

  • BoletoPayment struct with updated attributes
Link to this function

get!(user, id)

View Source
get!(StarkBank.User.Project.t(), binary()) :: StarkBank.BoletoPayment.t()

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

Link to this function

pdf(user, id)

View Source
pdf(StarkBank.User.Project.t(), binary()) ::
  {:ok, binary()} | {:error, [%StarkBank.Error{code: term(), message: term()}]}

Retrieve a specific BoletoPayment pdf file

Receive a single BoletoPayment pdf file generated in the Stark Bank API by passing its id. Only valid for boleto payments with "success" status.

Parameters (required):

  • user [Project]: Project struct returned from StarkBank.project().
  • id [string]: struct unique id. ex: "5656565656565656"

Return:

  • BoletoPayment pdf file content
Link to this function

pdf!(user, id)

View Source
pdf!(StarkBank.User.Project.t(), binary()) :: binary()

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

Link to this function

query(user, options \\ [])

View Source
query(StarkBank.User.Project.t(), any()) ::
  ({:cont, {:ok, [StarkBank.BoletoPayment.t()]}}
   | {:error, [StarkBank.Error.t()]}
   | {:halt, any()}
   | {:suspend, any()},
   any() ->
     any())

Retrieve BoletoPayments

Receive a stream of BoletoPayment structs previously created in the Stark Bank API

Parameters (required):

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

Parameters (optional):

  • limit [integer, default nil]: maximum number of structs to be retrieved. Unlimited if nil. ex: 35
  • status [string, default nil]: filter for status of retrieved structs. ex: "paid"
  • tags [list of strings, default nil]: tags to filter retrieved structs. ex: ["tony", "stark"]
  • after [Date, default nil] date filter for structs created only after specified date. ex: Date(2020, 3, 10)
  • before [Date, default nil] date filter for structs only before specified date. ex: Date(2020, 3, 10)

Return:

  • stream of BoletoPayment structs with updated attributes
Link to this function

query!(user, options \\ [])

View Source
query!(StarkBank.User.Project.t(), any()) ::
  ({:cont, [StarkBank.BoletoPayment.t()]}
   | {:halt, any()}
   | {:suspend, any()},
   any() ->
     any())

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