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

Rapyd: add force_3ds_secure flag #4927

Merged
merged 1 commit into from
Oct 23, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
* Rapyd: Update recurrence_type field [yunnydang] #4922
* Element: Add lodging fields [yunnydang] #4813
* SafeCharge: Update sg_CreditType field on the credit method [yunnydang] #4918
* Rapyd: add force_3ds_secure flag [Heavyblade] #4927

== Version 1.135.0 (August 24, 2023)
* PaymentExpress: Correct endpoints [steveh] #4827
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/rapyd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def add_tokens(post, payment, options)

def add_3ds(post, payment, options)
if options[:execute_threed] == true
post[:payment_method_options] = { '3d_required' => true }
post[:payment_method_options] = { '3d_required' => true } if options[:force_3d_secure].present?
elsif three_d_secure = options[:three_d_secure]
post[:payment_method_options] = {}
post[:payment_method_options]['3d_required'] = three_d_secure[:required]
Expand Down
14 changes: 13 additions & 1 deletion test/unit/gateways/rapyd_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def test_success_purchase_with_recurrence_type
end.respond_with(successful_purchase_response)
end

def test_successful_purchase_with_3ds_gateway_specific
def test_successful_purchase_with_3ds_global
@options[:three_d_secure] = {
required: true,
version: '2.1.0'
Expand All @@ -173,6 +173,18 @@ def test_successful_purchase_with_3ds_gateway_specific
end.respond_with(successful_purchase_response)
end

def test_successful_purchase_with_3ds_gateway_specific
@options.merge!(execute_threed: true, force_3d_secure: true)

stub_comms(@gateway, :ssl_request) do
@gateway.purchase(@amount, @credit_card, @options)
end.check_request do |_method, _endpoint, data, _headers|
request = JSON.parse(data)
assert_equal request['payment_method_options']['3d_required'], true
assert_nil request['payment_method_options']['3d_version']
end.respond_with(successful_purchase_response)
end

def test_failed_purchase
@gateway.expects(:ssl_request).returns(failed_purchase_response)

Expand Down