Skip to content

Commit

Permalink
Adyen: Remove raw_error_message
Browse files Browse the repository at this point in the history
Remote
143 tests, 464 assertions, 11 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
92.3077% passed
  • Loading branch information
Alma Malambo committed Aug 28, 2024
1 parent 780a77d commit bbf1738
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Cybersource: Add apple_pay with discover. [DustinHaefele] #5213
* MercadoPago: Add idempotency key field [yunnydang] #5229
* Adyen: Update split refund method [yunnydang] #5218
* Adyen: Remove raw_error_message [almalee24] #5202

== Version 1.137.0 (August 2, 2024)
* Unlock dependency on `rexml` to allow fixing a CVE (#5181).
Expand Down
10 changes: 0 additions & 10 deletions lib/active_merchant/billing/gateways/adyen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -904,23 +904,13 @@ def message_from(action, response, options = {})
end

def authorize_message_from(response, options = {})
return raw_authorize_error_message(response) if options[:raw_error_message]

if response['refusalReason'] && response['additionalData'] && (response['additionalData']['merchantAdviceCode'] || response['additionalData']['refusalReasonRaw'])
"#{response['refusalReason']} | #{response['additionalData']['merchantAdviceCode'] || response['additionalData']['refusalReasonRaw']}"
else
response['refusalReason'] || response['resultCode'] || response['message'] || response['result']
end
end

def raw_authorize_error_message(response)
if response['refusalReason'] && response['additionalData'] && response['additionalData']['refusalReasonRaw']
"#{response['refusalReason']} | #{response['additionalData']['refusalReasonRaw']}"
else
response['refusalReason'] || response['resultCode'] || response['message'] || response['result']
end
end

def authorization_from(action, parameters, response)
return nil if response['pspReference'].nil?

Expand Down
9 changes: 0 additions & 9 deletions test/unit/gateways/adyen_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,6 @@ def test_failed_authorise_mastercard
assert_failure response
end

def test_failed_authorise_mastercard_raw_error_message
@gateway.expects(:ssl_post).returns(failed_authorize_mastercard_response)

response = @gateway.send(:commit, 'authorise', {}, { raw_error_message: true })

assert_equal 'Refused | 01: Refer to card issuer', response.message
assert_failure response
end

def test_successful_capture
@gateway.expects(:ssl_post).returns(successful_capture_response)
response = @gateway.capture(@amount, '7914775043909934')
Expand Down

0 comments on commit bbf1738

Please sign in to comment.