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

Braintree: Add boolean for skip_advanced_fraud_checking #2811

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 @@ -14,6 +14,7 @@
* Braintree: Remove decimal for non-fractional currencies [nfarve] #2806
* Realex: Add documented country support for US and CA [a-salty-strudel] #2810
* Paymentez: Add `tax_percentage` optional parameter [deedeelavinder] #2814
* Braintree: Add `skip_advanced_fraud_checking` optional parameter [deedeelavinder] #2811

== Version 1.78.0 (March 29, 2018)
* Litle: Add store for echecks [nfarve] #2779
Expand Down
7 changes: 6 additions & 1 deletion lib/active_merchant/billing/gateways/braintree_blue.rb
Expand Up @@ -555,9 +555,14 @@ def create_transaction_parameters(money, credit_card_or_vault_id, options)
:options => {
:store_in_vault => options[:store] ? true : false,
:submit_for_settlement => options[:submit_for_settlement],
:hold_in_escrow => options[:hold_in_escrow]
:hold_in_escrow => options[:hold_in_escrow],
}
}

if options[:skip_advanced_fraud_checking]
parameters[:options].merge!({ :skip_advanced_fraud_checking => options[:skip_advanced_fraud_checking] })
end

parameters[:custom_fields] = options[:custom_fields]
parameters[:device_data] = options[:device_data] if options[:device_data]
parameters[:service_fee_amount] = options[:service_fee_amount] if options[:service_fee_amount]
Expand Down
7 changes: 7 additions & 0 deletions test/remote/gateways/remote_braintree_blue_test.rb
Expand Up @@ -279,6 +279,13 @@ def test_successful_purchase_with_phone_from_address
assert_equal '(555)555-5555', transaction["customer_details"]["phone"]
end

def test_successful_purchase_with_skip_advanced_fraud_checking_option
assert response = @gateway.purchase(@amount, @credit_card, @options.merge(skip_advanced_fraud_checking: true))
assert_success response
assert_equal '1000 Approved', response.message
assert_equal 'submitted_for_settlement', response.params["braintree_transaction"]["status"]
end

def test_purchase_with_store_using_random_customer_id
assert response = @gateway.purchase(
@amount, credit_card('5105105105105100'), @options.merge(:store => true)
Expand Down