activemerchant/active_merchant

View on GitHub

Showing 999 of 1,496 total issues

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

      def parse(response)
        params = {}

        lines = response.split("\n")

Severity: Minor
Found in lib/active_merchant/billing/gateways/net_registry.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_stored_credential_used has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_stored_credential_used(post, options)
        post[:payment_information] ||= '2'
        post[:issuer_id] = options[:stored_credential][:network_transaction_id] if options[:issuer_id].blank?
        if options[:stored_credential][:initiator] == 'merchant'
          case options[:stored_credential][:reason_type]
Severity: Minor
Found in lib/active_merchant/billing/gateways/moneris.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_3d_secure_1_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_3d_secure_1_data(post, options)
        if three_d_secure_options = options[:three_d_secure]
          post[:i8] = build_i8(
            three_d_secure_options[:eci],
            three_d_secure_options[:cavv],
Severity: Minor
Found in lib/active_merchant/billing/gateways/credorax.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(doc, options)
        address = options[:billing_address]
        return unless address

        doc.country(address[:country]) if address[:country]
Severity: Minor
Found in lib/active_merchant/billing/gateways/blue_snap.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_stored_credential_initial has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_stored_credential_initial(post, options)
        post[:payment_information] ||= '0'
        post[:issuer_id] ||= ''
        if options[:stored_credential][:initiator] == 'merchant'
          case options[:stored_credential][:reason_type]
Severity: Minor
Found in lib/active_merchant/billing/gateways/moneris.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_credit_card_eci has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_credit_card_eci(xml, credit_card, options)
        eci = if credit_card.is_a?(NetworkTokenizationCreditCard) && credit_card.source == :apple_pay && card_brand(credit_card) == 'discover'
                # Payeezy requires an ECI of 5 for apple pay transactions
                # See: https://support.payeezy.com/hc/en-us/articles/203730589-Ecommerce-Flag-Values
                '05'
Severity: Minor
Found in lib/active_merchant/billing/gateways/firstdata_e4_v27.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_xml_request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def build_xml_request(transaction_type, options = {}, transaction_id = nil, &block)
        xml = Builder::XmlMarkup.new
        xml.tag! 'JetPay' do
          # The basic values needed for any request
          xml.tag! 'TerminalID', @options[:login]
Severity: Minor
Found in lib/active_merchant/billing/gateways/jetpay.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_network_token_cryptogram_and_eci has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_network_token_cryptogram_and_eci(post, payment_method, options)
        return unless payment_method.is_a?(NetworkTokenizationCreditCard) && options.dig(:stored_credential, :initiator) != 'merchant'
        return if digital_wallet_payment_method?(payment_method) && options[:new_ap_gp_route] != true

        post[:payment_method_options] ||= {}
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe_payment_intents.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 transaction_hash has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def transaction_hash(result)
        unless result.success?
          return { 'processor_response_code' => response_code_from_result(result),
                   'additional_processor_response' => additional_processor_response_from_result(result),
                   'payment_instrument_type' => payment_instrument_type(result.transaction),
Severity: Minor
Found in lib/active_merchant/billing/gateways/braintree_blue.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 authorize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def authorize(money, payment, options = {})
        if ach?(payment)
          direct_bank_error = 'Direct bank account transactions are not supported for authorize.'
          return Response.new(false, direct_bank_error)
        end
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe.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_payment_method has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_payment_method(parameters, credit_card_or_vault_id, options)
        if credit_card_or_vault_id.is_a?(String) || credit_card_or_vault_id.is_a?(Integer)
          add_third_party_token(parameters, credit_card_or_vault_id, options)
        else
          parameters[:customer].merge!(
Severity: Minor
Found in lib/active_merchant/billing/gateways/braintree_blue.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_auth_purchase_params has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_auth_purchase_params(post, money, credit_card, options)
        post[:payment_method_id] = add_payment_method_id(credit_card, options)
        post[:site_transaction_id] = options[:order_id]
        post[:bin] = credit_card.number[0..5]
        post[:payment_type] = options[:payment_type] || 'single'
Severity: Minor
Found in lib/active_merchant/billing/gateways/decidir.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 purchase has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def purchase(money, payment, options = {})
        if ach?(payment)
          direct_bank_error = 'Direct bank account transactions are not supported. Bank accounts must be stored and verified before use.'
          return Response.new(false, direct_bank_error)
        end
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe.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_stored_credential has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_stored_credential(post, options)
        return unless options[:stored_credential]

        post[:storedCredential] = {}

Severity: Minor
Found in lib/active_merchant/billing/gateways/paysafe.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_three_d_secure has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_three_d_secure(post, payment_method, options)
        three_d_secure = options[:three_d_secure]
        return unless three_d_secure.present?

        post[:threeDomainSecure] = {
Severity: Minor
Found in lib/active_merchant/billing/gateways/kushki.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/secure_pay.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]
          post[:street]  = address[:address1].to_s
          post[:city]    = address[:city].to_s
          post[:state]   = (address[:state].blank? ? 'NA' : address[:state].to_s)
Severity: Minor
Found in lib/active_merchant/billing/gateways/transact_pro.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_credit_card_eci has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_credit_card_eci(xml, credit_card, options)
        eci =
          if credit_card.is_a?(NetworkTokenizationCreditCard) && credit_card.source == :apple_pay && card_brand(credit_card) == 'discover'
            # Discover requires any Apple Pay transaction, regardless of in-app
            # or web, and regardless of the ECI contained in the PKPaymentToken,
Severity: Minor
Found in lib/active_merchant/billing/gateways/firstdata_e4.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_element has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_element(reply, node)
        if node.has_elements?
          node.elements.each { |e| parse_element(reply, e) }
        else
          if /item/.match?(node.parent.name)
Severity: Minor
Found in lib/active_merchant/billing/gateways/ipg.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_level3_tax has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_level3_tax(xml, options = {})
        if (level3 = options[:level_3_data])
          xml.tag! :PC3VATtaxAmt, byte_limit(level3[:vat_tax], 12) if level3[:vat_tax]
          xml.tag! :PC3VATtaxRate, byte_limit(level3[:vat_rate], 4) if level3[:vat_rate]
          xml.tag! :PC3AltTaxInd, byte_limit(level3[:alt_ind], 15) if level3[:alt_ind]
Severity: Minor
Found in lib/active_merchant/billing/gateways/orbital.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