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: Additional tests for credit transactions #4848

Merged
merged 1 commit into from
Aug 9, 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 @@ -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)
Expand Down
19 changes: 19 additions & 0 deletions test/remote/gateways/remote_braintree_blue_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand Down
Loading