activemerchant/active_merchant

View on GitHub

Showing 999 of 1,496 total issues

Method parse_direct_response has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def parse_direct_response(params)
        delimiter = @options[:delimiter] || ','
        direct_response = { 'raw' => params }
        direct_response_fields = params.split(delimiter)
        direct_response.merge(
Severity: Major
Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb - About 2 hrs to fix

    File vanco.rb has 252 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'nokogiri'
    
    module ActiveMerchant
      module Billing
        class VancoGateway < Gateway
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/vanco.rb - About 2 hrs to fix

      File ixopay.rb has 252 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'nokogiri'
      
      module ActiveMerchant #:nodoc:
        module Billing #:nodoc:
          class IxopayGateway < Gateway
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/ixopay.rb - About 2 hrs to fix

        Method parameters has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def parameters(money, creditcard, options = {})
                params = {
                  # General order parameters
                  StoreID: @options[:login],
                  Passphrase: @options[:password],
        Severity: Major
        Found in lib/active_merchant/billing/gateways/psigate.rb - About 2 hrs to fix

          File cecabank_json.rb has 251 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'active_merchant/billing/gateways/cecabank/cecabank_common'
          
          module ActiveMerchant
            module Billing
              class CecabankJsonGateway < Gateway
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb - About 2 hrs to fix

            Method parse_direct_response_elements has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def parse_direct_response_elements(response, options)
                    params = response[:direct_response]&.tr('"', '')
                    return {} unless params
            
                    parts = params.split(options[:delimiter] || ',')
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 2 hrs to fix

              Method commit has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def commit(method, url, parameters = nil, options = {}, type = false)
                      raw_response = response = nil
                      success = false
                      begin
                        json = parameters ? parameters.to_json : nil
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/worldpay_online_payments.rb - About 1 hr to fix

                Method add_mpi_3ds has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_mpi_3ds(xml, three_d_secure_options)
                        # structure as per https://developer.paypal.com/api/nvp-soap/payflow/3d-secure-mpi/
                        authentication_id = three_d_secure_options[:authentication_id]
                        authentication_status = three_d_secure_options[:authentication_response_status]
                
                
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/payflow.rb - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method add_address_and_customer_info has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_address_and_customer_info(xml, options)
                        billing_address = options[:billing_address] || options[:address]
                        shipping_address = options[:shipping_address]
                        ipv4_address = ipv4?(options[:ip]) ? options[:ip] : nil
                
                
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/realex.rb - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method post_data has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def post_data(params)
                        return nil unless params
                
                        params.map do |key, value|
                          next if value.blank?
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/securion_pay.rb - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method add_profile has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_profile(xml, profile, update = false)
                        xml.tag!('profile') do
                          # Merchant assigned ID for the customer. Up to 20 characters. (optional)
                          xml.tag!('merchantCustomerId', profile[:merchant_customer_id]) if profile[:merchant_customer_id]
                          # Description of the customer. Up to 255 Characters (optional)
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method add_stored_credentials_data has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_stored_credentials_data(post, options)
                        return unless @protocol_version == '4.00'
                        return unless stored_credential = options[:stored_credential]
                
                        initiator = stored_credential[:initiator] == 'cardholder' ? 'CIT' : 'MIT'
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/sage_pay.rb - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method add_address has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_address(post, options)
                        return unless post[:card]&.kind_of?(Hash)
                
                        if address = options[:billing_address]
                          post[:card][:addressLine1] = address[:address1] if address[:address1]
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/securion_pay.rb - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method add_fraud_parameters has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_fraud_parameters(post, options)
                        if @protocol >= 4
                          post[:fraud_remote_addr] = options[:ip] if options[:ip]
                          post[:fraud_http_accept] = options[:fraud_http_accept] if options[:fraud_http_accept]
                          post[:fraud_http_accept_language] = options[:fraud_http_accept_language] if options[:fraud_http_accept_language]
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method add_shipping_address has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_shipping_address(xml, options, root_node = 'shipTo')
                        address = options[:shipping_address] || options[:address]
                        return unless address
                
                        xml.send(root_node) do
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method add_splits has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_splits(post, options)
                        return unless split_data = options[:splits]
                
                        splits = []
                        split_data.each do |split|
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method add_network_tokenization_card has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_network_tokenization_card(post, payment, options)
                        selected_brand = NETWORK_TOKENIZATION_CARD_SOURCE[options[:wallet_type]&.to_s || payment.source.to_s]
                        if selected_brand
                          post[:selectedBrand] = selected_brand
                          post[:additionalData] = {} unless post[:additionalData]
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method add_3ds_2_optional_fields has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_3ds_2_optional_fields(post, options)
                        three_ds = options[:three_ds_2] || {}
                
                        if three_ds.has_key?(:optional)
                          three_ds[:optional].each do |key, value|
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/credorax.rb - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method error_code_from has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def error_code_from(response)
                        error_code = nil
                        if error = response.dig('status_details', 'error')
                          code = error.dig('reason', 'id')
                          standard_error_code = STANDARD_ERROR_CODE_MAPPING[code]
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/decidir.rb - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method add_shipment_address has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_shipment_address(post, options)
                        if (address = options[:shipping_address])
                          post[:address] = {}
                          post[:address][:street1] = address[:address1] if address[:address1]
                          post[:address][:street2] = address[:address2] if address[:address2]
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/conekta.rb - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Severity
                Category
                Status
                Source
                Language