webmoney 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +7 -0
- data/Gemfile +7 -3
- data/Gemfile.lock +31 -41
- data/README +3 -3
- data/VERSION +1 -1
- data/lib/request_result.rb +12 -0
- data/lib/request_xml.rb +44 -41
- data/lib/webmoney.rb +25 -6
- data/rakefile +13 -16
- data/spec/spec_helper.rb +1 -2
- data/spec/unit/iconv_spec.rb +31 -0
- data/spec/unit/passport_spec.rb +3 -53
- data/spec/unit/trust_spec.rb +25 -0
- data/spec/unit/webmoney_spec.rb +5 -5
- data/webmoney.gemspec +73 -59
- metadata +72 -11
- data/.gitignore +0 -6
data/ChangeLog
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
ChangeLog
|
2
2
|
|
3
|
+
Fri Feb 18 2011 18:30:00 +0300
|
4
|
+
----------------------------
|
5
|
+
V 0.0.11
|
6
|
+
* Add i_trust and trust_me interfaces
|
7
|
+
* Trim reqn() to 14 digits. Warning: request to WebMoney Transfer support team for reset REQN counter, might be necessary!
|
8
|
+
* Fix error in create_invoice, create_transaction
|
9
|
+
|
3
10
|
Wed Oct 06 2010 11:14:00 +0300
|
4
11
|
----------------------------
|
5
12
|
V 0.0.10
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,41 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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
|
-
- nokogiri:
|
33
|
-
version: 1.4.3.1
|
34
|
-
- rake-compiler:
|
35
|
-
version: 0.7.1
|
36
|
-
- rspec:
|
37
|
-
version: 1.3.0
|
38
|
-
hash: 46b2419c1fae88ace745852a84f3ee395ef8a70e
|
39
|
-
sources:
|
40
|
-
- Rubygems:
|
41
|
-
uri: http://rubygems.org
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.5.2)
|
7
|
+
bundler (~> 1.0.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
nokogiri (1.4.4)
|
11
|
+
rake (0.8.7)
|
12
|
+
rake-compiler (0.7.5)
|
13
|
+
rake
|
14
|
+
rspec (2.3.0)
|
15
|
+
rspec-core (~> 2.3.0)
|
16
|
+
rspec-expectations (~> 2.3.0)
|
17
|
+
rspec-mocks (~> 2.3.0)
|
18
|
+
rspec-core (2.3.1)
|
19
|
+
rspec-expectations (2.3.0)
|
20
|
+
diff-lcs (~> 1.1.2)
|
21
|
+
rspec-mocks (2.3.0)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
ruby
|
25
|
+
|
26
|
+
DEPENDENCIES
|
27
|
+
bundler (~> 1.0.0)
|
28
|
+
jeweler (~> 1.5.2)
|
29
|
+
nokogiri
|
30
|
+
rake-compiler
|
31
|
+
rspec (~> 2.3.0)
|
data/README
CHANGED
@@ -18,8 +18,10 @@ Completed:
|
|
18
18
|
- create_transaction - x2
|
19
19
|
- outgoing_invoices - x4
|
20
20
|
- send_message - x6
|
21
|
-
- get_passport - x11
|
22
21
|
- find_wm - x8
|
22
|
+
- get_passport - x11
|
23
|
+
- i_trust - x15
|
24
|
+
- trust_me - x15
|
23
25
|
- bussines_level
|
24
26
|
- login
|
25
27
|
|
@@ -31,8 +33,6 @@ Incompleted (help need!):
|
|
31
33
|
- incoming_invoices - x10
|
32
34
|
- reject_protection - x13
|
33
35
|
- transaction_moneyback - x14
|
34
|
-
- i_trust - x15
|
35
|
-
- trust_me - x15
|
36
36
|
- trust_save - x15
|
37
37
|
- create_purse - x16
|
38
38
|
- create_contract - x17
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.11
|
data/lib/request_result.rb
CHANGED
@@ -87,4 +87,16 @@ module Webmoney::RequestResult # :nodoc:all
|
|
87
87
|
}
|
88
88
|
end
|
89
89
|
|
90
|
+
def result_trust_me(doc)
|
91
|
+
{
|
92
|
+
:count => doc.at('//trustlist')['cnt'].to_i,
|
93
|
+
:invoices => doc.xpath('//trust[@inv="1"]/purse').map(&:inner_text),
|
94
|
+
:transactions => doc.xpath('//trust[@trans="1"]/purse').map(&:inner_text),
|
95
|
+
:balance => doc.xpath('//trust[@purse="1"]/purse').map(&:inner_text),
|
96
|
+
:history => doc.xpath('//trust[@transhist="1"]/purse').map(&:inner_text)
|
97
|
+
}
|
98
|
+
end
|
99
|
+
|
100
|
+
alias_method :result_i_trust, :result_trust_me
|
101
|
+
|
90
102
|
end
|
data/lib/request_xml.rb
CHANGED
@@ -12,7 +12,7 @@ module Webmoney::RequestXML # :nodoc:all
|
|
12
12
|
x.mode opt[:mode] || 0
|
13
13
|
}
|
14
14
|
# unless mode == 1, signed data need'nt
|
15
|
-
x.sign( (classic? && opt[:mode]) ? sign(@wmid
|
15
|
+
x.sign( (classic? && opt[:mode]) ? sign("#{@wmid}#{opt[:wmid]}") : nil )
|
16
16
|
}
|
17
17
|
}
|
18
18
|
end
|
@@ -27,40 +27,34 @@ module Webmoney::RequestXML # :nodoc:all
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def xml_check_sign(opt)
|
30
|
-
plan_out =
|
30
|
+
plan_in, plan_out = filter_str(opt[:plan])
|
31
31
|
Nokogiri::XML::Builder.new( :encoding => 'windows-1251' ) { |x|
|
32
32
|
x.send('w3s.request') {
|
33
33
|
x.wmid @wmid
|
34
34
|
x.testsign {
|
35
35
|
x.wmid opt[:wmid]
|
36
|
-
x.plan { x.cdata
|
36
|
+
x.plan { x.cdata plan_in }
|
37
37
|
x.sign opt[:sign]
|
38
38
|
}
|
39
|
-
if classic?
|
40
|
-
plan = @wmid + opt[:wmid] + plan_out + opt[:sign]
|
41
|
-
x.sign sign(plan)
|
42
|
-
end
|
39
|
+
x.sign sign("#{@wmid}#{opt[:wmid]}#{plan_out}#{opt[:sign]}") if classic?
|
43
40
|
}
|
44
41
|
}
|
45
42
|
end
|
46
43
|
|
47
44
|
def xml_send_message(opt)
|
48
45
|
req = reqn()
|
49
|
-
|
50
|
-
|
46
|
+
subj_in, subj_out = filter_str(opt[:subj])
|
47
|
+
text_in, text_out = filter_str(opt[:text])
|
51
48
|
Nokogiri::XML::Builder.new( :encoding => 'windows-1251' ) { |x|
|
52
49
|
x.send('w3s.request') {
|
53
50
|
x.wmid @wmid
|
54
51
|
x.reqn req
|
55
52
|
x.message do
|
56
53
|
x.receiverwmid opt[:wmid]
|
57
|
-
x.msgsubj { x.cdata
|
58
|
-
x.msgtext { x.cdata
|
59
|
-
end
|
60
|
-
if classic?
|
61
|
-
@plan = opt[:wmid] + req + msgtext + msgsubj
|
62
|
-
x.sign sign(@plan)
|
54
|
+
x.msgsubj { x.cdata subj_in }
|
55
|
+
x.msgtext { x.cdata text_in }
|
63
56
|
end
|
57
|
+
x.sign sign("#{opt[:wmid]}#{req}#{text_out}#{subj_out}") if classic?
|
64
58
|
}
|
65
59
|
}
|
66
60
|
end
|
@@ -75,59 +69,53 @@ module Webmoney::RequestXML # :nodoc:all
|
|
75
69
|
x.wmid( opt[:wmid] || '' )
|
76
70
|
x.purse( opt[:purse] || '' )
|
77
71
|
end
|
78
|
-
if classic?
|
79
|
-
@plan = "#{opt[:wmid]}#{opt[:purse]}"
|
80
|
-
x.sign sign(@plan)
|
81
|
-
end
|
72
|
+
x.sign sign("#{opt[:wmid]}#{opt[:purse]}") if classic?
|
82
73
|
}
|
83
74
|
}
|
84
75
|
end
|
85
76
|
|
86
77
|
def xml_create_invoice(opt)
|
87
78
|
req = reqn()
|
88
|
-
|
89
|
-
|
79
|
+
desc_in, desc_out = filter_str(opt[:desc])
|
80
|
+
address_in, address_out = filter_str(opt[:address])
|
90
81
|
amount = opt[:amount].to_f.to_s.gsub(/\.?0+$/, '')
|
91
82
|
Nokogiri::XML::Builder.new( :encoding => 'windows-1251' ) { |x|
|
92
83
|
x.send('w3s.request') {
|
93
|
-
x.wmid @wmid
|
94
84
|
x.reqn req
|
85
|
+
x.wmid @wmid
|
86
|
+
x.sign sign("#{opt[:orderid]}#{opt[:customerwmid]}#{opt[:storepurse]}#{amount}#{desc_out}#{address_out}#{opt[:period]||0}#{opt[:expiration]||0}#{req}") if classic?
|
95
87
|
x.invoice do
|
96
88
|
x.orderid opt[:orderid]
|
97
89
|
x.customerwmid opt[:customerwmid]
|
98
90
|
x.storepurse opt[:storepurse]
|
99
91
|
x.amount amount
|
100
|
-
x.desc
|
101
|
-
x.address
|
92
|
+
x.desc desc_in
|
93
|
+
x.address address_in
|
102
94
|
x.period opt[:period].to_i
|
103
95
|
x.expiration opt[:expiration].to_i
|
104
96
|
end
|
105
|
-
if classic?
|
106
|
-
@plan = "#{opt[:orderid]}#{opt[:customerwmid]}#{opt[:storepurse]}" + amount
|
107
|
-
@plan+= desc + address + "#{opt[:period].to_i}#{opt[:expiration].to_i}" + req
|
108
|
-
x.sign sign(@plan)
|
109
|
-
end
|
110
97
|
}
|
111
98
|
}
|
112
99
|
end
|
113
100
|
|
114
101
|
def xml_create_transaction(opt)
|
115
102
|
req = reqn()
|
116
|
-
|
103
|
+
desc_in, desc_out = filter_str(opt[:desc]) # description
|
104
|
+
pcode = opt[:pcode].strip if opt[:period] > 0 && opt[:pcode]
|
117
105
|
Nokogiri::XML::Builder.new( :encoding => 'windows-1251' ) { |x|
|
118
106
|
x.send('w3s.request') {
|
119
107
|
x.reqn req
|
120
|
-
x.wmid(@wmid)
|
121
|
-
|
108
|
+
x.wmid(@wmid)
|
109
|
+
x.sign sign("#{req}#{opt[:transid]}#{opt[:pursesrc]}#{opt[:pursedest]}#{opt[:amount]}#{opt[:period]||0}#{pcode}#{desc_out}#{opt[:wminvid]||0}") if classic?
|
122
110
|
x.trans {
|
123
111
|
x.tranid opt[:transid] # transaction id - unique
|
124
112
|
x.pursesrc opt[:pursesrc] # sender purse
|
125
113
|
x.pursedest opt[:pursedest] # recipient purse
|
126
114
|
x.amount opt[:amount]
|
127
115
|
x.period( opt[:period] || 0 ) # protection period (0 - no protection)
|
128
|
-
x.pcode(
|
129
|
-
x.desc
|
130
|
-
x.wminvid(
|
116
|
+
x.pcode( pcode ) if pcode # protection code
|
117
|
+
x.desc desc_in
|
118
|
+
x.wminvid( wminvid ) # invoice number (0 - without invoice)
|
131
119
|
}
|
132
120
|
}
|
133
121
|
}
|
@@ -137,8 +125,9 @@ module Webmoney::RequestXML # :nodoc:all
|
|
137
125
|
req = reqn()
|
138
126
|
Nokogiri::XML::Builder.new( :encoding => 'windows-1251' ) { |x|
|
139
127
|
x.send('w3s.request') {
|
140
|
-
x.wmid @wmid
|
141
128
|
x.reqn req
|
129
|
+
x.wmid @wmid
|
130
|
+
x.sign sign("#{opt[:purse]}#{req}") if classic?
|
142
131
|
x.getoutinvoices do
|
143
132
|
x.purse opt[:purse]
|
144
133
|
x.wminvid opt[:wminvid]
|
@@ -146,11 +135,6 @@ module Webmoney::RequestXML # :nodoc:all
|
|
146
135
|
x.datestart opt[:datestart].strftime("%Y%m%d %H:%M:%S")
|
147
136
|
x.datefinish opt[:datefinish].strftime("%Y%m%d %H:%M:%S")
|
148
137
|
end
|
149
|
-
if classic?
|
150
|
-
# TODO
|
151
|
-
@plan = opt[:purse] + req
|
152
|
-
x.sign sign(@plan)
|
153
|
-
end
|
154
138
|
}
|
155
139
|
}
|
156
140
|
end
|
@@ -168,4 +152,23 @@ module Webmoney::RequestXML # :nodoc:all
|
|
168
152
|
}
|
169
153
|
end
|
170
154
|
|
155
|
+
def xml_i_trust(opt)
|
156
|
+
opt[:wmid] = @wmid
|
157
|
+
xml_trust_me(opt)
|
158
|
+
end
|
159
|
+
|
160
|
+
def xml_trust_me(opt)
|
161
|
+
req = reqn()
|
162
|
+
Nokogiri::XML::Builder.new { |x|
|
163
|
+
x.send('w3s.request') {
|
164
|
+
x.reqn req
|
165
|
+
x.wmid @wmid
|
166
|
+
x.sign sign("#{opt[:wmid]}#{req}")
|
167
|
+
x.gettrustlist do
|
168
|
+
x.wmid opt[:wmid]
|
169
|
+
end
|
170
|
+
}
|
171
|
+
}
|
172
|
+
end
|
173
|
+
|
171
174
|
end
|
data/lib/webmoney.rb
CHANGED
@@ -82,9 +82,28 @@ module Webmoney
|
|
82
82
|
|
83
83
|
@rid = opt[:rid]
|
84
84
|
|
85
|
-
# Iconv
|
86
|
-
|
87
|
-
|
85
|
+
# Iconv will raise exception Iconv::IllegalSequence,
|
86
|
+
# when uncovertable character in input sequence. It is default behavior.
|
87
|
+
# With option :force_encoding Iconv initialized with //IGNORE option, and
|
88
|
+
# uncovertable characters will be cutted.
|
89
|
+
if opt[:force_encoding]
|
90
|
+
#Iconv.new(to, from)
|
91
|
+
@ic_out = Iconv.new('CP1251//IGNORE', 'UTF-8')
|
92
|
+
@ic_in = Iconv.new('UTF-8', 'CP1251')
|
93
|
+
instance_eval do
|
94
|
+
def filter_str(str)
|
95
|
+
str_out = @ic_out.iconv(str)
|
96
|
+
return @ic_in.iconv(str_out), str_out
|
97
|
+
end
|
98
|
+
end
|
99
|
+
else
|
100
|
+
@ic_out = Iconv.new('CP1251', 'UTF-8')
|
101
|
+
instance_eval do
|
102
|
+
def filter_str(str)
|
103
|
+
return str, @ic_out.iconv(str)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
88
107
|
|
89
108
|
prepare_interface_urls
|
90
109
|
|
@@ -97,7 +116,7 @@ module Webmoney
|
|
97
116
|
def classic?
|
98
117
|
!! @signer
|
99
118
|
end
|
100
|
-
|
119
|
+
|
101
120
|
# Send message through Queue and Thread
|
102
121
|
#
|
103
122
|
# Params: { :wmid, :subj, :text }
|
@@ -186,11 +205,11 @@ module Webmoney
|
|
186
205
|
end
|
187
206
|
|
188
207
|
# Create unique Request Number based on time,
|
189
|
-
# return
|
208
|
+
# return 14 digits string
|
190
209
|
def reqn
|
191
210
|
t = Time.now
|
192
211
|
msec = t.to_f.to_s.match(/\.(\d\d)/)[1] rescue '00'
|
193
|
-
t.strftime('%
|
212
|
+
t.strftime('%y%m%d%H%M%S') + msec
|
194
213
|
end
|
195
214
|
|
196
215
|
def make_xml(iface, opt) # :nodoc:
|
data/rakefile
CHANGED
@@ -1,24 +1,25 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
require 'rake/clean'
|
4
|
-
|
5
|
-
require 'rake/extensiontask'
|
6
|
-
rescue LoadError
|
7
|
-
puts "Rake-compiler not available. Install it with: sudo gem install rake-compiler"
|
8
|
-
exit 1
|
9
|
-
end
|
10
|
-
require 'spec/rake/spectask'
|
4
|
+
require 'rake/extensiontask'
|
11
5
|
|
12
6
|
CLEAN.include ["ext/wmsigner/*.{so,o}", "ext/wmsigner/Makefile", "lib/wmsigner.so", "pkg", "tmp"]
|
13
7
|
|
14
8
|
Rake::ExtensionTask.new('wmsigner')
|
15
9
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
require 'rspec/core'
|
11
|
+
require 'rspec/core/rake_task'
|
12
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
13
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
14
|
+
end
|
15
|
+
|
16
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
17
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
18
|
+
spec.rcov = true
|
20
19
|
end
|
21
20
|
|
21
|
+
task :default => :spec
|
22
|
+
|
22
23
|
spec = begin
|
23
24
|
require 'jeweler'
|
24
25
|
Jeweler::Tasks.new do |gemspec|
|
@@ -27,7 +28,6 @@ spec = begin
|
|
27
28
|
gemspec.authors = ["Alexander Oryol"]
|
28
29
|
gemspec.email = "eagle.alex@gmail.com"
|
29
30
|
gemspec.summary = "Webmoney interfaces and native wmsigner"
|
30
|
-
gemspec.add_dependency('nokogiri')
|
31
31
|
gemspec.files << %w( rakefile ChangeLog lib/WebMoneyCA.crt ) +
|
32
32
|
Dir.glob( 'ext/**/*.{h,cpp,rb}' ) +
|
33
33
|
Dir.glob( 'tools/*.rb' )
|
@@ -40,7 +40,4 @@ spec = begin
|
|
40
40
|
gemspec.extensions = Dir.glob( 'ext/**/extconf.rb' )
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
44
|
-
rescue LoadError
|
45
|
-
puts "Jeweler not available. Install it with: sudo gem install jeweler -s http://gemcutter.org"
|
46
|
-
end
|
43
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe 'filter_str' do
|
5
|
+
|
6
|
+
let(:test) { "ényképek-0001.xls" }
|
7
|
+
|
8
|
+
it "default behavior" do
|
9
|
+
@wm = TestWM.new
|
10
|
+
lambda { @wm.filter_str(test)}.should raise_error(Iconv::IllegalSequence)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "with force_encoding" do
|
14
|
+
@wm = TestWM.new(:force_encoding => true)
|
15
|
+
input, output = @wm.filter_str(test)
|
16
|
+
output.should == Iconv.iconv('CP1251//IGNORE', 'UTF-8', test)[0]
|
17
|
+
input.should == Iconv.iconv('UTF-8', 'CP1251', output)[0]
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should send message with ignore characters" do
|
21
|
+
@wm = TestWM.new(:force_encoding => true)
|
22
|
+
result = @wm.request( :send_message,
|
23
|
+
:wmid => @wm.wmid,
|
24
|
+
:subj => 'Wörter',
|
25
|
+
:text => 'ényképek-0001.xls')
|
26
|
+
result.should be_kind_of(Hash)
|
27
|
+
result[:id].should match(/^\d*$/)
|
28
|
+
((result[:date] + 60) > Time.now).should be_true
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/spec/unit/passport_spec.rb
CHANGED
@@ -23,60 +23,10 @@ describe Webmoney::Passport, "class" do
|
|
23
23
|
res[:attestat].should have_key(key)
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
:citid=>"12918",
|
30
|
-
:cap_owner=>"0",
|
31
|
-
:region=>"Москва",
|
32
|
-
:countryid=>"195",
|
33
|
-
:city=>"Москва",
|
34
|
-
:pasdoc=>"0",
|
35
|
-
:nickname=>"Арбитр",
|
36
|
-
:country=>"Россия",
|
37
|
-
:inndoc=>"0",
|
38
|
-
:sex=>"0",
|
39
|
-
:email=>"", :pdateMMDDYYYY => "", :pday => "", :pmonth => "", :pyear => "",
|
40
|
-
:iname=>"", :inn=>"", :okonx=>"", :bik=>"", :pbywhom=>"", :phonemobile=>"", :rcountry=>"",
|
41
|
-
:bmonth=>"", :jadres=>"", :okpo=>"", :bday=>"", :pnomer=>"", :bankname=>"", :pcountry=>"", :pcountryid=>"",
|
42
|
-
:jcountryid=>"", :ks=>"", :infoopen=>"", :icq=>"", :byear=>"", :oname=>"", :osnovainfo=>"", :dirfio=>"",
|
43
|
-
:pdate=>"", :bplace=>"", :rs=>"", :rcity=>"", :adres=>"", :phone=>"", :buhfio=>"", :radres=>"", :fname=>"",
|
44
|
-
:phonehome=>"", :jcity=>"", :name=>"", :pcity=>"", :jstatus=>"", :fax=>"", :zipcode=>"", :rcountryid=>"",
|
45
|
-
:web=>"", :jzipcode=>"", :jcountry=>"", :jabberid=>""
|
46
|
-
}
|
26
|
+
res[:userinfo].should have_key(:city)
|
27
|
+
res[:directory].should have_key(:jstatus)
|
28
|
+
res[:directory][:jstatus].should have_key(20)
|
47
29
|
|
48
|
-
# a1 = res[:userinfo].keys.map(&:to_s).sort
|
49
|
-
# a2 = u_info.keys.map(&:to_s).sort
|
50
|
-
# puts ((a1|a2) - (a1 & a2)).inspect
|
51
|
-
|
52
|
-
res[:userinfo].should == u_info
|
53
|
-
|
54
|
-
res[:directory].should == {
|
55
|
-
:ctype=>{
|
56
|
-
1=>"Частное лицо",
|
57
|
-
2=>"Юридическое лицо"
|
58
|
-
},
|
59
|
-
:jstatus=>{
|
60
|
-
20=>"Директор юридического лица",
|
61
|
-
21=>"Бухгалтер юридического лица",
|
62
|
-
22=>"Представитель юридического лица",
|
63
|
-
23=>"ИП"
|
64
|
-
},
|
65
|
-
:types=>{
|
66
|
-
100=>"Аттестат псевдонима",
|
67
|
-
110=>"Формальный аттестат",
|
68
|
-
120=>"Начальный аттестат",
|
69
|
-
130=>"Персональный аттестат",
|
70
|
-
135=>"Аттестат продавца",
|
71
|
-
136=>"Аттестат Capitaller",
|
72
|
-
140=>"Аттестат разработчика",
|
73
|
-
150=>"Аттестат регистратора",
|
74
|
-
170=>"Аттестат Гаранта",
|
75
|
-
190=>"Аттестат сервиса WMT",
|
76
|
-
200=>"Аттестат сервиса WMT",
|
77
|
-
300=>"Аттестат Оператора"
|
78
|
-
}
|
79
|
-
}
|
80
30
|
end
|
81
31
|
|
82
32
|
it "should return userinfo attributes with checked/locked" do
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe "trust (x15) interfaces" do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@wm = webmoney()
|
8
|
+
end
|
9
|
+
|
10
|
+
it ":trust_me should return hash" do
|
11
|
+
wmid = WmConfig.second['wmid']
|
12
|
+
result = @wm.request(:trust_me, :wmid => wmid)
|
13
|
+
[:count, :invoices, :transactions, :balance, :history].each do |key|
|
14
|
+
result.should have_key(key)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
it ":i_trust should return hash too" do
|
19
|
+
result = @wm.request(:i_trust)
|
20
|
+
[:count, :invoices, :transactions, :balance, :history].each do |key|
|
21
|
+
result.should have_key(key)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/spec/unit/webmoney_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe Webmoney, "class" do
|
|
15
15
|
t1 = @wm.send(:reqn)
|
16
16
|
sleep(0.1)
|
17
17
|
t2 = @wm.send(:reqn)
|
18
|
-
t1.should match(/^\d{
|
18
|
+
t1.should match(/^\d{14}$/)
|
19
19
|
(t2 > t1).should be_true
|
20
20
|
end
|
21
21
|
|
@@ -31,12 +31,12 @@ describe Webmoney, "class" do
|
|
31
31
|
|
32
32
|
it "should correct reqn" do
|
33
33
|
Time.stub!(:now).and_return(Time.at(1244704683.69677))
|
34
|
-
@wm.send(:reqn).should == '
|
34
|
+
@wm.send(:reqn).should == '09061111180369'
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should correct reqn with zero microsec" do
|
38
38
|
Time.stub!(:now).and_return(Time.at(1244704683))
|
39
|
-
@wm.send(:reqn).should == '
|
39
|
+
@wm.send(:reqn).should == '09061111180300'
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should raise error on incorrect arg" do
|
@@ -164,8 +164,8 @@ describe Webmoney, "class" do
|
|
164
164
|
:amount => 1,
|
165
165
|
:customerwmid => @wm.wmid,
|
166
166
|
:storepurse => WmConfig.second['wmz'],
|
167
|
-
:desc => "
|
168
|
-
:address => "Address"
|
167
|
+
:desc => "Invoice текст",
|
168
|
+
:address => "Address адрес"
|
169
169
|
)
|
170
170
|
end
|
171
171
|
|
data/webmoney.gemspec
CHANGED
@@ -1,84 +1,86 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{webmoney}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alexander Oryol"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-02-18}
|
13
13
|
s.email = %q{eagle.alex@gmail.com}
|
14
14
|
s.extensions = ["ext/wmsigner/extconf.rb"]
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"ChangeLog",
|
17
|
-
|
17
|
+
"README"
|
18
18
|
]
|
19
19
|
s.files = [
|
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
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
20
|
+
"ChangeLog",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"README",
|
24
|
+
"RUNNING_TESTS",
|
25
|
+
"VERSION",
|
26
|
+
"ext/wmsigner/base64.cpp",
|
27
|
+
"ext/wmsigner/base64.h",
|
28
|
+
"ext/wmsigner/cmdbase.cpp",
|
29
|
+
"ext/wmsigner/cmdbase.h",
|
30
|
+
"ext/wmsigner/crypto.cpp",
|
31
|
+
"ext/wmsigner/crypto.h",
|
32
|
+
"ext/wmsigner/extconf.rb",
|
33
|
+
"ext/wmsigner/md4.cpp",
|
34
|
+
"ext/wmsigner/md4.h",
|
35
|
+
"ext/wmsigner/rsalib1.cpp",
|
36
|
+
"ext/wmsigner/rsalib1.h",
|
37
|
+
"ext/wmsigner/signer.cpp",
|
38
|
+
"ext/wmsigner/signer.h",
|
39
|
+
"ext/wmsigner/stdafx.cpp",
|
40
|
+
"ext/wmsigner/stdafx.h",
|
41
|
+
"ext/wmsigner/wmsigner.cpp",
|
42
|
+
"lib/certs/0b532bc2.0",
|
43
|
+
"lib/certs/3c58f906.0",
|
44
|
+
"lib/certs/AddTrust_External_Root.crt",
|
45
|
+
"lib/certs/WebMoneyCA.crt",
|
46
|
+
"lib/interfaces.rb",
|
47
|
+
"lib/messenger.rb",
|
48
|
+
"lib/passport.rb",
|
49
|
+
"lib/purse.rb",
|
50
|
+
"lib/request_result.rb",
|
51
|
+
"lib/request_retval.rb",
|
52
|
+
"lib/request_xml.rb",
|
53
|
+
"lib/webmoney.rb",
|
54
|
+
"lib/wmid.rb",
|
55
|
+
"rakefile",
|
56
|
+
"spec/spec",
|
57
|
+
"spec/spec_helper.rb",
|
58
|
+
"spec/unit/iconv_spec.rb",
|
59
|
+
"spec/unit/messenger_spec.rb",
|
60
|
+
"spec/unit/passport_spec.rb",
|
61
|
+
"spec/unit/purse_spec.rb",
|
62
|
+
"spec/unit/signer_spec.rb",
|
63
|
+
"spec/unit/time_spec.rb",
|
64
|
+
"spec/unit/trust_spec.rb",
|
65
|
+
"spec/unit/webmoney_spec.rb",
|
66
|
+
"spec/unit/wmid_spec.rb",
|
67
|
+
"webmoney.gemspec"
|
67
68
|
]
|
68
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
69
69
|
s.require_paths = ["lib"]
|
70
70
|
s.rubyforge_project = %q{webmoney}
|
71
71
|
s.rubygems_version = %q{1.3.7}
|
72
72
|
s.summary = %q{Webmoney interfaces and native wmsigner}
|
73
73
|
s.test_files = [
|
74
|
+
"spec/spec_helper.rb",
|
75
|
+
"spec/unit/iconv_spec.rb",
|
76
|
+
"spec/unit/messenger_spec.rb",
|
77
|
+
"spec/unit/passport_spec.rb",
|
78
|
+
"spec/unit/purse_spec.rb",
|
79
|
+
"spec/unit/signer_spec.rb",
|
74
80
|
"spec/unit/time_spec.rb",
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
"spec/unit/passport_spec.rb",
|
79
|
-
"spec/unit/webmoney_spec.rb",
|
80
|
-
"spec/unit/wmid_spec.rb",
|
81
|
-
"spec/spec_helper.rb"
|
81
|
+
"spec/unit/trust_spec.rb",
|
82
|
+
"spec/unit/webmoney_spec.rb",
|
83
|
+
"spec/unit/wmid_spec.rb"
|
82
84
|
]
|
83
85
|
|
84
86
|
if s.respond_to? :specification_version then
|
@@ -87,11 +89,23 @@ Gem::Specification.new do |s|
|
|
87
89
|
|
88
90
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
89
91
|
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
92
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
93
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
94
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
95
|
+
s.add_development_dependency(%q<rake-compiler>, [">= 0"])
|
90
96
|
else
|
91
97
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
98
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
99
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
100
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
101
|
+
s.add_dependency(%q<rake-compiler>, [">= 0"])
|
92
102
|
end
|
93
103
|
else
|
94
104
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
105
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
106
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
107
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
108
|
+
s.add_dependency(%q<rake-compiler>, [">= 0"])
|
95
109
|
end
|
96
110
|
end
|
97
111
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 11
|
9
|
+
version: 0.0.11
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alexander Oryol
|
@@ -14,12 +14,11 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-02-18 00:00:00 +03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: nokogiri
|
22
|
-
prerelease: false
|
23
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
23
|
none: false
|
25
24
|
requirements:
|
@@ -29,7 +28,66 @@ dependencies:
|
|
29
28
|
- 0
|
30
29
|
version: "0"
|
31
30
|
type: :runtime
|
31
|
+
prerelease: false
|
32
32
|
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rspec
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 2
|
42
|
+
- 3
|
43
|
+
- 0
|
44
|
+
version: 2.3.0
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: bundler
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 1
|
57
|
+
- 0
|
58
|
+
- 0
|
59
|
+
version: 1.0.0
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: jeweler
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
segments:
|
71
|
+
- 1
|
72
|
+
- 5
|
73
|
+
- 2
|
74
|
+
version: 1.5.2
|
75
|
+
type: :development
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: *id004
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake-compiler
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *id005
|
33
91
|
description:
|
34
92
|
email: eagle.alex@gmail.com
|
35
93
|
executables: []
|
@@ -40,7 +98,6 @@ extra_rdoc_files:
|
|
40
98
|
- ChangeLog
|
41
99
|
- README
|
42
100
|
files:
|
43
|
-
- .gitignore
|
44
101
|
- ChangeLog
|
45
102
|
- Gemfile
|
46
103
|
- Gemfile.lock
|
@@ -79,11 +136,13 @@ files:
|
|
79
136
|
- rakefile
|
80
137
|
- spec/spec
|
81
138
|
- spec/spec_helper.rb
|
139
|
+
- spec/unit/iconv_spec.rb
|
82
140
|
- spec/unit/messenger_spec.rb
|
83
141
|
- spec/unit/passport_spec.rb
|
84
142
|
- spec/unit/purse_spec.rb
|
85
143
|
- spec/unit/signer_spec.rb
|
86
144
|
- spec/unit/time_spec.rb
|
145
|
+
- spec/unit/trust_spec.rb
|
87
146
|
- spec/unit/webmoney_spec.rb
|
88
147
|
- spec/unit/wmid_spec.rb
|
89
148
|
- webmoney.gemspec
|
@@ -92,8 +151,8 @@ homepage:
|
|
92
151
|
licenses: []
|
93
152
|
|
94
153
|
post_install_message:
|
95
|
-
rdoc_options:
|
96
|
-
|
154
|
+
rdoc_options: []
|
155
|
+
|
97
156
|
require_paths:
|
98
157
|
- lib
|
99
158
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -120,11 +179,13 @@ signing_key:
|
|
120
179
|
specification_version: 3
|
121
180
|
summary: Webmoney interfaces and native wmsigner
|
122
181
|
test_files:
|
123
|
-
- spec/
|
124
|
-
- spec/unit/
|
125
|
-
- spec/unit/signer_spec.rb
|
182
|
+
- spec/spec_helper.rb
|
183
|
+
- spec/unit/iconv_spec.rb
|
126
184
|
- spec/unit/messenger_spec.rb
|
127
185
|
- spec/unit/passport_spec.rb
|
186
|
+
- spec/unit/purse_spec.rb
|
187
|
+
- spec/unit/signer_spec.rb
|
188
|
+
- spec/unit/time_spec.rb
|
189
|
+
- spec/unit/trust_spec.rb
|
128
190
|
- spec/unit/webmoney_spec.rb
|
129
191
|
- spec/unit/wmid_spec.rb
|
130
|
-
- spec/spec_helper.rb
|