Showing 1,005 of 1,501 total issues
Method add_customer
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_customer(xml, options)
customer = options[:customer]
return unless customer
xml.tag!('customer') 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_network_tokenization_card
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_network_tokenization_card(post, payment, options)
if options.dig(:stored_credential, :initiator) == 'merchant'
post[:paymentInformation][:tokenizedCard] = {
number: payment.number,
expirationMonth: payment.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 add_address
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_address(post, options)
if address = options[:shipping_address]
post[:deliveryAddress] = {}
post[:deliveryAddress][:street] = options[:address_override] == true ? address[:address2] : address[:address1] || 'NA'
post[:deliveryAddress][:houseNumberOrName] = options[:address_override] == true ? address[:address1] : address[:address2] || 'NA'
- 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_extra_data
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_extra_data(post, payment, options)
post[:telephoneNumber] = (options[:billing_address][:phone_number] if options.dig(:billing_address, :phone_number)) || (options[:billing_address][:phone] if options.dig(:billing_address, :phone)) || ''
post[:selectedBrand] = options[:selected_brand] if options[:selected_brand] && !post[:selectedBrand]
post[:deliveryDate] = options[:delivery_date] if options[:delivery_date]
post[:merchantOrderReference] = options[:merchant_order_reference] if options[:merchant_order_reference]
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
def add_customer_data(post, options)
post[:d1] = options[:ip] || '127.0.0.1'
if (billing_address = options[:billing_address])
post[:c5] = billing_address[:address1] if billing_address[:address1]
post[:c7] = billing_address[:city] if billing_address[:city]
- 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_shipping_contact_info
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_shipping_contact_info(doc, payment_method, options)
if address = options[:shipping_address]
# https://developers.bluesnap.com/v8976-XML/docs/shipping-contact-info
doc.send('first-name', payment_method.first_name)
doc.send('last-name', payment_method.last_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 create_intent
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def create_intent(money, payment_method, options = {})
MultiResponse.run do |r|
if payment_method.is_a?(NetworkTokenizationCreditCard) && digital_wallet_payment_method?(payment_method) && options[:new_ap_gp_route] != true
r.process { tokenize_apple_google(payment_method, options) }
payment_method = (r.params['token']['id']) if r.success?
- 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 post_data
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def post_data(params)
return nil unless params
params.map do |key, value|
next if value.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
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_payment(xml, money, payment, options)
requires!(options.merge!({ money: money }), :currency, :money)
xml.tag!('v1:Payment') do
xml.tag!('v1:HostedDataID', payment) if payment&.is_a?(String)
xml.tag!('v1:HostedDataStoreID', options[:hosted_data_store_id]) if options[:hosted_data_store_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 add_installments
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_installments(xml, options)
return unless %i[installment_total_count installment_total_amount installment_plan_type first_installment_date installment_annual_interest_rate installment_grace_period_duration].any? { |gsf| options.include?(gsf) }
xml.tag! 'installment' do
xml.tag!('totalCount', options[:installment_total_count]) if options[:installment_total_count]
- 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 request
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request(method, body, headers = {})
request_start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
headers = headers.dup
headers['connection'] ||= 'close'
Method add_creditcard
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_creditcard(post, creditcard, options, use_sources = false)
card = {}
if emv_payment?(creditcard)
add_emv_creditcard(post, creditcard.icc_data)
post[:card][:read_method] = 'contactless' if creditcard.read_method == 'contactless'
Method test_gateways
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_gateways
success, failed, missing, errored, disabled = [], [], [], [], []
puts "Verifying #{@gateways.count} SSL certificates\n\n"
Method scrub
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scrub(transcript)
ret_transcript = transcript
auth_origin = ret_transcript[/<authorization>(.*?)<\/authorization>/, 1]
unless auth_origin.nil?
auth_origin = auth_origin.gsub('\n', '')
Method create_intent
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_intent(money, payment_method, options = {})
MultiResponse.run do |r|
if payment_method.is_a?(NetworkTokenizationCreditCard) && digital_wallet_payment_method?(payment_method) && options[:new_ap_gp_route] != true
r.process { tokenize_apple_google(payment_method, options) }
payment_method = (r.params['token']['id']) if r.success?
Consider simplifying this complex logical expression. Open
return unless options[:merchant_descriptor] ||
options[:user_po] ||
options[:taxable] ||
options[:reference_data_code] ||
options[:invoice_number] ||
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 add_aft_data
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_aft_data(xml, payment_method, options)
xml.fundingTransfer 'type' => options[:aft_type], 'category' => 'PULL_FROM_CARD' do
xml.paymentPurpose options[:aft_payment_purpose] # Must be included for the recipient for following countries, otherwise optional: Argentina, Bangladesh, Chile, Columbia, Jordan, Mexico, Thailand, UAE, India cross-border
xml.fundingParty 'type' => 'sender' do
xml.accountReference options[:aft_sender_account_reference], 'accountType' => options[:aft_sender_account_type]
Method parse_element
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_element(reply, node)
case node.name
when 'CrossReferenceTransactionResult'
reply[:transaction_result] = {}
node.attributes.each do |a, b|
Method create_transaction_parameters
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_transaction_parameters(money, credit_card_or_vault_id, options)
parameters = {
amount: localized_amount(money, options[:currency] || default_currency).to_s,
order_id: options[:order_id],
customer: {