activemerchant/active_merchant

View on GitHub

Showing 1,501 of 1,501 total issues

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

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

          def authorize(money, payment_method, options = {})
            post = {}
            add_amount(post, money)
            post[:description] = options[:description]
            add_common_params(post, options)
    Severity: Major
    Found in lib/active_merchant/billing/gateways/balanced.rb and 1 other location - About 1 hr to fix
    lib/active_merchant/billing/gateways/balanced.rb on lines 40..54

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

    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

              post[:payment][:responsible] = {}
              post[:payment][:responsible][:name] = options[:responsible_name] if options[:responsible_name]
              post[:payment][:responsible][:document] = options[:responsible_document] if options[:responsible_document]
              post[:payment][:responsible][:birth_date] = options[:responsible_birth_date] if options[:responsible_birth_date]
    Severity: Major
    Found in lib/active_merchant/billing/gateways/ebanx.rb and 1 other location - About 1 hr to fix
    lib/active_merchant/billing/gateways/checkout_v2.rb on lines 246..249

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

    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

              post[:sender][:identification] = {}
              post[:sender][:identification][:type] = identification[:type] if identification[:type]
              post[:sender][:identification][:number] = identification[:number] if identification[:number]
              post[:sender][:identification][:issuing_country] = identification[:issuing_country] if identification[:issuing_country]
    Severity: Major
    Found in lib/active_merchant/billing/gateways/checkout_v2.rb and 1 other location - About 1 hr to fix
    lib/active_merchant/billing/gateways/ebanx.rb on lines 166..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 49.

    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 purchase_swipe(money, paysource, options = {})
            money = amount(money)
            case normalize(paysource)
            when /1$/, AUTHORIZATION
              Response.new(true, SUCCESS_MESSAGE, { paid_amount: money }, test: true, authorization: AUTHORIZATION)
    Severity: Major
    Found in lib/active_merchant/billing/gateways/bogus.rb and 1 other location - About 1 hr to fix
    lib/active_merchant/billing/gateways/bogus.rb on lines 133..141

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

    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

            doc.detailTax do
              doc.taxIncludedInTotal(level_3_data[:tax_included_in_total]) if level_3_data[:tax_included_in_total]
              doc.taxAmount(level_3_data[:tax_amount]) if level_3_data[:tax_amount]
              doc.taxRate(level_3_data[:tax_rate]) if level_3_data[:tax_rate]
              doc.taxTypeIdentifier(level_3_data[:tax_type_identifier]) if level_3_data[:tax_type_identifier]
    Severity: Major
    Found in lib/active_merchant/billing/gateways/litle.rb and 1 other location - About 1 hr to fix
    lib/active_merchant/billing/gateways/litle.rb on lines 123..128

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

    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

                doc.detailTax do
                  doc.taxIncludedInTotal(line_item[:tax_included_in_total]) if line_item[:tax_included_in_total]
                  doc.taxAmount(line_item[:tax_amount]) if line_item[:tax_amount]
                  doc.taxRate(line_item[:tax_rate]) if line_item[:tax_rate]
                  doc.taxTypeIdentifier(line_item[:tax_type_identifier]) if line_item[:tax_type_identifier]
    Severity: Major
    Found in lib/active_merchant/billing/gateways/litle.rb and 1 other location - About 1 hr to fix
    lib/active_merchant/billing/gateways/litle.rb on lines 81..86

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

    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 authorize_swipe(money, paysource, options = {})
            money = amount(money)
            case normalize(paysource)
            when /1$/, AUTHORIZATION
              Response.new(true, SUCCESS_MESSAGE, { authorized_amount: money }, test: true, authorization: AUTHORIZATION)
    Severity: Major
    Found in lib/active_merchant/billing/gateways/bogus.rb and 1 other location - About 1 hr to fix
    lib/active_merchant/billing/gateways/bogus.rb on lines 157..165

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

    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 purchase(money, payment_method, options = {})
            post = {}
            add_amount(post, money)
            post[:description] = options[:description]
            add_common_params(post, options)
    Severity: Major
    Found in lib/active_merchant/billing/gateways/balanced.rb and 1 other location - About 1 hr to fix
    lib/active_merchant/billing/gateways/balanced.rb on lines 58..72

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

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

              Method add_credit_card_to_customer has 26 lines of code (exceeds 25 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

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

                      def recurring(money, creditcard, options = {})
                        ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
                
                        requires!(options, %i[periodicity bimonthly monthly biweekly weekly yearly daily])
                
                
                Severity: Minor
                Found in lib/active_merchant/billing/gateways/trust_commerce.rb - About 1 hr to fix

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

                        def add_address(post, creditcard, options)
                          if address = options[:billing_address] || options[:address]
                            post[:ownerName] = address[:name]
                            post[:ownerStreet] = address[:address1]
                            post[:ownerCity] = address[:city]
                  lib/active_merchant/billing/gateways/cenpos.rb on lines 115..122
                  lib/active_merchant/billing/gateways/latitude19.rb on lines 193..200

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

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

                        def add_customer_data(params, options)
                          if (billing_address = options[:billing_address] || options[:address])
                            params[:address1] = billing_address[:address1]
                            params[:address2] = billing_address[:address2]
                            params[:city] = billing_address[:city]
                  Severity: Major
                  Found in lib/active_merchant/billing/gateways/latitude19.rb and 2 other locations - About 1 hr to fix
                  lib/active_merchant/billing/gateways/cenpos.rb on lines 115..122
                  lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb on lines 90..97

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

                  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

                        ISSUER_RESPONSE_CODES = {
                          '00' => 'Approved',
                          '01' => 'Refer to Card Issuer',
                          '02' => 'Refer to Card Issuer',
                          '03' => 'Invalid Merchant',
                  Severity: Major
                  Found in lib/active_merchant/billing/gateways/migs/migs_codes.rb and 1 other location - About 1 hr to fix
                  lib/active_merchant/billing/gateways/migs/migs_codes.rb on lines 4..27

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

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

                        def add_customer_data(post, options)
                          if (billing_address = (options[:billing_address] || options[:address]))
                            post[:CustomerEmailAddress] = billing_address[:email]
                            post[:CustomerPhone] = billing_address[:phone]
                            post[:CustomerBillingAddress] = billing_address[:address1]
                  Severity: Major
                  Found in lib/active_merchant/billing/gateways/cenpos.rb and 2 other locations - About 1 hr to fix
                  lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb on lines 90..97
                  lib/active_merchant/billing/gateways/latitude19.rb on lines 193..200

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language