activemerchant/active_merchant

View on GitHub

Showing 1,501 of 1,501 total issues

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

      def add_sub_payments(post, options)
        # sub_payments field is required for purchase transactions, even if empty
        post[:sub_payments] = []

        return unless sub_payments = options[:sub_payments]
Severity: Minor
Found in lib/active_merchant/billing/gateways/decidir.rb and 1 other location - About 40 mins to fix
lib/active_merchant/billing/gateways/decidir_plus.rb on lines 161..173

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

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(amount, payment_method, options)
        commit('purchase', amount, options) do |xml|
          add_credentials(xml, options)
          add_invoice(xml, amount, options)
          add_track_id(xml, options[:order_id] || generate_unique_id)
Severity: Minor
Found in lib/active_merchant/billing/gateways/checkout.rb and 1 other location - About 40 mins to fix
lib/active_merchant/billing/gateways/checkout.rb on lines 46..55

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

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(amount, payment_method, options = {})
        post = {}
        add_invoice(post, amount, options)
        add_customer_vault_data(post, options)
        add_payment_method(post, payment_method, options)
Severity: Minor
Found in lib/active_merchant/billing/gateways/nmi.rb and 1 other location - About 40 mins to fix
lib/active_merchant/billing/gateways/nmi.rb on lines 34..46

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

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

Consider simplifying this complex logical expression.
Open

        elsif response['error_type']
          response['error_type'] + ': ' + response['error_codes'].first
        else
          response_summary = response['response_summary'] || response.dig('actions', 0, 'response_summary')
          response_summary || response['response_code'] || response['status'] || response['message'] || 'Unable to read error message'
