Skip to content

Commit

Permalink
parse card_type from authorize.net response
Browse files Browse the repository at this point in the history
  • Loading branch information
dingels35 committed May 30, 2019
1 parent b69fcad commit 55977ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/active_merchant/billing/gateways/authorize_net.rb
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,10 @@ def parse_normal(action, body)
(empty?(element.content) ? nil : element.content[-4..-1])
end

response[:card_type] = if(element = doc.at_xpath('//accountType'))
(empty?(element.content) ? nil : element.content)
end

response[:test_request] = if(element = doc.at_xpath('//testRequest'))
(empty?(element.content) ? nil : element.content)
end
Expand Down
1 change: 1 addition & 0 deletions test/remote/gateways/remote_authorize_net_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ def test_bad_login
authorization_code
avs_result_code
card_code
card_type
cardholder_authentication_code
full_response_code
response_code
Expand Down
2 changes: 2 additions & 0 deletions test/unit/gateways/authorize_net_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ def test_successful_authorization
assert_equal 'M', response.cvv_result['code']
assert_equal 'CVV matches', response.cvv_result['message']
assert_equal 'I00001', response.params['full_response_code']
assert_equal '0015', response.params['account_number']
assert_equal 'MasterCard', response.params['card_type']

assert_equal '508141794', response.authorization.split('#')[0]
assert response.test?
Expand Down

0 comments on commit 55977ad

Please sign in to comment.