-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the fundingDestination field and fundingSource to authorize call
- Loading branch information
1 parent
b99cdd0
commit 9a46606
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -440,6 +440,25 @@ def test_successful_authorize_with_no_address | |
assert_equal 'Authorised', response.message | ||
end | ||
|
||
def test_successful_authorize_with_fund_source_and_fund_destination | ||
fund_options = { | ||
fund_source: { | ||
additional_data: { fundingSource: 'Debit' }, | ||
first_name: 'Payer', | ||
last_name: 'Name', | ||
billing_address: @us_address, | ||
shopper_email: '[email protected]' | ||
}, | ||
fund_destination: { | ||
additional_data: { walletIdentifier: '12345' } | ||
} | ||
} | ||
|
||
response = @gateway.authorize(@amount, @credit_card, @options.merge!(fund_options)) | ||
assert_success response | ||
assert_equal 'Authorised', response.message | ||
end | ||
|
||
def test_successful_authorize_with_credit_card_no_name | ||
credit_card_no_name = ActiveMerchant::Billing::CreditCard.new({ | ||
number: '4111111111111111', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -661,6 +661,33 @@ def test_risk_data_sent | |
end.respond_with(successful_authorize_response) | ||
end | ||
|
||
def test_fund_source_and_fund_destination_sent | ||
fund_options = { | ||
fund_source: { | ||
additional_data: { fundingSource: 'Debit' }, | ||
first_name: 'Payer', | ||
last_name: 'Name', | ||
billing_address: @us_address, | ||
shopper_email: '[email protected]' | ||
}, | ||
fund_destination: { | ||
additional_data: { walletIdentifier: '12345' } | ||
} | ||
} | ||
|
||
stub_comms do | ||
@gateway.authorize(@amount, @credit_card, @options.merge(fund_options)) | ||
end.check_request do |_endpoint, data, _headers| | ||
fund_source = JSON.parse(data)['fundSource'] | ||
fund_destination = JSON.parse(data)['fundDestination'] | ||
assert_equal '[email protected]', fund_source['shopperEmail'] | ||
assert_equal 'Payer', fund_source['shopperName']['firstName'] | ||
assert_equal 'Name', fund_source['shopperName']['lastName'] | ||
assert_equal 'Debit', fund_source['additionalData']['fundingSource'] | ||
assert_equal '12345', fund_destination['additionalData']['walletIdentifier'] | ||
end.respond_with(successful_authorize_response) | ||
end | ||
|
||
def test_manual_capture_sent | ||
stub_comms do | ||
@gateway.authorize(@amount, @credit_card, @options.merge(manual_capture: 'true')) | ||
|