activemerchant/active_merchant

View on GitHub

Showing 1,478 of 1,478 total issues

Class PinGateway has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

    class PinGateway < Gateway
      self.test_url = 'https://test-api.pinpayments.com/1'
      self.live_url = 'https://api.pinpayments.com/1'

      self.default_currency = 'AUD'
Severity: Minor
Found in lib/active_merchant/billing/gateways/pin.rb - About 3 hrs to fix

    Class EwayRapidGateway has 31 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class EwayRapidGateway < Gateway
          self.test_url = 'https://api.sandbox.ewaypayments.com/'
          self.live_url = 'https://api.ewaypayments.com/'
    
          self.money_format = :cents
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/eway_rapid.rb - About 3 hrs to fix

      Class HiPayGateway has 31 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class HiPayGateway < Gateway
            # to add more check => payment_product_list: https://developer.hipay.com/api-explorer/api-online-payments#/payments/generateHostedPaymentPage
            PAYMENT_PRODUCT = {
              'visa' => 'visa',
              'master' => 'mastercard'
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/hi_pay.rb - About 3 hrs to fix

        Class SkipJackGateway has 31 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class SkipJackGateway < Gateway
              API_VERSION = '?.?'
        
              self.live_url = 'https://www.skipjackic.com'
              self.test_url = 'https://developer.skipjackic.com'
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/skip_jack.rb - About 3 hrs to fix

          Class DecidirGateway has 31 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class DecidirGateway < Gateway
                self.test_url = 'https://developers.decidir.com/api/v2'
                self.live_url = 'https://live.decidir.com/api/v2'
          
                self.supported_countries = ['AR']
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/decidir.rb - About 3 hrs to fix

            Class SmartPs has 31 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class SmartPs < Gateway #:nodoc:
                  ##
                  # This is the base gateway for processors who use the smartPS processing system
            
                  self.abstract_class = true
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/smart_ps.rb - About 3 hrs to fix

              Class TelrGateway has 31 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class TelrGateway < Gateway
                    self.display_name = 'Telr'
                    self.homepage_url = 'http://www.telr.com/'
              
                    self.live_url = 'https://secure.telr.com/gateway/remote.xml'
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/telr.rb - About 3 hrs to fix

                Method transaction_hash has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def transaction_hash(result)
                        unless result.success?
                          return { 'processor_response_code' => response_code_from_result(result),
                                   'additional_processor_response' => additional_processor_response_from_result(result),
                                   'payment_instrument_type' => payment_instrument_type(result.transaction),
                Severity: Major
                Found in lib/active_merchant/billing/gateways/braintree_blue.rb - About 3 hrs to fix

                  Method build_request has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def build_request(action)
                          xml = Builder::XmlMarkup.new(encoding: 'UTF-8')
                          xml.instruct!(:xml, encoding: 'UTF-8')
                          xml.SOAP :Envelope, {
                            'xmlns:SOAP' => 'http://schemas.xmlsoap.org/soap/envelope/',
                  Severity: Minor
                  Found in lib/active_merchant/billing/gateways/hps.rb - About 3 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_external_mpi_fields has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def add_external_mpi_fields(data, options)
                          return unless options[:three_d_secure]
                  
                          if options[:three_d_secure][:version] == THREE_DS_V2
                            data[:threeDSServerTransID] = options[:three_d_secure][:three_ds_server_trans_id] if options[:three_d_secure][:three_ds_server_trans_id]
                  Severity: Minor
                  Found in lib/active_merchant/billing/gateways/redsys.rb - About 3 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_cim has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def parse_cim(body, options)
                          response = {}
                  
                          doc = Nokogiri::XML(body).remove_namespaces!
                  
                  
                  Severity: Minor
                  Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 3 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 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def add_billing_address(post, options)
                          if (address = (options[:billing_address] || options[:address]))
                            post[:billing_address] = {}
                            post[:billing_address][:street1] = address[:address1] if address[:address1]
                            post[:billing_address][:street2] = address[:address2] if address[:address2]
                  Severity: Minor
                  Found in lib/active_merchant/billing/gateways/conekta.rb - About 3 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_purchases_data has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def add_purchases_data(params, options)
                          return unless options[:purchases]
                  
                          params['purchases'] = []
                  
                  
                  Severity: Minor
                  Found in lib/active_merchant/billing/gateways/priority.rb - About 3 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

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                        RESPONSE_TEXTS = {
                          0 => 'Transaction Approved',
                          400 => 'Cancellation Accepted',
                          481 => 'Cancellation Accepted',
                          500 => 'Reconciliation Accepted',
                  Severity: Major
                  Found in lib/active_merchant/billing/gateways/redsys_rest.rb and 1 other location - About 3 hrs to fix
                  lib/active_merchant/billing/gateways/redsys.rb on lines 104..171

                  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 128.

                  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

                        RESPONSE_TEXTS = {
                          0 => 'Transaction Approved',
                          400 => 'Cancellation Accepted',
                          481 => 'Cancellation Accepted',
                          500 => 'Reconciliation Accepted',
                  Severity: Major
                  Found in lib/active_merchant/billing/gateways/redsys.rb and 1 other location - About 3 hrs to fix
                  lib/active_merchant/billing/gateways/redsys_rest.rb on lines 92..159

                  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 128.

                  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 country.rb has 320 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module ActiveMerchant #:nodoc:
                    class InvalidCountryCodeError < StandardError
                    end
                  
                    class CountryCodeFormatError < StandardError
                  Severity: Minor
                  Found in lib/active_merchant/country.rb - About 3 hrs to fix

                    Class VisanetPeruGateway has 30 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        class VisanetPeruGateway < Gateway
                          include Empty
                          self.display_name = 'VisaNet Peru Gateway'
                          self.homepage_url = 'http://www.visanet.com.pe'
                    
                    
                    Severity: Minor
                    Found in lib/active_merchant/billing/gateways/visanet_peru.rb - About 3 hrs to fix

                      Class MercuryGateway has 30 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class MercuryGateway < Gateway
                            URLS = {
                              test: 'https://w1.mercurycert.net/ws/ws.asmx',
                              live: 'https://w1.mercurypay.com/ws/ws.asmx'
                            }
                      Severity: Minor
                      Found in lib/active_merchant/billing/gateways/mercury.rb - About 3 hrs to fix

                        Class XpayGateway has 30 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                            class XpayGateway < Gateway
                              self.display_name = 'XPay Gateway'
                              self.homepage_url = 'https://developer.nexi.it/en'
                        
                              self.test_url = 'https://xpaysandbox.nexigroup.com/api/phoenix-0.0/psp/api/v1/'
                        Severity: Minor
                        Found in lib/active_merchant/billing/gateways/xpay.rb - About 3 hrs to fix

                          Class OmiseGateway has 30 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class OmiseGateway < Gateway
                                API_URL     = 'https://api.omise.co/'
                                VAULT_URL   = 'https://vault.omise.co/'
                          
                                STANDARD_ERROR_CODE_MAPPING = {
                          Severity: Minor
                          Found in lib/active_merchant/billing/gateways/omise.rb - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language