View Source Gringotts.Response (gringotts v1.1.1)

Defines the Response struct and some utilities.

All Gringotts public API calls will return a Response.t wrapped in an :ok or :error tuple. It is guaranteed that an :ok will be returned only when the request succeeds at the gateway, ie, no error occurs.

Link to this section Summary

Types

t()

The standard Response from Gringotts.

Link to this section Types

@type t() :: %Gringotts.Response{
  avs_result: %{street: String.t(), zip_code: String.t()},
  cvc_result: String.t(),
  fraud_review: term(),
  gateway_code: String.t(),
  id: String.t(),
  message: String.t(),
  raw: String.t(),
  reason: String.t(),
  status_code: non_neg_integer(),
  success: boolean(),
  token: String.t()
}

The standard Response from Gringotts.

FieldTypeDescription
successbooleanIndicates the status of the transaction.
idString.tGateway supplied identifier of the transaction.
tokenString.tGateway supplied token. This is different from Response.id.
status_codenon_neg_integerHTTP response code.
gateway_codeString.tGateway's response code "as-is".
messageString.tString describing the response status.
avs_resultmapAddress Verification Result. Schema: %{street: String.t, zip_code: String.t}
cvc_resultString.tResult of the CVC validation.
reasonString.tExplain the reason of error, in case of error. nil otherwise.
rawString.tRaw response from the gateway.
fraud_reviewtermGateway's risk assessment of the transaction.

notes

Notes

  1. It is not guaranteed that all fields will be populated for all calls, and some gateways might insert non-standard fields. Please refer the Gateways' docs for that information.

  2. success is deprecated in v1.1.0 and will be removed in v1.2.0.

  3. For some actions the Gateway returns an additional token, say as reponse to a customer tokenization/registration. In such cases the id is not useable because it refers to the transaction, the token is.

On the other hand for authorizations or captures, there's no token.

  1. The schema of fraud_review is Gateway specific.

Link to this section Functions