starkbank v0.0.3 StarkBank.Boleto View Source
Groups Boleto related functions
Boleto struct:
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]
Link to this section Summary
Functions
Create Boletos
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 list of Boleto entities
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.
Retrieve a specific Boleto
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.
Retrieve a specific Boleto pdf file
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.
Retrieve Boletos
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
create(user, boletos)
View Sourcecreate(StarkBank.User.Project.t(), [StarkBank.Boleto.t()]) :: {:ok, [StarkBank.Boleto.t()]} | {:error, [StarkBank.Error.t()]}
Create Boletos
Send a list of Boleto structs for creation in the Stark Bank API
Parameters (required):
- user [Project]: Project struct returned from StarkBank.project().
- boletos [list of Boleto structs]: list of Boleto structs to be created in the API
Return:
- list of Boleto structs with updated attributes
create!(user, boletos)
View Sourcecreate!(StarkBank.User.Project.t(), [StarkBank.Boleto.t()]) :: any()
Same as create(), but it will unwrap the error tuple and raise in case of errors.
delete(user, id)
View Sourcedelete(StarkBank.User.Project.t(), binary()) :: {:ok, StarkBank.Boleto.t()} | {:error, [%StarkBank.Error{code: term(), message: term()}]}
Delete list of Boleto entities
Delete a list of Boleto entities previously created in the Stark Bank API
Parameters (required):
- user [Project]: Project struct returned from StarkBank.project().
- id [string]: Boleto unique id. ex: "5656565656565656"
Return:
- deleted Boleto struct with updated attributes
delete!(user, id)
View Sourcedelete!(StarkBank.User.Project.t(), binary()) :: StarkBank.Boleto.t()
Same as delete(), but it will unwrap the error tuple and raise in case of errors.
get(user, id)
View Sourceget(StarkBank.User.Project.t(), binary()) :: {:ok, StarkBank.Boleto.t()} | {:error, [%StarkBank.Error{code: term(), message: term()}]}
Retrieve a specific Boleto
Receive a single Boleto struct previously created in 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:
- Boleto struct with updated attributes
get!(user, id)
View Sourceget!(StarkBank.User.Project.t(), binary()) :: StarkBank.Boleto.t()
Same as get(), but it will unwrap the error tuple and raise in case of errors.
Retrieve a specific Boleto pdf file
Receive a single Boleto pdf file generated in 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:
- Boleto pdf file content
Same as pdf(), but it will unwrap the error tuple and raise in case of errors.
query(user, options \\ [])
View Sourcequery(StarkBank.User.Project.t(), any()) :: ({:cont, {:ok, [StarkBank.Boleto.t()]}} | {:error, [StarkBank.Error.t()]} | {:halt, any()} | {:suspend, any()}, any() -> any())
Retrieve Boletos
Receive a stream of Boleto 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" 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"]
- 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 Boleto structs with updated attributes
Same as query(), but it will unwrap the error tuple and raise in case of errors.