diff --git a/lib/active_merchant/billing/gateways/worldpay.rb b/lib/active_merchant/billing/gateways/worldpay.rb index 020c8ca9ffa..4171469544e 100644 --- a/lib/active_merchant/billing/gateways/worldpay.rb +++ b/lib/active_merchant/billing/gateways/worldpay.rb @@ -699,7 +699,7 @@ def add_stored_credential_using_normalized_fields(xml, options) stored_credential_params = generate_stored_credential_params(is_initial_transaction, reason) xml.storedCredentials stored_credential_params do - xml.schemeTransactionIdentifier network_transaction_id(options) if network_transaction_id(options) && !is_initial_transaction + xml.schemeTransactionIdentifier options[:stored_credential][:network_transaction_id] if options[:stored_credential][:network_transaction_id] && !is_initial_transaction end end diff --git a/test/unit/gateways/worldpay_test.rb b/test/unit/gateways/worldpay_test.rb index 19e3d7f4c1f..53c20f25e9e 100644 --- a/test/unit/gateways/worldpay_test.rb +++ b/test/unit/gateways/worldpay_test.rb @@ -315,22 +315,6 @@ def test_authorize_passes_ip_and_session_id assert_success response end - def test_authorize_prefers_non_normal_ntid - stored_credential_params = stored_credential(:used, :recurring, :merchant, network_transaction_id: '3812908490218390214124') - options = @options.merge( - stored_credential_transaction_id: '000000000000020005060720116005060' - ) - - options.merge!({ stored_credential: stored_credential_params }) - response = stub_comms do - @gateway.authorize(@amount, @credit_card, options) - end.check_request do |_endpoint, data, _headers| - assert_match(//, data) - assert_match(/000000000000020005060720116005060\<\/schemeTransactionIdentifier\>/, data) - end.respond_with(successful_authorize_response) - assert_success response - end - def test_authorize_passes_stored_credential_options options = @options.merge( stored_credential_usage: 'USED',