activemerchant/active_merchant

View on GitHub

Showing 999 of 1,496 total issues

Method add_address has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def add_address(post, creditcard, options)
        return post unless options.key?(:address) || options.key?(:billing_address)

        billing_address = options[:address] || options[:billing_address]
        post[:source] ||= {}
Severity: Minor
Found in lib/active_merchant/billing/gateways/deepstack.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 15 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(action, body, options, try_again = true)
        credentials = ensure_credentials
        payload = encrypt_payload(body, credentials, options)

        if options.dig :http, :method
Severity: Minor
Found in lib/active_merchant/billing/gateways/alelo.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 15 (exceeds 5 allowed). Consider refactoring.
Open

      def add_shipping_address(post, options)
        if address = options[:shipping_address]
          post[:address] = {}
          post[:address][:street] = address[:address1].match(/\D+/)[0].strip if address[:address1]&.match(/\D+/)
          post[:address][:number] = address[:address1].match(/\d+/)[0] if address[:address1]&.match(/\d+/)
Severity: Minor
Found in lib/active_merchant/billing/gateways/mundipagg.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 15 (exceeds 5 allowed). Consider refactoring.
Open

      def add_address(post, options)
        address = (options[:billing_address] || options[:address])
        if address && address[:zip].present?
          post[:address] = {}
          post[:address][:line1] = address[:address1] if address[:address1]
Severity: Minor
Found in lib/active_merchant/billing/gateways/balanced.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_payment_instrument has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def add_address_payment_instrument(post, creditcard, options)
        return post unless options.key?(:address) || options.key?(:billing_address)

        billing_address = options[:address] || options[:billing_address]
        post[:source] = {} unless post.key?(:payment_instrument)
Severity: Minor
Found in lib/active_merchant/billing/gateways/deepstack.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_level2_purchase has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def add_level2_purchase(xml, options = {})
        if (level2 = options[:level_2_data])
          xml.tag! :PCOrderNum,       byte_limit(level2[:purchase_order], 17) if level2[:purchase_order]
          xml.tag! :PCDestZip,        byte_limit(format_address_field(level2[:zip]), 10) if level2[:zip]
          xml.tag! :PCDestName,       byte_limit(format_address_field(level2[:name]), 30) if level2[:name]
Severity: Minor
Found in lib/active_merchant/billing/gateways/orbital.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_normalized_threeds_2_data has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def add_normalized_threeds_2_data(xml, payment_method, options)
        threeds_2_options = options[:three_d_secure]
        cc_brand = card_brand(payment_method).to_sym

        return if threeds_2_options[:cavv].blank? && infer_commerce_indicator?(options, cc_brand)
Severity: Minor
Found in lib/active_merchant/billing/gateways/cyber_source.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_request has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def build_request(payment_code, money, payment, options)
        xml = Builder::XmlMarkup.new indent: 2
        xml.instruct!
        xml.tag! 'Request', 'version' => API_VERSION do
          xml.tag! 'Header' do
Severity: Minor
Found in lib/active_merchant/billing/gateways/axcessms.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_level2_card_and_more_tax has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def add_level2_card_and_more_tax(xml, options = {})
        if (level2 = options[:level_2_data])
          xml.tag! :PCardRequestorName, byte_limit(level2[:requestor_name], 38) if level2[:requestor_name]
          xml.tag! :PCardLocalTaxRate, byte_limit(level2[:local_tax_rate], 5) if level2[:local_tax_rate]
          # Canadian Merchants Only
Severity: Minor
Found in lib/active_merchant/billing/gateways/orbital.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 15 (exceeds 5 allowed). Consider refactoring.
Open

      def add_address(post, options)
        if address = options[:billing_address] || options[:address]
          if address[:address2]
            post[:billing_address]    = address[:address1].to_s << ' ' << address[:address2].to_s
          else
Severity: Minor
Found in lib/active_merchant/billing/gateways/efsnet.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 fields has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def fields(action)
        # Gateway expects fields in fixed order below.
        case action
        when 'PAYMENT', 'PREAUTH'
          %i[
Severity: Minor
Found in lib/active_merchant/billing/gateways/world_net.rb - About 1 hr to fix

    Method add_payment_method has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def add_payment_method(post, payment_method, options, key = :source)
            # the key = :destination when this method is called in def credit
            post[key] = {}
            case payment_method
            when NetworkTokenizationCreditCard
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/checkout_v2.rb - About 1 hr to fix

      Method build_create_profile_request has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def build_create_profile_request(options)
              xml = Builder::XmlMarkup.new :indent => 2
              xml.tag! 'CreateRecurringPaymentsProfileReq', 'xmlns' => PAYPAL_NAMESPACE do
                xml.tag! 'CreateRecurringPaymentsProfileRequest', 'xmlns:n2' => EBAY_NAMESPACE do
                  xml.tag! 'n2:Version', API_VERSION
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb - About 1 hr to fix

        Method build_merchant_data has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def build_merchant_data(xml, data, options = {})
                # See https://sis-t.redsys.es:25443/sis/services/SerClsWSEntradaV2/wsdl/SerClsWSEntradaV2.wsdl
                # (which results from calling #webservice_url + '?WSDL', https://sis-t.redsys.es:25443/sis/services/SerClsWSEntradaV2?WSDL)
                xml.DATOSENTRADA do
                  # Basic elements
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/redsys.rb - About 1 hr to fix

          Method build_new_order_xml has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def build_new_order_xml(action, money, payment_source, parameters = {})
                  requires!(parameters, :order_id)
                  @use_secondary_url = parameters[:use_secondary_url] if parameters[:use_secondary_url]
                  xml = xml_envelope
                  xml.tag! :Request do
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/orbital.rb - About 1 hr to fix

            Method post_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                  def post_data(params)
                    return nil unless params
            
                    params.map do |key, value|
                      next if value.blank?
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/cecabank/cecabank_xml.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_xml_request has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                  def build_xml_request(action, data)
                    xml = Builder::XmlMarkup.new indent: 2
                    xml.Request(version: '1.0') do
                      xml.Header do
                        xml.Security(sender: @options[:sender], type: 'MERCHANT')
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/bank_frick.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_extra_options has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                  def add_extra_options(post, options)
                    extra = {}
                    extra[:ecm] = '32' if options[:recurring]
                    extra[:name] = options[:merchant] if options[:merchant]
                    extra[:location] = options[:merchant_location] if options[:merchant_location]
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/fat_zebra.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_extra_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                  def add_extra_data(post, payment, options)
                    post[:telephoneNumber] = (options[:billing_address][:phone_number] if options.dig(:billing_address, :phone_number)) || (options[:billing_address][:phone] if options.dig(:billing_address, :phone)) || ''
                    post[:selectedBrand] = options[:selected_brand] if options[:selected_brand] && !post[:selectedBrand]
                    post[:deliveryDate] = options[:delivery_date] if options[:delivery_date]
                    post[:merchantOrderReference] = options[:merchant_order_reference] if options[:merchant_order_reference]
            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_address has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                  def add_address(post, options)
                    if address = options[:shipping_address]
                      post[:deliveryAddress] = {}
                      post[:deliveryAddress][:street] = options[:address_override] == true ? address[:address2] : address[:address1] || 'NA'
                      post[:deliveryAddress][:houseNumberOrName] = options[:address_override] == true ? address[:address1] : address[:address2] || 'NA'
            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

            Severity
            Category
            Status
            Source
            Language