activemerchant/active_merchant

View on GitHub

Showing 977 of 1,450 total issues

Method add_line_item_information_for_level_three_visa has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

      def add_line_item_information_for_level_three_visa(doc, payment_method, level_3_data)
        doc.lineItemData do
          level_3_data[:line_items].each do |line_item|
            doc.itemSequenceNumber(line_item[:item_sequence_number]) if line_item[:item_sequence_number]
            doc.commodityCode(line_item[:commodity_code]) if line_item[:commodity_code]
Severity: Minor
Found in lib/active_merchant/billing/gateways/litle.rb - About 7 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

File paypal_common_api.rb has 481 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    # This module is included in both PaypalGateway and PaypalExpressGateway
    module PaypalCommonAPI
      include Empty
Severity: Minor
Found in lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb - About 7 hrs to fix

    Class CheckoutV2Gateway has 52 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class CheckoutV2Gateway < Gateway
          self.display_name = 'Checkout.com Unified Payments'
          self.homepage_url = 'https://www.checkout.com/'
          self.live_url = 'https://api.checkout.com'
          self.test_url = 'https://api.sandbox.checkout.com'
    Severity: Major
    Found in lib/active_merchant/billing/gateways/checkout_v2.rb - About 7 hrs to fix

      Class PayeezyGateway has 52 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class PayeezyGateway < Gateway
            class_attribute :integration_url
      
            self.test_url = 'https://api-cert.payeezy.com/v1'
            self.integration_url = 'https://api-cat.payeezy.com/v1'
      Severity: Major
      Found in lib/active_merchant/billing/gateways/payeezy.rb - About 7 hrs to fix

        File credit_card_methods.rb has 463 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'set'
        
        module ActiveMerchant #:nodoc:
          module Billing #:nodoc:
            # Convenience methods that can be included into a custom Credit Card object, such as an ActiveRecord based Credit Card object.
        Severity: Minor
        Found in lib/active_merchant/billing/credit_card_methods.rb - About 7 hrs to fix

          Method add_creditcard has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_creditcard(post, creditcard, options, use_sources = false)
                  card = {}
                  if emv_payment?(creditcard)
                    add_emv_creditcard(post, creditcard.icc_data)
                    post[:card][:read_method] = 'contactless' if creditcard.read_method == 'contactless'
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/stripe.rb - About 7 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 46 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_address(xml, options)
                  if address = options[:billing_address] || options[:address]
                    address[:email] ||= options[:email]
                    xml.address do
                      xml.BillingAddress1 address[:address1] if address[:address1]
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/element.rb - About 7 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

          Class FirstdataE4V27Gateway has 50 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class FirstdataE4V27Gateway < Gateway
                self.test_url = 'https://api.demo.globalgatewaye4.firstdata.com/transaction/v28'
                self.live_url = 'https://api.globalgatewaye4.firstdata.com/transaction/v28'
          
                TRANSACTIONS = {
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/firstdata_e4_v27.rb - About 7 hrs to fix

            Method add_payment_method has a Cognitive Complexity of 45 (exceeds 5 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 6 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

            Class LitleGateway has 49 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class LitleGateway < Gateway
                  SCHEMA_VERSION = '9.14'
            
                  class_attribute :postlive_url, :prelive_url
            
            
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/litle.rb - About 6 hrs to fix

              Class GlobalCollectGateway has 49 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class GlobalCollectGateway < Gateway
                    class_attribute :preproduction_url
                    class_attribute :ogone_direct_test
                    class_attribute :ogone_direct_live
              
              
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/global_collect.rb - About 6 hrs to fix

                Method parse_normal has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                Open

                      def parse_normal(action, body)
                        doc = Nokogiri::XML(body)
                        doc.remove_namespaces!
                
                        response = { action: action }
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 6 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

                File credorax.rb has 446 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module ActiveMerchant #:nodoc:
                  module Billing #:nodoc:
                    class CredoraxGateway < Gateway
                      class_attribute :test_url, :live_na_url, :live_eu_url
                
                
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/credorax.rb - About 6 hrs to fix

                  File eway_rapid.rb has 445 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'json'
                  
                  module ActiveMerchant #:nodoc:
                    module Billing #:nodoc:
                      class EwayRapidGateway < Gateway
                  Severity: Minor
                  Found in lib/active_merchant/billing/gateways/eway_rapid.rb - About 6 hrs to fix

                    Class RapydGateway has 48 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        class RapydGateway < Gateway
                          class_attribute :payment_redirect_test, :payment_redirect_live
                    
                          self.test_url = 'https://sandboxapi.rapyd.net/v1/'
                          self.live_url = 'https://api.rapyd.net/v1/'
                    Severity: Minor
                    Found in lib/active_merchant/billing/gateways/rapyd.rb - About 6 hrs to fix

                      Class CyberSourceRestGateway has 47 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class CyberSourceRestGateway < Gateway
                            include ActiveMerchant::Billing::CyberSourceCommon
                      
                            self.test_url = 'https://apitest.cybersource.com'
                            self.live_url = 'https://api.cybersource.com'
                      Severity: Minor
                      Found in lib/active_merchant/billing/gateways/cyber_source_rest.rb - About 6 hrs to fix

                        Class SagePayGateway has 47 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                            class SagePayGateway < Gateway
                              cattr_accessor :simulate
                              self.simulate = false
                        
                              class_attribute :simulator_url
                        Severity: Minor
                        Found in lib/active_merchant/billing/gateways/sage_pay.rb - About 6 hrs to fix

                          Method add_paypal_details has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def add_paypal_details(xml, options)
                                  xml.tag! 'PayPal' do
                                    xml.tag! 'EMail', options[:email] unless options[:email].blank?
                                    xml.tag! 'ReturnURL', options[:return_url] unless options[:return_url].blank?
                                    xml.tag! 'CancelURL', options[:cancel_return_url] unless options[:cancel_return_url].blank?
                          Severity: Minor
                          Found in lib/active_merchant/billing/gateways/payflow_express.rb - About 6 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 build_merchant_data has a Cognitive Complexity of 42 (exceeds 5 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 6 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 legacy_parse has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def legacy_parse(action, xml)
                                  response = {}
                          
                                  error_messages = []
                                  error_codes = []
                          Severity: Minor
                          Found in lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb - About 6 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

                          Severity
                          Category
                          Status
                          Source
                          Language