activemerchant/active_merchant

View on GitHub

Showing 1,478 of 1,478 total issues

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

    class TrexleGateway < Gateway
      self.test_url = 'https://core.trexle.com/api/v1'
      self.live_url = 'https://core.trexle.com/api/v1'

      self.default_currency = 'USD'
Severity: Minor
Found in lib/active_merchant/billing/gateways/trexle.rb - About 2 hrs to fix

    File securion_pay.rb has 270 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module ActiveMerchant #:nodoc:
      module Billing #:nodoc:
        class SecurionPayGateway < Gateway
          self.test_url = 'https://api.securionpay.com/'
          self.live_url = 'https://api.securionpay.com/'
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/securion_pay.rb - About 2 hrs to fix

      File monei.rb has 270 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'nokogiri'
      
      module ActiveMerchant #:nodoc:
        module Billing #:nodoc:
          #
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/monei.rb - About 2 hrs to fix

        File iats_payments.rb has 269 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module ActiveMerchant #:nodoc:
          module Billing #:nodoc:
            class IatsPaymentsGateway < Gateway
              class_attribute :live_na_url, :live_uk_url
        
        
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/iats_payments.rb - About 2 hrs to fix

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

              4 => {
                authorize: %w(protocol msgtype merchant ordernumber amount
                              currency autocapture cardnumber expirationdate cvd
                              cardtypelock testmode fraud_remote_addr
                              fraud_http_accept fraud_http_accept_language
          lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb on lines 53..79
          lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb on lines 81..108

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

          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 3 locations. Consider refactoring.
          Open

              5 => {
                authorize: %w(protocol msgtype merchant ordernumber amount
                              currency autocapture cardnumber expirationdate cvd
                              cardtypelock testmode fraud_remote_addr
                              fraud_http_accept fraud_http_accept_language
          lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb on lines 25..51
          lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb on lines 81..108

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

          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

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

                def build_request(action, body)
                  xml = Builder::XmlMarkup.new
                  xml.instruct!
                  xml.tag! 'SecurePayMessage' do
                    xml.tag! 'MessageInfo' do
          Severity: Major
          Found in lib/active_merchant/billing/gateways/secure_pay_au.rb and 1 other location - About 2 hrs to fix
          lib/active_merchant/billing/gateways/nab_transact.rb on lines 141..169

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

          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

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

                def build_request(action, body)
                  xml = Builder::XmlMarkup.new
                  xml.instruct!
                  xml.tag! 'NABTransactMessage' do
                    xml.tag! 'MessageInfo' do
          Severity: Major
          Found in lib/active_merchant/billing/gateways/nab_transact.rb and 1 other location - About 2 hrs to fix
          lib/active_merchant/billing/gateways/secure_pay_au.rb on lines 152..180

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

          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 3 locations. Consider refactoring.
          Open

              6 => {
                authorize: %w(protocol msgtype merchant ordernumber amount
                              currency autocapture cardnumber expirationdate cvd
                              cardtypelock testmode fraud_remote_addr
                              fraud_http_accept fraud_http_accept_language
          lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb on lines 25..51
          lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb on lines 53..79

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

          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

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

                def add_d3d(post, options)
                  add_pair post, 'FLAG3D', 'Y'
                  win_3ds = THREE_D_SECURE_DISPLAY_WAYS.key?(options[:win_3ds]) ?
                    THREE_D_SECURE_DISPLAY_WAYS[options[:win_3ds]] :
                    THREE_D_SECURE_DISPLAY_WAYS[:main_window]
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/ogone.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

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

                def parse(body)
                  response = {}
          
                  root = REXML::Document.new(body).root
          
          
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/cecabank/cecabank_xml.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

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

                def add_address(doc, address)
                  return unless address
          
                  doc.companyName(address[:company]) unless address[:company].blank?
                  doc.addressLine1(truncate(address[:address1], 35)) unless address[:address1].blank?
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/litle.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

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

                def add_sub_merchant_data(xml, options)
                  xml.subMerchantData do
                    xml.pfId options[:pf_id] if options[:pf_id]
                    xml.subName options[:sub_name] if options[:sub_name]
                    xml.subId options[:sub_id] if options[:sub_id]
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/worldpay.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

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

                def add_rooms(lodging_options)
                  rooms = []
                  lodging_options[:rooms]&.each do |item|
                    room = {}
                    room['dailyRoomRate'] = item[:daily_room_rate] if item[:daily_room_rate]
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/global_collect.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

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

                def add_three_d_secure(xml, options)
                  three_d_secure = options[:three_d_secure]
                  xml.tag! 'ThreeDSecureRequest' do
                    xml.tag! 'MpiVendor3ds', 'Y'
                    xml.tag! 'AuthStatus3ds', three_d_secure[:authentication_response_status] || three_d_secure[:trans_status] if three_d_secure[:authentication_response_status] || three_d_secure[:trans_status]
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/paypal.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

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

                def store(creditcard, options = {})
                  post = {}
                  post[:client_id] = @options[:client_id]
                  post[:user_name] = "#{creditcard.first_name} #{creditcard.last_name}"
                  post[:email] = options[:email] || 'unspecified@example.com'
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/wepay.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

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

                def add_product_data(post, money, options)
                  post[:account_id] = @options[:account_id]
                  post[:amount] = amount(money)
                  post[:short_description] = (options[:description] || 'Purchase')
                  post[:type] = (options[:type] || 'goods')
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/wepay.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

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

                def add_credit_card(xml, payment, options = {}, credit_envelope = 'v1')
                  if payment&.is_a?(CreditCard)
                    requires!(options.merge!({ card_number: payment.number, month: payment.month, year: payment.year }), :card_number, :month, :year)
          
                    xml.tag!("#{credit_envelope}:CreditCardData") do
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/ipg.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

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

                def add_customer_details(post, payment, options)
                  if address = options[:billing_address] || options[:address]
                    post[:sg_FirstName] = payment.first_name if payment.respond_to?(:first_name)
                    post[:sg_LastName] = payment.last_name if payment.respond_to?(:last_name)
                    post[:sg_Address] = address[:address1] if address[:address1]
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/safe_charge.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

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

                def create_post_for_auth_or_purchase(token, money, options)
                  {
                    'token' => token,
                    'orderDescription' => options[:description] || 'Worldpay Order',
                    'amount' => money,
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/worldpay_online_payments.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

          Severity
          Category
          Status
          Source
          Language