View Source StarkInfra.PixRequest (starkinfra v0.0.1)
Groups PixRequest related functions
Link to this section Summary
Functions
PixRequests are used to receive or send instant payments to accounts hosted in any Pix participant. When you initialize a PixRequest, the entity will not be automatically created in the Stark Infra API. The 'create' function sends the structs to the Stark Infra API and returns the list of created structs.
Same as create(), but it will unwrap the error tuple and raise in case of errors.
Send a list of PixRequest structs for creation in the Stark Infra API
Same as get(), but it will unwrap the error tuple and raise in case of errors.
Receive a single PixRequest struct previously created in the Stark Infra API by its id
Same as page(), but it will unwrap the error tuple and raise in case of errors.
Receive a list of up to 100 PixRequest structs previously created in the Stark Infra API and the cursor to the next page. Use this function instead of query if you want to manually page your requests.
Same as parse(), but it will unwrap the error tuple and raise in case of errors.
Create a single PixRequest struct from a content string received from a handler listening at the request url. If the provided digital signature does not check out with the StarkInfra public key, a starkinfra.error.InvalidSignatureError will be raised.
Same as query(), but it will unwrap the error tuple and raise in case of errors.
Receive a stream of PixRequest structs previously created in the Stark Infra API
Link to this section Types
@type t() :: %StarkInfra.PixRequest{ amount: term(), cash_amount: term(), cashier_bank_code: term(), cashier_type: term(), created: term(), description: term(), end_to_end_id: term(), external_id: term(), fee: term(), flow: term(), id: term(), initiator_tax_id: term(), method: term(), receiver_account_number: term(), receiver_account_type: term(), receiver_bank_code: term(), receiver_branch_code: term(), receiver_key_id: term(), receiver_name: term(), receiver_tax_id: term(), reconciliation_id: term(), sender_account_number: term(), sender_account_type: term(), sender_bank_code: term(), sender_branch_code: term(), sender_name: term(), sender_tax_id: term(), status: term(), tags: term(), updated: term() }
Link to this section Functions
PixRequests are used to receive or send instant payments to accounts hosted in any Pix participant. When you initialize a PixRequest, the entity will not be automatically created in the Stark Infra API. The 'create' function sends the structs to the Stark Infra API and returns the list of created structs.
parameters-required
Parameters (required):
- `:amount` [integer]: amount in cents to be transferred. ex: 11234 (= R$ 112.34)
- `:external_id` [string]: string that must be unique among all your PixRequests. Duplicated external IDs will cause failures. By default, this parameter will block any PixRequests that repeats amount and receiver information on the same date. ex: "my-internal-id-123456"
- `:sender_name` [string]: sender's full name. ex: "Edward Stark"
- `:sender_tax_id` [string]: sender's tax ID (CPF or CNPJ) with or without formatting. ex: "01234567890" or "20.018.183/0001-80"
- `:sender_branch_code` [string]: sender's bank account branch code. Use '-' in case there is a verifier digit. ex: "1357-9"
- `:sender_account_number` [string]: sender's bank account number. Use '-' before the verifier digit. ex: "876543-2"
- `:sender_account_type` [string, default "checking"]: sender's bank account type. ex: "checking", "savings", "salary" or "payment"
- `:receiver_name` [string]: receiver's full name. ex: "Edward Stark"
- `:receiver_tax_id` [string]: receiver's tax ID (CPF or CNPJ) with or without formatting. ex: "01234567890" or "20.018.183/0001-80"
- `:receiver_bank_code` [string]: receiver's bank institution code in Brazil. ex: "20018183"
- `:receiver_account_number` [string]: receiver's bank account number. Use '-' before the verifier digit. ex: "876543-2"
- `:receiver_branch_code` [string]: receiver's bank account branch code. Use '-' in case there is a verifier digit. ex: "1357-9"
- `:receiver_account_type` [string]: receiver's bank account type. ex: "checking", "savings", "salary" or "payment"
- `:end_to_end_id` [string]: central bank's unique transaction ID. ex: "E79457883202101262140HHX553UPqeq"
parameters-optional
Parameters (optional):
- `:receiver_key_id` [string, default nil]: receiver's dict key. ex: "20.018.183/0001-80"
- `:description` [string, default nil]: optional description to override default description to be shown in the bank statement. ex: "Payment for service #1234"
- `:reconciliation_id` [string, default nil]: Reconciliation ID linked to this payment. ex: "b77f5236-7ab9-4487-9f95-66ee6eaf1781"
- `:initiator_tax_id` [string, default nil]: Payment initiator's tax id (CPF/CNPJ). ex: "01234567890" or "20.018.183/0001-80"
- `:cash_amount` [integer, default nil]: Amount to be withdrawal from the cashier in cents. ex: 1000 (= R$ 10.00)
- `:cashier_bank_code` [string, default nil]: Cashier's bank code. ex: "00000000"
- `:cashier_type` [string, default nil]: Cashier's type. ex: [merchant, other, participant]
- `:tags` [list of strings, default nil]: list of strings for reference when searching for PixRequests. ex: ["employees", "monthly"]
- `:method` [string, default nil]: execution method for thr creation of the PIX. ex: "manual", "payerQrcode", "dynamicQrcode".
attributes-return-only
Attributes (return-only):
- `:id` [string]: unique id returned when the PixRequest is created. ex: "5656565656565656"
- `:fee` [integer]: fee charged when PixRequest is paid. ex: 200 (= R$ 2.00)
- `:status` [string]: current PixRequest status. Options: “created”, “processing”, “success”, “failed”
- `:flow` [string]: direction of money flow. ex: "in" or "out"
- `:sender_bank_code` [string]: sender's bank institution code in Brazil. ex: "20018183"
- `:created` [DateTime]: creation datetime for the PixRequest. ex: ~U[2020-03-10 10:30:0:0]
- `:updated` [DateTime]: latest update datetime for the PixRequest. ex: ~U[2020-03-10 10:30:0:0]
@spec create!([t() | map()], [ {:user, StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil} ]) :: any()
Same as create(), but it will unwrap the error tuple and raise in case of errors.
@spec create([t() | map()], [ {:user, StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil} ]) :: {:ok, [t()]} | {:error, [{:error, StarkInfra.Error.t()}]}
Send a list of PixRequest structs for creation in the Stark Infra API
parameters-required
Parameters (required):
- `:requests` [list of PixRequest structs]: list of PixRequest structs to be created in the API
options
Options:
- `:user` [Organization/Project, default nil]: Organization or Project struct returned from StarkInfra.project(). Only necessary if default project or organization has not been set in configs.
return
Return:
- `:list of PixRequest structs with updated attributes
Same as get(), but it will unwrap the error tuple and raise in case of errors.
Receive a single PixRequest struct previously created in the Stark Infra API by its id
parameters-required
Parameters (required):
- `:id` [string]: struct unique id. ex: "5656565656565656"
options
Options:
- `:user` [Organization/Project, default nil]: Organization or Project struct returned from StarkInfra.project(). Only necessary if default project or organization has not been set in configs.
return
Return:
- PixRequest struct with updated attributes
@spec page!( cursor: binary(), limit: integer(), after: Date.t() | binary(), before: Date.t() | binary(), status: [binary()], tags: [binary()], ids: [binary()], end_to_end_ids: [binary()], external_ids: [binary()], user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil ) :: any()
Same as page(), but it will unwrap the error tuple and raise in case of errors.
@spec page( cursor: binary(), limit: integer(), after: Date.t() | binary(), before: Date.t() | binary(), status: [binary()], tags: [binary()], ids: [binary()], end_to_end_ids: [binary()], external_ids: [binary()], user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil ) :: {:ok, {[t()], [{:cursor, binary()}]}} | {:error, [{:error, StarkInfra.Error.t()}]}
Receive a list of up to 100 PixRequest structs previously created in the Stark Infra API and the cursor to the next page. Use this function instead of query if you want to manually page your requests.
options
Options:
- `:cursor` [string, default nil]: cursor returned on the previous page function call
- `:limit` [integer, default 100]: maximum number of structs to be retrieved. Max = 100. ex: 35
- `:after` [Date or string, default nil]: date filter for structs created after a specified date. ex: ~D[2020, 3, 10]
- `:before` [Date or string, default nil]: date filter for structs created before a specified date. ex: ~D[2020, 3, 10]
- `:status` [list of strings, default nil]: filter for status of retrieved structs. Options: “created”, “processing”, “success”, “failed”
- `: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"]
- `:end_to_end_ids` [list of strings, default nil]: central bank's unique transaction IDs. ex: ["E79457883202101262140HHX553UPqeq", "E79457883202101262140HHX553UPxzx"]
- `:external_ids` [list of strings, default nil]: url safe strings that must be unique among all your PixRequests. Duplicated external IDs will cause failures. By default, this parameter will block any PixRequests that repeats amount and receiver information on the same date. ex: ["my-internal-id-123456", "my-internal-id-654321"]
- `:user` [Organization/Project, default nil]: Organization or Project struct returned from StarkInfra.project(). Only necessary if default project or organization has not been set in configs.
## Return:
- list of PixRequest structs with updated attributes
- cursor to retrieve the next page of PixRequest structs
@spec parse!( content: binary(), signature: binary(), cache_pid: PID, user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() ) :: any()
Same as parse(), but it will unwrap the error tuple and raise in case of errors.
@spec parse( content: binary(), signature: binary(), cache_pid: PID, user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() ) :: {:ok, t()} | {:error, [{:error, StarkInfra.Error.t()}]}
Create a single PixRequest struct from a content string received from a handler listening at the request url. If the provided digital signature does not check out with the StarkInfra public key, a starkinfra.error.InvalidSignatureError will be raised.
parameters-required
Parameters (required):
- `:content` [string]: response content from request received at user endpoint (not parsed)
- `:signature` [string]: base-64 digital signature received at response header "Digital-Signature"
options
Options:
- `cache_pid` [PID, default nil]: PID of the process that holds the public key cache, returned on previous parses. If not provided, a new cache process will be generated.
- `:user` [Organization/Project, default nil]: Organization or Project struct returned from StarkInfra.project(). Only necessary if default project or organization has not been set in configs.
return
Return:
- Parsed PixRequest object
@spec query!( limit: integer(), after: Date.t() | binary(), before: Date.t() | binary(), status: [binary()], tags: [binary()], ids: [binary()], end_to_end_ids: [binary()], external_ids: [binary()], user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil ) :: any()
Same as query(), but it will unwrap the error tuple and raise in case of errors.
@spec query( limit: integer(), after: Date.t() | binary(), before: Date.t() | binary(), status: [binary()], tags: [binary()], ids: [binary()], end_to_end_ids: [binary()], external_ids: [binary()], user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil ) :: {:ok, [t()]} | {:error, [{:error, StarkInfra.Error.t()}]}
Receive a stream of PixRequest structs previously created in the Stark Infra API
options
Options:
- `:limit` [integer, default 100]: maximum number of structs to be retrieved. Max = 100. ex: 35
- `:after` [Date or string, default nil]: date filter for structs created after a specified date. ex: ~D[2020, 3, 10]
- `:before` [Date or string, default nil]: date filter for structs created before a specified date. ex: ~D[2020, 3, 10]
- `:status` [list of strings, default nil]: filter for status of retrieved structs. Options: “created”, “processing”, “success”, “failed”
- `: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"]
- `:end_to_end_ids` [list of strings, default nil]: central bank's unique transaction IDs. ex: ["E79457883202101262140HHX553UPqeq", "E79457883202101262140HHX553UPxzx"]
- `:external_ids` [list of strings, default nil]: url safe strings that must be unique among all your PixRequests. Duplicated external IDs will cause failures. By default, this parameter will block any PixRequests that repeats amount and receiver information on the same date. ex: ["my-internal-id-123456", "my-internal-id-654321"]
- `:user` [Organization/Project, default nil]: Organization or Project struct returned from StarkInfra.project(). Only necessary if default project or organization has not been set in configs.
return
Return:
- stream of PixRequest structs with updated attributes