Showing 999 of 1,496 total issues
Method add_network_tokenization_card
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_network_tokenization_card(post, payment_method, options)
post[:b21] = NETWORK_TOKENIZATION_CARD_SOURCE[payment_method.source.to_s]
post[:token_eci] = post[:b21] == 'vts_mdes_token' ? '07' : nil
post[:token_eci] = options[:eci] || payment_method&.eci || (payment_method.brand.to_s == 'master' ? '00' : '07')
post[:token_crypto] = payment_method&.payment_cryptogram if payment_method.source.to_s == 'network_token'
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_payment(post, credit_card_reference, options = {})
post[:card] ||= {}
if credit_card_reference.is_a?(String)
post[:card][:paymentToken] = credit_card_reference
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 recursively_parse_element
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def recursively_parse_element(node, response)
if node.has_elements?
node.elements.each { |n| recursively_parse_element(n, response) }
else
response[dexmlize_param_name(node.name)] = (node.text ? node.text.strip : nil)
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse(response)
return bad_authentication_response if response.code.to_i == 401
return generic_error_response(response.body) if [403, 405, 429].include?(response.code.to_i)
parsed = {}
- 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 success_from
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def success_from(response, action = nil)
transaction_current_status = response.dig('transaction', 'current_status')
request_status = response['status']
transaction_status = response.dig('transaction', 'status')
default_response = SUCCESS_STATUS.include?(transaction_current_status || request_status || transaction_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 add_credit_card
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_credit_card(params, credit_card, options)
return unless credit_card
params['Customer'] ||= {}
if credit_card.respond_to? :number
- 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_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_customer_data(post, options)
requires!(options, :user_id)
post[:user] ||= {}
post[:user][:id] = options[:user_id]
post[:user][:email] = options[:email] if options[: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 message_from
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def message_from(response)
return response['detail'] if response['detail'].present?
if !success_from(response) && response['error']
response['error'] && response['error']['type']
- 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_items_xml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_payment_details_items_xml(xml, options, currency_code)
options[:items].each do |item|
xml.tag! 'n2:PaymentDetailsItem' do
xml.tag! 'n2:Name', item[:name]
xml.tag! 'n2:Number', item[:number]
- 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 uri
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def uri(action, authorization)
version = ogone_direct? ? 'v2' : 'v1'
uri = "/#{version}/#{@options[:merchant_id]}/"
case action
when :authorize
- 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_claim_without_transaction_id
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_claim_without_transaction_id(post, options = {})
return if options[:stored_credential] || options[:network_transaction_id] || options[:ds_transaction_id]
return unless options[:claim_without_transaction_id]
post[:payment_method_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 copy_when_present
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def copy_when_present(dest, dest_path, source, source_path = nil)
source_path ||= dest_path
source_path.each do |key|
return nil unless source[key]
- 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_billing_address_for_card_tokenization
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_billing_address_for_card_tokenization(post, options = {})
return unless (billing = options[:billing_address] || options[:address])
billing = add_address(billing, options)
billing[:address].transform_keys! { |k| k == :postal_code ? :address_zip : k.to_s.prepend('address_').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
Method add_billing
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_billing(post, card, options = {})
return unless has_name_info?(card)
billing = post['payment_method']['card']['billing'] || {}
billing['email'] = options[:email] if options[: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 add_fee
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_fee(post, options)
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]
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def message_from(response)
if success_from(response)
case response['status']
when 'paid'
'Transação aprovada'
- 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_method_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_payment_method_data(payment_method, options = {})
post = {
type: 'card',
card: {
exp_month: payment_method.month,
- 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 refund
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def refund(*args)
# legacy signature: #refund(transaction_id, options = {})
# new signature: #refund(money, transaction_id, options = {})
money, transaction_id, options = extract_refund_args(args)
money = localized_amount(money, options[:currency] || default_currency).to_s 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 add_connected_account
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_connected_account(post, options = {})
post[:on_behalf_of] = options[:on_behalf_of] if options[:on_behalf_of]
return unless options[:transfer_destination]
- 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_details_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_details_data(post, options)
details = {}
details[:name] = options[:customer] || (options[:billing_address][:name] if options[:billing_address])
details[:phone] = options[:phone] || (options[:billing_address][:phone] if options[:billing_address])
details[:email] = options[:email] if options[: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"