webmoney 0.0.4.4 → 0.0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +7 -0
- data/lib/passport.rb +1 -0
- data/lib/webmoney.rb +4 -1
- data/rakefile +1 -1
- data/spec/unit/webmoney_spec.rb +18 -0
- metadata +6 -4
data/ChangeLog
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
ChangeLog
|
2
2
|
|
3
|
+
Thu Jun 11 2009 13:05:00 + 0400
|
4
|
+
----------------------------
|
5
|
+
V 0.0.4.5
|
6
|
+
* Fix unexistent WMID passport request error
|
7
|
+
* Fix zero microsecounds error in reqn()
|
8
|
+
|
9
|
+
|
3
10
|
Sun Mar 15 2009 14:55:18 +0400
|
4
11
|
----------------------------
|
5
12
|
V 0.0.4.4
|
data/lib/passport.rb
CHANGED
@@ -10,6 +10,7 @@ class Webmoney
|
|
10
10
|
root = doc.at('/response')
|
11
11
|
if root && root['retval'] && root['retval'].to_i == 0
|
12
12
|
super(doc.at('/response/certinfo')['wmid'])
|
13
|
+
raise NonExistentWmidError unless doc.at('/response/certinfo/attestat')
|
13
14
|
tid = doc.at('/response/certinfo/attestat/row')['tid'].to_i
|
14
15
|
recalled = doc.at('/response/certinfo/attestat/row')['recalled'].to_i
|
15
16
|
locked = doc.at('/response/certinfo/userinfo/value/row')['locked'].to_i
|
data/lib/webmoney.rb
CHANGED
@@ -32,9 +32,11 @@ class Webmoney
|
|
32
32
|
class RequestError < WebmoneyError; end
|
33
33
|
class ResultError < WebmoneyError; end
|
34
34
|
class IncorrectWmidError < WebmoneyError; end
|
35
|
+
class NonExistentWmidError < WebmoneyError; end
|
35
36
|
class CaCertificateError < WebmoneyError; end
|
36
37
|
|
37
38
|
attr_reader :wmid, :error, :errormsg, :last_request, :messenger
|
39
|
+
attr_accessor :interfaces
|
38
40
|
|
39
41
|
# Required options:
|
40
42
|
#
|
@@ -191,7 +193,8 @@ class Webmoney
|
|
191
193
|
# return 16 digits string
|
192
194
|
def reqn
|
193
195
|
t = Time.now
|
194
|
-
|
196
|
+
msec = t.to_f.to_s.match(/\.(\d\d)/)[1] rescue '00'
|
197
|
+
t.strftime('%Y%m%d%H%M%S') + msec
|
195
198
|
end
|
196
199
|
|
197
200
|
def make_xml(iface, opt) # :nodoc:
|
data/rakefile
CHANGED
data/spec/unit/webmoney_spec.rb
CHANGED
@@ -24,6 +24,16 @@ class Webmoney
|
|
24
24
|
(t2 > t1).should be_true
|
25
25
|
end
|
26
26
|
|
27
|
+
it "should correct reqn" do
|
28
|
+
Time.stub!(:now).and_return(Time.at(1244704683.69677))
|
29
|
+
@wm.send(:reqn).should == '2009061111180369'
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should correct reqn with zero microsec" do
|
33
|
+
Time.stub!(:now).and_return(Time.at(1244704683))
|
34
|
+
@wm.send(:reqn).should == '2009061111180300'
|
35
|
+
end
|
36
|
+
|
27
37
|
it "should raise error on incorrect arg" do
|
28
38
|
lambda { @wm.send(:request, :check_sign, 1) }.
|
29
39
|
should raise_error(ArgumentError)
|
@@ -89,6 +99,14 @@ class Webmoney
|
|
89
99
|
@wm.request(:get_passport, :wmid => @wm.wmid).should be_instance_of(Passport)
|
90
100
|
end
|
91
101
|
|
102
|
+
it "should raise exception on bad WMID" do
|
103
|
+
lambda {@wm.request(:get_passport, :wmid => '111')}.should raise_error(Webmoney::ResultError)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should raise exception on non existent WMID" do
|
107
|
+
lambda {@wm.request(:get_passport, :wmid => '012345678901')}.should raise_error(Webmoney::NonExistentWmidError)
|
108
|
+
end
|
109
|
+
|
92
110
|
it "should return correct BL" do
|
93
111
|
wmid = '370860915669'
|
94
112
|
@wm.request(:bussines_level, :wmid => wmid).should == 0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmoney
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.4.
|
4
|
+
version: 0.0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Oryol
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-12 00:00:00 +04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -71,6 +71,8 @@ files:
|
|
71
71
|
- tools/rakehelp.rb
|
72
72
|
has_rdoc: true
|
73
73
|
homepage: http://github.com/eagleas/webmoney
|
74
|
+
licenses: []
|
75
|
+
|
74
76
|
post_install_message:
|
75
77
|
rdoc_options: []
|
76
78
|
|
@@ -91,9 +93,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
93
|
requirements: []
|
92
94
|
|
93
95
|
rubyforge_project: webmoney
|
94
|
-
rubygems_version: 1.3.
|
96
|
+
rubygems_version: 1.3.4
|
95
97
|
signing_key:
|
96
|
-
specification_version:
|
98
|
+
specification_version: 3
|
97
99
|
summary: Webmoney interfaces and native wmsigner
|
98
100
|
test_files:
|
99
101
|
- spec/spec_helper.rb
|