starkbank v0.2.0 StarkBank.Boleto View Source
Groups Boleto related functions
Link to this section Summary
Functions
When you initialize a Boleto struct, the entity will not be automatically sent to the Stark Bank API. The 'create' function sends the structs to the Stark Bank API and returns the list of created structs.
Send a list of Boleto 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 list of Boleto entities previously created in the Stark Bank API
Same as delete(), but it will unwrap the error tuple and raise in case of errors.
Receive a single Boleto struct previously created in the Stark Bank API by passing its id
Same as get(), but it will unwrap the error tuple and raise in case of errors.
Receive a single Boleto pdf file generated in the Stark Bank API by passing its id.
Same as pdf(), but it will unwrap the error tuple and raise in case of errors.
Receive a stream of Boleto 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
t()
View Sourcet() :: %StarkBank.Boleto{ amount: term(), bar_code: term(), city: term(), created: term(), descriptions: term(), district: term(), due: term(), fee: term(), fine: term(), id: term(), interest: term(), line: term(), name: term(), overdue_limit: term(), state_code: term(), status: term(), street_line_1: term(), street_line_2: term(), tags: term(), tax_id: term(), zip_code: term() }
Link to this section Functions
When you initialize a Boleto struct, the entity will not be automatically sent to the Stark Bank API. The 'create' function sends the structs to the Stark Bank API and returns the list of created structs.
Parameters (required):
:amount
[integer]: Boleto value in cents. Minimum amount = 200 (R$2,00). ex: 1234 (= R$ 12.34):name
[string]: payer full name. ex: "Anthony Edward Stark":tax_id
[string]: payer tax ID (CPF or CNPJ) with or without formatting. ex: "01234567890" or "20.018.183/0001-80":street_line_1
[string]: payer main address. ex: Av. Paulista, 200:street_line_2
[string]: payer address complement. ex: Apto. 123:district
[string]: payer address district / neighbourhood. ex: Bela Vista:city
[string]: payer address city. ex: Rio de Janeiro:state_code
[string]: payer address state. ex: GO:zip_code
[string]: payer address zip code. ex: 01311-200:due
[Date, default today + 2 days]: Boleto due date in ISO format. ex: 2020-04-30
Parameters (optional):
:fine
[float, default 0.0]: Boleto fine for overdue payment in %. ex: 2.5:interest
[float, default 0.0]: Boleto monthly interest for overdue payment in %. ex: 5.2:overdue_limit
[integer, default 59]: limit in days for automatic Boleto cancellation after due date. ex: 7 (max: 59):descriptions
[list of maps, default nil]: list of maps with :text (string) and :amount (int, optional) pairs:tags
[list of strings]: list of strings for tagging
Attributes (return-only):
:id
[string, default nil]: unique id returned when Boleto is created. ex: "5656565656565656":fee
[integer, default nil]: fee charged when Boleto is paid. ex: 200 (= R$ 2.00):line
[string, default nil]: generated Boleto line for payment. ex: "34191.09008 63571.277308 71444.640008 5 81960000000062":bar_code
[string, default nil]: generated Boleto bar-code for payment. ex: "34195819600000000621090063571277307144464000":status
[string, default nil]: current Boleto status. ex: "registered" or "paid":created
[DateTime, default nil]: creation datetime for the Boleto. ex: ~U[2020-03-26 19:32:35.418698Z]
create(boletos, options \\ [])
View Sourcecreate([StarkBank.Boleto.t()], [{:user, StarkBank.User.Project.t() | nil}]) :: {:ok, [StarkBank.Boleto.t()]} | {:error, [StarkBank.Error.t()]}
Send a list of Boleto structs for creation in the Stark Bank API
Parameters (required):
boletos
[list of Boleto structs]: list of Boleto structs 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 Boleto structs with updated attributes
create!(boletos, options \\ [])
View Sourcecreate!([StarkBank.Boleto.t()], [{:user, StarkBank.User.Project.t() | nil}]) :: any()
Same as create(), but it will unwrap the error tuple and raise in case of errors.
delete(id, options \\ [])
View Sourcedelete(binary(), [{:user, StarkBank.User.Project.t() | nil}]) :: {:ok, StarkBank.Boleto.t()} | {:error, [%StarkBank.Error{code: term(), message: term()}]}
Delete a list of Boleto entities previously created in the Stark Bank API
Parameters (required):
id
[string]: Boleto unique id. ex: "5656565656565656"
Options:
:user
[Project]: Project struct returned from StarkBank.project(). Only necessary if default project has not been set in configs.
Return:
- deleted Boleto struct with updated attributes
delete!(id, options \\ [])
View Sourcedelete!(binary(), [{:user, StarkBank.User.Project.t() | nil}]) :: StarkBank.Boleto.t()
Same as delete(), but it will unwrap the error tuple and raise in case of errors.
get(id, options \\ [])
View Sourceget(binary(), [{:user, StarkBank.User.Project.t() | nil}]) :: {:ok, StarkBank.Boleto.t()} | {:error, [%StarkBank.Error{code: term(), message: term()}]}
Receive a single Boleto struct previously created in the Stark Bank API by passing its id
Parameters (required):
id
[string]: struct unique id. ex: "5656565656565656"
Options:
:user
[Project]: Project struct returned from StarkBank.project(). Only necessary if default project has not been set in configs.
Return:
- Boleto struct with updated attributes
get!(id, options \\ [])
View Sourceget!(binary(), [{:user, StarkBank.User.Project.t() | nil}]) :: StarkBank.Boleto.t()
Same as get(), but it will unwrap the error tuple and raise in case of errors.
Receive a single Boleto pdf file generated in the Stark Bank API by passing its id.
Parameters (required):
id
[string]: struct unique id. ex: "5656565656565656"
Options:
:user
[Project]: Project struct returned from StarkBank.project(). Only necessary if default project has not been set in configs.
Return:
- Boleto pdf file content
Same as pdf(), but it will unwrap the error tuple and raise in case of errors.
query(options \\ [])
View Sourcequery( limit: integer(), after: Date.t() | binary(), before: Date.t() | binary(), status: binary(), tags: [binary()], ids: [binary()], user: StarkBank.User.Project.t() ) :: ({:cont, {:ok, [StarkBank.Boleto.t()]}} | {:error, [StarkBank.Error.t()]} | {:halt, any()} | {:suspend, any()}, any() -> any())
Receive a stream of Boleto structs previously created in the Stark Bank API
Options:
:limit
[integer, default nil]: maximum number of structs to be retrieved. Unlimited if nil. ex: 35:after
[Date | string, default nil]: (optional) date filter for structs created only after specified date. ex: Date(2020, 3, 10):before
[Date | string, default nil]: date filter for structs only before specified date. ex: Date(2020, 3, 10):status
[string, default nil]: filter for status of retrieved structs. ex: "paid" or "registered":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 Boleto structs with updated attributes
Same as query(), but it will unwrap the error tuple and raise in case of errors.