activemerchant/active_merchant

View on GitHub

Showing 999 of 1,496 total issues

Method add_d3d has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def add_d3d(post, options)
        add_pair post, 'FLAG3D', 'Y'
        win_3ds = THREE_D_SECURE_DISPLAY_WAYS.key?(options[:win_3ds]) ?
          THREE_D_SECURE_DISPLAY_WAYS[options[:win_3ds]] :
          THREE_D_SECURE_DISPLAY_WAYS[:main_window]
Severity: Minor
Found in lib/active_merchant/billing/gateways/ogone.rb - About 1 hr to fix

    Method error_code_from has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def error_code_from(response)
            unless success_from(response)
              case response['errorCode']
              when '3002' then STANDARD_ERROR_CODE[:invalid_number] # You submitted an invalid card number or brand or combination of card number and brand with your request.
              when '3004' then STANDARD_ERROR_CODE[:incorrect_zip] # The zip/postal code must be provided for an AVS check request.
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/netbanx.rb - About 1 hr to fix

      Method add_address has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def add_address(xml, creditcard, options)
              return unless creditcard
      
              if address = options[:billing_address] || options[:address]
                xml.tag!('CUSTOMER_BILL') do
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/secure_net.rb - About 1 hr to fix

        Method add_customer_data has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def add_customer_data(post, options)
                post[:email] = options[:email]
                post[:ipaddress] = options[:ip]
                post[:customer_id] = options[:customer_id] || options[:customer]
        
        
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/nmi.rb - About 1 hr to fix

          Method add_settings has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def add_settings(xml, source, options)
                  xml.transactionSettings do
                    if options[:recurring] || subsequent_recurring_transaction?(options)
                      xml.setting do
                        xml.settingName('recurringBilling')
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 1 hr to fix

            Method add_transaction has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def add_transaction(xml, transaction)
                    raise StandardError, "Invalid Customer Information Manager Transaction Type: #{transaction[:type]}" unless CIM_TRANSACTION_TYPES.include?(transaction[:type])
            
                    xml.tag!('transaction') do
                      xml.tag!(CIM_TRANSACTION_TYPES[transaction[:type]]) do
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb - About 1 hr to fix

              Method verify has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def verify(creditcard, options = {})
                      if options[:allow_card_verification] == true
                        options.delete(:allow_card_verification)
                        exp_month = creditcard.month.to_s
                        exp_year = creditcard.year.to_s
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/braintree_blue.rb - About 1 hr to fix

                Method add_level_3_data has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_level_3_data(post, options)
                        post[:invoice_id] = options[:invoice_id] if options[:invoice_id]
                        post[:customer_reference_id] = options[:customer_reference_id] if options[:customer_reference_id]
                        post[:tax_amount] = options[:tax_amount].to_i if options[:tax_amount]
                        post[:national_tax_amount] = options[:national_tax_amount].to_i if options[:national_tax_amount]
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/pay_trace.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 requires! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def requires!(hash, *params)
                        params.each do |param|
                          if param.is_a?(Array)
                            raise ArgumentError.new("Missing required parameter: #{param.first}") unless hash.has_key?(param.first)
                
                
                Severity: Minor
                Found in lib/active_merchant/billing/gateway.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 commit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def commit(action, parameters)
                        parameters[:request] = action
                
                        url = (test? ? test_url : live_url)
                        payload = parameters.to_json unless parameters.nil?
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/payway_dot_com.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 test_gateways has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  def test_gateways(min_version = :TLS1_1)
                    raise 'Requires Ruby 2.5 or better' unless Net::HTTP.instance_methods.include?(:min_version=)
                
                    puts "Verifying #{@gateways.count} gateways for SSL min_version=#{min_version}\n\n"
                
                
                Severity: Minor
                Found in lib/support/ssl_version.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 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_address(tag, post, options)
                        return unless address_options = options[:shipping_address]
                
                        address = {}
                        address[:name] = address_options[:name] if address_options[:name]
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/simetrik.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_transaction_data has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_transaction_data(xml, money, options)
                        options[:order_id] ||= generate_unique_id
                
                        xml.tag! "FNC_CC_#{options[:action].to_s.upcase}" do
                          xml.tag! 'FunctionID', clean_description(options[:description])
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/wirecard.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_credit_card has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_credit_card(xml, credit_card, action)
                        xml.tag! 'Account' do
                          if credit_card.track_data.present?
                            # Track 1 has a start sentinel (STX) of '%' and track 2 is ';'
                            # Track 1 and 2 have identical end sentinels (ETX) of '?'
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/mercury.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 parse_response has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def parse_response(response, root)
                        status = nil
                
                        root.elements.to_a.each do |node|
                          status = REXML::XPath.first(node, 'CC_TRANSACTION/PROCESSING_STATUS') if node.name =~ /FNC_CC_/
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/wirecard.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 commit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def commit(action, parameters)
                        if action == 'void'
                          commit_raw(action, parameters)
                        else
                          MultiResponse.run(true) do |r|
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/ct_payment.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 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_network_tokenization_card(xml, payment_method, options)
                        source = payment_method.respond_to?(:source) ? payment_method.source : options[:wallet_type]
                        token_type = NETWORK_TOKEN_TYPE.fetch(source, 'NETWORKTOKEN')
                
                        xml.paymentDetails do
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/worldpay.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 commit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def commit(action, money, parameters)
                        case action
                        when 'sale'
                          begin
                            response = call_api(TRANSACTION_API, parameters)
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/swipe_checkout.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 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def add_shipping_address(post, options)
                        return unless shipping = options[:shipping_address]
                
                        shipping_address = {}
                        address = {}
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/commerce_hub.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 build_sale_or_authorization_request has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def build_sale_or_authorization_request(action, money, credit_card_or_referenced_id, options)
                        transaction_type = define_transaction_type(credit_card_or_referenced_id)
                        reference_id = credit_card_or_referenced_id if transaction_type == 'DoReferenceTransaction'
                
                        billing_address = options[:billing_address] || options[:address]
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/paypal.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