Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adyen: Correctly parse error messages for 3DS2 auths #3619

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -22,6 +22,7 @@
* Worldpay: Fix response for failed refunds when falling back to voids [jasonwebster] #3609
* iATS Payments: Add support for Customer Code payment method [molbrown] #3611
* HPS: Add Google Pay support [MSmedal] #3597
* Adyen: Parse appropriate message for 3DS2 authorization calls [britth] #3619

== Version 1.107.1 (Apr 1, 2020)
* Add `allowed_push_host` to gemspec [mdeloupy]
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/adyen.rb
Expand Up @@ -549,7 +549,7 @@ def success_from(action, response, options)
end

def message_from(action, response)
return authorize_message_from(response) if action.to_s == 'authorise' || action.to_s == 'authorise3d'
return authorize_message_from(response) if %w(authorise authorise3d authorise3ds2).include?(action.to_s)

response['response'] || response['message'] || response['result']
end
Expand Down
29 changes: 29 additions & 0 deletions test/unit/gateways/adyen_test.rb
Expand Up @@ -225,6 +225,15 @@ def test_failed_authorise3d
assert_failure response
end

def test_failed_authorise3ds2
@gateway.expects(:ssl_post).returns(failed_authorize_3ds2_response)

response = @gateway.send(:commit, 'authorise3ds2', {}, {})

assert_equal '3D Not Authenticated', 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 Expand Up @@ -999,6 +1008,26 @@ def failed_authorize_response
RESPONSE
end

def failed_authorize_3ds2_response
<<-RESPONSE
{
"additionalData":
{
"threeds2.threeDS2Result.dsTransID": "1111-abc-234",
"threeds2.threeDS2Result.eci":"07",
"threeds2.threeDS2Result.threeDSServerTransID":"222-cde-321",
"threeds2.threeDS2Result.transStatusReason":"01",
"threeds2.threeDS2Result.messageVersion":"2.1.0",
"threeds2.threeDS2Result.authenticationValue":"ABCDEFG",
"threeds2.threeDS2Result.transStatus":"N"
},
"pspReference":"8514775559925128",
"refusalReason":"3D Not Authenticated",
"resultCode":"Refused"
}
RESPONSE
end

def successful_capture_response
<<-RESPONSE
{
Expand Down