Class: Moneta::Eterminal
- Inherits:
-
Object
- Object
- Moneta::Eterminal
- Defined in:
- lib/moneta.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ Eterminal
constructor
A new instance of Eterminal.
- #login(pin = nil) ⇒ Object
- #token(amount, pin = nil) ⇒ Object
- #transaction_list(date, pin = nil) ⇒ Object
- #transaction_status(transaction_id, pin = nil) ⇒ Object
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] 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
#login(pin = nil) ⇒ Object
35 36 37 38 39 |
# File 'lib/moneta.rb', line 35 def login(pin=nil) savon_call(:log_in, {:pin => pin}).to_hash rescue Exception => ex {error_code: -1, error_description: ex.} end |
#token(amount, pin = nil) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/moneta.rb', line 41 def token(amount, pin=nil) soap_body = {:amount => amount} soap_body[:pin] = pin unless pin.nil? 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. } end |
#transaction_list(date, pin = nil) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/moneta.rb', line 57 def transaction_list(date, pin=nil) soap_body = {:date => date} soap_body[:pin] = pin unless pin.nil? savon_call(:get_transaction_list, soap_body).to_hash rescue Exception => ex {error_code: -1, error_description: ex.} end |
#transaction_status(transaction_id, pin = nil) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/moneta.rb', line 49 def transaction_status(transaction_id, pin=nil) soap_body = {:transaction_id => transaction_id} soap_body[:pin] = pin unless pin.nil? savon_call(:get_transaction_status, soap_body).to_hash rescue Exception => ex {error_code: -1, error_description: ex.} end |