Permalink
Browse files

Merge pull request #243 from howaboutwe/master

Adds support for get_customer_profile_ids to the Authorize.net CIM.
  • Loading branch information...
2 parents 0a6bca9 + bf2624e commit cd1a7025d085230e009480c983eaf1e233c82491 @ntalbott ntalbott committed Feb 28, 2012
@@ -39,6 +39,7 @@ class AuthorizeNetCimGateway < Gateway
:create_customer_payment_profile => 'createCustomerPaymentProfile',
:create_customer_shipping_address => 'createCustomerShippingAddress',
:get_customer_profile => 'getCustomerProfile',
+ :get_customer_profile_ids => 'getCustomerProfileIds',
:get_customer_payment_profile => 'getCustomerPaymentProfile',
:get_customer_shipping_address => 'getCustomerShippingAddress',
:delete_customer_profile => 'deleteCustomerProfile',
@@ -222,6 +223,11 @@ def get_customer_profile(options)
commit(:get_customer_profile, request)
end
+ def get_customer_profile_ids(options = {})
+ request = build_request(:get_customer_profile_ids, options)
+ commit(:get_customer_profile_ids, request)
+ end
+
# Retrieve a customer payment profile for an existing customer profile.
#
# Returns a Response whose params hash contains all the payment profile information. Sensitive information such as credit card
@@ -540,6 +546,10 @@ def build_get_customer_profile_request(xml, options)
xml.target!
end
+ def build_get_customer_profile_ids_request(xml, options)
+ xml.target!
+ end
+
def build_get_customer_payment_profile_request(xml, options)
xml.tag!('customerProfileId', options[:customer_profile_id])
xml.tag!('customerPaymentProfileId', options[:customer_payment_profile_id])
@@ -297,6 +297,14 @@ def test_should_get_customer_profile_request
assert_equal @customer_profile_id, response.authorization
end
+ def test_should_get_customer_profile_ids_request
+ @gateway.expects(:ssl_post).returns(successful_get_customer_profile_ids_response)
+
+ assert response = @gateway.get_customer_profile_ids
+ assert_instance_of Response, response
+ assert_success response
+ end
+
def test_should_get_customer_profile_request_with_multiple_payment_profiles
@gateway.expects(:ssl_post).returns(successful_get_customer_profile_response_with_multiple_payment_profiles)
@@ -727,6 +735,27 @@ def successful_get_customer_profile_response
XML
end
+ def successful_get_customer_profile_ids_response
+ <<-XML
+ <?xml version="1.0" encoding="utf-8"?>
+ <getCustomerProfileIdsResponse xmlns="AnetApi/xml/v1/schema/
+ AnetApiSchema.xsd">
+ <messages>
+ <resultCode>Ok</resultCode>
+ <message>
+ <code>I00001</code>
+ <text>Successful.</text>
+ </message>
+ </messages>
+ <ids>
+ <numericString>10000</numericString>
+ <numericString>10001</numericString>
+ <numericString>10002</numericString>
+ </ids>
+ </getCustomerProfileIdsResponse>
+ XML
+ end
+
def successful_get_customer_profile_response_with_multiple_payment_profiles
<<-XML
<?xml version="1.0" encoding="utf-8"?>

0 comments on commit cd1a702

Please sign in to comment.