ugalic_moneta 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/moneta.rb +26 -14
  2. data/lib/moneta/version.rb +1 -1
  3. metadata +2 -2
@@ -9,7 +9,7 @@ module Moneta
9
9
  cert_file = params_hash[:cert_file]
10
10
  ca_cert_file = params_hash[:ca_cert_file]
11
11
  wsdl_path = params_hash[:wsdl_file]
12
-
12
+ @namespace = params_hash[:namespace]
13
13
  HTTPI::Adapter.use = :net_http
14
14
 
15
15
  @client = Savon::Client.new do
@@ -32,41 +32,53 @@ module Moneta
32
32
  end
33
33
  end
34
34
 
35
- def login(pin=nil)
36
- savon_call(:log_in, {:pin => pin}).to_hash
35
+ def login(*args)
36
+ soap_body = args.first
37
+ savon_call(:log_in, soap_body).to_hash
37
38
  rescue Exception => ex
38
39
  {error_code: -1, error_description: ex.message}
39
40
  end
40
41
 
41
- def token(amount, pin=nil)
42
- soap_body = {:amount => amount}
43
- soap_body[:pin] = pin unless pin.nil?
42
+ def token(*args)
43
+ soap_body = args.first
44
44
  savon_call(:get_token, soap_body).to_hash #amount should be in format "x.xx CURRENCY"
45
45
  rescue Exception => ex
46
46
  { error_code: -1, error_description: ex.message }
47
47
  end
48
48
 
49
- def transaction_status(transaction_id, pin=nil)
50
- soap_body = {:transaction_id => transaction_id}
51
- soap_body[:pin] = pin unless pin.nil?
49
+ def transaction_status(*args)
50
+ soap_body = args.first
52
51
  savon_call(:get_transaction_status, soap_body).to_hash
53
52
  rescue Exception => ex
54
53
  {error_code: -1, error_description: ex.message}
55
54
  end
56
55
 
57
- def transaction_list(date, pin=nil)
58
- soap_body = {:date => date}
59
- soap_body[:pin] = pin unless pin.nil?
56
+ def transaction_list(*args)
57
+ soap_body = args.first
60
58
  savon_call(:get_transaction_list, soap_body).to_hash
61
59
  rescue Exception => ex
62
60
  {error_code: -1, error_description: ex.message}
63
61
  end
64
62
 
63
+ def reverse(*args)
64
+ soap_body = args.first
65
+ savon_call(:reverse, soap_body).to_hash
66
+ rescue Exception => ex
67
+ {error_code: -1, error_description: ex.message}
68
+ end
69
+
70
+ def cancel_transaction(*args)
71
+ soap_body = args.first
72
+ savon_call(:cancel_transaction, soap_body).to_hash
73
+ rescue Exception => ex
74
+ {error_code: -1, error_description: ex.message}
75
+ end
76
+
65
77
  private
66
78
 
67
79
  def savon_call(method, body)
68
- envelope = @client.request :soap, method, :xmlns => 'http://www.mpay.si/mgw/ekanali/public/2007/03/29' do
69
- soap.body = body
80
+ envelope = @client.request :soap, method, :xmlns => @namespace do
81
+ soap.body = body unless body.empty?
70
82
  end
71
83
  end
72
84
  end
@@ -1,3 +1,3 @@
1
1
  module Moneta
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ugalic_moneta
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Uros Galic
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-22 00:00:00 +01:00
13
+ date: 2011-03-03 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency