Showing 999 of 1,496 total issues
File hps.rb
has 404 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'nokogiri'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class HpsGateway < Gateway
Class MercadoPagoGateway
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class MercadoPagoGateway < Gateway
self.live_url = self.test_url = 'https://api.mercadopago.com/v1'
self.supported_countries = %w[AR BR CL CO MX PE UY]
self.supported_cardtypes = %i[visa master american_express elo cabal naranja creditel]
Class IpgGateway
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class IpgGateway < Gateway
self.test_url = 'https://test.ipg-online.com/ipgapi/services'
self.live_url = 'https://www5.ipg-online.com/ipgapi/services'
self.supported_countries = %w(AR)
Method add_address
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def add_address(xml, payment_method, address, options, shipTo = false)
first_name, last_name = address_names(address[:name], payment_method)
bill_to_merchant_tax_id = options[:merchant_tax_id] unless shipTo
xml.tag! shipTo ? 'shipTo' : 'billTo' do
- Read upRead up
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_auth_wallet
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def add_auth_wallet(xml, payment_method, options)
commerce_indicator = 'internet' if subsequent_nt_apple_pay_auth(payment_method.source, options)
brand = card_brand(payment_method).to_sym
- Read upRead up
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
Class AirwallexGateway
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
class AirwallexGateway < Gateway
self.test_url = 'https://api-demo.airwallex.com/api/v1'
self.live_url = 'https://pci-api.airwallex.com/api/v1'
# per https://www.airwallex.com/docs/online-payments__overview, cards are accepted in all EU countries
File pay_trace.rb
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class PayTraceGateway < Gateway
self.test_url = 'https://api.sandbox.paytrace.com'
self.live_url = 'https://api.paytrace.com'
File beanstream_core.rb
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
module BeanstreamCore
include Empty
Method add_line_items
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def add_line_items(post, options)
return unless options[:line_items]
line_items = []
options[:line_items].each do |li|
- Read upRead up
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
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def add_transaction(xml, money, options = {})
xml.transaction do
xml.ReversalType options[:reversal_type] if options[:reversal_type]
xml.TransactionID options[:trans_id] if options[:trans_id]
xml.TransactionAmount amount(money.to_i) if money
- Read upRead up
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 build_check_request
has a Cognitive Complexity of 35 (exceeds 5 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
- Read upRead up
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_submerchant
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def add_submerchant(post, options)
if submerchant = options[:submerchant]
post[:SubMerchant] = {}
post[:SubMerchant][:Merchant_Category_Code] = submerchant[:merchant_category_code] if submerchant[:merchant_category_code]
post[:SubMerchant][:Payment_Facilitator_Code] = submerchant[:payment_facilitator_code] if submerchant[:payment_facilitator_code]
- Read upRead up
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
File redsys_rest.rb
has 385 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
# = Redsys Merchant Gateway
#
# Gateway support for the Spanish "Redsys" payment gateway system. This is
File payflow.rb
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'nokogiri'
require 'active_merchant/billing/gateways/payflow/payflow_common_api'
require 'active_merchant/billing/gateways/payflow/payflow_response'
require 'active_merchant/billing/gateways/payflow_express'
Class MonerisGateway
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
class MonerisGateway < Gateway
WALLETS = %w(APP GPP)
self.test_url = 'https://esqa.moneris.com/gateway2/servlet/MpgRequest'
self.live_url = 'https://www3.moneris.com/gateway2/servlet/MpgRequest'
File jetpay_v2.rb
has 380 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class JetpayV2Gateway < Gateway
self.test_url = 'https://test1.jetpay.com/jetpay'
self.live_url = 'https://gateway20.jetpay.com/jetpay'
File blue_pay.rb
has 379 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'digest/md5'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class BluePayGateway < Gateway
Method add_pay_data
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def add_pay_data(xml, money, options)
xml.tag! 'PayData' do
xml.tag! 'Invoice' do
xml.tag! 'CustIP', options[:ip] unless options[:ip].blank?
xml.tag! 'InvNum', options[:order_id] unless options[:order_id].blank?
- Read upRead up
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_details
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def add_payment_details(xml, money, currency_code, options = {})
xml.tag! 'n2:PaymentDetails' do
xml.tag! 'n2:OrderTotal', localized_amount(money, currency_code), 'currencyID' => currency_code
# All of the values must be included together and add up to the order total
- Read upRead up
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
Class OgoneGateway
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class OgoneGateway < Gateway
CVV_MAPPING = { 'OK' => 'M',
'KO' => 'N',
'NO' => 'P' }