Showing 999 of 1,496 total issues
Method parse
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def parse(body)
reply = {}
xml = REXML::Document.new(body)
if root = REXML::XPath.first(xml, '//soap:Fault') then
reply = parse_fault(root)
Method normal_refund
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def normal_refund(amount, authorization, options)
transaction_id, card_number, = split_authorization(authorization)
commit(:refund) do |xml|
xml.transactionRequest do
Method build_request
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def build_request(action)
xml = Builder::XmlMarkup.new(encoding: 'UTF-8')
xml.instruct!(:xml, encoding: 'UTF-8')
xml.SOAP :Envelope, {
'xmlns:SOAP' => 'http://schemas.xmlsoap.org/soap/envelope/',
Method build_change_profile_request
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def build_change_profile_request(profile_id, options)
xml = Builder::XmlMarkup.new :indent => 2
xml.tag! 'UpdateRecurringPaymentsProfileReq', 'xmlns' => PAYPAL_NAMESPACE do
xml.tag! 'UpdateRecurringPaymentsProfileRequest', 'xmlns:n2' => EBAY_NAMESPACE do
xml.tag! 'n2:Version', API_VERSION
Method build_request
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def build_request(payment_code, money, payment, options)
xml = Builder::XmlMarkup.new indent: 2
xml.instruct!
xml.tag! 'Request', 'version' => API_VERSION do
xml.tag! 'Header' do
Method build_credit_card_request
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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 credit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def credit(money, creditcard, options = {})
post = payment_request(money, options)
post[:amount] = amount_hash(money, options[:currency])
post[:card] = credit_card_hash(creditcard)
post[:dateOfBirth] = options[:date_of_birth] if options[:date_of_birth]
Method store
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def store(payment, options = {})
params = {}
post = {}
if payment.is_a?(ApplePayPaymentToken)
Method add_auth_wallet
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def add_auth_wallet(xml, payment_method, options)
commerce_indicator = 'internet' if subsequent_nt_apple_pay_auth(payment_method.source, options)
brand = card_brand(payment_method).to_sym
Method add_addresses
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def add_addresses(post, options)
if address = options[:billing_address] || options[:address]
post[:card_address1] = address[:address1]
post[:card_zip] = address[:zip]
post[:card_city] = address[:city]
Method parse
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def parse(action, soap)
xml = REXML::Document.new(soap)
root = REXML::XPath.first(xml, '//SOAP-ENV:Body')
response = root ? parse_element(root[0]) : { response: soap }
Method commit
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def commit(action, money, parameters)
case action
when 'sale'
begin
response = call_api(TRANSACTION_API, parameters)
Method soap_request
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def soap_request(arguments, action)
# eWay demands all fields be sent, but contain an empty string if blank
post = case action
when 'QueryCustomer'
arguments
Method update
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def update(vault_id, creditcard, options = {})
braintree_credit_card = nil
commit do
braintree_credit_card = @braintree_gateway.customer.find(vault_id).credit_cards.detect(&:default?)
return Response.new(false, 'Braintree::NotFoundError') if braintree_credit_card.nil?
Method build_create_subscription_request
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def build_create_subscription_request(payment_method, options)
default_subscription_params = { frequency: 'on-demand', amount: 0, automatic_renew: false }
options[:subscription] = default_subscription_params.update(
options[:subscription] || {}
)
Method parse
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def parse(body)
response = {}
root = REXML::Document.new(body).root
Method add_pay_data
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def add_pay_data(xml, money, options)
xml.tag! 'PayData' do
xml.tag! 'Invoice' do
xml.tag! 'CustIP', options[:ip] unless options[:ip].blank?
xml.tag! 'InvNum', options[:order_id] unless options[:order_id].blank?
Method add_payout_sender_data
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def add_payout_sender_data(post, options)
return unless options[:payout] == true
post[:sender] = {
# options for type are individual, corporate, or government
Method avs_mapping
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def avs_mapping
{
'street: M, zip: M' => 'M',
'street: M, zip: N' => 'A',
'street: M, zip: U' => 'B',