lib/active_merchant/billing/gateways/cardknox.rb in activemerchant-1.86.0 vs lib/active_merchant/billing/gateways/cardknox.rb in activemerchant-1.87.0
- old
+ new
@@ -1,11 +1,11 @@
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class CardknoxGateway < Gateway
self.live_url = 'https://x1.cardknox.com/gateway'
- self.supported_countries = ['US','CA','GB']
+ self.supported_countries = ['US', 'CA', 'GB']
self.default_currency = 'USD'
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
self.homepage_url = 'https://www.cardknox.com/'
self.display_name = 'Cardknox'
@@ -253,11 +253,11 @@
end
def parse(body)
fields = {}
for line in body.split('&')
- key, value = *line.scan( %r{^(\w+)\=(.*)$} ).flatten
+ key, value = *line.scan(%r{^(\w+)\=(.*)$}).flatten
fields[key] = CGI.unescape(value.to_s)
end
{
result: fields['xResult'],
@@ -274,11 +274,11 @@
cvv_result_code: fields['xCvvResultCode'],
remaining_balance: fields['xRemainingBalance'],
amount: fields['xAuthAmount'],
masked_card_num: fields['xMaskedCardNumber'],
masked_account_number: fields['MaskedAccountNumber']
- }.delete_if{|k, v| v.nil?}
+ }.delete_if { |k, v| v.nil? }
end
def commit(action, source_type, parameters)
response = parse(ssl_post(live_url, post_data(COMMANDS[source_type][action], parameters)))
@@ -318,10 +318,10 @@
seed = SecureRandom.hex(32).upcase
hash = Digest::SHA1.hexdigest("#{initial_parameters[:command]}:#{@options[:pin]}:#{parameters[:amount]}:#{parameters[:invoice]}:#{seed}")
initial_parameters[:Hash] = "s/#{seed}/#{hash}/n" unless @options[:pin].blank?
parameters = initial_parameters.merge(parameters)
- parameters.reject{|k, v| v.blank?}.collect{ |key, value| "x#{key}=#{CGI.escape(value.to_s)}" }.join('&')
+ parameters.reject { |k, v| v.blank? }.collect { |key, value| "x#{key}=#{CGI.escape(value.to_s)}" }.join('&')
end
end
end
end