lib/active_merchant/billing/gateways/cashnet.rb in activemerchant-1.79.2 vs lib/active_merchant/billing/gateways/cashnet.rb in activemerchant-1.80.0
- old
+ new
@@ -1,17 +1,17 @@
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class CashnetGateway < Gateway
include Empty
- self.live_url = "https://commerce.cashnet.com/"
- self.test_url = "https://train.cashnet.com/"
+ self.live_url = 'https://commerce.cashnet.com/'
+ self.test_url = 'https://train.cashnet.com/'
- self.supported_countries = ["US"]
+ self.supported_countries = ['US']
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
- self.homepage_url = "http://www.higherone.com/"
- self.display_name = "Cashnet"
+ self.homepage_url = 'http://www.higherone.com/'
+ self.display_name = 'Cashnet'
self.money_format = :dollars
self.max_retries = 0
# Creates a new CashnetGateway
#
@@ -32,11 +32,11 @@
:merchant,
:operator,
:password,
:merchant_gateway_name
)
- options[:default_item_code] ||= "FEE"
+ options[:default_item_code] ||= 'FEE'
super
end
def purchase(money, payment_object, options = {})
post = {}
@@ -90,13 +90,13 @@
post = {}
post[:command] = action
post[:merchant] = @options[:merchant]
post[:operator] = @options[:operator]
post[:password] = @options[:password]
- post[:station] = (@options[:station] || "WEB")
+ post[:station] = (@options[:station] || 'WEB')
post[:custcode] = (@options[:custcode] || "ActiveMerchant/#{ActiveMerchant::VERSION}")
- post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
+ post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
end
def add_creditcard(post, creditcard)
post[:cardno] = creditcard.number
post[:cid] = creditcard.verification_value
@@ -140,17 +140,17 @@
end
def handle_response(response)
if (200...300).include?(response.code.to_i)
return response.body
- elsif 302 == response.code.to_i
+ elsif response.code.to_i == 302
return ssl_get(URI.parse(response['location']))
end
raise ResponseError.new(response)
end
def unparsable_response(raw_response)
- message = "Unparsable response received from Cashnet. Please contact Cashnet if you continue to receive this message."
+ message = 'Unparsable response received from Cashnet. Please contact Cashnet if you continue to receive this message.'
message += " (The raw response returned by the API was #{raw_response.inspect})"
return Response.new(false, message)
end
CASHNET_CODES = {