activemerchant/active_merchant

View on GitHub

Showing 999 of 1,496 total issues

Method add_airline_travel_details has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_airline_travel_details(post, options)
        return unless options[:airline_travel_details]

        post[:airlineTravelDetails] = {}
        post[:airlineTravelDetails][:passengerName] = options[:airline_travel_details][:passenger_name] if options[:airline_travel_details][:passenger_name]
Severity: Minor
Found in lib/active_merchant/billing/gateways/paysafe.rb - About 35 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_profile_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_profile_data(post, payment, options)
        post[:firstName] = payment.first_name
        post[:lastName] = payment.last_name
        post[:dateOfBirth] = {}
        post[:dateOfBirth][:year] = options[:date_of_birth][:year]
Severity: Minor
Found in lib/active_merchant/billing/gateways/paysafe.rb - About 35 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_3ds_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_3ds_info(parameters, three_d_secure_opts)
        return if empty?(three_d_secure_opts)

        pass_thru = {}

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

      def stored_credentials(parameters, stored_credential)
        case stored_credential[:reason_type]
        when 'recurring', 'installment'
          if stored_credential[:initial_transaction]
            parameters[:transaction_source] = "#{stored_credential[:reason_type]}_first"
Severity: Minor
Found in lib/active_merchant/billing/gateways/braintree_blue.rb - About 35 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_billing_address has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_billing_address(post, options)
        address = options[:billing_address] || {}

        post[:bill_name1], post[:bill_name2] = split_names(address[:name])
        post[:bill_street] = address[:address1] if address[:address1]
Severity: Minor
Found in lib/active_merchant/billing/gateways/ezic.rb - About 35 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 tokenize_apple_google has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def tokenize_apple_google(payment, options = {})
        tokenization_method = payment.source == :google_pay ? :android_pay : payment.source
        post = {
          card: {
            number: payment.number,
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe_payment_intents.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def refund(money, identification, options = {})
        post = {}
        add_amount(post, money, options)
        post[:refund_application_fee] = true if options[:refund_application_fee]
        post[:reverse_transfer] = options[:reverse_transfer] if options[:reverse_transfer]
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(action, post)
        begin
          raw_response = ssl_post(url(action), post.to_json, headers)
          response = parse(raw_response)
        rescue ResponseError => e
Severity: Minor
Found in lib/active_merchant/billing/gateways/allied_wallet.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(method, url, parameters = nil, options = {})
        add_expand_parameters(parameters, options) if parameters
        return Response.new(false, 'Invalid API Key provided') unless key_valid?(options)

        response = api_request(method, url, parameters, options)
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe.rb - About 35 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 eci has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def eci(options)
        if options.dig(:stored_credential, :initial_transaction)
          'SSL'
        elsif options.dig(:stored_credential, :initiator) && options[:stored_credential][:initiator] == 'cardholder'
          'MTO'
Severity: Minor
Found in lib/active_merchant/billing/gateways/qvalent.rb - About 35 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_soft_descriptors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_soft_descriptors(post, options)
        post['customer.merchantName'] = options[:customer_merchant_name] if options[:customer_merchant_name]
        post['customer.merchantStreetAddress'] = options[:customer_merchant_street_address] if options[:customer_merchant_street_address]
        post['customer.merchantLocation'] = options[:customer_merchant_location] if options[:customer_merchant_location]
        post['customer.merchantState'] = options[:customer_merchant_state] if options[:customer_merchant_state]
Severity: Minor
Found in lib/active_merchant/billing/gateways/qvalent.rb - About 35 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_fields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_network_token_fields(post, payment_method)
        if payment_method.source == :apple_pay || payment_method.source == :google_pay
          post[:cavv] = payment_method.payment_cryptogram
          post[:eci] = payment_method.eci
          post[:decrypted_applepay_data] = 1 if payment_method.source == :apple_pay
Severity: Minor
Found in lib/active_merchant/billing/gateways/nmi.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_auth_purchase_params(xml, payment_method, options)
        xml.ssl_dynamic_dba                     options[:dba] if options.has_key?(:dba)
        xml.ssl_merchant_initiated_unscheduled  merchant_initiated_unscheduled(options) if merchant_initiated_unscheduled(options)
        xml.ssl_add_token                       options[:add_recurring_token] if options.has_key?(:add_recurring_token)
        xml.ssl_customer_code                   options[:customer] if options.has_key?(:customer)
Severity: Minor
Found in lib/active_merchant/billing/gateways/elavon.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

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

        external_recurring_data = post[:external_recurring_data] = {}

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

      def validate
        errors = []

        errors << [:merchant_name, 'is required'] if self.merchant_name.blank?
        errors << [:merchant_name, 'is required to be 25 bytes or less'] if self.merchant_name.bytesize > 25
Severity: Minor
Found in lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb - About 35 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_credentials has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_stored_credentials(post, options = {})
        stored_credential = options[:stored_credential]
        return unless stored_credential && !stored_credential.values.all?(&:nil?)

        post[:payment_method_options] ||= {}
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe_payment_intents.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def parse(body)
        # The bp20api has max one value per form field.
        response_fields = CGI::parse(body).map { |k, v| [k.upcase, v.first] }.to_h

        return parse_recurring(response_fields) if response_fields.include? 'REBILL_ID'
Severity: Minor
Found in lib/active_merchant/billing/gateways/blue_pay.rb - About 35 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_invoice has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_invoice(doc, money, options)
        doc.amount amount(money) unless money.nil?
        doc.currency_code(options[:currency] || currency(money) || default_currency)
        doc.order_id(options[:order_id])
        doc.ip(options[:ip]) if options[:ip]
Severity: Minor
Found in lib/active_merchant/billing/gateways/spreedly_core.rb - About 35 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 avs_result_code has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def avs_result_code(xml)
        billing_address_elem = validation_result_element(xml, 'Billing Address')
        zip_code_elem = validation_result_element(xml, 'Zip Code')

        return nil unless billing_address_elem && zip_code_elem
Severity: Minor
Found in lib/active_merchant/billing/gateways/cenpos.rb - About 35 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 message_from has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def message_from(response)
        return response['error'] if response['error']
        return 'Failed' unless response.key?('result')

        if response['result'].key?('pgwResponseCode')
Severity: Minor
Found in lib/active_merchant/billing/gateways/latitude19.rb - About 35 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