activemerchant/offsite_payments

View on GitHub

Showing 40 of 57 total issues

File realex_offsite.rb has 725 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module OffsitePayments #:nodoc:
  module Integrations #:nodoc:
    module RealexOffsite
      mattr_accessor :production_url
      mattr_accessor :test_url
Severity: Major
Found in lib/offsite_payments/integrations/realex_offsite.rb - About 1 day to fix

    Class Notification has 38 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class Notification < OffsitePayments::Notification
    
            def unescape(val) #:nodoc:
              if val
                CGI::unescape val
    Severity: Minor
    Found in lib/offsite_payments/integrations/authorize_net_sim.rb - About 5 hrs to fix

      Class Notification has 28 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class Notification < OffsitePayments::Notification
              def complete?
                status == 'Completed'
              end
      
      
      Severity: Minor
      Found in lib/offsite_payments/integrations/world_pay.rb - About 3 hrs to fix

        Class Notification has 28 methods (exceeds 20 allowed). Consider refactoring.
        Open

              class Notification < OffsitePayments::Notification
                def initialize(post, options = {})
                  super(post, options)
                  @merchant_id = options[:credential1]
                  @secret_key = options[:credential2]
        Severity: Minor
        Found in lib/offsite_payments/integrations/payu_in.rb - About 3 hrs to fix

          Class Notification has 27 methods (exceeds 20 allowed). Consider refactoring.
          Open

                class Notification < OffsitePayments::Notification
                  self.production_ips = [
                    '78.108.178.206',
                    '79.137.235.129',
                    '95.163.96.79',
          Severity: Minor
          Found in lib/offsite_payments/integrations/a1agregator.rb - About 3 hrs to fix

            Class Notification has 27 methods (exceeds 20 allowed). Consider refactoring.
            Open

                  class Notification < OffsitePayments::Notification
                    include ActiveUtils::PostsData
                    include ActiveUtils::RequiresParameters
            
                    def initialize(query_string, options={})
            Severity: Minor
            Found in lib/offsite_payments/integrations/pxpay.rb - About 3 hrs to fix

              File sage_pay_form.rb has 294 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module OffsitePayments #:nodoc:
                module Integrations #:nodoc:
                  module SagePayForm
                    mattr_accessor :production_url
                    mattr_accessor :test_url
              Severity: Minor
              Found in lib/offsite_payments/integrations/sage_pay_form.rb - About 3 hrs to fix

                Class Notification has 26 methods (exceeds 20 allowed). Consider refactoring.
                Open

                      class Notification < OffsitePayments::Notification
                        def complete?
                          status == 'Completed'
                        end
                
                
                Severity: Minor
                Found in lib/offsite_payments/integrations/chronopay.rb - About 3 hrs to fix

                  Class Notification has 26 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                        class Notification < OffsitePayments::Notification
                          include Common
                          def initialize(post, options={})
                            super
                            @secret = options[:credential3]
                  Severity: Minor
                  Found in lib/offsite_payments/integrations/realex_offsite.rb - About 3 hrs to fix

                    Class Notification has 25 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                          class Notification < OffsitePayments::Notification
                            class CryptError < StandardError; end
                    
                            include Encryption
                    
                    
                    Severity: Minor
                    Found in lib/offsite_payments/integrations/sage_pay_form.rb - About 2 hrs to fix

                      Class Notification has 25 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                            class Notification < OffsitePayments::Notification
                              def initialize(post, options = {})
                                super(post, options)
                                @secret_key = options[:credential2]
                              end
                      Severity: Minor
                      Found in lib/offsite_payments/integrations/citrus.rb - About 2 hrs to fix

                        Method generate_md5string has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def generate_md5string
                                  fields = [@fields["pmt_action"], @fields["pmt_version"]]
                                  fields += [@fields["pmt_selleriban"]] unless @fields["pmt_selleriban"].nil?
                                  fields += [@fields["pmt_id"], @fields["pmt_orderid"], @fields["pmt_reference"], @fields["pmt_duedate"],
                                  @fields["pmt_amount"], @fields["pmt_currency"], @fields["pmt_okreturn"], @fields["pmt_errorreturn"], @fields["pmt_cancelreturn"],
                        Severity: Minor
                        Found in lib/offsite_payments/integrations/maksuturva.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

                        File authorize_net_sim.rb has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        module OffsitePayments #:nodoc:
                          module Integrations #:nodoc:
                            module AuthorizeNetSim
                              # Overwrite this if you want to change the ANS test url
                              mattr_accessor :test_url
                        Severity: Minor
                        Found in lib/offsite_payments/integrations/authorize_net_sim.rb - About 2 hrs to fix

                          Class Notification has 23 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                                class Notification < OffsitePayments::Notification
                                  def initialize(*args)
                                    super
                                    @signature = params.delete('pg_sig')
                                  end
                          Severity: Minor
                          Found in lib/offsite_payments/integrations/platron.rb - About 2 hrs to fix

                            Method verify_response has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                    def verify_response(params, secret)
                                      logstr = ''
                                      params.each { |key, value|
                                        logstr += "#{key} #{value}\n"
                                      }
                            Severity: Minor
                            Found in lib/offsite_payments/integrations/wirecard_checkout_page.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

                            File wirecard_checkout_page.rb has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            module OffsitePayments #:nodoc:
                              module Integrations #:nodoc:
                                # Shop System Plugins - Terms of use
                                #
                                # This terms of use regulates warranty and liability between Wirecard Central Eastern Europe (subsequently referred to as WDCEE) and it's
                            Severity: Minor
                            Found in lib/offsite_payments/integrations/wirecard_checkout_page.rb - About 2 hrs to fix

                              File direc_pay.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              module OffsitePayments #:nodoc:
                                module Integrations #:nodoc:
                                  module DirecPay
                                    mattr_accessor :production_url, :test_url
                              
                              
                              Severity: Minor
                              Found in lib/offsite_payments/integrations/direc_pay.rb - About 2 hrs to fix

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

                                        def form_fields
                                          fields.delete('locale')
                                
                                          map_billing_address_to_shipping_address unless @shipping_address_set
                                
                                
                                Severity: Minor
                                Found in lib/offsite_payments/integrations/sage_pay_form.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 shipping_address has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                        def shipping_address(params = {})
                                          # Get the country code in the correct format
                                          # Use what we were given if we can't find anything
                                          country_code = lookup_country_code(params.delete(:country))
                                          add_field(mappings[:shipping_address][:country], country_code)
                                Severity: Minor
                                Found in lib/offsite_payments/integrations/paypal.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 parse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def parse(post)
                                      @raw = post.to_s
                                      for line in @raw.split('&')
                                        key, value = *line.scan( %r{^([A-Za-z0-9_.-]+)\=(.*)$} ).flatten
                                        if key.present?
                                Severity: Minor
                                Found in lib/offsite_payments/notification.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