Permalink
Browse files

Remove Response#card_data

git-svn-id: https://activemerchant.googlecode.com/svn/trunk/active_merchant@553 6513ea26-6c20-0410-8a68-89cd7235086d
  • Loading branch information...
1 parent 92c2981 commit d2da5d494e3da2cd2332e1a57cae0dab1ea9686a codyfauser committed Jan 12, 2008
View
@@ -1,5 +1,6 @@
= ActiveMerchant CHANGELOG
+* Remove Response#card_data. The application has access to the information anyway [cody]
* Return the last 4 digits of the card number from the Response instead of the masked number [cody]
* Actually use the shipping address in TrustCommerce [cody]
* Update TrustCommerceGateway to support avs and cvv results. Remove test_result_from_cc_number. Automatically fallback to SSL POST if the TCLink library is not available. Add additional customer information to the requests. [cody]
@@ -96,8 +96,7 @@ def commit(action, money, parameters)
:authorization => @response[:transaction_id],
:fraud_review => fraud_review?(@response),
:avs_result => { :code => @response[:avs_result_code] },
- :cvv_result => @response[:card_code],
- :card_number => parameters[:card_num]
+ :cvv_result => @response[:card_code]
)
end
@@ -121,8 +121,7 @@ def commit(action, money, parameters)
:authorization => @response["transactionid"],
:test => test?,
:cvv_result => @response["cvvresponse"],
- :avs_result => { :code => @response["avsresponse"] },
- :card_number => parameters[:ccnumber]
+ :avs_result => { :code => @response["avsresponse"] }
)
end
@@ -172,7 +172,6 @@ def commit(action, parameters)
Response.new(success, message, @response,
:test => test?,
:authorization => @response[:cross_reference],
- :card_number => parameters[:CardNumber],
:cvv_result => CVV_CODE[ @response[:avscv2_response_code].to_s[0, 1] ],
:avs_result => {
:street_match => AVS_STREET_MATCH[ @response[:avscv2_response_code].to_s[2, 1] ],
@@ -235,8 +235,7 @@ def commit(money, creditcard, options = {})
:test => test?,
:authorization => @response[:ordernum],
:avs_result => { :code => @response[:avs].to_s[2,1] },
- :cvv_result => @response[:avs].to_s[3,1],
- :card_number => creditcard && parameters[:creditcard][:cardnumber]
+ :cvv_result => @response[:avs].to_s[3,1]
)
end
@@ -122,8 +122,7 @@ def commit(action, parameters = {})
Response.new(successful_response?(response), message_from(response[:message]), @response,
:test => test?,
- :authorization => authorization_string(response),
- :card_number => parameters[:pan]
+ :authorization => authorization_string(response)
)
end
@@ -324,9 +324,8 @@ def commit(action, parameters)
@response = parse(data)
Response.new(successful?(@response), message_from(@response), @response,
- :test => test?,
- :authorization => @response[:transaction_id] || parameters[:transaction_id],
- :card_number => parameters[:number]
+ :test => test?,
+ :authorization => @response[:transaction_id] || parameters[:transaction_id]
)
end
@@ -197,16 +197,9 @@ def commit(request_body, request_type = nil)
:test => test?,
:authorization => @response[:pn_ref] || @response[:rp_ref],
:cvv_result => CVV_CODE[@response[:cv_result]],
- :avs_result => { :code => @response[:avs_result] },
- :card_number => parse_credit_card_number(request)
+ :avs_result => { :code => @response[:avs_result] }
)
end
-
- def parse_credit_card_number(request)
- xml = REXML::Document.new(request)
- card_number = REXML::XPath.first(xml, '//Tender/Card/CardNum')
- card_number && card_number.text
- end
end
end
end
@@ -303,16 +303,9 @@ def commit(action, request)
:test => test?,
:authorization => @response[:transaction_id] || @response[:authorization_id], # latter one is from reauthorization
:avs_result => { :code => @response[:avs_code] },
- :cvv_result => @response[:cvv2_code],
- :card_number => parse_credit_card_number(request)
+ :cvv_result => @response[:cvv2_code]
)
end
-
- def parse_credit_card_number(request)
- xml = REXML::Document.new(request)
- card_number = REXML::XPath.first(xml, '//n2:CreditCard/n2:CreditCardNumber')
- card_number && card_number.text
- end
end
end
end
@@ -98,8 +98,7 @@ def commit(money, creditcard, options = {})
:test => test?,
:authorization => @response[:orderid],
:avs_result => { :code => @response[:avsresult] },
- :cvv_result => @response[:cardidresult],
- :card_number => parameters[:CardNumber]
+ :cvv_result => @response[:cardidresult]
)
end
@@ -120,8 +120,7 @@ def commit(action, params)
Response.new(success, message, @response,
:test => test?,
- :authorization => @response[:transaction],
- :card_number => params[:cardnumber]
+ :authorization => @response[:transaction]
)
end
@@ -376,8 +376,7 @@ def commit(action, parameters)
:test => test?,
:authorization => data["transid"],
:cvv_result => data["cvv"],
- :avs_result => { :code => data["avs"] },
- :card_number => parameters['cc']
+ :avs_result => { :code => data["avs"] }
)
end
@@ -5,7 +5,7 @@ class Error < ActiveMerchantError #:nodoc:
end
class Response
- attr_reader :params, :message, :test, :authorization, :avs_result, :cvv_result, :card_data
+ attr_reader :params, :message, :test, :authorization, :avs_result, :cvv_result
def success?
@success
@@ -26,15 +26,6 @@ def initialize(success, message, params = {}, options = {})
@fraud_review = options[:fraud_review]
@avs_result = AVSResult.new(options[:avs_result]).to_hash
@cvv_result = CVVResult.new(options[:cvv_result]).to_hash
- @card_data = format_card_data(options[:card_number])
- end
-
- private
- def format_card_data(number)
- {
- 'type' => CreditCard.type?(number),
- 'number' => CreditCard.last_digits(number)
- }
end
end
end
@@ -163,13 +163,6 @@ def test_cvv_result
assert_equal 'M', response.cvv_result['code']
end
- def test_card_data
- @gateway.expects(:ssl_post).returns(fraud_review_response)
-
- response = @gateway.purchase(100, @credit_card)
- assert_equal CreditCard.last_digits(@credit_card.number), response.card_data['number']
- end
-
private
def post_data_fixture
@@ -107,14 +107,7 @@ def test_cvv_result
response = @gateway.purchase(@amount, @credit_card)
assert_equal 'N', response.cvv_result['code']
end
-
- def test_card_data
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
-
- response = @gateway.purchase(@amount, @credit_card)
- assert_equal CreditCard.last_digits(@credit_card.number), response.card_data['number']
- end
-
+
private
def successful_purchase_response
'response=1&responsetext=SUCCESS&authcode=123456&transactionid=510695343&avsresponse=N&cvvresponse=N&orderid=ea1e0d50dcc8cfc6e4b55650c592097e&type=sale&response_code=100'
@@ -61,13 +61,6 @@ def test_cvv_result
assert_equal 'M', response.cvv_result['code']
end
- def test_card_data
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
-
- response = @gateway.purchase(@amount, @credit_card, @options)
- assert_equal CreditCard.last_digits(@credit_card.number), response.card_data['number']
- end
-
def test_supported_countries
assert_equal ['GB'], CardStreamGateway.supported_countries
end
@@ -156,13 +156,6 @@ def test_cvv_result
assert_equal 'M', response.cvv_result['code']
end
- def test_card_data
- @gateway.expects(:ssl_post).returns(successful_authorization_response)
-
- response = @gateway.purchase(@amount, @credit_card, @options)
- assert_equal CreditCard.last_digits(@credit_card.number), response.card_data['number']
- end
-
private
def successful_authorization_response
'<r_csp>CSI</r_csp><r_time>Sun Jan 6 21:41:31 2008</r_time><r_ref>0004486182</r_ref><r_error/><r_ordernum>1000</r_ordernum><r_message>APPROVED</r_message><r_code>1234560004486182:NNNM:100018312899:</r_code><r_tdate>1199680890</r_tdate><r_score/><r_authresponse/><r_approved>APPROVED</r_approved><r_avs>NNNM</r_avs>'
@@ -118,15 +118,7 @@ def test_should_raise_error_if_transaction_param_empty_on_credit_request
end
end
- def test_card_data
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
-
- response = @gateway.purchase(@amount, @credit_card, @options)
- assert_equal CreditCard.last_digits(@credit_card.number), response.card_data['number']
- end
-
- private
-
+ private
def successful_purchase_response
<<-RESPONSE
<?xml version="1.0"?>
@@ -60,13 +60,6 @@ def test_purchase_exception
end
end
- def test_card_data
- @gateway.expects(:ssl_post).returns(successful_authorization_response)
-
- response = @gateway.purchase(100, @credit_card)
- assert_equal CreditCard.last_digits(@credit_card.number), response.card_data['number']
- end
-
private
def successful_authorization_response
<<-RESPONSE
@@ -66,14 +66,6 @@ def test_cvv_result
assert_equal 'M', response.cvv_result['code']
end
-
- def test_card_data
- @gateway.expects(:ssl_post).returns(successful_authorization_response)
-
- response = @gateway.purchase(@amount, @credit_card, @options)
- assert_equal CreditCard.last_digits(@credit_card.number), response.card_data['number']
- end
-
def test_using_test_mode
assert @gateway.test?
end
@@ -220,13 +220,6 @@ def test_cvv_result
response = @gateway.purchase(@amount, @credit_card, @options)
assert_equal 'M', response.cvv_result['code']
end
-
- def test_card_data
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
-
- response = @gateway.purchase(@amount, @credit_card, @options)
- assert_equal CreditCard.last_digits(@credit_card.number), response.card_data['number']
- end
private
def successful_purchase_response
@@ -93,13 +93,6 @@ def test_cvv_result
assert_equal 'M', response.cvv_result['code']
end
- def test_card_data
- @gateway.expects(:ssl_post).returns(successful_authorization_response)
-
- response = @gateway.purchase(@amount, @credit_card, @options)
- assert_equal CreditCard.last_digits(@credit_card.number), response.card_data['number']
- end
-
private
def successful_authorization_response
@@ -93,13 +93,6 @@ def test_supported_card_types
assert_equal [ :dankort, :forbrugsforeningen, :visa, :master, :american_express, :diners_club, :jcb, :maestro ], QuickpayGateway.supported_cardtypes
end
- def test_card_data
- @gateway.expects(:ssl_post).returns(successful_authorization_response)
-
- response = @gateway.authorize(@amount, @credit_card, @options)
- assert_equal CreditCard.last_digits(@credit_card.number), response.card_data['number']
- end
-
private
def error_response
@@ -58,13 +58,6 @@ def test_cvv_result
assert_equal 'P', response.cvv_result['code']
end
- def test_card_data
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
-
- response = @gateway.purchase(@amount, @credit_card)
- assert_equal CreditCard.last_digits(@credit_card.number), response.card_data['number']
- end
-
def test_supported_countries
assert_equal ['US'], TrustCommerceGateway.supported_countries
end
View
@@ -25,22 +25,4 @@ def test_cvv_result
assert_equal 'M', cvv_result['code']
assert_equal CVVResult.messages['M'], cvv_result['message']
end
-
- def test_card_data
- response = Response.new(true, 'message', {}, :card_number => '5105105105105100')
- assert_equal 'master', response.card_data['type']
- assert_equal CreditCard.last_digits('5105105105105100'), response.card_data['number']
- end
-
- def test_empty_card_data
- response = Response.new(true, 'message', {}, :card_number => nil)
- assert_nil response.card_data['type']
- assert_nil response.card_data['number']
- end
-
- def test_blank_card_data
- response = Response.new(true, 'message', {}, :card_number => '')
- assert_nil response.card_data['type']
- assert_nil response.card_data['number']
- end
end

0 comments on commit d2da5d4

Please sign in to comment.