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: Set 3DS exemptions via API #3331

Merged

Conversation

britth
Copy link
Contributor

@britth britth commented Sep 4, 2019

There are a few different ways to request exemptions via Adyen.
Users can let Adyen handle compliance by default, they can
configure specific rules using dynamic 3dsecure, or they can set
exemption flags via the API. This PR updates the Adyen gateway to
allow users to set specific exemptions using the sca_exemption
field, used in conjunction with the execute_threed field. Users
can also now set execute_threed to false if they want to bypass
3DS on a transaction.

Remote:
64 tests, 207 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Unit:
39 tests, 188 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

@britth britth requested review from jeremywrowe, nfarve and a team September 5, 2019 16:18
Copy link

@nfarve nfarve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐘

@@ -340,6 +340,10 @@ def add_3ds(post, options)
post[:browserInfo] = { userAgent: options[:user_agent], acceptHeader: options[:accept_header] }
post[:additionalData] = { executeThreeD: 'true' } if options[:execute_threed]
end
if options[:sca_exemption] && !options[:execute_threed].nil?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic has some subtleties that might be worth locking down in the unit test suite. Could we add a couple tests which assert the expected shape of the outgoing request via a check_request block (a la test_update_shopper_statement_and_industry_usage_sent) given various combinations of :sca_exemption and :execute_threed options?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified by using Hash#has_key? eg:

if options.has_key?(:sca_exception) && options.has_key?(:execute_threed)
  ...
end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call 👍 Since from what i've seen, these exemptions are only relevant for 3ds2, moved this snippet of logic up to the conditional related to 3ds2 and added unit tests to check that values are sent as expected

@britth britth force-pushed the adyen-set-3ds-exemptions-via-api branch 2 times, most recently from 9df0c8b to c894331 Compare September 9, 2019 19:14
Copy link
Contributor

@jeremywrowe jeremywrowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

There are a few different ways to request exemptions via Adyen.
Users can let Adyen handle compliance by default, they can
configure specific rules using dynamic 3dsecure, or they can set
exemption flags via the API. This PR updates the Adyen gateway to
allow users to set specific exemptions using the sca_exemption
field, used in conjunction with the execute_threed field. Users
can also now set execute_threed to false if they want to bypass
3DS on a transaction.

Remote:
66 tests, 213 assertions, 2 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
96.9697% passed
(2 failures unrelated, related to standalone 3ds feature)

Unit:
47 tests, 228 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
@britth britth force-pushed the adyen-set-3ds-exemptions-via-api branch from c894331 to fca5cad Compare September 9, 2019 19:44
@britth britth merged commit fca5cad into activemerchant:master Sep 9, 2019
@britth britth deleted the adyen-set-3ds-exemptions-via-api branch October 29, 2019 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants