activemerchant/active_merchant

View on GitHub

Showing 999 of 1,496 total issues

File safe_charge.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'nokogiri'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    class SafeChargeGateway < Gateway
Severity: Minor
Found in lib/active_merchant/billing/gateways/safe_charge.rb - About 2 hrs to fix

    Method request has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def request(method, body, headers = {})
          request_start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
    
          headers = headers.dup
          headers['connection'] ||= 'close'
    Severity: Minor
    Found in lib/active_merchant/connection.rb - About 2 hrs 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 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_address(params, options)
            address = options[:billing_address] || options[:address]
    
            if address
              params[:address]   = address[:address1] unless address[:address1].blank?
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/pay_junction.rb - About 2 hrs 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 has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_3ds(post, options)
            if three_ds_2_options = options[:three_ds_2]
              device_channel = three_ds_2_options[:channel]
              if device_channel == 'app'
                post[:threeDS2RequestData] = { deviceChannel: device_channel }
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/barclaycard_smartpay.rb - About 2 hrs 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_aggregate_data has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_aggregate_data(post, options)
            aggregate_data = {}
            data = options[:aggregate_data]
            aggregate_data[:indicator] = data[:indicator] if data[:indicator]
            aggregate_data[:identification_number] = data[:identification_number] if data[:identification_number]
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/decidir.rb - About 2 hrs 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_aggregate_data has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_aggregate_data(post, options)
            aggregate_data = {}
            data = options[:aggregate_data]
            aggregate_data[:indicator] = data[:indicator] if data[:indicator]
            aggregate_data[:identification_number] = data[:identification_number] if data[:identification_number]
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/decidir_plus.rb - About 2 hrs 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 create_setup_intent has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def create_setup_intent(payment_method, options = {})
            MultiResponse.run do |r|
              r.process do
                post = {}
                add_customer(post, options)
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/stripe_payment_intents.rb - About 2 hrs 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_transaction_data has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_transaction_data(trans_type, post, money, options)
            currency = options[:currency] || currency(money)
    
            post[:sg_TransType] = trans_type
            post[:sg_Currency] = currency
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/safe_charge.rb - About 2 hrs 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 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_billing_address(post, type, options)
            if address = (options[:billing_address] || options[:address])
              billing = {}
              address = options[:billing_address] || options[:address]
              billing[:street] = address[:address1].match(/\D+/)[0].strip if address[:address1]
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/mundipagg.rb - About 2 hrs 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_essential_attributes has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def validate_essential_attributes #:nodoc:
            errors = []
    
            if self.class.requires_name?
              errors << [:first_name, 'cannot be empty'] if first_name.blank?
    Severity: Minor
    Found in lib/active_merchant/billing/credit_card.rb - About 2 hrs 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_normal has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def parse_normal(action, body)
            doc = Nokogiri::XML(body)
            doc.remove_namespaces!
    
            response = { action: action }
    Severity: Major
    Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 2 hrs to fix

      Class PaywayDotComGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class PaywayDotComGateway < Gateway
            self.test_url = 'https://paywaywsdev.com/PaywayWS/Payment/CreditCard'
            self.live_url = 'https://paywayws.net/PaywayWS/Payment/CreditCard'
      
            self.supported_countries = %w[US CA]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/payway_dot_com.rb - About 2 hrs to fix

        Class VposGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class VposGateway < Gateway
              self.test_url = 'https://vpos.infonet.com.py:8888'
              self.live_url = 'https://vpos.infonet.com.py'
        
              self.supported_countries = ['PY']
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/vpos.rb - About 2 hrs to fix

          Class IridiumGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class IridiumGateway < Gateway
                self.live_url = self.test_url = 'https://gw1.iridiumcorp.net/'
          
                # The countries the gateway supports merchants from as 2 digit ISO country codes
                self.supported_countries = %w[GB ES]
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/iridium.rb - About 2 hrs to fix

            Class CheckoutGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class CheckoutGateway < Gateway
                  self.default_currency = 'USD'
                  self.money_format = :cents
            
                  self.supported_countries = %w[AD AT BE BG CH CY CZ DE DK EE ES FO FI FR GB GI GL GR HR HU IE IS IL IT LI LT LU LV MC MT NL NO PL PT RO SE SI SM SK SJ TR VA]
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/checkout.rb - About 2 hrs to fix

              Class InspireGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class InspireGateway < Gateway
                    self.live_url = self.test_url = 'https://secure.inspiregateway.net/api/transact.php'
              
                    self.supported_countries = ['US']
                    self.supported_cardtypes = %i[visa master american_express]
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/inspire.rb - About 2 hrs to fix

                Class MitGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class MitGateway < Gateway
                      self.live_url = 'https://wpy.mitec.com.mx/ModuloUtilWS/activeCDP.htm'
                      self.test_url = 'https://scqa.mitec.com.mx/ModuloUtilWS/activeCDP.htm'
                
                      self.supported_countries = ['MX']
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/mit.rb - About 2 hrs to fix

                  Class CamsGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class CamsGateway < Gateway
                        self.live_url = 'https://secure.centralams.com/gw/api/transact.php'
                  
                        self.supported_countries = ['US']
                        self.default_currency = 'USD'
                  Severity: Minor
                  Found in lib/active_merchant/billing/gateways/cams.rb - About 2 hrs to fix

                    Class CC5Gateway has 21 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        class CC5Gateway < Gateway
                          self.default_currency = 'TRY'
                    
                          CURRENCY_CODES = {
                            'TRY' => 949,
                    Severity: Minor
                    Found in lib/active_merchant/billing/gateways/cc5.rb - About 2 hrs to fix

                      Class WepayGateway has 21 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class WepayGateway < Gateway
                            self.test_url = 'https://stage.wepayapi.com/v2'
                            self.live_url = 'https://wepayapi.com/v2'
                      
                            self.supported_countries = %w[US CA]
                      Severity: Minor
                      Found in lib/active_merchant/billing/gateways/wepay.rb - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language