activemerchant/active_merchant

View on GitHub

Showing 1,501 of 1,501 total issues

Method add_card_or_token_payment has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def add_card_or_token_payment(xml, card_or_token, options)
        xml.hps :CardData do
          if card_or_token.respond_to?(:number)
            if card_or_token.track_data
              xml.tag!('hps:TrackData', 'method' => 'swipe') do
Severity: Minor
Found in lib/active_merchant/billing/gateways/hps.rb - About 1 hr to fix

    Method add_payment_method_id has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def add_payment_method_id(options)
            return options[:payment_method_id].to_i if options[:payment_method_id]
    
            if options[:debit]
              case options[:card_brand]
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/decidir_plus.rb - About 1 hr to fix

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

            def commit(action, parameters, method = 'POST')
              url = (test? ? test_url : live_url)
              if no_hmac(action)
                request_headers = headers.merge(create_basic(parameters, action))
              else
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/deepstack.rb - About 1 hr to fix

        Method localized_amount has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def localized_amount(money, currency)
                amount = amount(money)
        
                return amount unless non_fractional_currency?(currency) || three_decimal_currency?(currency)
        
        
        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 add_three_ds_fields has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_three_ds_fields(post, three_ds_options)
                three_ds = {}
                three_ds[:version] = three_ds_options[:version] if three_ds_options[:version]
                three_ds[:eci] = three_ds_options[:eci] if three_ds_options[:eci]
                three_ds[:cavv] = three_ds_options[:cavv] if three_ds_options[:cavv]
        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_address has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_address(post, options)
                return unless post[:card]&.kind_of?(Hash)
        
                card_address = {}
                if address = options[:billing_address] || options[:address]
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/quickbooks.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 purchase has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def purchase(money, payment_or_customer_id, options = {})
                if visa_or_mastercard?(options)
                  MultiResponse.run(:use_first_response) do |r|
                    endpoint = customer_id?(payment_or_customer_id) ? ENDPOINTS[:customer_id_sale] : ENDPOINTS[:keyed_sale]
        
        
        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 add_stored_credentials has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_stored_credentials(post, creditcard, options)
                return unless stored_credential = options[:stored_credential]
        
                return if options[:exemption_type].blank? && !(stored_credential[:reason_type] && stored_credential[:initiator])
        
        
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/cecabank/cecabank_json.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 list has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.list
            hosts = Set.new
            invalid_lines = Set.new
        
            Dir['lib/**/*.rb'].each do |file|
        Severity: Minor
        Found in lib/support/outbound_hosts.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 perform_request has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def perform_request(action, post, options, authorization = nil, method = :post)
                begin
                  raw_response = ssl_request(method, url(action, authorization), post.nil? || post.empty? ? nil : post.to_json, headers(action, options))
                  response = parse(raw_response)
                  response['id'] = response['_links']['payment']['href'].split('/')[-1] if action == :capture && response.key?('_links')
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/checkout_v2.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_address has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def build_address(xml, addr)
                if addr[:name]
                  first_name, last_name = split_names(addr[:name])
                  xml.tag! 'firstName', first_name
                  xml.tag! 'lastName', last_name
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/optimal_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_address has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_address(xml, address)
                return if address.nil?
        
                xml.tag! 'CORPTRUSTCENTER_DATA' do
                  xml.tag! 'ADDRESS' do
        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_merchant_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_merchant_data(doc, options = {})
                if options[:affiliate] || options[:campaign] || options[:merchant_grouping_id]
                  doc.merchantData do
                    doc.affiliate(options[:affiliate]) if options[:affiliate]
                    doc.campaign(options[:campaign]) if options[:campaign]
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.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 errors_to_string has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def errors_to_string(root)
                # Get context error messages (can be 0..*)
                errors = []
                REXML::XPath.each(root, '//ERROR') do |error_elem|
                  error = {}
        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 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def commit(action, request)
                url = test? ? test_url : live_url
                xml = ssl_post(url, request, 'Content-Type' => 'text/xml')
        
                response_params = parse(action, xml)
        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_authorization_options has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_authorization_options(post, payment, options)
                initiator = options.dig(:stored_credential, :initiator) == 'cardholder' ? 'customer' : 'merchant'
                authorization_options = {
                  authorizationOptions: {
                    initiator: {
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/cyber_source_rest.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 credit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def credit(money, payment, options = {})
                action = options[:payout] ? 'payout' : 'refundWithData'
                post = init_post(options)
                add_invoice(post, money, options)
                add_payment(post, payment, options, action)
        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_customerdetails has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_customerdetails(xml, creditcard, address, options, shipTo = false)
                xml.tag! 'CustomerDetails' do
                  if address
                    country_code = Country.find(address[:country]).code(:numeric) unless address[:country].blank?
                    xml.tag! 'BillingAddress' do
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/iridium.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 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse(body)
                top = JSON.parse(body)
        
                if result = top.delete('result')
                  result.split('&').inject({}) do |hash, string|
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/payu_in.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 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_address(post, options)
                return unless billing_address = options[:billing_address]
        
                post[:streetaddress] = billing_address[:address1] if billing_address[:address1]
                post[:streetaddress2] = billing_address[:address2] if billing_address[:address2]
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/hi_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

        Severity
        Category
        Status
        Source
        Language