class AuthorizeNet::KeyValueResponse

The core, key/value response class. You shouldn’t instantiate this one. Instead you should use AuthorizeNet::AIM::Response or AuthorizeNet::SIM::Response.

Public Instance Methods

approved?() click to toggle source

Check to see if the transaction was approved.

# File lib/authorize_net/key_value_response.rb, line 66
def approved?
  @fields[:response_code] == ResponseCode::APPROVED
end
custom_fields() click to toggle source

Returns all the custom fields returned in the response, keyed by their field name.

# File lib/authorize_net/key_value_response.rb, line 111
def custom_fields
  @custom_fields
end
declined?() click to toggle source

Check to see if the transaction was declined.

# File lib/authorize_net/key_value_response.rb, line 71
def declined?
  @fields[:response_code] == ResponseCode::DECLINED
end
error?() click to toggle source

Check to see if the transaction was returned with an error.

# File lib/authorize_net/key_value_response.rb, line 76
def error?
  @fields[:response_code] == ResponseCode::ERROR
end
fields() click to toggle source

Returns all the fields returned in the response, keyed by their API name. Custom fields are NOT included (see custom_fields).

# File lib/authorize_net/key_value_response.rb, line 106
def fields
  @fields
end
held?() click to toggle source

Check to see if the transaction was held for review by Authorize.Net.

# File lib/authorize_net/key_value_response.rb, line 81
def held?
  @fields[:response_code] == ResponseCode::HELD
end
response_code() click to toggle source

Returns the response code received from the gateway. Note: its better to use success?, approved?, etc. to check the response code.

# File lib/authorize_net/key_value_response.rb, line 87
def response_code
  @fields[:response_code]
end
response_reason_code() click to toggle source

Returns the response reason code received from the gateway. This code can be used to identify why something failed by referencing the AIM documentation.

# File lib/authorize_net/key_value_response.rb, line 93
def response_reason_code
  @fields[:response_reason_code]
end
response_reason_text() click to toggle source

Returns the response reason text received from the gateway. This is a brief, human readable explanation of why you got the response code that you got. Note that these strings tend to be a bit vague. More detail can be gleaned from the response_reason_code.

# File lib/authorize_net/key_value_response.rb, line 100
def response_reason_text
  @fields[:response_reason_text]
end