activemerchant/active_merchant

View on GitHub

Showing 1,450 of 1,450 total issues

Class IpgGateway has 42 methods (exceeds 20 allowed). Consider refactoring.
Open

    class IpgGateway < Gateway
      self.test_url = 'https://test.ipg-online.com/ipgapi/services'
      self.live_url = 'https://www5.ipg-online.com/ipgapi/services'

      self.supported_countries = %w(AR)
Severity: Minor
Found in lib/active_merchant/billing/gateways/ipg.rb - About 5 hrs to fix

    Method add_address has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_address(xml, payment_method, address, options, shipTo = false)
            first_name, last_name = address_names(address[:name], payment_method)
            bill_to_merchant_tax_id = options[:merchant_tax_id] unless shipTo
    
            xml.tag! shipTo ? 'shipTo' : 'billTo' do
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/cyber_source.rb - About 5 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 AirwallexGateway has 41 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class AirwallexGateway < Gateway
          self.test_url = 'https://api-demo.airwallex.com/api/v1'
          self.live_url = 'https://pci-api.airwallex.com/api/v1'
    
          # per https://www.airwallex.com/docs/online-payments__overview, cards are accepted in all EU countries
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/airwallex.rb - About 5 hrs to fix

      Identical blocks of code found in 2 locations. 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: Major
      Found in lib/active_merchant/billing/gateways/decidir.rb and 1 other location - About 5 hrs to fix
      lib/active_merchant/billing/gateways/decidir_plus.rb on lines 138..158

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

      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_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: Major
      Found in lib/active_merchant/billing/gateways/decidir_plus.rb and 1 other location - About 5 hrs to fix
      lib/active_merchant/billing/gateways/decidir.rb on lines 221..241

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

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

      module ActiveMerchant #:nodoc:
        module Billing #:nodoc:
          module BeanstreamCore
            include Empty
      
      
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb - About 5 hrs to fix

        File pay_trace.rb has 393 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module ActiveMerchant #:nodoc:
          module Billing #:nodoc:
            class PayTraceGateway < Gateway
              self.test_url = 'https://api.sandbox.paytrace.com'
              self.live_url = 'https://api.paytrace.com'
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/pay_trace.rb - About 5 hrs to fix

          Method add_line_items has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_line_items(post, options)
                  return unless options[:line_items]
          
                  line_items = []
                  options[:line_items].each do |li|
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/pay_trace.rb - About 5 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 has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_transaction(xml, money, options = {})
                  xml.transaction do
                    xml.ReversalType options[:reversal_type] if options[:reversal_type]
                    xml.TransactionID options[:trans_id] if options[:trans_id]
                    xml.TransactionAmount amount(money.to_i) if money
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/element.rb - About 5 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 MercadoPagoGateway has 40 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class MercadoPagoGateway < Gateway
                self.live_url = self.test_url = 'https://api.mercadopago.com/v1'
          
                self.supported_countries = %w[AR BR CL CO MX PE UY]
                self.supported_cardtypes = %i[visa master american_express elo cabal naranja creditel]
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/mercado_pago.rb - About 5 hrs to fix

            Method build_check_request has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

                  def build_check_request(action, money, check, options)
                    xml = Builder::XmlMarkup.new
                    xml.tag! TRANSACTIONS[action] do
                      xml.tag! 'PayData' do
                        xml.tag! 'Invoice' do
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/payflow.rb - About 5 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_submerchant has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

                  def add_submerchant(post, options)
                    if submerchant = options[:submerchant]
                      post[:SubMerchant] = {}
                      post[:SubMerchant][:Merchant_Category_Code] = submerchant[:merchant_category_code] if submerchant[:merchant_category_code]
                      post[:SubMerchant][:Payment_Facilitator_Code] = submerchant[:payment_facilitator_code] if submerchant[:payment_facilitator_code]
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/mundipagg.rb - About 5 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 payflow.rb has 384 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'nokogiri'
            require 'active_merchant/billing/gateways/payflow/payflow_common_api'
            require 'active_merchant/billing/gateways/payflow/payflow_response'
            require 'active_merchant/billing/gateways/payflow_express'
            
            
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/payflow.rb - About 5 hrs to fix

              Class MonerisGateway has 39 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class MonerisGateway < Gateway
                    WALLETS = %w(APP GPP)
              
                    self.test_url = 'https://esqa.moneris.com/gateway2/servlet/MpgRequest'
                    self.live_url = 'https://www3.moneris.com/gateway2/servlet/MpgRequest'
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/moneris.rb - About 5 hrs to fix

                File jetpay_v2.rb has 380 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module ActiveMerchant #:nodoc:
                  module Billing #:nodoc:
                    class JetpayV2Gateway < Gateway
                      self.test_url = 'https://test1.jetpay.com/jetpay'
                      self.live_url = 'https://gateway20.jetpay.com/jetpay'
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/jetpay_v2.rb - About 5 hrs to fix

                  File blue_pay.rb has 379 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'digest/md5'
                  
                  module ActiveMerchant #:nodoc:
                    module Billing #:nodoc:
                      class BluePayGateway < Gateway
                  Severity: Minor
                  Found in lib/active_merchant/billing/gateways/blue_pay.rb - About 5 hrs to fix

                    Method add_pay_data has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def add_pay_data(xml, money, options)
                            xml.tag! 'PayData' do
                              xml.tag! 'Invoice' do
                                xml.tag! 'CustIP', options[:ip] unless options[:ip].blank?
                                xml.tag! 'InvNum', options[:order_id] unless options[:order_id].blank?
                    Severity: Minor
                    Found in lib/active_merchant/billing/gateways/payflow_express.rb - About 5 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_payment_details has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def add_payment_details(xml, money, currency_code, options = {})
                            xml.tag! 'n2:PaymentDetails' do
                              xml.tag! 'n2:OrderTotal', localized_amount(money, currency_code), 'currencyID' => currency_code
                    
                              # All of the values must be included together and add up to the order total
                    Severity: Minor
                    Found in lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb - About 5 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 OgoneGateway has 38 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        class OgoneGateway < Gateway
                          CVV_MAPPING = { 'OK' => 'M',
                                          'KO' => 'N',
                                          'NO' => 'P' }
                    
                    
                    Severity: Minor
                    Found in lib/active_merchant/billing/gateways/ogone.rb - About 5 hrs to fix

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

                          class PayTraceGateway < Gateway
                            self.test_url = 'https://api.sandbox.paytrace.com'
                            self.live_url = 'https://api.paytrace.com'
                      
                            self.supported_countries = ['US']
                      Severity: Minor
                      Found in lib/active_merchant/billing/gateways/pay_trace.rb - About 5 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language