activemerchant/active_merchant

View on GitHub

Showing 999 of 1,496 total issues

Class StripeGateway has 75 methods (exceeds 20 allowed). Consider refactoring.
Open

    class StripeGateway < Gateway
      self.live_url = 'https://api.stripe.com/v1/'

      # Docs on AVS codes: https://en.wikipedia.org/w/index.php?title=Address_verification_service&_ga=2.97570079.1027215965.1655989706-2008268124.1655989706#AVS_response_codes
      # possible response values: https://stripe.com/docs/api/payment_methods/object#payment_method_object-card-checks
Severity: Major
Found in lib/active_merchant/billing/gateways/stripe.rb - About 1 day to fix

    Class BraintreeBlueGateway has 74 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class BraintreeBlueGateway < Gateway
          include BraintreeCommon
          include Empty
    
          self.display_name = 'Braintree (Blue Platform)'
    Severity: Major
    Found in lib/active_merchant/billing/gateways/braintree_blue.rb - About 1 day to fix

      Method build_reference_sale_or_authorization_request has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
      Open

            def build_reference_sale_or_authorization_request(action, money, reference, 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 1 day 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 checkout_v2.rb has 601 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module ActiveMerchant #:nodoc:
        module Billing #:nodoc:
          class CheckoutV2Gateway < Gateway
            self.display_name = 'Checkout.com Unified Payments'
            self.homepage_url = 'https://www.checkout.com/'
      Severity: Major
      Found in lib/active_merchant/billing/gateways/checkout_v2.rb - About 1 day to fix

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

              def add_address(xml, options)
                address = address = options[:billing_address] || options[:address]
                shipping_address = options[:shipping_address]
        
                if address || shipping_address
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/vantiv_express.rb - About 1 day 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 stripe_payment_intents.rb has 582 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'active_support/core_ext/hash/slice'
        
        module ActiveMerchant #:nodoc:
          module Billing #:nodoc:
            # This gateway uses the current Stripe {Payment Intents API}[https://stripe.com/docs/api/payment_intents].
        Severity: Major
        Found in lib/active_merchant/billing/gateways/stripe_payment_intents.rb - About 1 day to fix

          File redsys.rb has 562 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'nokogiri'
          
          module ActiveMerchant #:nodoc:
            module Billing #:nodoc:
              # = Redsys Merchant Gateway
          Severity: Major
          Found in lib/active_merchant/billing/gateways/redsys.rb - About 1 day to fix

            Class StripePaymentIntentsGateway has 64 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class StripePaymentIntentsGateway < StripeGateway
                  ALLOWED_METHOD_STATES = %w[automatic manual].freeze
                  ALLOWED_CANCELLATION_REASONS = %w[duplicate fraudulent requested_by_customer abandoned].freeze
                  CREATE_INTENT_ATTRIBUTES = %i[description statement_descriptor_suffix statement_descriptor receipt_email save_payment_method]
                  CONFIRM_INTENT_ATTRIBUTES = %i[receipt_email return_url save_payment_method setup_future_usage off_session]
            Severity: Major
            Found in lib/active_merchant/billing/gateways/stripe_payment_intents.rb - About 1 day to fix

              File authorize_net_cim.rb has 554 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module ActiveMerchant #:nodoc:
                module Billing #:nodoc:
                  # ==== Customer Information Manager (CIM)
                  #
                  # The Authorize.Net Customer Information Manager (CIM) is an optional additional service that allows you to store sensitive payment information on
              Severity: Major
              Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb - About 1 day to fix

                Method parameters has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                Open

                      def parameters(money, creditcard, options = {})
                        params = {
                          payment: {
                            subtotal: amount(options[:subtotal]),
                            tax: amount(options[:tax]),
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/linkpoint.rb - About 1 day 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 litle.rb has 544 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'nokogiri'
                
                module ActiveMerchant #:nodoc:
                  module Billing #:nodoc:
                    class LitleGateway < Gateway
                Severity: Major
                Found in lib/active_merchant/billing/gateways/litle.rb - About 1 day to fix

                  Method add_lodging has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def add_lodging(xml, options)
                          if options[:lodging]
                            lodging = parse_lodging(options[:lodging])
                            xml.ExtendedParameters do
                              xml.Lodging do
                  Severity: Minor
                  Found in lib/active_merchant/billing/gateways/vantiv_express.rb - About 1 day 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_change_profile_request has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def build_change_profile_request(profile_id, options)
                          xml = Builder::XmlMarkup.new :indent => 2
                          xml.tag! 'UpdateRecurringPaymentsProfileReq', 'xmlns' => PAYPAL_NAMESPACE do
                            xml.tag! 'UpdateRecurringPaymentsProfileRequest', 'xmlns:n2' => EBAY_NAMESPACE do
                              xml.tag! 'n2:Version', API_VERSION
                  Severity: Minor
                  Found in lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb - About 1 day 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 blue_snap.rb has 537 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'nokogiri'
                  
                  module ActiveMerchant
                    module Billing
                      class BlueSnapGateway < Gateway
                  Severity: Major
                  Found in lib/active_merchant/billing/gateways/blue_snap.rb - About 1 day to fix

                    Method parameters has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def parameters(money, creditcard, options = {})
                            params = {
                              # General order parameters
                              StoreID: @options[:login],
                              Passphrase: @options[:password],
                    Severity: Minor
                    Found in lib/active_merchant/billing/gateways/psigate.rb - About 1 day 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 CheckoutV2Gateway has 59 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 1 day to fix

                      File trans_first_transaction_express.rb has 509 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'nokogiri'
                      
                      module ActiveMerchant #:nodoc:
                        module Billing #:nodoc:
                          class TransFirstTransactionExpressGateway < Gateway

                        File global_collect.rb has 508 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        module ActiveMerchant #:nodoc:
                          module Billing #:nodoc:
                            class GlobalCollectGateway < Gateway
                              class_attribute :preproduction_url
                              class_attribute :ogone_direct_test
                        Severity: Major
                        Found in lib/active_merchant/billing/gateways/global_collect.rb - About 1 day to fix

                          Method add_line_item_information_for_level_three_visa has a Cognitive Complexity of 52 (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.itemDescription(line_item[:item_description]) if line_item[:item_description]
                          Severity: Minor
                          Found in lib/active_merchant/billing/gateways/litle.rb - About 1 day 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 AuthorizeNetCimGateway has 56 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class AuthorizeNetCimGateway < Gateway
                                self.test_url = 'https://apitest.authorize.net/xml/v1/request.api'
                                self.live_url = 'https://api2.authorize.net/xml/v1/request.api'
                          
                                AUTHORIZE_NET_CIM_NAMESPACE = 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'
                          Severity: Major
                          Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb - About 1 day to fix
                            Severity
                            Category
                            Status
                            Source
                            Language