Skip to content

Commit

Permalink
PayTrace: Update MultiResponse for Capture
Browse files Browse the repository at this point in the history
Update MulitResponse for Capture to pass
:use_first_response. This will correctly
populate authorization.
  • Loading branch information
Alma Malambo committed Aug 28, 2024
1 parent 05a4801 commit 04a6cef
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* Adyen: Update split refund method [yunnydang] #5218
* Adyen: Remove raw_error_message [almalee24] #5202
* Elavon: Remove old Stored Credential method [almalee24] #5219
* PayTrace: Update MultiResponse for Capture [almalee24] #5203

== Version 1.137.0 (August 2, 2024)
* Unlock dependency on `rexml` to allow fixing a CVE (#5181).
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/pay_trace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def authorize(money, payment_or_customer_id, options = {})

def capture(money, authorization, options = {})
if visa_or_mastercard?(options)
MultiResponse.run do |r|
MultiResponse.run(:use_first_response) do |r|
r.process { commit(ENDPOINTS[:capture], build_capture_request(money, authorization, options)) }
r.process { commit(ENDPOINTS[:"level_3_#{options[:visa_or_mastercard]}"], send_level_3_data(r, options)) }
end
Expand Down
3 changes: 2 additions & 1 deletion test/remote/gateways/remote_pay_trace_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ def test_successful_authorize_and_capture_with_level_3_data
assert_success capture

transaction_id = auth.authorization
assert_equal "Visa/MasterCard enhanced data was successfully added to Transaction ID #{transaction_id}. 2 line item records were created.", capture.message
assert_equal capture.authorization, transaction_id
assert_equal 'Your transaction was successfully captured.', capture.message
end

def test_failed_authorize
Expand Down

0 comments on commit 04a6cef

Please sign in to comment.