activemerchant/active_merchant

View on GitHub

Showing 1,005 of 1,501 total issues

Method add_credit_card_to_customer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def add_credit_card_to_customer(credit_card, options)
        commit do
          parameters = {
            customer_id: options[:customer],
            token: options[:credit_card_token],
Severity: Minor
Found in lib/active_merchant/billing/gateways/braintree_blue.rb - About 1 hr to fix

    Method recurring has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def recurring(money, creditcard, options = {})
            ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
    
            requires!(options, %i[periodicity bimonthly monthly biweekly weekly yearly daily])
    
    
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/trust_commerce.rb - About 1 hr to fix

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

            def add_shipping_address(post, options)
              return unless options[:shipping_address]
      
              address = options[:shipping_address]
      
      
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/forte.rb - About 55 mins 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 interval has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def interval(options)
              if options.include? :periodicity
                requires!(options, [:periodicity, *PERIODICITIES.keys])
                PERIODICITIES[options[:periodicity]]
              elsif options.include? :interval
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_address(post, options)
              if address = options[:billing_address] || options[:address]
                post[:address] = address[:address1].to_s
                post[:company] = address[:company].to_s
                post[:phone]   = address[:phone].to_s
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/metrics_global.rb - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_shipping_address(post, options)
              return unless shipping_address = options[:shipping_address]
      
              post[:shipping_address] = {}
              post[:shipping_address][:name] = shipping_address[:name] if shipping_address[:name]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/pay_trace.rb - About 55 mins 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 refund has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def refund(money, payment, options = {})
              request = build_xml_request do |doc|
                add_authentication(doc)
                add_descriptor(doc, options)
                doc.send(refund_type(payment), transaction_attributes(options)) do
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/litle.rb - About 55 mins 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_card has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_card(action, post, payment_method, options)
              post[:card] = {}
              post[:card][:entryMode] = options[:entry_mode] || 'M' unless DISALLOWED_ENTRY_MODE_ACTIONS.include?(action)
              if payment_method.is_a?(CreditCard)
                post[:card][:expirationDate] = "#{format(payment_method.month, :two_digits)}#{format(payment_method.year, :two_digits)}"
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/shift4.rb - About 55 mins 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_payment_method has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def build_payment_method(payment)
              case payment
              when NetworkTokenizationCreditCard
                {
                  source: 'network-token',
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/plexo.rb - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_address(post, creditcard, options)
              if address = options[:billing_address] || options[:address]
                post[:ci_billaddr1] = address[:address1].to_s
                post[:ci_billaddr2] = address[:address2].to_s unless address[:address2].blank?
                post[:ci_billcity]  = address[:city].to_s
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/sallie_mae.rb - About 55 mins 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 store has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def store(payment_method, options = {})
              request = build_xml_request do |doc|
                add_authentication(doc)
                doc.registerTokenRequest(transaction_attributes(options)) do
                  doc.orderId(truncate(options[:order_id], 24))
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/litle.rb - About 55 mins 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_reference_transaction_request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def build_reference_transaction_request(action, money, options)
              currency_code = options[:currency] || currency(money)
      
              # I am not sure why it's set like this for express gateway
              # but I don't want to break the existing behavior
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/paypal_express.rb - About 55 mins 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_line_items_into_level_three_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_line_items_into_level_three_data(xml, item, data)
              xml.item do
                xml.description item[:description] if item[:description]
                xml.productCode item[:product_code] if item[:product_code]
                xml.commodityCode item[:commodity_code] if item[:commodity_code]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/worldpay.rb - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_address(post, options)
              if address = options[:billing_address] || options[:address]
                post[:address1] = address[:address1].to_s
                post[:address2] = address[:address2].to_s
                post[:city]     = address[:city].to_s
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/payscout.rb - About 55 mins 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 amount_for_verify has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def amount_for_verify(options)
              return 100 unless options[:verify_amount].present?
      
              amount = options[:verify_amount]
              raise ArgumentError.new 'verify_amount value must be an integer' unless amount.is_a?(Integer) && !amount.negative? || amount.is_a?(String) && amount.match?(/^\d+$/) && !amount.to_i.negative?
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 55 mins 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_additional_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_additional_data(post, payment, options)
              post[:additionalData] ||= {}
              post[:additionalData][:overwriteBrand] = normalize(options[:overwrite_brand]) if options[:overwrite_brand]
              post[:additionalData][:customRoutingFlag] = options[:custom_routing_flag] if options[:custom_routing_flag]
              post[:additionalData][:authorisationType] = options[:authorisation_type] if options[:authorisation_type]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/adyen.rb - About 55 mins 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_aft_request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def build_aft_request(money, payment_method, options)
              build_request do |xml|
                xml.submit do
                  xml.order order_tag_attributes(options) do
                    xml.description(options[:description].blank? ? 'Account Funding Transaction' : options[:description])
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/worldpay.rb - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def commit(action, request, *success_criteria, options)
              xml = ssl_post(url, request, headers(options))
              raw = parse(action, xml)
      
              if options[:execute_threed]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/worldpay.rb - About 55 mins 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 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse(body)
              reply = {}
              xml = REXML::Document.new(body)
              if root = REXML::XPath.first(xml, '//soap:Fault') then
                reply = parse_fault(root)
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/eway_managed.rb - About 55 mins 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 create_customer_profile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def create_customer_profile(credit_card, options)
              commit(:cim_store, options) do |xml|
                xml.profile do
                  xml.merchantCustomerId(truncate(options[:merchant_customer_id], 20) || SecureRandom.hex(10))
                  xml.description(truncate(options[:description], 255)) unless empty?(options[:description])
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 55 mins 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