lib/active_merchant/billing/gateways/optimal_payment.rb
Class OptimalPaymentGateway
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class OptimalPaymentGateway < Gateway
self.test_url = 'https://webservices.test.optimalpayments.com/creditcardWS/CreditCardServlet/v1'
self.live_url = 'https://webservices.optimalpayments.com/creditcardWS/CreditCardServlet/v1'
# The countries the gateway supports merchants from as 2 digit ISO country codes
File optimal_payment.rb
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class OptimalPaymentGateway < Gateway
self.test_url = 'https://webservices.test.optimalpayments.com/creditcardWS/CreditCardServlet/v1'
self.live_url = 'https://webservices.optimalpayments.com/creditcardWS/CreditCardServlet/v1'
Method build_address
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def build_address(xml, addr)
if addr[:name]
first_name, last_name = split_names(addr[:name])
xml.tag! 'firstName', first_name
xml.tag! 'lastName', 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 hash_from_xml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def hash_from_xml(response)
hsh = {}
%w(confirmationNumber authCode
decision code description
actionCode avsResponse cvdResponse
- 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"