activemerchant/active_merchant

View on GitHub

Showing 1,478 of 1,478 total issues

Method build_mass_pay_request has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

      def build_mass_pay_request(*args)
        default_options = args.last.is_a?(Hash) ? args.pop : {}
        recipients = args.first.is_a?(Array) ? args : [args]
        receiver_type = default_options[:receiver_type]

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

      def build_reference_request(action, money, authorization, options)
        xml = Builder::XmlMarkup.new
        xml.tag! TRANSACTIONS[action] do
          xml.tag! 'PNRef', authorization

Severity: Minor
Found in lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb - About 4 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 firstdata_e4.rb has 343 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    class FirstdataE4Gateway < Gateway
      # TransArmor support requires v11 or lower
      self.test_url = 'https://api.demo.globalgatewaye4.firstdata.com/transaction/v11'
Severity: Minor
Found in lib/active_merchant/billing/gateways/firstdata_e4.rb - About 4 hrs to fix

    File jetpay.rb has 342 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module ActiveMerchant #:nodoc:
      module Billing #:nodoc:
        class JetpayGateway < Gateway
          class_attribute :live_us_url, :live_ca_url
    
    
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/jetpay.rb - About 4 hrs to fix

      Class SimetrikGateway has 33 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class SimetrikGateway < Gateway
            self.test_url = 'https://payments.sta.simetrik.com/v1'
            self.live_url = 'https://payments.simetrik.com/v1'
      
            class_attribute :test_auth_url, :live_auth_url, :test_audience, :live_audience
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/simetrik.rb - About 4 hrs to fix

        Class OptimalPaymentGateway has 33 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class OptimalPaymentGateway < Gateway
              self.test_url = 'https://webservices.test.optimalpayments.com/creditcardWS/CreditCardServlet/v1'
              self.live_url = 'https://webservices.optimalpayments.com/creditcardWS/CreditCardServlet/v1'
        
              # The countries the gateway supports merchants from as 2 digit ISO country codes
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/optimal_payment.rb - About 4 hrs to fix

          Class PlexoGateway has 33 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class PlexoGateway < Gateway
                self.test_url = 'https://api.testing.plexo.com.uy/v1/payments'
                self.live_url = 'https://api.plexo.com.uy/v1/payments'
          
                self.supported_countries = ['UY']
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/plexo.rb - About 4 hrs to fix

            Class RedsysRestGateway has 33 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class RedsysRestGateway < Gateway
                  self.test_url = 'https://sis-t.redsys.es:25443/sis/rest/'
                  self.live_url = 'https://sis.redsys.es/sis/rest/'
            
                  self.supported_countries = ['ES']
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/redsys_rest.rb - About 4 hrs to fix

              Class CardConnectGateway has 33 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class CardConnectGateway < Gateway
                    self.test_url = 'https://fts-uat.cardconnect.com/cardconnect/rest/'
                    self.live_url = 'https://fts.cardconnect.com/cardconnect/rest/'
              
                    self.supported_countries = ['US']
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/card_connect.rb - About 4 hrs to fix

                Class KushkiGateway has 33 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class KushkiGateway < Gateway
                      self.display_name = 'Kushki'
                      self.homepage_url = 'https://www.kushkipagos.com'
                
                      self.test_url = 'https://api-uat.kushkipagos.com/'
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/kushki.rb - About 4 hrs to fix

                  Class BluePayGateway has 33 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class BluePayGateway < Gateway
                        class_attribute :rebilling_url, :ignore_http_status
                  
                        self.live_url      = 'https://secure.bluepay.com/interfaces/bp20post'
                        self.rebilling_url = 'https://secure.bluepay.com/interfaces/bp20rebadmin'
                  Severity: Minor
                  Found in lib/active_merchant/billing/gateways/blue_pay.rb - About 4 hrs to fix

                    File rapyd.rb has 339 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    module ActiveMerchant #:nodoc:
                      module Billing #:nodoc:
                        class RapydGateway < Gateway
                          class_attribute :payment_redirect_test, :payment_redirect_live
                    
                    
                    Severity: Minor
                    Found in lib/active_merchant/billing/gateways/rapyd.rb - About 4 hrs to fix

                      Identical blocks of code found in 2 locations. 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: Major
                      Found in lib/active_merchant/billing/gateways/secure_pay.rb and 1 other location - About 4 hrs to fix
                      lib/active_merchant/billing/gateways/metrics_global.rb on lines 257..278

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 140.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. 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: Major
                      Found in lib/active_merchant/billing/gateways/metrics_global.rb and 1 other location - About 4 hrs to fix
                      lib/active_merchant/billing/gateways/secure_pay.rb on lines 155..176

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 140.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      File barclaycard_smartpay.rb has 335 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      module ActiveMerchant #:nodoc:
                        module Billing #:nodoc:
                          class BarclaycardSmartpayGateway < Gateway
                            self.test_url = 'https://pal-test.barclaycardsmartpay.com/pal/servlet'
                            self.live_url = 'https://pal-live.barclaycardsmartpay.com/pal/servlet'
                      Severity: Minor
                      Found in lib/active_merchant/billing/gateways/barclaycard_smartpay.rb - About 4 hrs to fix

                        File card_stream.rb has 335 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        module ActiveMerchant #:nodoc:
                          module Billing #:nodoc:
                            class CardStreamGateway < Gateway
                              THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE = 'Specifying the :threeDSRequired initialization option is deprecated. Please use the `:threeds_required => true` *transaction* option instead.'
                        
                        
                        Severity: Minor
                        Found in lib/active_merchant/billing/gateways/card_stream.rb - About 4 hrs to fix

                          File decidir.rb has 334 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          module ActiveMerchant #:nodoc:
                            module Billing #:nodoc:
                              class DecidirGateway < Gateway
                                self.test_url = 'https://developers.decidir.com/api/v2'
                                self.live_url = 'https://live.decidir.com/api/v2'
                          Severity: Minor
                          Found in lib/active_merchant/billing/gateways/decidir.rb - About 4 hrs to fix

                            Class CecabankJsonGateway has 32 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                                class CecabankJsonGateway < Gateway
                                  include CecabankCommon
                            
                                  CECA_ACTIONS_DICTIONARY = {
                                    purchase: :REST_AUTORIZACION,
                            Severity: Minor
                            Found in lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb - About 4 hrs to fix

                              Class ForteGateway has 32 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                                  class ForteGateway < Gateway
                                    include Empty
                              
                                    self.test_url = 'https://sandbox.forte.net/api/v2'
                                    self.live_url = 'https://api.forte.net/v2'
                              Severity: Minor
                              Found in lib/active_merchant/billing/gateways/forte.rb - About 4 hrs to fix

                                Class VancoGateway has 32 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                    class VancoGateway < Gateway
                                      include Empty
                                
                                      self.test_url = 'https://uat.vancopayments.com/cgi-bin/ws2.vps'
                                      self.live_url = 'https://myvanco.vancopayments.com/cgi-bin/ws2.vps'
                                Severity: Minor
                                Found in lib/active_merchant/billing/gateways/vanco.rb - About 4 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language