Class: AuthorizeNet::KeyValueResponse
- Defined in:
- lib/authorize_net/key_value_response.rb
Overview
The core, key/value response class. You shouldn’t instantiate this one. Instead you should use AuthorizeNet::AIM::Response or AuthorizeNet::SIM::Response.
Direct Known Subclasses
Defined Under Namespace
Modules: AVSResponseCode, CAVVResponseCode, CCVResponseCode, CardType, ResponseCode
Constant Summary
Constants included from TypeConversions
TypeConversions::API_FIELD_PREFIX
Instance Attribute Summary collapse
-
#custom_fields ⇒ Object
readonly
Returns all the custom fields returned in the response, keyed by their field name.
-
#fields ⇒ Object
readonly
Returns all the fields returned in the response, keyed by their API name.
Instance Method Summary collapse
-
#approved? ⇒ Boolean
Check to see if the transaction was approved.
-
#declined? ⇒ Boolean
Check to see if the transaction was declined.
-
#error? ⇒ Boolean
Check to see if the transaction was returned with an error.
-
#held? ⇒ Boolean
Check to see if the transaction was held for review by Authorize.Net.
-
#response_code ⇒ Object
Returns the response code received from the gateway.
-
#response_reason_code ⇒ Object
Returns the response reason code received from the gateway.
-
#response_reason_text ⇒ Object
Returns the response reason text received from the gateway.
Methods inherited from Response
Methods included from TypeConversions
#boolean_to_value, #date_to_value, #datetime_to_value, #decimal_to_value, #integer_to_value, #to_external_field, #to_internal_field, #to_param, #value_to_boolean, #value_to_date, #value_to_datetime, #value_to_decimal, #value_to_integer
Constructor Details
This class inherits a constructor from AuthorizeNet::Response
Instance Attribute Details
#custom_fields ⇒ Object (readonly)
Returns all the custom fields returned in the response, keyed by their field name.
107 108 109 |
# File 'lib/authorize_net/key_value_response.rb', line 107 def custom_fields @custom_fields end |
#fields ⇒ Object (readonly)
Returns all the fields returned in the response, keyed by their API name. Custom fields are NOT included (see custom_fields).
104 105 106 |
# File 'lib/authorize_net/key_value_response.rb', line 104 def fields @fields end |
Instance Method Details
#approved? ⇒ Boolean
Check to see if the transaction was approved.
64 65 66 |
# File 'lib/authorize_net/key_value_response.rb', line 64 def approved? @fields[:response_code] == ResponseCode::APPROVED end |
#declined? ⇒ Boolean
Check to see if the transaction was declined.
69 70 71 |
# File 'lib/authorize_net/key_value_response.rb', line 69 def declined? @fields[:response_code] == ResponseCode::DECLINED end |
#error? ⇒ Boolean
Check to see if the transaction was returned with an error.
74 75 76 |
# File 'lib/authorize_net/key_value_response.rb', line 74 def error? @fields[:response_code] == ResponseCode::ERROR end |
#held? ⇒ Boolean
Check to see if the transaction was held for review by Authorize.Net.
79 80 81 |
# File 'lib/authorize_net/key_value_response.rb', line 79 def held? @fields[:response_code] == ResponseCode::HELD end |
#response_code ⇒ Object
Returns the response code received from the gateway. Note: its better to use success?, approved?, etc. to check the response code.
85 86 87 |
# File 'lib/authorize_net/key_value_response.rb', line 85 def response_code @fields[:response_code] end |
#response_reason_code ⇒ Object
Returns the response reason code received from the gateway. This code can be used to identify why something failed by referencing the AIM documentation.
91 92 93 |
# File 'lib/authorize_net/key_value_response.rb', line 91 def response_reason_code @fields[:response_reason_code] end |
#response_reason_text ⇒ Object
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.
98 99 100 |
# File 'lib/authorize_net/key_value_response.rb', line 98 def response_reason_text @fields[:response_reason_text] end |