Skip to content

Commit

Permalink
Adyen: add network_transaction_id to store call
Browse files Browse the repository at this point in the history
This makes it possible to pass the networkTxReference field with `store`

CER-91
Unit:
95 tests, 482 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Remote:
124 tests, 443 assertions, 3 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
97.5806% passed

One failing test is related to something that might be an outdated assumption (Adyen doesn’t allow recurring transactions with Cabal). The other two are 3DS2-related. All are failing on master.

Local:
5272 tests, 76166 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
  • Loading branch information
jcreiff committed Aug 3, 2022
1 parent b296ad8 commit 4caf3c5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/adyen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def store(credit_card, options = {})
add_extra_data(post, credit_card, options)
add_stored_credentials(post, credit_card, options)
add_address(post, options)

add_network_transaction_reference(post, options)
options[:recurring_contract_type] ||= 'RECURRING'
add_recurring_contract(post, options)

Expand Down
8 changes: 8 additions & 0 deletions test/remote/gateways/remote_adyen_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,14 @@ def test_successful_tokenize_only_store
assert_equal 'Success', response.message
end

def test_successful_tokenize_only_store_with_ntid
assert response = @gateway.store(@credit_card, @options.merge({ tokenize_only: true, network_transaction_id: '858435661128555' }))

assert_success response
assert !response.authorization.split('#')[2].nil?
assert_equal 'Success', response.message
end

def test_successful_store_with_elo_card
assert response = @gateway.store(@elo_credit_card, @options)

Expand Down
8 changes: 8 additions & 0 deletions test/unit/gateways/adyen_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,14 @@ def test_successful_tokenize_only_store
assert_equal '#8835205392522157#', response.authorization
end

def test_successful_tokenize_only_store_with_ntid
stub_comms do
@gateway.store(@credit_card, @options.merge({ tokenize_only: true, network_transaction_id: '858435661128555' }))
end.check_request do |_endpoint, data, _headers|
assert_equal '858435661128555', JSON.parse(data)['additionalData']['networkTxReference']
end.respond_with(successful_store_response)
end

def test_successful_store
response = stub_comms do
@gateway.store(@credit_card, @options)
Expand Down

0 comments on commit 4caf3c5

Please sign in to comment.