activemerchant/active_merchant

View on GitHub

Showing 1,005 of 1,501 total issues

Method add_sub_merchant has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def add_sub_merchant(xml, submerchant)
        xml.tag!('v1:SubMerchant') do
          xml.tag!('v1:Mcc', submerchant[:mcc]) if submerchant[:mcc]
          xml.tag!('v1:LegalName', submerchant[:legal_name]) if submerchant[:legal_name]
          add_address(xml, submerchant[:address]) if submerchant[:address]
Severity: Minor
Found in lib/active_merchant/billing/gateways/ipg.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 add_invoice has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def add_invoice(post, money, options)
        post[:order_number] = options[:order_id] if options[:order_id].present?

        if options[:item_codes].present?
          codes_and_amounts = options[:item_codes].transform_keys { |key| key.to_s.delete('_') }
Severity: Minor
Found in lib/active_merchant/billing/gateways/cashnet.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 add_invoice has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def add_invoice(xml, money, options)
        xml.AuthCode options[:force] if options[:force]
        if options[:order_items].blank?
          xml.Total(amount(money)) unless money.nil? || money < 0.01
          xml.Description(options[:description]) unless options[:description].blank?
Severity: Minor
Found in lib/active_merchant/billing/gateways/itransact.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 build_request has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def build_request(body, options = {})
        xml = Builder::XmlMarkup.new
        xml.instruct!
        xml.tag! 'XMLPayRequest', 'Timeout' => timeout.to_s, 'version' => '2.1', 'xmlns' => XMLNS do
          xml.tag! 'RequestData' do
Severity: Minor
Found in lib/active_merchant/billing/gateways/payflow/payflow_common_api.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 add_mc_ucafind has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def add_mc_ucafind(xml, credit_card, three_d_secure, options)
        return unless three_d_secure

        if options[:alternate_ucaf_flow]
          return unless %w(4 6 7).include?(three_d_secure[:eci])
Severity: Minor
Found in lib/active_merchant/billing/gateways/orbital.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 add_customer_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def add_customer_data(post, options)
        if options.has_key? :email
          post[:email] = options[:email]
          post[:email_customer] = false
        end
Severity: Minor
Found in lib/active_merchant/billing/gateways/secure_pay.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 add_other_tax has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def add_other_tax(xml, options)
        return unless %i[vat_tax_rate local_tax_amount national_tax_amount national_tax_indicator].any? { |gsf| options.include?(gsf) }

        xml.tag! 'otherTax' do
          xml.tag! 'vatTaxRate', options[:vat_tax_rate] if options[:vat_tax_rate]
Severity: Minor
Found in lib/active_merchant/billing/gateways/cyber_source.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 send_initialize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def send_initialize(amount, is_auth, options = {})
        properties = {
          accountNumber: @options[:account],
          purchaseOperation: is_auth ? 'AUTHORIZATION' : 'SALE',
          price: amount,
Severity: Minor
Found in lib/active_merchant/billing/gateways/payex.rb - About 1 hr to fix

    Method generate_signature has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def generate_signature(action, parameters)
            signature_fields =
              case action
              when CECA_ACTION_REFUND
                options[:signature_key].to_s +
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb - About 1 hr to fix

      Method add_payment_method has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def add_payment_method(post, payment_method)
              case payment_method
              when String
                token, exp_month, exp_year = payment_method.split('|')[2..4]
                card = {
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/datatrans.rb - About 1 hr to fix

        Method commit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def commit(action, request, *success_criteria, options)
                xml = ssl_post(url, request, headers(options))
                raw = parse(action, xml)
        
                if options[:execute_threed]
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/worldpay.rb - About 1 hr to fix

          Method build_mass_pay_request has 27 lines of code (exceeds 25 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 1 hr to fix

            Method add_address has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def add_address(post, creditcard, options)
                    shipping_address = options[:shipping_address]
                    if billing_address = options[:billing_address] || options[:address]
                      post['order']['customer']['billingAddress'] = {
                        'street' => truncate(split_address(billing_address[:address1])[1], 50),
            Severity: Minor
            Found in lib/active_merchant/billing/gateways/global_collect.rb - About 1 hr to fix

              Method commit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def commit(action, params: '', iid: '', card_number: nil, jwt: '')
                      response =
                        begin
                          case action
                          when 'void'
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/priority.rb - About 1 hr to fix

                Method commit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def commit(action, parameters, auth = nil)
                        url = url_for(action, auth)
                        authorization_secret_key = parameters[:authorization_secret_key] if parameters
                        parameters.merge!(parameters[:payment][:credit_card].delete(:card)).delete(:payment) if action == 'store'
                        response = if %w[refund void].include? action
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/mundipagg.rb - About 1 hr to fix

                  Method build_check_request has 26 lines of code (exceeds 25 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 1 hr to fix

                    Method add_payment_sender_data has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def add_payment_sender_data(post, options)
                            return unless options[:sender].is_a?(Hash)
                    
                            sender = options[:sender]
                    
                    
                    Severity: Minor
                    Found in lib/active_merchant/billing/gateways/checkout_v2.rb - About 1 hr to fix

                      Method commit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def commit(action, parameters, options = {})
                              three_ds_errors = validate_three_ds_params(parameters[:three_dsecure]) if parameters[:three_dsecure].present?
                              return three_ds_errors if three_ds_errors
                      
                              url = url(action, parameters, options)
                      Severity: Minor
                      Found in lib/active_merchant/billing/gateways/d_local.rb - About 1 hr to fix

                        Method parse has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def parse(body)
                                results = {}
                                fields = body.split("\r\n")
                        
                                response = fields[1].split('=')
                        Severity: Minor
                        Found in lib/active_merchant/billing/gateways/instapay.rb - About 1 hr to fix

                          Method commit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def commit(action, post, account = 'ws', password = @options[:password])
                                  request = post_data(flatten_hash(post))
                                  request_headers = headers(account, password)
                                  raw_response = ssl_post(build_url(action), request, request_headers)
                                  response = parse(raw_response)
                          Severity: Minor
                          Found in lib/active_merchant/billing/gateways/barclaycard_smartpay.rb - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language