Severity: Major
Found in lib/active_merchant/billing/gateways/checkout_v2.rb - About 40 mins to fix

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

            {
              browserAcceptHeader: browser_info[:accept_header],
              browserUserAgent: browser_info[:user_agent],
              browserJavaEnabled: browser_info[:java],
              browserJavascriptEnabled: browser_info[:java],
    Severity: Major
    Found in lib/active_merchant/billing/gateways/redsys_rest.rb and 3 other locations - About 40 mins to fix
    lib/active_merchant/billing/gateways/datatrans.rb on lines 146..156
    lib/active_merchant/billing/gateways/flex_charge.rb on lines 134..144
    lib/active_merchant/billing/gateways/linkpoint.rb on lines 361..371

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

    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, options = {})
            MultiResponse.run do |r|
              r.process { commit('tokenize', 'card_tokens', card_token_request(money, payment, options)) }
              options[:card_token] = r.authorization.split('|').first
              r.process { commit('purchase', 'payments', purchase_request(money, payment, options)) }
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/mercado_pago.rb and 1 other location - About 40 mins to fix
    lib/active_merchant/billing/gateways/mercado_pago.rb on lines 26..30

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

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

          def add_duty(xml, duty)
            xml.tag!('duty') do
              xml.tag!('amount', duty[:amount]) if duty[:amount]
              xml.tag!('name', duty[:name]) if duty[:name]
              xml.tag!('description', duty[:description]) if duty[:description]
    Severity: Major
    Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb and 3 other locations - About 40 mins to fix
    lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 704..708
    lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 720..724
    lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 728..732

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

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

          def add_order(xml, order)
            xml.tag!('order') do
              xml.tag!('invoiceNumber', order[:invoice_number]) if order[:invoice_number]
              xml.tag!('description', order[:description]) if order[:description]
              xml.tag!('purchaseOrderNumber', order[:purchase_order_number]) if order[:purchase_order_number]
    Severity: Major
    Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb and 3 other locations - About 40 mins to fix
    lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 704..708
    lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 712..716
    lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 720..724

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

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

            post[:threeDSecure] = {
              threeDsVersion: three_d_secure[:version],
              EcommerceIndicator: three_d_secure[:eci],
              authenticationValue: three_d_secure[:cavv],
              directoryServerTransactionId:  three_d_secure[:ds_transaction_id],
    Severity: Major
    Found in lib/active_merchant/billing/gateways/flex_charge.rb and 3 other locations - About 40 mins to fix
    lib/active_merchant/billing/gateways/datatrans.rb on lines 146..156
    lib/active_merchant/billing/gateways/linkpoint.rb on lines 361..371
    lib/active_merchant/billing/gateways/redsys_rest.rb on lines 311..321

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

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

              telecheck: {
                routing: options[:telecheck_routing],
                account: options[:telecheck_account],
                checknumber: options[:telecheck_checknumber],
                bankname: options[:telecheck_bankname],
    Severity: Major
    Found in lib/active_merchant/billing/gateways/linkpoint.rb and 3 other locations - About 40 mins to fix
    lib/active_merchant/billing/gateways/datatrans.rb on lines 146..156
    lib/active_merchant/billing/gateways/flex_charge.rb on lines 134..144
    lib/active_merchant/billing/gateways/redsys_rest.rb on lines 311..321

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

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

          def parse(xml)
            response = {}
    
            doc = Nokogiri::XML(xml)
            doc.root.xpath('*').each do |node|
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/vanco.rb and 1 other location - About 40 mins to fix
    lib/active_merchant/billing/gateways/spreedly_core.rb on lines 239..253

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

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

                  {
                    eci: three_d_secure[:eci],
                    xid: three_d_secure[:xid],
                    threeDSTransactionId: three_d_secure[:ds_transaction_id],
                    cavv: three_d_secure[:cavv],
    Severity: Major
    Found in lib/active_merchant/billing/gateways/datatrans.rb and 3 other locations - About 40 mins to fix
    lib/active_merchant/billing/gateways/flex_charge.rb on lines 134..144
    lib/active_merchant/billing/gateways/linkpoint.rb on lines 361..371
    lib/active_merchant/billing/gateways/redsys_rest.rb on lines 311..321

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

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

          def add_shipping(xml, shipping)
            xml.tag!('shipping') do
              xml.tag!('amount', shipping[:amount]) if shipping[:amount]
              xml.tag!('name', shipping[:name]) if shipping[:name]
              xml.tag!('description', shipping[:description]) if shipping[:description]
    Severity: Major
    Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb and 3 other locations - About 40 mins to fix
    lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 704..708
    lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 712..716
    lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 728..732

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

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

          def parse(xml)
            response = {}
    
            doc = Nokogiri::XML(xml)
            doc.root.xpath('*').each do |node|
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/spreedly_core.rb and 1 other location - About 40 mins to fix
    lib/active_merchant/billing/gateways/vanco.rb on lines 59..73

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

    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

            if options[:descriptor_name] || options[:descriptor_city]
              post[:billing_descriptor] = {}
              post[:billing_descriptor][:name] = options[:descriptor_name] if options[:descriptor_name]
              post[:billing_descriptor][:city] = options[:descriptor_city] if options[:descriptor_city]
            end
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/checkout_v2.rb and 2 other locations - About 40 mins to fix
    lib/active_merchant/billing/gateways/commerce_hub.rb on lines 297..301
    lib/active_merchant/billing/gateways/wepay.rb on lines 160..164

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

    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

            if options[:card_expiration_month] || options[:card_expiration_year]
              source[:card] = {}
              source[:card][:expirationMonth] = options[:card_expiration_month] if options[:card_expiration_month]
              source[:card][:expirationYear] = options[:card_expiration_year] if options[:card_expiration_year]
            end
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/commerce_hub.rb and 2 other locations - About 40 mins to fix
    lib/active_merchant/billing/gateways/checkout_v2.rb on lines 160..164
    lib/active_merchant/billing/gateways/wepay.rb on lines 160..164

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

    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(money, payment_method, options = {})
            post = {}
            add_amount(post, money, options)
            add_service_fee(post, options)
            add_invoice(post, options)
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/forte.rb and 1 other location - About 40 mins to fix
    lib/active_merchant/billing/gateways/forte.rb on lines 23..34

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

    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, options)
            add_service_fee(post, options)
            add_invoice(post, options)
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/forte.rb and 1 other location - About 40 mins to fix
    lib/active_merchant/billing/gateways/forte.rb on lines 37..48

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

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

          def add_tax(xml, tax)
            xml.tag!('tax') do
              xml.tag!('amount', tax[:amount]) if tax[:amount]
              xml.tag!('name', tax[:name]) if tax[:name]
              xml.tag!('description', tax[:description]) if tax[:description]
    Severity: Major
    Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb and 3 other locations - About 40 mins to fix
    lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 712..716
    lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 720..724
    lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 728..732

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

    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

            if options[:application_fee] || options[:fee_payer]
              post[:fee] = {}
              post[:fee][:app_fee] = options[:application_fee] if options[:application_fee]
              post[:fee][:fee_payer] = options[:fee_payer] if options[:fee_payer]
            end
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/wepay.rb and 2 other locations - About 40 mins to fix
    lib/active_merchant/billing/gateways/checkout_v2.rb on lines 160..164
    lib/active_merchant/billing/gateways/commerce_hub.rb on lines 297..301

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

    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