Showing 1,501 of 1,501 total issues
Method message_from
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def message_from(response)
if response[:faultcode] && response[:faultstring]
response[:faultstring]
elsif response[:error_number] != '0'
response[:error_description]
- 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_customer_responsible_person
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_customer_responsible_person(post, payment, options)
post[:payment][:person_type] = options[:person_type] if options[:person_type]
if options[:person_type]&.casecmp('business')&.zero?
post[:payment][:responsible] = {}
post[:payment][:responsible][:name] = options[:responsible_name] if options[:responsible_name]
- 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 message_from
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def message_from(results)
if results[:response_code] == DECLINED
return CVVResult.messages[results[:card_code]] if CARD_CODE_ERRORS.include?(results[:card_code])
return AVSResult.messages[results[:avs_result_code]] if AVS_REASON_CODES.include?(results[:response_reason_code]) && AVS_ERRORS.include?(results[:avs_result_code])
end
- 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_sub_merchant
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_sub_merchant(post, sub_merchant_options)
sub_merchant = {}
sub_merchant[:merchant_id] = sub_merchant_options[:merchant_id] if sub_merchant_options[:merchant_id]
sub_merchant[:extra_params] = sub_merchant_options[:extra_params] if sub_merchant_options[:extra_params]
sub_merchant[:mcc] = sub_merchant_options[:mcc] if sub_merchant_options[:mcc]
- 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_xml_request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_xml_request(money, credit_card, options, &block)
card_number = credit_card.respond_to?(:number) ? credit_card.number : ''
hash_data = generate_hash_data(format_order_id(options[:order_id]), @options[:terminal_id], card_number, amount(money), security_data)
xml = Builder::XmlMarkup.new(indent: 2)
- 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_risk_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_risk_data(post, options)
return unless options[:risk].is_a?(Hash)
risk = options[:risk]
post[:risk] = {} unless risk.empty?
- 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 to_s
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_s
if response.kind_of?(String)
if response.start_with?('Failed')
return response
else
- 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_three_ds
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_three_ds(post, options)
return unless three_d_secure = options[:three_d_secure]
post.ElectronicCommerceIndicator(formatted_three_ds_eci(three_d_secure[:eci])) if three_d_secure[:eci]
post.CardHolderAuthenticationID(three_d_secure[:xid]) if three_d_secure[:xid]
- 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 authorize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def authorize(money, payment_or_customer_id, options = {})
post = {}
add_amount(post, money, options)
if customer_id?(payment_or_customer_id)
post[:customer_id] = payment_or_customer_id
- 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 create_customer_profile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_customer_profile(options)
requires!(options, :profile)
requires!(options[:profile], :email) unless options[:profile][:merchant_customer_id] || options[:profile][:description]
requires!(options[:profile], :description) unless options[:profile][:email] || options[:profile][:merchant_customer_id]
requires!(options[:profile], :merchant_customer_id) unless options[:profile][:description] || options[:profile][:email]
- 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 commit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def commit(url, parameters = nil, options = {}, method = nil)
if parameters.present? && parameters[:threeDSecure].present?
three_ds_errors = validate_three_ds_params(parameters[:threeDSecure][:external])
return three_ds_errors if three_ds_errors
end
- 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_customer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_customer(post, card, options)
address = options[:billing_address] || {}
post[:customer] = {}
post[:customer][:addressLine1] = address[:address1] if address[:address1]
- 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_card_on_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_card_on_file(post, options)
return unless options[:stored_credential] || options[:usage_indicator] || options[:indicator] || options[:scheduled_indicator] || options[:transaction_id]
stored_credential = options[:stored_credential] || {}
post[:cardOnFile] = {}
- 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 validate_three_ds_params
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_three_ds_params(three_ds)
errors = {}
supported_version = %w{1.0 2.0 2.1.0 2.2.0}.include?(three_ds[:three_dsecure_version])
supported_enrollment = ['Y', 'N', 'U', nil].include?(three_ds[:enrollment_response])
supported_auth_response = ['Y', 'N', 'U', nil].include?(three_ds[:authentication_response])
- 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 parse_eci
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_eci(payment)
return nil unless payment.is_a?(NetworkTokenizationCreditCard)
if (eci = payment.eci)
eci = eci[0] == '0' ? eci.sub!(/^0/, '') : eci
- 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_creditcard
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_creditcard(post, creditcard, options = {})
if creditcard.respond_to?(:number)
post[:card_number] = creditcard.number
post[:card_expiry] = "#{creditcard.month}/#{creditcard.year}"
post[:cvv] = creditcard.verification_value if creditcard.verification_value?
- 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 commit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def commit(action, money, options)
request = build_request(action, money, options)
headers = { 'Content-Type' => 'text/xml',
'Authorization' => encoded_credentials }
- 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_stored_credential_params
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_stored_credential_params(doc, options = {})
return unless stored_credential = options[:stored_credential]
if stored_credential[:initial_transaction]
add_stored_credential_for_initial_txn(doc, options)
- 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_stored_credentials
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_stored_credentials(params, options)
if options[:sequence] || options[:stored_credential]
params[:stored_credentials] = {}
params[:stored_credentials][:cardbrand_original_transaction_id] = original_transaction_id(options) if original_transaction_id(options)
params[:stored_credentials][:initiator] = initiator(options) if initiator(options)
- 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 execute_3ds_flow
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def execute_3ds_flow(post, money, payment, transaction_type, options = {})
post_3ds = post.dup
MultiResponse.run do |r|
r.process { commit(:init_payment, post) }
- 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"