webmoney 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/VERSION +1 -1
- data/ext/wmsigner/signer.cpp +4 -10
- data/lib/request_result.rb +18 -19
- data/lib/request_xml.rb +1 -1
- data/lib/webmoney.rb +1 -1
- metadata +3 -3
data/ChangeLog
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.12
|
data/ext/wmsigner/signer.cpp
CHANGED
@@ -10,18 +10,12 @@
|
|
10
10
|
#include <sys/types.h>
|
11
11
|
#include <sys/stat.h>
|
12
12
|
#include <errno.h>
|
13
|
-
#define __open _open
|
14
|
-
#define __read _read
|
15
|
-
#define __close _close
|
16
13
|
#else
|
17
14
|
#include <sys/types.h>
|
18
15
|
#include <sys/stat.h>
|
19
16
|
#include <sys/uio.h>
|
20
17
|
#include <unistd.h>
|
21
18
|
#include <errno.h>
|
22
|
-
#define __open open
|
23
|
-
#define __read read
|
24
|
-
#define __close close
|
25
19
|
#endif
|
26
20
|
|
27
21
|
#ifndef TRUE
|
@@ -115,9 +109,9 @@ int Signer::LoadKeys()
|
|
115
109
|
|
116
110
|
if( (!isIgnoreKeyFile) && (Key64Flag == FALSE) ) {
|
117
111
|
#ifdef O_BINARY
|
118
|
-
fh =
|
112
|
+
fh = open( m_szKeyFileName, O_RDONLY | O_BINARY);
|
119
113
|
#else
|
120
|
-
fh =
|
114
|
+
fh = open( m_szKeyFileName, O_RDONLY);
|
121
115
|
#endif
|
122
116
|
|
123
117
|
if( fh == -1 )
|
@@ -131,10 +125,10 @@ if( (!isIgnoreKeyFile) && (Key64Flag == FALSE) ) {
|
|
131
125
|
if (st_size == lMinKeyFileSize)
|
132
126
|
{
|
133
127
|
// load 164 bytes from "small" keys file
|
134
|
-
nReaden =
|
128
|
+
nReaden = read( fh, pBufRead, nMaxBufLen );
|
135
129
|
bKeysReaded = (nReaden == lMinKeyFileSize);
|
136
130
|
}
|
137
|
-
|
131
|
+
close( fh );
|
138
132
|
}
|
139
133
|
else {
|
140
134
|
bKeysReaded = true;
|
data/lib/request_result.rb
CHANGED
@@ -32,12 +32,12 @@ module Webmoney::RequestResult # :nodoc:all
|
|
32
32
|
res = {
|
33
33
|
:retval => doc.at('//retval').inner_html.to_i,
|
34
34
|
:retdesc => (doc.at('//testwmpurse/retdesc').inner_html rescue nil),
|
35
|
-
:orderid =>
|
35
|
+
:orderid => doc.at('//invoice/orderid').inner_html.to_i
|
36
36
|
}
|
37
37
|
if res[:retval] == 0
|
38
|
-
res[:id] =
|
39
|
-
res[:ts] =
|
40
|
-
res[:state] =
|
38
|
+
res[:id] = doc.at('//invoice')['id'].to_i
|
39
|
+
res[:ts] = doc.at('//invoice')['ts'].to_i
|
40
|
+
res[:state] = doc.at('//invoice/state').inner_html.to_i
|
41
41
|
res[:created_at] = Time.parse(doc.at('//invoice/datecrt').inner_html)
|
42
42
|
end
|
43
43
|
res
|
@@ -58,22 +58,21 @@ module Webmoney::RequestResult # :nodoc:all
|
|
58
58
|
:retval => doc.at('//retval').inner_html.to_i,
|
59
59
|
:retdesc => (doc.at('//testwmpurse/retdesc').inner_html rescue nil),
|
60
60
|
}
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
75
|
-
r
|
61
|
+
res[:invoices] = doc.xpath('//outinvoices/outinvoice').map do |invoice|
|
62
|
+
r = {
|
63
|
+
:id => invoice['id'].to_i,
|
64
|
+
:ts => invoice['ts'].to_i,
|
65
|
+
}
|
66
|
+
invoice.elements.each do |tag|
|
67
|
+
name = tag.name.to_sym
|
68
|
+
value = tag.inner_html
|
69
|
+
value = value.to_i if [:orderid, :tranid, :period, :expiration, :wmtranid, :state].include?(name)
|
70
|
+
value = value.to_f if [:rest, :amount, :comiss].include?(name)
|
71
|
+
value = Time.parse(value) if [:datecrt, :dateupd].include?(name)
|
72
|
+
value = @ic_in.iconv(value) if [:desc, :address].include?(name)
|
73
|
+
r[name] = value
|
76
74
|
end
|
75
|
+
r
|
77
76
|
end
|
78
77
|
res
|
79
78
|
end
|
data/lib/request_xml.rb
CHANGED
@@ -115,7 +115,7 @@ module Webmoney::RequestXML # :nodoc:all
|
|
115
115
|
x.period( opt[:period] || 0 ) # protection period (0 - no protection)
|
116
116
|
x.pcode( pcode ) if pcode # protection code
|
117
117
|
x.desc desc_in
|
118
|
-
x.wminvid( wminvid )
|
118
|
+
x.wminvid( opt[:wminvid] || 0 ) # invoice number (0 - without invoice)
|
119
119
|
}
|
120
120
|
}
|
121
121
|
}
|
data/lib/webmoney.rb
CHANGED
@@ -86,10 +86,10 @@ module Webmoney
|
|
86
86
|
# when uncovertable character in input sequence. It is default behavior.
|
87
87
|
# With option :force_encoding Iconv initialized with //IGNORE option, and
|
88
88
|
# uncovertable characters will be cutted.
|
89
|
+
@ic_in = Iconv.new('UTF-8', 'CP1251')
|
89
90
|
if opt[:force_encoding]
|
90
91
|
#Iconv.new(to, from)
|
91
92
|
@ic_out = Iconv.new('CP1251//IGNORE', 'UTF-8')
|
92
|
-
@ic_in = Iconv.new('UTF-8', 'CP1251')
|
93
93
|
instance_eval do
|
94
94
|
def filter_str(str)
|
95
95
|
str_out = @ic_out.iconv(str)
|
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
|
+
- 12
|
9
|
+
version: 0.0.12
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alexander Oryol
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-04-26 00:00:00 +04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|