diff --git a/CHANGELOG b/CHANGELOG index c48e241e172..1bc8f15d3bf 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -12,6 +12,7 @@ * CyberSource: Add merchant_id [almalee24] #4844 * Global Collect: Add agent numeric code and house number field [yunnydang] #4847 * Deepstack: Add Deepstack Gateway [khoinguyendeepstack] #4830 +* Braintree: Additional tests for credit transactions [jcreiff] #4848 == Version 1.134.0 (July 25, 2023) diff --git a/test/remote/gateways/remote_braintree_blue_test.rb b/test/remote/gateways/remote_braintree_blue_test.rb index 3cc5b8cb5c9..9c69d45ffb7 100644 --- a/test/remote/gateways/remote_braintree_blue_test.rb +++ b/test/remote/gateways/remote_braintree_blue_test.rb @@ -927,6 +927,25 @@ def test_successful_credit_with_merchant_account_id assert_equal 'submitted_for_settlement', response.params['braintree_transaction']['status'] end + def test_failed_credit_with_merchant_account_id + assert response = @gateway.credit(@declined_amount, credit_card('4000111111111115'), merchant_account_id: fixtures(:braintree_blue)[:merchant_account_id]) + assert_failure response + assert_equal '2000 Do Not Honor', response.message + assert_equal '2000 : Do Not Honor', response.params['braintree_transaction']['additional_processor_response'] + end + + def test_successful_credit_using_card_token + assert response = @gateway.store(@credit_card) + assert_success response + assert_equal 'OK', response.message + credit_card_token = response.params['credit_card_token'] + + assert response = @gateway.credit(@amount, credit_card_token, { merchant_account_id: fixtures(:braintree_blue)[:merchant_account_id], payment_method_token: true }) + assert_success response, 'You must specify a valid :merchant_account_id key in your fixtures.yml AND get credits enabled in your Sandbox account for this to pass.' + assert_equal '1002 Processed', response.message + assert_equal 'submitted_for_settlement', response.params['braintree_transaction']['status'] + end + def test_successful_authorize_with_merchant_account_id assert response = @gateway.authorize(@amount, @credit_card, merchant_account_id: fixtures(:braintree_blue)[:merchant_account_id]) assert_success response, 'You must specify a valid :merchant_account_id key in your fixtures.yml for this to pass.'