View Source StarkInfra.IssuingAuthorization (starkinfra v0.0.1)

Groups IssuingAuthorization related functions

Link to this section Summary

Functions

An IssuingAuthorization presents purchase data to be analysed and answered with an approval or a declination.

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

Create a single IssuingAuthorization struct received from IssuingAuthorization at the informed endpoint. If the provided digital signature does not check out with the StarkInfra public key, a starkinfra.error.InvalidSignatureError will be raised.

Helps you respond IssuingAuthorization requests.

Link to this section Types

@type t() :: %StarkInfra.IssuingAuthorization{
  acquirer_id: term(),
  amount: term(),
  card_id: term(),
  card_tags: term(),
  end_to_end_id: term(),
  holder_tags: term(),
  id: term(),
  is_partial_allowed: term(),
  issuer_amount: term(),
  issuer_currency_code: term(),
  merchant_amount: term(),
  merchant_category_code: term(),
  merchant_country_code: term(),
  merchant_currency_code: term(),
  merchant_fee: term(),
  merchant_id: term(),
  merchant_name: term(),
  method_code: term(),
  purpose: term(),
  score: term(),
  tax: term(),
  wallet_id: term()
}

Link to this section Functions

Link to this function

%StarkInfra.IssuingAuthorization{}

View Source (struct)

An IssuingAuthorization presents purchase data to be analysed and answered with an approval or a declination.

attributes-return-only

Attributes (return-only):

- `:end_to_end_id` [string]: central bank's unique transaction ID. ex: "E79457883202101262140HHX553UPqeq"
- `:amount` [integer]: IssuingPurchase value in cents. Minimum = 0. ex: 1234 (= R$ 12.34)
- `:tax` [integer]: IOF amount taxed for international purchases. ex: 1234 (= R$ 12.34)
- `:card_id` [string]: unique id returned when IssuingCard is created. ex: "5656565656565656"
- `:issuer_amount` [integer]: issuer amount. ex: 1234 (= R$ 12.34)
- `:issuer_currency_code` [string]: issuer currency code. ex: "USD"
- `:merchant_amount` [integer]: merchant amount. ex: 1234 (= R$ 12.34)
- `:merchant_currency_code` [string]: merchant currency code. ex: "USD"
- `:merchant_category_code` [string]: merchant category code. ex: "fastFoodRestaurants"
- `:merchant_country_code` [string]: merchant country code. ex: "USA"
- `:acquirer_id` [string]: acquirer ID. ex: "5656565656565656"
- `:merchant_id` [string]: merchant ID. ex: "5656565656565656"
- `:merchant_name` [string]: merchant name. ex: "Google Cloud Platform"
- `:merchant_fee` [integer]: merchant fee charged. ex: 200 (= R$ 2.00)
- `:wallet_id` [string]: virtual wallet ID. ex: "googlePay"
- `:method_code` [string]: method code. ex: "chip", "token", "server", "manual", "magstripe" or "contactless"
- `:score` [float]: internal score calculated for the authenticity of the purchase. Nil in case of insufficient data. ex: 7.6
- `:is_partial_allowed` [bool]: true if the the merchant allows partial purchases. ex: False
- `:purpose` [string]: purchase purpose. ex: "purchase"
- `:card_tags` [list of strings]: tags of the IssuingCard responsible for this purchase. ex: ["travel", "food"]
- `:holder_tags` [list of strings]: tags of the IssuingHolder responsible for this purchase. ex: ["technology", "john snow"]
@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 IssuingAuthorization struct received from IssuingAuthorization at the informed endpoint. 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 IssuingAuthorization struct
Link to this function

response!(status, options \\ [])

View Source

Helps you respond IssuingAuthorization requests.

parameters-required

Parameters (required):

- `:status` [string]: sub-issuer response to the authorization. ex: "accepted" or "denied"

options

Options

- `:amount` [integer, default 0]: amount in cents that was authorized. ex: 1234 (= R$ 12.34)
- `:reason` [string, default ""]: denial reason. ex: "other"
- `:tags` [list of strings, default []]: tags to filter retrieved object. ex: ["tony", "stark"]

return

Return:

- Dumped JSON string that must be returned to us on the IssuingAuthorization request