lib/active_merchant/billing/gateways/skip_jack.rb in activemerchant-1.86.0 vs lib/active_merchant/billing/gateways/skip_jack.rb in activemerchant-1.87.0
- old
+ new
@@ -1,6 +1,5 @@
-#!ruby19
# encoding: utf-8
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class SkipJackGateway < Gateway
@@ -259,11 +258,11 @@
def add_status_action(post, action)
post[:szDesiredStatus] = action
end
def commit(action, money, parameters)
- response = parse( ssl_post( url_for(action), post_data(action, money, parameters) ), action )
+ response = parse(ssl_post(url_for(action), post_data(action, money, parameters)), action)
# Pass along the original transaction id in the case an update transaction
Response.new(response[:success], message_from(response, action), response,
:test => test?,
:authorization => response[:szTransactionFileName] || parameters[:szTransactionId],
@@ -273,11 +272,11 @@
end
def url_for(action)
result = test? ? self.test_url : self.live_url
result += advanced? && action == :authorization ? ADVANCED_PATH : BASIC_PATH
- result += "?#{ACTIONS[action]}"
+ result + "?#{ACTIONS[action]}"
end
def add_credentials(params, action)
if action == :authorization
params[:SerialNumber] = @options[:login]
@@ -352,12 +351,12 @@
end
def post_data(action, money, params = {})
add_credentials(params, action)
add_amount(params, action, money)
- sorted_params = params.to_a.sort{|a,b| a.to_s <=> b.to_s}.reverse
- sorted_params.collect { |key, value| "#{key.to_s}=#{CGI.escape(value.to_s)}" }.join('&')
+ sorted_params = params.to_a.sort_by(&:to_s).reverse
+ sorted_params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
end
def add_transaction_id(post, transaction_id)
post[:szTransactionId] = transaction_id
end
@@ -367,10 +366,10 @@
post[:CustomerCode] = options[:customer].to_s.slice(0, 17)
post[:InvoiceNumber] = options[:invoice]
post[:OrderDescription] = options[:description]
if order_items = options[:items]
- post[:OrderString] = order_items.collect { |item| "#{item[:sku]}~#{item[:description].tr('~','-')}~#{item[:declared_value]}~#{item[:quantity]}~#{item[:taxable]}~~~~~~~~#{item[:tax_rate]}~||"}.join
+ post[:OrderString] = order_items.collect { |item| "#{item[:sku]}~#{item[:description].tr('~', '-')}~#{item[:declared_value]}~#{item[:quantity]}~#{item[:taxable]}~~~~~~~~#{item[:tax_rate]}~||" }.join
else
post[:OrderString] = '1~None~0.00~0~N~||'
end
end