From 9f3e19f070e901dce6493395a0af374710b0ea97 Mon Sep 17 00:00:00 2001 From: codyfauser Date: Fri, 28 Mar 2008 14:58:35 +0000 Subject: [PATCH] Fail hard when attempting to capture without a credit card with NetRegistry git-svn-id: https://activemerchant.googlecode.com/svn/trunk/active_merchant@661 6513ea26-6c20-0410-8a68-89cd7235086d --- CHANGELOG | 1 + lib/active_merchant/billing/gateways/net_registry.rb | 1 + test/unit/gateways/net_registry_test.rb | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index b3693fdb291..5b4ff2c26ce 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ = ActiveMerchant CHANGELOG +* Fail hard when attempting to capture without a credit card with NetRegistry [cody] * Add support for the order fields to the create_customer_profile_transaction in Authorize.net CIM. [Patrick T. Joyce] * Strip invalid characters and limit lengths of Protx customer data [Simon Russell] * Fix empty start or end dates in Protx [Simon Russell] diff --git a/lib/active_merchant/billing/gateways/net_registry.rb b/lib/active_merchant/billing/gateways/net_registry.rb index a076d5534ce..71036e65008 100644 --- a/lib/active_merchant/billing/gateways/net_registry.rb +++ b/lib/active_merchant/billing/gateways/net_registry.rb @@ -72,6 +72,7 @@ def authorize(money, credit_card, options = {}) # described in "Programming for NetRegistry's E-commerce # Gateway." [http://rubyurl.com/hNG] def capture(money, authorization, options = {}) + requires!(options, :credit_card) credit_card = options[:credit_card] params = { diff --git a/test/unit/gateways/net_registry_test.rb b/test/unit/gateways/net_registry_test.rb index 726a7319701..ff13bc8d253 100644 --- a/test/unit/gateways/net_registry_test.rb +++ b/test/unit/gateways/net_registry_test.rb @@ -37,6 +37,12 @@ def test_successful_credit response = @gateway.credit(@amount, '0707161858000000', @options) assert_success response end + + def test_capture_without_credit_card_provided + assert_raise(ArgumentError) do + response = @gateway.capture(@amount, '0707161858000000', @options) + end + end def test_successful_authorization @gateway.stubs(:ssl_post).returns(successful_authorization_response)