starkbank v2.6.1 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 list of up to 100 Boleto objects previously created in the Stark Bank API and the cursor to the next page. Use this function instead of query if you want to manually page your requests.
Same as page(), 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(), discounts: term(), district: term(), due: term(), fee: term(), fine: term(), id: term(), interest: term(), line: term(), name: term(), our_number: term(), overdue_limit: term(), receiver_name: term(), receiver_tax_id: term(), state_code: term(), status: term(), street_line_1: term(), street_line_2: term(), tags: term(), tax_id: term(), transaction_ids: 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
Parameters (optional):
:due
[Date or string, default today + 2 days]: Boleto due date in ISO format. ex: 2020-04-30: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 payment after due date. ex: 7 (max: 59):receiver_name
[string]: receiver (Sacador Avalista) full name. ex: "Anthony Edward Stark":receiver_tax_id
[string]: receiver (Sacador Avalista) tax ID (CPF or CNPJ) with or without formatting. ex: "01234567890" or "20.018.183/0001-80":descriptions
[list of maps, default nil]: list of maps with :text (string) and :amount (int, optional) pairs:discounts
[list of maps, default nil]: list of maps with :percentage (float) and :date (Date or string) 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":transaction_ids
[list of strings, default nil]: ledger transaction ids linked to this boleto. ex: ["19827356981273"]: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]:our_number
[string, default nil]: reference number registered at the settlement bank. ex: "10131474"
create(boletos, options \\ [])
View Sourcecreate([t() | map()], [ {:user, StarkBank.User.Project.t() | StarkBank.User.Organization.t() | nil} ]) :: {:ok, [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
[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:
- list of Boleto structs with updated attributes
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
Parameters (required):
id
[string]: Boleto unique id. ex: "5656565656565656"
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:
- deleted Boleto struct
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
Parameters (required):
id
[string]: struct unique id. ex: "5656565656565656"
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:
- Boleto struct with updated attributes
Same as get(), but it will unwrap the error tuple and raise in case of errors.
page(options \\ [])
View Sourcepage( cursor: binary(), limit: integer(), after: Date.t() | binary(), before: Date.t() | binary(), status: binary(), tags: [binary()], ids: [binary()], user: StarkBank.User.Project.t() | StarkBank.User.Organization.t() ) :: {:ok, {binary(), [t()]}} | {:error, [%StarkBank.Error{code: term(), message: term()}]}
Receive a list of up to 100 Boleto objects previously created in the Stark Bank API and the cursor to the next page. Use this function instead of query if you want to manually page your requests.
Options:
:cursor
[string, default nil]: cursor returned on the previous page function call:limit
[integer, default nil]: maximum number of structs to be retrieved. Unlimited if nil. ex: 35:after
[Date or string, default nil]: date filter for structs created only after specified date. ex: ~D[2020-03-25]:before
[Date or string, default nil]: date filter for structs created only before specified date. ex: ~D[2020-03-25]: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
[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:
- stream of Boleto structs with updated attributes
Same as page(), 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:
:layout
[string]: Layout specification. Available options are "default" and "booklet".: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:
- 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() | StarkBank.User.Organization.t() ) :: ({:cont, {:ok, [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 or string, default nil]: date filter for structs created only after specified date. ex: ~D[2020-03-25]:before
[Date or string, default nil]: date filter for structs created only before specified date. ex: ~D[2020-03-25]: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
[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:
- stream of Boleto structs with updated attributes
Same as query(), but it will unwrap the error tuple and raise in case of errors.