lib/active_merchant/billing/gateways/paybox_direct.rb in activemerchant-1.105.0 vs lib/active_merchant/billing/gateways/paybox_direct.rb in activemerchant-1.106.0
- old
+ new
@@ -10,34 +10,34 @@
# Payment API Version
API_VERSION = '00103'
# Transactions hash
TRANSACTIONS = {
- :authorization => '00001',
- :capture => '00002',
- :purchase => '00003',
- :unreferenced_credit => '00004',
- :void => '00005',
- :refund => '00014'
+ authorization: '00001',
+ capture: '00002',
+ purchase: '00003',
+ unreferenced_credit: '00004',
+ void: '00005',
+ refund: '00014'
}
CURRENCY_CODES = {
- 'AUD'=> '036',
- 'CAD'=> '124',
- 'CZK'=> '203',
- 'DKK'=> '208',
- 'HKD'=> '344',
- 'ICK'=> '352',
- 'JPY'=> '392',
- 'NOK'=> '578',
- 'SGD'=> '702',
- 'SEK'=> '752',
- 'CHF'=> '756',
- 'GBP'=> '826',
- 'USD'=> '840',
- 'EUR'=> '978',
- 'XPF'=> '953'
+ 'AUD' => '036',
+ 'CAD' => '124',
+ 'CZK' => '203',
+ 'DKK' => '208',
+ 'HKD' => '344',
+ 'ICK' => '352',
+ 'JPY' => '392',
+ 'NOK' => '578',
+ 'SGD' => '702',
+ 'SEK' => '752',
+ 'CHF' => '756',
+ 'GBP' => '826',
+ 'USD' => '840',
+ 'EUR' => '978',
+ 'XPF' => '953'
}
SUCCESS_CODES = ['00000']
UNAVAILABILITY_CODES = ['00001', '00097', '00098']
SUCCESS_MESSAGE = 'The transaction was approved'
@@ -93,11 +93,11 @@
commit('capture', money, post)
end
def void(identification, options = {})
requires!(options, :order_id, :amount)
- post ={}
+ post = {}
add_invoice(post, options)
add_reference(post, identification)
add_amount(post, options[:amount], options)
post[:porteur] = '000000000000000'
post[:dateval] = '0000'
@@ -154,15 +154,15 @@
response = parse(ssl_post(test? ? self.test_url : self.live_url, request_data))
response = parse(ssl_post(self.live_url_backup, request_data)) if service_unavailable?(response) && !test?
Response.new(
success?(response),
message_from(response),
- response.merge(:timestamp => parameters[:dateq]),
- :test => test?,
- :authorization => response[:numappel].to_s + response[:numtrans].to_s,
- :fraud_review => false,
- :sent_params => parameters.delete_if { |key, value| ['porteur', 'dateval', 'cvv'].include?(key.to_s) }
+ response.merge(timestamp: parameters[:dateq]),
+ test: test?,
+ authorization: response[:numappel].to_s + response[:numtrans].to_s,
+ fraud_review: false,
+ sent_params: parameters.delete_if { |key, value| ['porteur', 'dateval', 'cvv'].include?(key.to_s) }
)
end
def success?(response)
SUCCESS_CODES.include?(response[:codereponse])
@@ -176,18 +176,18 @@
success?(response) ? SUCCESS_MESSAGE : (response[:commentaire] || FAILURE_MESSAGE)
end
def post_data(action, parameters = {})
parameters.update(
- :version => API_VERSION,
- :type => TRANSACTIONS[action.to_sym],
- :dateq => Time.now.strftime('%d%m%Y%H%M%S'),
- :numquestion => unique_id(parameters[:order_id]),
- :site => @options[:login].to_s[0, 7],
- :rang => @options[:rang] || @options[:login].to_s[7..-1],
- :cle => @options[:password],
- :pays => '',
- :archivage => parameters[:order_id]
+ version: API_VERSION,
+ type: TRANSACTIONS[action.to_sym],
+ dateq: Time.now.strftime('%d%m%Y%H%M%S'),
+ numquestion: unique_id(parameters[:order_id]),
+ site: @options[:login].to_s[0, 7],
+ rang: @options[:rang] || @options[:login].to_s[7..-1],
+ cle: @options[:password],
+ pays: '',
+ archivage: parameters[:order_id]
)
parameters.collect { |key, value| "#{key.to_s.upcase}=#{CGI.escape(value.to_s)}" }.join('&')
end