View Source StarkInfra.PixReversal (starkinfra v0.1.0)

Groups PixReversal related functions

Link to this section Summary

Functions

PixReversals are instant payments used to revert PixReversals. You can only revert inbound PixReversals. When you initialize a PixReversal, the entity will not be automatically created in the Stark Infra API. The 'create' function sends the objects to the Stark Infra API and returns the list of created objects.

Same as create(), but it will unwrap the error tuple and raise in case of errors.

Send a list of PixReversal 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 PixReversal 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 PixReversal 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 reversals.

Same as parse(), but it will unwrap the error tuple and raise in case of errors.

Create a single PixReversal 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 PixReversal structs previously created in the Stark Infra API

Link to this section Types

@type t() :: %StarkInfra.PixReversal{
  amount: term(),
  bank_code: term(),
  created: term(),
  end_to_end_id: term(),
  external_id: term(),
  fee: term(),
  flow: term(),
  id: term(),
  reason: term(),
  return_id: term(),
  status: term(),
  tags: term(),
  updated: term()
}

Link to this section Functions

Link to this function

%StarkInfra.PixReversal{}

View Source (struct)

PixReversals are instant payments used to revert PixReversals. You can only revert inbound PixReversals. When you initialize a PixReversal, the entity will not be automatically created in the Stark Infra API. The 'create' function sends the objects to the Stark Infra API and returns the list of created objects.

parameters-required

Parameters (required):

  • :amount [integer]: amount in cents to be reversed from the PixReversal. ex: 1234 (= R$ 12.34)
  • :external_id [string]: string that must be unique among all your PixReversals. Duplicated external IDs will cause failures. By default, this parameter will block any PixReversal that repeats amount and receiver information on the same date. ex: "my-internal-id-123456"
  • :end_to_end_id [string]: central bank's unique transaction ID. ex: "E79457883202101262140HHX553UPqeq"
  • :reason [string]: reason why the PixReversal is being reversed. Options are "bankError", "fraud", "chashierError", "customerRequest"

parameters-optional

Parameters (optional):

  • :tags [list of strings, default nil]: list of strings for reference when searching for PixReversals. ex: ["employees", "monthly"]

attributes-return-only

Attributes (return-only):

  • :id [string]: unique id returned when the PixReversal is created. ex: "5656565656565656".
  • :return_id [string]: central bank's unique reversal transaction ID. ex: "D20018183202202030109X3OoBHG74wo".
  • :bank_code [string]: code of the bank institution in Brazil. ex: "20018183"
  • :fee [string]: fee charged by this PixReversal. ex: 200 (= R$ 2.00)
  • :status [string]: current PixReversal status. ex: "registered" or "paid"
  • :flow [string]: direction of money flow. ex: "in" or "out"
  • :created [DateTime]: creation datetime for the PixReversal. ex: ~U[2020-03-10 10:30:0:0]
  • :updated [DateTime]: latest update datetime for the PixReversal. ex: ~U[2020-03-10 10:30:0:0]
Link to this function

create!(keys, options \\ [])

View Source
@spec create!([t() | map()], [
  {:user, StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil}
]) :: {:ok, [t()]} | {:error, [{:error, StarkInfra.Error.t()}]}

Same as create(), but it will unwrap the error tuple and raise in case of errors.

Link to this function

create(keys, options \\ [])

View Source
@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 PixReversal structs for creation in the Stark Infra API

parameters-required

Parameters (required):

  • :reversals [list of PixReversal objects]: list of PixReversal 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 PixReversal structs with updated attributes

Same as get(), but it will unwrap the error tuple and raise in case of errors.

Receive a single PixReversal 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:

  • PixReversal struct with updated attributes
@spec page!(
  cursor: binary(),
  limit: integer(),
  after: Date.t() | binary(),
  before: Date.t() | binary(),
  status: [binary()],
  tags: [binary()],
  ids: [binary()],
  return_ids: [binary()],
  external_ids: [binary()],
  user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil
) :: {:ok, t()} | {:error, [{:error, StarkInfra.Error.t()}]}

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()],
  return_ids: [binary()],
  external_ids: [binary()],
  user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil
) :: {:ok, t()} | {:error, [{:error, StarkInfra.Error.t()}]}

Receive a list of up to 100 PixReversal 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 reversals.

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 objects. Options: “created”, “processing”, “success”, “failed”
  • :tags [list of strings, default nil]: tags to filter retrieved objects. ex: ["tony", "stark"]
  • :ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
  • :return_ids [list of strings, default nil]: central bank's unique reversal transaction ID. ex: ["D20018183202202030109X3OoBHG74wo", "D20018183202202030109X3OoBHG72rd"].
  • :external_ids [list of strings, default nil]: url safe string that must be unique among all your PixReversals. Duplicated external IDs will cause failures. By default, this parameter will block any PixReversal 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:

  • list of PixReversal structs with updated attributes
  • cursor to retrieve the next page of PixReversal objects
@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 PixReversal 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 PixReversal object
@spec query!(
  limit: integer(),
  after: Date.t() | binary(),
  before: Date.t() | binary(),
  status: [binary()],
  tags: [binary()],
  ids: [binary()],
  return_ids: [binary()],
  external_ids: [binary()],
  user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil
) :: {:ok, t()} | {:error, [{:error, StarkInfra.Error.t()}]}

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()],
  return_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 PixReversal structs previously created in the Stark Infra API

options

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 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 objects. Options: “created”, “processing”, “success”, “failed”
  • :tags [list of strings, default nil]: tags to filter retrieved objects. ex: ["tony", "stark"]
  • :ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ["5656565656565656", "4545454545454545"]
  • :return_ids [list of strings, default nil]: central bank's unique reversal transaction IDs. ex: ["D20018183202202030109X3OoBHG74wo", "D20018183202202030109X3OoBHG72rd"].
  • :external_ids [list of strings, default nil]: url safe strings that must be unique among all your PixReversals. Duplicated external IDs will cause failures. By default, this parameter will block any PixReversal 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 PixReversal structs with updated attributes