4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/payme/response/binary.rb', line 4
def self.included(klass)
klass.class_eval do
def launch
result = exec.split('!')
raise Payme::Errors::MissingPath if result.empty? or (result[1].empty? && result[2].empty?)
parse_result result
end
private
def exec
path = File.join(options[:bin_path], 'response')
`#{path} pathfile=#{options[:pathfile]} message=#{message}`
end
def parse_result(result)
parsed = Hash.new
result.each_index do |i|
parsed[fields[i-1].to_sym] = result[i]
end
parsed
end
def fields
['code', 'error', 'merchant_id', 'merchant_country', 'amount', 'transaction_id', 'payment_means',
'transmission_date', 'payment_time', 'payment_date', 'response_code', 'payment_certificate',
'authorisation_id', 'currency_code', 'card_number', 'cvv_flag', 'cvv_response_code',
'bank_response_code', 'complementary_code', 'complementary_info', 'return_context',
'caddie', 'receipt_complement', 'merchant_language', 'language', 'customer_id',
'order_id', 'customer_email', 'customer_ip_address', 'capture_day', 'capture_mode', 'data']
end
end
end
|