activemerchant/active_merchant

View on GitHub

Showing 999 of 1,496 total issues

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

      def add_customer_data(xml, payment_source, options)
        billing_address = options[:billing_address] || options[:address]
        shipping_address = options[:shipping_address] || options[:address]

        xml.CustomerData {
Severity: Minor
Found in lib/active_merchant/billing/gateways/itransact.rb - About 1 hr to fix

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

          def commit(action, post)
            post[:MerchantId] = @options[:merchant_id]
            post[:Password] = @options[:password]
            post[:UserId] = @options[:user_id]
            post[:TransactionType] = action
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/cenpos.rb - About 1 hr to fix

      Method ensure_credentials has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def ensure_credentials(try_again = true)
              multiresp = MultiResponse.new
              access_token = @options[:access_token]
              key = @options[:encryption_key]
              uuid = @options[:encryption_uuid]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/alelo.rb - About 1 hr to fix

        Method build_customer_request_xml has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def build_customer_request_xml(credit_card, options = {})
                ActiveMerchant.deprecated 'Customer Profile support in Orbital is non-conformant to the ActiveMerchant API and will be removed in its current form in a future version. Please contact the ActiveMerchant maintainers if you have an interest in modifying it to conform to the store/unstore/update API.'
                xml = xml_envelope
                xml.tag! :Request do
                  xml.tag! :Profile do
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/orbital.rb - About 1 hr to fix

          Method configure_ssl has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def configure_ssl(http)
                return unless endpoint.scheme == 'https'
          
                http.use_ssl = true
                http.ssl_version = ssl_version if ssl_version
          Severity: Minor
          Found in lib/active_merchant/connection.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 success_from has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def success_from(action, response)
                  return response['status'] == 'Pending' if action == :credit
                  return true if action == :unstore && response == 204
          
                  store_response = response['token'] || response['id']
          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 retry_network_exceptions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def retry_network_exceptions(options = {})
                initial_retries = options[:max_retries] || DEFAULT_RETRIES
                retries = initial_retries
                request_start = nil
          
          
          Severity: Minor
          Found in lib/active_merchant/network_connection_retries.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 prepare_address_for_non_american_countries has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def prepare_address_for_non_american_countries(options)
                  [options[:billing_address], options[:shipping_address]].compact.each do |address|
                    next if empty?(address[:country])
          
                    unless %w[US CA].include?(address[:country])
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/beanstream/beanstream_core.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 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_address(post, payment, options)
                  post[:cardAccount] ||= {}
                  address = options[:billing_address] || options[:address] || {}
                  first_name, last_name = split_names(address[:name])
                  full_address = "#{address[:address1]} #{address[:address2]}".strip
          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 add_forward_payload has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_forward_payload(post, money, payment, options)
                  forward_payload = {}
                  add_user(forward_payload, options[:user]) if options[:user]
                  add_order(forward_payload, money, options)
                  add_payment_method(forward_payload, payment, options[:payment_method]) if options[:payment_method] || payment
          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_customer_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_customer_data(post, payment_method, options)
                  billing = {}
                  shipping = {}
                  customer = {}
                  device = {}
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/mastercard.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_creditcard has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_creditcard(post, creditcard, options)
                  card = {}
                  if creditcard.respond_to?(:number)
                    card[:number] = creditcard.number
                    card[:expMonth] = creditcard.month
          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_payer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_payer(post, card, options)
                  address = options[:billing_address] || options[:address]
                  phone_number = address[:phone] || address[:phone_number] if address
          
                  post[:payer] = {}
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/d_local.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_additional_verification has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_additional_verification(xml, options)
                  return unless (options[:verify_zip].to_s == 'true') || (options[:verify_address].to_s == 'true')
          
                  if address = options[:billing_address]
                    xml.AdditionalVerification do
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/creditcall.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 handle_message has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def handle_message(response, success)
                  if success && response['status'].present?
                    'Token successfully created.'
                  elsif success
                    "#{response['gateway_message']} - #{response['bank_message']}"
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/payeezy.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 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def commit(method, action, params, options)
                  url = "#{test? ? test_url : live_url}/#{action}"
          
                  begin
                    raw_response = ssl_request(method, url, post_data(params), headers(options))
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/pin.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 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_merchant_data(post, options)
                  post[:additionalData][:subMerchantID] = options[:sub_merchant_id] if options[:sub_merchant_id]
                  post[:additionalData][:subMerchantName] = options[:sub_merchant_name] if options[:sub_merchant_name]
                  post[:additionalData][:subMerchantStreet] = options[:sub_merchant_street] if options[:sub_merchant_street]
                  post[:additionalData][:subMerchantCity] = options[:sub_merchant_city] if options[:sub_merchant_city]
          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_customer_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_customer_data(xml, payment_source, options)
                  xml.customer do
                    xml.id(options[:customer]) unless empty?(options[:customer]) || options[:customer] !~ /^\w+$/
                    xml.email(options[:email]) unless empty?(options[:email])
                  end
          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 normal_refund has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def normal_refund(amount, authorization, options)
                  transaction_id, card_number, = split_authorization(authorization)
          
                  commit(:refund) do |xml|
                    xml.transactionRequest 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 parse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def parse(data, action)
                  params  = {}
                  success = false
                  message = ''
                  options = @options.merge(test: test?)
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/redsys.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