diff --git a/CHANGELOG b/CHANGELOG index 155bc2f66d3..bbbc58ec63e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,7 +20,6 @@ * IPG: Change credentials inputs to use a combined store and user ID string as the user ID input [kylene-spreedly] #4854 * Braintree Blue: Update the credit card details transaction hash [yunnydang] #4865 * VisaNet Peru: Update generate_purchase_number_stamp [almalee24] #4855 -* Cybersource: Support recurring transactions for NT [aenand] #4840 == Version 1.134.0 (July 25, 2023) * Update required Ruby version [almalee24] #4823 diff --git a/lib/active_merchant/billing/gateways/cyber_source.rb b/lib/active_merchant/billing/gateways/cyber_source.rb index b8670353698..ec015454ddc 100644 --- a/lib/active_merchant/billing/gateways/cyber_source.rb +++ b/lib/active_merchant/billing/gateways/cyber_source.rb @@ -807,34 +807,26 @@ def network_tokenization?(payment_method) payment_method.is_a?(NetworkTokenizationCreditCard) end - def subsequent_nt_auth(options) - return unless options[:stored_credential] || options[:stored_credential_overrides] - - options.dig(:stored_credential_overrides, :subsequent_auth) || options.dig(:stored_credential, :initiator) == 'merchant' - end - def add_auth_network_tokenization(xml, payment_method, options) return unless network_tokenization?(payment_method) - commerce_indicator = 'internet' if subsequent_nt_auth(options) - brand = card_brand(payment_method).to_sym case brand when :visa xml.tag! 'ccAuthService', { 'run' => 'true' } do - xml.tag!('cavv', payment_method.payment_cryptogram) unless commerce_indicator - xml.commerceIndicator commerce_indicator.nil? ? ECI_BRAND_MAPPING[brand] : commerce_indicator - xml.tag!('xid', payment_method.payment_cryptogram) unless commerce_indicator + xml.tag!('cavv', payment_method.payment_cryptogram) + xml.tag!('commerceIndicator', ECI_BRAND_MAPPING[brand]) + xml.tag!('xid', payment_method.payment_cryptogram) xml.tag!('reconciliationID', options[:reconciliation_id]) if options[:reconciliation_id] end when :master xml.tag! 'ucaf' do - xml.tag!('authenticationData', payment_method.payment_cryptogram) unless commerce_indicator + xml.tag!('authenticationData', payment_method.payment_cryptogram) xml.tag!('collectionIndicator', DEFAULT_COLLECTION_INDICATOR) end xml.tag! 'ccAuthService', { 'run' => 'true' } do - xml.commerceIndicator commerce_indicator.nil? ? ECI_BRAND_MAPPING[brand] : commerce_indicator + xml.tag!('commerceIndicator', ECI_BRAND_MAPPING[brand]) xml.tag!('reconciliationID', options[:reconciliation_id]) if options[:reconciliation_id] end when :american_express diff --git a/test/remote/gateways/remote_cyber_source_test.rb b/test/remote/gateways/remote_cyber_source_test.rb index a92a91895c5..40277267975 100644 --- a/test/remote/gateways/remote_cyber_source_test.rb +++ b/test/remote/gateways/remote_cyber_source_test.rb @@ -740,38 +740,6 @@ def test_purchase_with_network_tokenization_with_amex_cc assert_successful_response(auth) end - def test_purchase_with_apple_pay_network_tokenization_visa_subsequent_auth - credit_card = network_tokenization_credit_card('4111111111111111', - brand: 'visa', - eci: '05', - source: :apple_pay, - payment_cryptogram: 'EHuWW9PiBkWvqE5juRwDzAUFBAk=') - @options[:stored_credential] = { - initiator: 'merchant', - reason_type: 'unscheduled', - network_transaction_id: '016150703802094' - } - - assert auth = @gateway.purchase(@amount, credit_card, @options) - assert_successful_response(auth) - end - - def test_purchase_with_apple_pay_network_tokenization_mastercard_subsequent_auth - credit_card = network_tokenization_credit_card('5555555555554444', - brand: 'master', - eci: '05', - source: :apple_pay, - payment_cryptogram: 'EHuWW9PiBkWvqE5juRwDzAUFBAk=') - @options[:stored_credential] = { - initiator: 'merchant', - reason_type: 'unscheduled', - network_transaction_id: '0602MCC603474' - } - - assert auth = @gateway.purchase(@amount, credit_card, @options) - assert_successful_response(auth) - end - def test_successful_authorize_with_mdd_fields (1..20).each { |e| @options["mdd_field_#{e}".to_sym] = "value #{e}" } diff --git a/test/unit/gateways/cyber_source_test.rb b/test/unit/gateways/cyber_source_test.rb index 2e0519cc5e8..55505cc09a8 100644 --- a/test/unit/gateways/cyber_source_test.rb +++ b/test/unit/gateways/cyber_source_test.rb @@ -478,53 +478,6 @@ def test_successful_credit_cart_purchase_single_request_without_ignore_ccv assert_success response end - def test_successful_network_token_purchase_subsequent_auth_visa - @gateway.expects(:ssl_post).with do |_host, request_body| - assert_not_match %r'', request_body - assert_not_match %r'', request_body - assert_match %r'internet', request_body - true - end.returns(successful_purchase_response) - - credit_card = network_tokenization_credit_card('4111111111111111', - brand: 'visa', - transaction_id: '123', - eci: '05', - payment_cryptogram: '111111111100cryptogram') - options = @options.merge({ - stored_credential: { - initiator: 'merchant', - reason_type: 'unscheduled', - network_transaction_id: '016150703802094' - } - }) - assert response = @gateway.purchase(@amount, credit_card, options) - assert_success response - end - - def test_successful_network_token_purchase_subsequent_auth_mastercard - @gateway.expects(:ssl_post).with do |_host, request_body| - assert_not_match %r'', request_body - assert_match %r'internet', request_body - true - end.returns(successful_purchase_response) - - credit_card = network_tokenization_credit_card('5555555555554444', - brand: 'master', - transaction_id: '123', - eci: '05', - payment_cryptogram: '111111111100cryptogram') - options = @options.merge({ - stored_credential: { - initiator: 'merchant', - reason_type: 'unscheduled', - network_transaction_id: '016150703802094' - } - }) - assert response = @gateway.purchase(@amount, credit_card, options) - assert_success response - end - def test_successful_reference_purchase @gateway.stubs(:ssl_post).returns(successful_create_subscription_response, successful_purchase_response)