class AuthorizeNet::CIM::Response
The CIM
response class.
Public Class Methods
Constructs a new response object from raw_response in the context of transaction. You don‘t typically construct this object yourself, as AuthorizeNet::CIM::Transaction
will build one for you when it makes the request to the gateway.
AuthorizeNet::XmlResponse::new
# File lib/authorize_net/cim/response.rb, line 11 def initialize(raw_response, transaction) super unless connection_failure? begin @customer_profile_id = node_content_unless_nil(@root.at_css('customerProfileId')) @customer_payment_profile_id = node_content_unless_nil(@root.at_css('customerPaymentProfileId')) @customer_payment_profile_id_list = node_child_content_unless_nil(@root.at_css('customerPaymentProfileIdList')) @customer_shipping_address_id_list = node_child_content_unless_nil(@root.at_css('customerShippingAddressIdList')) @customer_address_id = node_content_unless_nil(@root.at_css('customerAddressId')) @validation_direct_response_list = @root.at_css('validationDirectResponseList') @validation_direct_response = @root.at_css('validationDirectResponse') @direct_response = @root.at_css('directResponse') @customer_profile_id_list = node_child_content_unless_nil(@root.at_css('ids')) @address = @root.at_css('address') @payment_profile = @root.at_css('paymentProfile') @profile = @root.at_css('profile') rescue @raw_response = $! end end end
Public Instance Methods
Returns an Address
built from the entity returned by the gateway. Returns nil otherwise.
# File lib/authorize_net/cim/response.rb, line 102 def address build_entity(@address, Fields::ADDRESS_ENTITY_DESCRIPTION) unless @address.nil? end
Returns an Address
ID if one was returned by the gateway. Returns nil otherwise. Note that this method will return nil if we got back a list of IDs (see address_ids
).
# File lib/authorize_net/cim/response.rb, line 46 def address_id @customer_address_id end
Returns a list of Address
IDs if any were returned by the gateway. Returns nil otherwise.
# File lib/authorize_net/cim/response.rb, line 51 def address_ids @customer_shipping_address_id_list end
Returns the direct response as an AuthorizeNet::AIM::Response
object if a direct response was returned by the gateway. Returns nil otherwise.
# File lib/authorize_net/cim/response.rb, line 87 def direct_response AuthorizeNet::AIM::Response.new(@direct_response.dup, @transaction) unless @direct_response.nil? end
Returns a PaymentProfile
built from the entity returned by the gateway. Returns nil otherwise.
# File lib/authorize_net/cim/response.rb, line 97 def payment_profile build_entity(@payment_profile, Fields::PAYMENT_PROFILE_ENTITY_DESCRIPTION) unless @payment_profile.nil? end
Returns a PaymentProfile
ID if one was returned by the gateway. Returns nil otherwise. Note that this method will return nil if we got back a list of IDs (see payment_profile_ids
).
# File lib/authorize_net/cim/response.rb, line 57 def payment_profile_id @customer_payment_profile_id end
Returns a list of PaymentProfile
IDs if any were returned by the gateway. Returns nil otherwise.
# File lib/authorize_net/cim/response.rb, line 62 def payment_profile_ids @customer_payment_profile_id_list end
Returns a CustomerProfile
built from the entity returned by the gateway. Returns nil otherwise.
# File lib/authorize_net/cim/response.rb, line 92 def profile build_entity(@profile, Fields::PROFILE_ENTITY_DESCRIPTION) unless @profile.nil? end
Returns a CustomerProfile
ID if one was returned by the gateway. Returns nil otherwise. Note that this method will return nil if we got back a list of IDs (see profile_ids
).
# File lib/authorize_net/cim/response.rb, line 35 def profile_id @customer_profile_id end
Returns a list of CustomerProfile
IDs if any were returned by the gateway. Returns nil otherwise.
# File lib/authorize_net/cim/response.rb, line 40 def profile_ids @customer_profile_id_list end
Returns a validation response as an AuthorizeNet::AIM::Response
object if a validation response was returned by the gateway. Returns nil otherwise. Note that this method will return nil if we got back a list of IDs (see validation_responses
).
# File lib/authorize_net/cim/response.rb, line 69 def validation_response AuthorizeNet::AIM::Response.new(@validation_direct_response.dup, @transaction) unless @validation_direct_response.nil? end
Returns a list of validation response as an AuthorizeNet::AIM::Response
objects if a list of validation response was returned by the gateway. Returns nil otherwise.
# File lib/authorize_net/cim/response.rb, line 75 def validation_responses unless @validation_direct_response_list.nil? responses = [] @validation_direct_response_list.element_children.each do |child| responses <<= AuthorizeNet::AIM::Response.new(child.dup, @transaction) unless child.nil? end return responses unless responses.length == 0 end end