Shopify/active_merchant

View on GitHub
lib/active_merchant/billing/gateways/netbanx.rb

Summary

Maintainability
C
1 day
Test Coverage

Class NetbanxGateway has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

    class NetbanxGateway < Gateway
      # Netbanx is the new REST based API for Optimal Payments / Paysafe
      self.test_url = 'https://api.test.netbanx.com/'
      self.live_url = 'https://api.netbanx.com/'

Severity: Minor
Found in lib/active_merchant/billing/gateways/netbanx.rb - About 4 hrs to fix

    File netbanx.rb has 294 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module ActiveMerchant #:nodoc:
      module Billing #:nodoc:
        class NetbanxGateway < Gateway
          # Netbanx is the new REST based API for Optimal Payments / Paysafe
          self.test_url = 'https://api.test.netbanx.com/'
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/netbanx.rb - About 3 hrs to fix

      Method error_code_from has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def error_code_from(response)
              unless success_from(response)
                case response['errorCode']
                when '3002' then STANDARD_ERROR_CODE[:invalid_number] # You submitted an invalid card number or brand or combination of card number and brand with your request.
                when '3004' then STANDARD_ERROR_CODE[:incorrect_zip] # The zip/postal code must be provided for an AVS check request.
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/netbanx.rb - About 1 hr to fix

        Method commit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def commit(method, uri, parameters)
                params = parameters.to_json unless parameters.nil?
                response =
                  begin
                    if method == :get
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/netbanx.rb - About 35 mins 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 refund has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def refund(money, authorization, options = {})
                # If the transactions that are pending, API call needs to be Cancellation
                settlement_data = get_settlement(authorization)
                return settlement_data if settlement_data.message != 'OK'
        
        
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/netbanx.rb - About 35 mins 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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_payment(post, credit_card_reference, options = {})
                post[:card] ||= {}
                if credit_card_reference.is_a?(String)
                  post[:card][:paymentToken] = credit_card_reference
                else
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/netbanx.rb - About 25 mins 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

        There are no issues that match your filters.

        Category
        Status