starkbank v2.6.1 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, BrcodePayments, 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 list of up to 100 PaymentRequest 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 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 section Functions
A PaymentRequest is an indirect request to access a specific cash-out service (such as Transfer, BrcodePayments, 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, BrcodePayments, BoletoPayment, UtilityPayment, TaxPayment, DarfPayment, 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 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
create(payment_requests, options \\ [])
View Sourcecreate([t() | map()], [ {:user, StarkBank.User.Project.t() | StarkBank.User.Organization.t() | nil} ]) :: {:ok, [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
[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 PaymentRequest structs with updated attributes
Same as create(), but it will unwrap the error tuple and raise in case of errors.
page(options \\ [])
View Sourcepage( cursor: binary(), limit: integer(), center_id: binary(), after: Date.t() | binary(), before: Date.t() | binary(), sort: binary(), status: binary(), type: binary(), tags: [binary()], ids: [binary()], user: StarkBank.User.Project.t() | StarkBank.User.Organization.t() ) :: {:ok, {binary(), [t()]}} | {:error, [%StarkBank.Error{code: term(), message: term()}]}
page( cursor: binary(), limit: integer(), center_id: binary(), after: Date.t() | binary(), before: Date.t() | binary(), sort: binary(), status: binary(), type: binary(), tags: [binary()], ids: [binary()], user: StarkBank.User.Project.t() | StarkBank.User.Organization.t() ) :: [t()]
Receive a list of up to 100 PaymentRequest 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
- `:center_id` [string]: target cost center ID. ex: '5656565656565656'
- `: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]
- `: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", "brcode-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` [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 PaymentRequest structs with updated attributes and cursor to retrieve the next page of PaymentRequest objects
Same as page(), but it will unwrap the error tuple and raise in case of errors.
query(options \\ [])
View Sourcequery( limit: integer(), center_id: binary(), after: Date.t() | binary(), before: Date.t() | binary(), sort: binary(), status: binary(), type: 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 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
- `:center_id` [string]: target cost center ID. ex: '5656565656565656'
- `: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]
- `: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", "brcode-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` [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 PaymentRequest structs with updated attributes
query!(options \\ [])
View Sourcequery!( limit: integer(), center_id: binary(), after: Date.t() | binary(), before: Date.t() | binary(), sort: binary(), status: binary(), type: binary(), tags: [binary()], ids: [binary()], user: StarkBank.User.Project.t() | StarkBank.User.Organization.t() ) :: ({:cont, [t()]} | {:halt, any()} | {:suspend, any()}, any() -> any())
Same as query(), but it will unwrap the error tuple and raise in case of errors.