diff --git a/lib/active_merchant/billing/gateways/nuvei.rb b/lib/active_merchant/billing/gateways/nuvei.rb index 471efa4ad56..b433aead3f8 100644 --- a/lib/active_merchant/billing/gateways/nuvei.rb +++ b/lib/active_merchant/billing/gateways/nuvei.rb @@ -38,7 +38,7 @@ def authorize(money, payment, options = {}, transaction_type = 'Auth') add_customer_ip(post, options) add_stored_credentials(post, payment, options) post[:userTokenId] = options[:user_token_id] if options[:user_token_id] - + post[:authenticationOnlyType] = options[:authentication_only_type] if options[:authentication_only_type] if options[:execute_threed] execute_3ds_flow(post, money, payment, transaction_type, options) else diff --git a/test/remote/gateways/remote_nuvei_test.rb b/test/remote/gateways/remote_nuvei_test.rb index 739e32a55e8..221247fa9e5 100644 --- a/test/remote/gateways/remote_nuvei_test.rb +++ b/test/remote/gateways/remote_nuvei_test.rb @@ -191,6 +191,12 @@ def test_successful_verify assert_match 'APPROVED', response.message end + def test_successful_verify_with_authentication_only_type + response = @gateway.verify(@credit_card, @options.merge({ authentication_only_type: 'MAINTAINCARD' })) + assert_match 'SUCCESS', response.params['status'] + assert_match 'APPROVED', response.message + end + def test_successful_general_credit credit_response = @gateway.credit(@amount, @credit_card, @options) assert_success credit_response diff --git a/test/unit/gateways/nuvei_test.rb b/test/unit/gateways/nuvei_test.rb index 30862109d16..28a738981dc 100644 --- a/test/unit/gateways/nuvei_test.rb +++ b/test/unit/gateways/nuvei_test.rb @@ -251,6 +251,20 @@ def test_successful_stored_credentials_merchant_recurring end.respond_with(successful_purchase_response) end + def test_successful_verify + @options.merge!(authentication_only_type: 'ACCOUNTVERIFICATION') + stub_comms(@gateway, :ssl_request) do + @gateway.verify(@credit_card, @options) + end.check_request(skip_response: true) do |_method, endpoint, data, _headers| + if /payment/.match?(endpoint) + json_data = JSON.parse(data) + assert_match(/Auth/, json_data['transactionType']) + assert_match(/ACCOUNTVERIFICATION/, json_data['authenticationOnlyType']) + assert_equal '0', json_data['amount'] + end + end + end + private def three_ds_assertions(payment_option_card)