activemerchant/active_merchant

View on GitHub

Showing 999 of 1,496 total issues

Method build_refund_request has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def build_refund_request(money, identification, options)
        xml = Builder::XmlMarkup.new

        xml.tag! 'RefundTransactionReq', 'xmlns' => PAYPAL_NAMESPACE do
          xml.tag! 'RefundTransactionRequest', 'xmlns:n2' => EBAY_NAMESPACE do
Severity: Minor
Found in lib/active_merchant/billing/gateways/paypal/paypal_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 flatten_params has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def flatten_params(flattened, params, prefix = nil)
        params.each do |key, value|
          next if value != false && value.blank?

          flattened_key = prefix.nil? ? key : "#{prefix}[#{key}]"
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe.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 store has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def store(payment_method, options = {})
        params = {}
        # If customer option is provided, create a payment method and attach to customer id
        # Otherwise, create a customer, then attach
        if new_apple_google_pay_flow(payment_method, options)
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe_payment_intents.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 create_transaction_parameters has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def create_transaction_parameters(money, credit_card_or_vault_id, options)
        parameters = {
          amount: localized_amount(money, options[:currency] || default_currency).to_s,
          order_id: options[:order_id],
          customer: {
Severity: Minor
Found in lib/active_merchant/billing/gateways/braintree_blue.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_credit_card_to_customer has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def add_credit_card_to_customer(credit_card, options)
        commit do
          parameters = {
            customer_id: options[:customer],
            token: options[:credit_card_token],
Severity: Minor
Found in lib/active_merchant/billing/gateways/braintree_blue.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_shipping has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def add_shipping(post, options = {})
        return post unless options.key?(:shipping_address)

        shipping = options[:shipping_address]
        post[:meta][:shipping_info] = {}
Severity: Minor
Found in lib/active_merchant/billing/gateways/deepstack.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_payment_method has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def add_payment_method(post, payment_method, options)
        if payment_method.is_a?(String)
          brand, token = split_authorization(payment_method)
          credit_card = {}
          credit_card[:securityCode] = options[:cvv] if options[:cvv]
Severity: Minor
Found in lib/active_merchant/billing/gateways/payu_latam.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_product_details has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def add_product_details(post, options)
        return unless options[:product_details]

        product_items_array = []
        options[:product_details].each do |item|
Severity: Minor
Found in lib/active_merchant/billing/gateways/kushki.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 ensure_credentials has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def ensure_credentials(try_again = true)
        multiresp = MultiResponse.new
        access_token = @options[:access_token]
        key = @options[:encryption_key]
        uuid = @options[:encryption_uuid]
Severity: Minor
Found in lib/active_merchant/billing/gateways/alelo.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_three_d_secure has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def add_three_d_secure(xml, three_d_secure)
        xml.tag!('v1:CreditCard3DSecure') do
          xml.tag!('v1:AuthenticationValue', three_d_secure[:cavv]) if three_d_secure[:cavv]
          xml.tag!('v1:XID', three_d_secure[:xid]) if three_d_secure[:xid]
          xml.tag!('v1:Secure3D2TransactionStatus', three_d_secure[:directory_response_status]) if three_d_secure[:directory_response_status]
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_transaction_control has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def add_transaction_control(xml, options)
        xml.TransactionControl {
          # if there was a 'global' option set...
          xml.TestMode(@options[:test_mode].upcase) if !@options[:test_mode].blank?
          # allow the global option to be overridden...
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 add_address has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def add_address(xml, address)
        xml.tag!('v1:Address') do
          xml.tag!('v1:Address1', address[:address1]) if address[:address1]
          xml.tag!('v1:Address2', address[:address2]) if address[:address2]
          xml.tag!('v1:Zip', address[:zip]) if address[:zip]
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_ecp_details has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def add_ecp_details(xml, payment_source, parameters = {})
        requires!(payment_source.account_number) if parameters[:auth_method]&.eql?('A') || parameters[:auth_method]&.eql?('P')
        xml.tag! :ECPActionCode, parameters[:action_code] if parameters[:action_code]
        xml.tag! :ECPCheckSerialNumber, payment_source.account_number if parameters[:auth_method]&.eql?('A') || parameters[:auth_method]&.eql?('P')
        if parameters[:auth_method]&.eql?('P')
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_stored_credential_options has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def add_stored_credential_options(xml, options = {})
        return unless options[:stored_credential] || options[:stored_credential_overrides]

        stored_credential_subsequent_auth_first = 'true' if cardholder_or_initiated_transaction?(options)
        stored_credential_transaction_id = options.dig(:stored_credential, :network_transaction_id) if options.dig(:stored_credential, :initiator) == 'merchant'
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 parse_element has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_element(reply, node)
        if node.has_elements?
          node.elements.each { |e| parse_element(reply, e) }
        else
          if /item/.match?(node.parent.name)
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 add_merchant_description has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def add_merchant_description(xml, options)
        return unless options[:merchant_descriptor_name] || options[:merchant_descriptor_address1] || options[:merchant_descriptor_locality]

        xml.tag! 'merchantInformation' do
          xml.tag! 'merchantDescriptor' do
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 add_payment_method has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def add_payment_method(doc, payment_method, options)
        if payment_method.is_a?(String)
          doc.token do
            doc.litleToken(payment_method)
            doc.expDate(format_exp_date(options[:basis_expiration_month], options[:basis_expiration_year])) if options[:basis_expiration_month] && options[:basis_expiration_year]
Severity: Minor
Found in lib/active_merchant/billing/gateways/litle.rb - About 1 hr to fix

    Method add_customer_with_credit_card has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def add_customer_with_credit_card(creditcard, options)
            commit do
              if options[:payment_method_nonce]
                credit_card_params = { payment_method_nonce: options[:payment_method_nonce] }
              else
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/braintree_blue.rb - About 1 hr to fix

      Method add_credit_card has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def add_credit_card(xml, credit_card, address)
              xml.tag! :Card do
                # DataCash calls the CC number 'pan'
                xml.tag! :pan, credit_card.number
                xml.tag! :expirydate, format_date(credit_card.month, credit_card.year)
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/data_cash.rb - About 1 hr to fix

        Method add_customer_data has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def add_customer_data(post, payment_method, options)
                billing = {}
                shipping = {}
                customer = {}
                device = {}
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/mastercard.rb - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language