Class: Moneta::Eterminal

Inherits:
Object
  • Object
show all
Defined in:
lib/moneta.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Eterminal

Returns a new instance of Eterminal.



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
# File 'lib/moneta.rb', line 4

def initialize(*args)
  return self if args.empty?
  params_hash = args[0]
  key_file      = params_hash[:key_file]
  key_pwd       = params_hash[:key_pwd]
  cert_file     = params_hash[:cert_file]
  ca_cert_file  = params_hash[:ca_cert_file]
  wsdl_path     = params_hash[:wsdl_file]
  @namespace    = params_hash[:namespace]
  HTTPI::Adapter.use = :net_http
  
  @client = Savon::Client.new do
    wsdl.document = wsdl_path
    http.auth.ssl.verify_mode = :none
    http.auth.ssl.cert_key_file = key_file
    http.auth.ssl.cert_key_password = key_pwd
    http.auth.ssl.cert_file = cert_file
    http.auth.ssl.ca_cert_file = ca_cert_file
    http.headers = {
      "User-Agent" => "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 (.NET CLR 3.5.30729)",
      "Accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
      "Accept-Language" => "sl,en-us;q=0.7,en;q=0.3",
      "Accept-Encoding" => "gzip, deflate",
      "Accept-Charset" => "ISO-8859-1,utf-8;q=0.7,*;q=0.7",
      "Keep-Alive" => "115",
      "Connection" => "Keep-Alive",
      "iis6-feature" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec porta libero eu neque hendrerit vel volutpat sapien aliquam. Aenean suscipit porta leo, in iaculis est ornare id. Vivamus dignissim vulputate sapien, sed euismod tellus ultrices ut. Pellentesque quam odio, varius vel tempus at, gravida nec mauris. Vestibulum sodales scelerisque nunc sit amet vulputate. Praesent iaculis ipsum vel leo luctus sodales."
      }
  end
end

Instance Method Details

#cancel_transaction(*args) ⇒ Object



70
71
72
73
74
75
# File 'lib/moneta.rb', line 70

def cancel_transaction(*args)
  soap_body = args.first
  savon_call(:cancel_transaction, soap_body).to_hash
rescue Exception => ex
  {error_code: -1, error_description: ex.message}
end

#login(*args) ⇒ Object



35
36
37
38
39
40
# File 'lib/moneta.rb', line 35

def (*args)
  soap_body = args.first
  savon_call(:log_in, soap_body).to_hash
rescue Exception => ex
  {error_code: -1, error_description: ex.message}
end

#reverse(*args) ⇒ Object



63
64
65
66
67
68
# File 'lib/moneta.rb', line 63

def reverse(*args)
  soap_body = args.first
  savon_call(:reverse, soap_body).to_hash
rescue Exception => ex
  {error_code: -1, error_description: ex.message}
end

#token(*args) ⇒ Object



42
43
44
45
46
47
# File 'lib/moneta.rb', line 42

def token(*args)
  soap_body = args.first
  savon_call(:get_token, soap_body).to_hash #amount should be in format "x.xx CURRENCY"
rescue Exception => ex
  { error_code: -1, error_description: ex.message }
end

#transaction_list(*args) ⇒ Object



56
57
58
59
60
61
# File 'lib/moneta.rb', line 56

def transaction_list(*args)
  soap_body = args.first
  savon_call(:get_transaction_list, soap_body).to_hash
rescue Exception => ex
  {error_code: -1, error_description: ex.message}
end

#transaction_status(*args) ⇒ Object



49
50
51
52
53
54
# File 'lib/moneta.rb', line 49

def transaction_status(*args)
  soap_body = args.first
  savon_call(:get_transaction_status, soap_body).to_hash
rescue Exception => ex
  {error_code: -1, error_description: ex.message}
end