Method build_recurring_request
has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring. Open
def build_recurring_request(action, money, options)
raise StandardError, "Invalid Recurring Profile Action: #{action}" unless RECURRING_ACTIONS.include?(action)
xml = Builder::XmlMarkup.new
xml.tag! 'RecurringProfiles' 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 build_credit_card_request
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
def build_credit_card_request(action, money, credit_card, 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 build_reference_sale_or_authorization_request
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
def build_reference_sale_or_authorization_request(action, money, reference, 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 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
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'
Method add_three_d_secure
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def add_three_d_secure(options, xml)
if options[:three_d_secure]
three_d_secure = options[:three_d_secure]
xml.tag! 'BuyerAuthResult' do
authentication_status(three_d_secure, xml)
- 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 PayflowGateway
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class PayflowGateway < Gateway
include PayflowCommonAPI
RECURRING_ACTIONS = Set.new(%i[add modify cancel inquiry reactivate payment])
Method add_mpi_3ds
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def add_mpi_3ds(xml, three_d_secure_options)
# structure as per https://developer.paypal.com/api/nvp-soap/payflow/3d-secure-mpi/
authentication_id = three_d_secure_options[:authentication_id]
authentication_status = three_d_secure_options[:authentication_response_status]
- 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_recurring_request
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_recurring_request(action, money, options)
raise StandardError, "Invalid Recurring Profile Action: #{action}" unless RECURRING_ACTIONS.include?(action)
xml = Builder::XmlMarkup.new
xml.tag! 'RecurringProfiles' do
Method build_credit_card_request
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_credit_card_request(action, money, credit_card, options)
xml = Builder::XmlMarkup.new
xml.tag! TRANSACTIONS[action] do
xml.tag! 'PayData' do
xml.tag! 'Invoice' do
Method build_reference_sale_or_authorization_request
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_reference_sale_or_authorization_request(action, money, reference, options)
xml = Builder::XmlMarkup.new
xml.tag! TRANSACTIONS[action] do
xml.tag! 'PayData' do
xml.tag! 'Invoice' do
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
Method recurring
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def recurring(money, credit_card, options = {})
ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
options[:name] = credit_card.name if options[:name].blank? && credit_card
request = build_recurring_request(options[:profile_id] ? :modify : :add, money, options) do |xml|
- 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"