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
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
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
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
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
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
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
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
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
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