Permalink
Browse files

Fixing commit to work with newer versions of active merchant.

  • Loading branch information...
1 parent a37cd00 commit d3e647f3db97bbaf915369a345fbde59af9794c5 @ylansegal committed Mar 8, 2012
Showing with 5 additions and 7 deletions.
  1. +5 −7 lib/authorize_net_cim_gateway_test.rb
@@ -62,16 +62,14 @@ def commit(action, request)
message = response_params['messages']['message']['text']
test_mode = test? || message =~ /Test Mode/
success = response_params['messages']['result_code'] == 'Ok'
-
- response = ActiveMerchant::Billing::Response.new(success, message, response_params,
+ response_params['direct_response'] = parse_direct_response(response_params['direct_response']) if response_params['direct_response']
+ transaction_id = response_params['direct_response']['transaction_id'] if response_params['direct_response']
+ ActiveMerchant::Billing::Response.new(success, message, response_params,
:test => test_mode,
- :authorization => response_params['customer_profile_id'] || (response_params['profile'] ? response_params['profile']['customer_profile_id'] : nil)
+ :authorization => transaction_id || response_params['customer_profile_id'] || (response_params['profile'] ? response_params['profile']['customer_profile_id'] : nil)
)
-
- response.params['direct_response'] = parse_direct_response(response) if response.params['direct_response']
- response
end
-
+
private
def test_credit_card(number = '4242424242424242', options = {})

0 comments on commit d3e647f

Please sign in to comment.