openpayu 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/.rspec +3 -0
- data/.rubocop.yml +45 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +193 -0
- data/Rakefile +1 -0
- data/doc/EmptyResponseError.html +123 -0
- data/doc/HttpStatusException.html +123 -0
- data/doc/NotImplementedException.html +123 -0
- data/doc/OpenPayU.html +436 -0
- data/doc/OpenPayU/Configuration.html +1530 -0
- data/doc/OpenPayU/Connection.html +381 -0
- data/doc/OpenPayU/Document.html +705 -0
- data/doc/OpenPayU/Documents.html +117 -0
- data/doc/OpenPayU/Documents/Request.html +503 -0
- data/doc/OpenPayU/Documents/Response.html +783 -0
- data/doc/OpenPayU/Models.html +117 -0
- data/doc/OpenPayU/Models/Address.html +861 -0
- data/doc/OpenPayU/Models/Buyer.html +587 -0
- data/doc/OpenPayU/Models/Buyer/Delivery.html +312 -0
- data/doc/OpenPayU/Models/Card.html +507 -0
- data/doc/OpenPayU/Models/Fee.html +367 -0
- data/doc/OpenPayU/Models/Model.html +1208 -0
- data/doc/OpenPayU/Models/NotifyResponse.html +297 -0
- data/doc/OpenPayU/Models/Order.html +1155 -0
- data/doc/OpenPayU/Models/PayMethod.html +507 -0
- data/doc/OpenPayU/Models/Product.html +787 -0
- data/doc/OpenPayU/Models/Refund.html +1020 -0
- data/doc/OpenPayU/Models/ShippingMethod.html +367 -0
- data/doc/OpenPayU/Models/StatusUpdate.html +647 -0
- data/doc/OpenPayU/Models/Token.html +507 -0
- data/doc/OpenPayU/Order.html +924 -0
- data/doc/OpenPayU/Refund.html +269 -0
- data/doc/OpenPayU/Token.html +288 -0
- data/doc/OpenPayU/XmlBuilder.html +277 -0
- data/doc/WrongConfigurationError.html +123 -0
- data/doc/WrongNotifyRequest.html +123 -0
- data/doc/WrongOrderParameters.html +267 -0
- data/doc/WrongSignatureException.html +123 -0
- data/doc/_index.html +446 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +338 -0
- data/doc/file.README.html +281 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +281 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +1007 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/openpayu.rb +66 -0
- data/lib/openpayu/configuration.rb +62 -0
- data/lib/openpayu/connection.rb +65 -0
- data/lib/openpayu/document.rb +105 -0
- data/lib/openpayu/documents/request.rb +34 -0
- data/lib/openpayu/documents/response.rb +48 -0
- data/lib/openpayu/exceptions.rb +19 -0
- data/lib/openpayu/models/address.rb +12 -0
- data/lib/openpayu/models/buyer.rb +11 -0
- data/lib/openpayu/models/buyer/delivery.rb +7 -0
- data/lib/openpayu/models/buyer/invoice.rb +8 -0
- data/lib/openpayu/models/card.rb +10 -0
- data/lib/openpayu/models/fee.rb +9 -0
- data/lib/openpayu/models/model.rb +151 -0
- data/lib/openpayu/models/notify_response.rb +9 -0
- data/lib/openpayu/models/order.rb +28 -0
- data/lib/openpayu/models/pay_method.rb +10 -0
- data/lib/openpayu/models/product.rb +10 -0
- data/lib/openpayu/models/refund.rb +41 -0
- data/lib/openpayu/models/shipping_method.rb +9 -0
- data/lib/openpayu/models/status_update.rb +14 -0
- data/lib/openpayu/models/token.rb +10 -0
- data/lib/openpayu/order.rb +119 -0
- data/lib/openpayu/refund.rb +26 -0
- data/lib/openpayu/token.rb +27 -0
- data/lib/openpayu/version.rb +4 -0
- data/lib/openpayu/xml_builder.rb +23 -0
- data/lib/openpayu_ruby.rb +2 -0
- data/openpayu_ruby.gemspec +40 -0
- data/spec/cassettes/cancel_order.yml +50 -0
- data/spec/cassettes/create_order.yml +51 -0
- data/spec/cassettes/refund_order.yml +100 -0
- data/spec/cassettes/retrieve_order.yml +51 -0
- data/spec/cassettes/update_order.yml +50 -0
- data/spec/integration/order_spec.rb +103 -0
- data/spec/openpayu.yml +11 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/test_objects/order.rb +97 -0
- data/spec/unit/configuration_spec.rb +71 -0
- data/spec/unit/document_spec.rb +18 -0
- data/spec/unit/models/order_spec.rb +82 -0
- data/spec/unit/models/refund_spec.rb +24 -0
- data/spec/unit/openpayu_spec.rb +27 -0
- metadata +327 -0
@@ -0,0 +1,381 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: OpenPayU::Connection
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.2
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (C)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../OpenPayU.html" title="OpenPayU (module)">OpenPayU</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Connection</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: OpenPayU::Connection
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">OpenPayU::Connection</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/openpayu/connection.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<h2>
|
111
|
+
Class Method Summary
|
112
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
113
|
+
</h2>
|
114
|
+
|
115
|
+
<ul class="summary">
|
116
|
+
|
117
|
+
<li class="public ">
|
118
|
+
<span class="summary_signature">
|
119
|
+
|
120
|
+
<a href="#delete-class_method" title="delete (class method)">+ (Object) <strong>delete</strong>(url, data, headers) </a>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
</span>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#get-class_method" title="get (class method)">+ (Object) <strong>get</strong>(url, data, headers) </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
|
161
|
+
<li class="public ">
|
162
|
+
<span class="summary_signature">
|
163
|
+
|
164
|
+
<a href="#post-class_method" title="post (class method)">+ (Object) <strong>post</strong>(url, data, headers) </a>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
</span>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
179
|
+
|
180
|
+
</li>
|
181
|
+
|
182
|
+
|
183
|
+
<li class="public ">
|
184
|
+
<span class="summary_signature">
|
185
|
+
|
186
|
+
<a href="#put-class_method" title="put (class method)">+ (Object) <strong>put</strong>(url, data, headers) </a>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
</span>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
201
|
+
|
202
|
+
</li>
|
203
|
+
|
204
|
+
|
205
|
+
</ul>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
<div id="class_method_details" class="method_details_list">
|
211
|
+
<h2>Class Method Details</h2>
|
212
|
+
|
213
|
+
|
214
|
+
<div class="method_details first">
|
215
|
+
<h3 class="signature first" id="delete-class_method">
|
216
|
+
|
217
|
+
+ (<tt>Object</tt>) <strong>delete</strong>(url, data, headers)
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
</h3><table class="source_code">
|
224
|
+
<tr>
|
225
|
+
<td>
|
226
|
+
<pre class="lines">
|
227
|
+
|
228
|
+
|
229
|
+
40
|
230
|
+
41
|
231
|
+
42</pre>
|
232
|
+
</td>
|
233
|
+
<td>
|
234
|
+
<pre class="code"><span class="info file"># File 'lib/openpayu/connection.rb', line 40</span>
|
235
|
+
|
236
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
237
|
+
<span class='id identifier rubyid_common_connection'>common_connection</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>DELETE</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
238
|
+
<span class='kw'>end</span></pre>
|
239
|
+
</td>
|
240
|
+
</tr>
|
241
|
+
</table>
|
242
|
+
</div>
|
243
|
+
|
244
|
+
<div class="method_details ">
|
245
|
+
<h3 class="signature " id="get-class_method">
|
246
|
+
|
247
|
+
+ (<tt>Object</tt>) <strong>get</strong>(url, data, headers)
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
</h3><table class="source_code">
|
254
|
+
<tr>
|
255
|
+
<td>
|
256
|
+
<pre class="lines">
|
257
|
+
|
258
|
+
|
259
|
+
36
|
260
|
+
37
|
261
|
+
38</pre>
|
262
|
+
</td>
|
263
|
+
<td>
|
264
|
+
<pre class="code"><span class="info file"># File 'lib/openpayu/connection.rb', line 36</span>
|
265
|
+
|
266
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
267
|
+
<span class='id identifier rubyid_common_connection'>common_connection</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>GET</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
268
|
+
<span class='kw'>end</span></pre>
|
269
|
+
</td>
|
270
|
+
</tr>
|
271
|
+
</table>
|
272
|
+
</div>
|
273
|
+
|
274
|
+
<div class="method_details ">
|
275
|
+
<h3 class="signature " id="post-class_method">
|
276
|
+
|
277
|
+
+ (<tt>Object</tt>) <strong>post</strong>(url, data, headers)
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
</h3><table class="source_code">
|
284
|
+
<tr>
|
285
|
+
<td>
|
286
|
+
<pre class="lines">
|
287
|
+
|
288
|
+
|
289
|
+
10
|
290
|
+
11
|
291
|
+
12
|
292
|
+
13
|
293
|
+
14
|
294
|
+
15
|
295
|
+
16
|
296
|
+
17
|
297
|
+
18
|
298
|
+
19
|
299
|
+
20
|
300
|
+
21</pre>
|
301
|
+
</td>
|
302
|
+
<td>
|
303
|
+
<pre class="code"><span class="info file"># File 'lib/openpayu/connection.rb', line 10</span>
|
304
|
+
|
305
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
306
|
+
<span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
|
307
|
+
<span class='id identifier rubyid_http'>http</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span> <span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span>
|
308
|
+
<span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_use_ssl'>use_ssl</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='const'>OpenPayU</span><span class='op'>::</span><span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_use_ssl?'>use_ssl?</span>
|
309
|
+
<span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='op'>::</span><span class='const'>Post</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
310
|
+
<span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span>
|
311
|
+
<span class='id identifier rubyid_request'>request</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span>
|
312
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>application/</span><span class='embexpr_beg'>#{</span><span class='const'>OpenPayU</span><span class='op'>::</span><span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_data_format'>data_format</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
313
|
+
<span class='id identifier rubyid_request'>request</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>OpenPayu-Signature</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>OpenPayu-Signature</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
314
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_request'>request</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span>
|
315
|
+
<span class='lbrace'>{</span> <span class='label'>response:</span> <span class='id identifier rubyid_response'>response</span><span class='comma'>,</span> <span class='label'>request:</span> <span class='id identifier rubyid_request'>request</span> <span class='rbrace'>}</span>
|
316
|
+
<span class='kw'>end</span></pre>
|
317
|
+
</td>
|
318
|
+
</tr>
|
319
|
+
</table>
|
320
|
+
</div>
|
321
|
+
|
322
|
+
<div class="method_details ">
|
323
|
+
<h3 class="signature " id="put-class_method">
|
324
|
+
|
325
|
+
+ (<tt>Object</tt>) <strong>put</strong>(url, data, headers)
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
</h3><table class="source_code">
|
332
|
+
<tr>
|
333
|
+
<td>
|
334
|
+
<pre class="lines">
|
335
|
+
|
336
|
+
|
337
|
+
23
|
338
|
+
24
|
339
|
+
25
|
340
|
+
26
|
341
|
+
27
|
342
|
+
28
|
343
|
+
29
|
344
|
+
30
|
345
|
+
31
|
346
|
+
32
|
347
|
+
33
|
348
|
+
34</pre>
|
349
|
+
</td>
|
350
|
+
<td>
|
351
|
+
<pre class="code"><span class="info file"># File 'lib/openpayu/connection.rb', line 23</span>
|
352
|
+
|
353
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
354
|
+
<span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
|
355
|
+
<span class='id identifier rubyid_http'>http</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span> <span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span>
|
356
|
+
<span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_use_ssl'>use_ssl</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='const'>OpenPayU</span><span class='op'>::</span><span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_use_ssl?'>use_ssl?</span>
|
357
|
+
<span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='op'>::</span><span class='const'>Put</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
358
|
+
<span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span>
|
359
|
+
<span class='id identifier rubyid_request'>request</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span>
|
360
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>application/</span><span class='embexpr_beg'>#{</span><span class='const'>OpenPayU</span><span class='op'>::</span><span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_data_format'>data_format</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
361
|
+
<span class='id identifier rubyid_request'>request</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>OpenPayu-Signature</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>OpenPayu-Signature</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
362
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_request'>request</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span>
|
363
|
+
<span class='lbrace'>{</span> <span class='label'>response:</span> <span class='id identifier rubyid_response'>response</span><span class='comma'>,</span> <span class='label'>request:</span> <span class='id identifier rubyid_request'>request</span> <span class='rbrace'>}</span>
|
364
|
+
<span class='kw'>end</span></pre>
|
365
|
+
</td>
|
366
|
+
</tr>
|
367
|
+
</table>
|
368
|
+
</div>
|
369
|
+
|
370
|
+
</div>
|
371
|
+
|
372
|
+
</div>
|
373
|
+
|
374
|
+
<div id="footer">
|
375
|
+
Generated on Tue Dec 17 15:20:59 2013 by
|
376
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
377
|
+
0.8.7.2 (ruby-1.9.3).
|
378
|
+
</div>
|
379
|
+
|
380
|
+
</body>
|
381
|
+
</html>
|
@@ -0,0 +1,705 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: OpenPayU::Document
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.2
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (D)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../OpenPayU.html" title="OpenPayU (module)">OpenPayU</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Document</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: OpenPayU::Document
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">OpenPayU::Document</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/openpayu/document.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
<div id="subclasses">
|
103
|
+
<h2>Direct Known Subclasses</h2>
|
104
|
+
<p class="children"><span class='object_link'><a href="Documents/Request.html" title="OpenPayU::Documents::Request (class)">OpenPayU::Documents::Request</a></span>, <span class='object_link'><a href="Documents/Response.html" title="OpenPayU::Documents::Response (class)">OpenPayU::Documents::Response</a></span></p>
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
<h2>
|
115
|
+
Instance Method Summary
|
116
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
117
|
+
</h2>
|
118
|
+
|
119
|
+
<ul class="summary">
|
120
|
+
|
121
|
+
<li class="public ">
|
122
|
+
<span class="summary_signature">
|
123
|
+
|
124
|
+
<a href="#deep_transform_keys-instance_method" title="#deep_transform_keys (instance method)">- (Object) <strong>deep_transform_keys</strong>(hash, &block) </a>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
</span>
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
139
|
+
|
140
|
+
</li>
|
141
|
+
|
142
|
+
|
143
|
+
<li class="public ">
|
144
|
+
<span class="summary_signature">
|
145
|
+
|
146
|
+
<a href="#generate_signature-instance_method" title="#generate_signature (instance method)">- (Object) <strong>generate_signature</strong>(data, algorithm, signature_key) </a>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
</span>
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
161
|
+
|
162
|
+
</li>
|
163
|
+
|
164
|
+
|
165
|
+
<li class="public ">
|
166
|
+
<span class="summary_signature">
|
167
|
+
|
168
|
+
<a href="#generate_signature_structure-instance_method" title="#generate_signature_structure (instance method)">- (Object) <strong>generate_signature_structure</strong>(data, algorithm, pos_id = '', key = '') </a>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
</span>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
183
|
+
|
184
|
+
</li>
|
185
|
+
|
186
|
+
|
187
|
+
<li class="public ">
|
188
|
+
<span class="summary_signature">
|
189
|
+
|
190
|
+
<a href="#get_signature-instance_method" title="#get_signature (instance method)">- (Object) <strong>get_signature</strong> </a>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
</span>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
205
|
+
|
206
|
+
</li>
|
207
|
+
|
208
|
+
|
209
|
+
<li class="public ">
|
210
|
+
<span class="summary_signature">
|
211
|
+
|
212
|
+
<a href="#parse_signature-instance_method" title="#parse_signature (instance method)">- (Object) <strong>parse_signature</strong> </a>
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
</span>
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
227
|
+
|
228
|
+
</li>
|
229
|
+
|
230
|
+
|
231
|
+
<li class="public ">
|
232
|
+
<span class="summary_signature">
|
233
|
+
|
234
|
+
<a href="#underscore_keys-instance_method" title="#underscore_keys (instance method)">- (Object) <strong>underscore_keys</strong>(hash) </a>
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
</span>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
249
|
+
|
250
|
+
</li>
|
251
|
+
|
252
|
+
|
253
|
+
<li class="public ">
|
254
|
+
<span class="summary_signature">
|
255
|
+
|
256
|
+
<a href="#verify_response-instance_method" title="#verify_response (instance method)">- (Object) <strong>verify_response</strong> </a>
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
</span>
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
271
|
+
|
272
|
+
</li>
|
273
|
+
|
274
|
+
|
275
|
+
<li class="public ">
|
276
|
+
<span class="summary_signature">
|
277
|
+
|
278
|
+
<a href="#verify_signature-instance_method" title="#verify_signature (instance method)">- (Object) <strong>verify_signature</strong>(message) </a>
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
</span>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
293
|
+
|
294
|
+
</li>
|
295
|
+
|
296
|
+
|
297
|
+
</ul>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
<div id="instance_method_details" class="method_details_list">
|
303
|
+
<h2>Instance Method Details</h2>
|
304
|
+
|
305
|
+
|
306
|
+
<div class="method_details first">
|
307
|
+
<h3 class="signature first" id="deep_transform_keys-instance_method">
|
308
|
+
|
309
|
+
- (<tt>Object</tt>) <strong>deep_transform_keys</strong>(hash, &block)
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
</h3><table class="source_code">
|
316
|
+
<tr>
|
317
|
+
<td>
|
318
|
+
<pre class="lines">
|
319
|
+
|
320
|
+
|
321
|
+
90
|
322
|
+
91
|
323
|
+
92
|
324
|
+
93
|
325
|
+
94
|
326
|
+
95
|
327
|
+
96
|
328
|
+
97
|
329
|
+
98
|
330
|
+
99
|
331
|
+
100
|
332
|
+
101</pre>
|
333
|
+
</td>
|
334
|
+
<td>
|
335
|
+
<pre class="code"><span class="info file"># File 'lib/openpayu/document.rb', line 90</span>
|
336
|
+
|
337
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_deep_transform_keys'>deep_transform_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
338
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
339
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
|
340
|
+
<span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='kw'>yield</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span><span class='rbracket'>]</span> <span class='op'>=</span>
|
341
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
342
|
+
<span class='id identifier rubyid_deep_transform_keys'>deep_transform_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
343
|
+
<span class='kw'>else</span>
|
344
|
+
<span class='id identifier rubyid_value'>value</span>
|
345
|
+
<span class='kw'>end</span>
|
346
|
+
<span class='kw'>end</span>
|
347
|
+
<span class='id identifier rubyid_result'>result</span>
|
348
|
+
<span class='kw'>end</span></pre>
|
349
|
+
</td>
|
350
|
+
</tr>
|
351
|
+
</table>
|
352
|
+
</div>
|
353
|
+
|
354
|
+
<div class="method_details ">
|
355
|
+
<h3 class="signature " id="generate_signature-instance_method">
|
356
|
+
|
357
|
+
- (<tt>Object</tt>) <strong>generate_signature</strong>(data, algorithm, signature_key)
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
</h3><table class="source_code">
|
364
|
+
<tr>
|
365
|
+
<td>
|
366
|
+
<pre class="lines">
|
367
|
+
|
368
|
+
|
369
|
+
21
|
370
|
+
22
|
371
|
+
23
|
372
|
+
24
|
373
|
+
25
|
374
|
+
26
|
375
|
+
27
|
376
|
+
28
|
377
|
+
29
|
378
|
+
30
|
379
|
+
31
|
380
|
+
32
|
381
|
+
33</pre>
|
382
|
+
</td>
|
383
|
+
<td>
|
384
|
+
<pre class="code"><span class="info file"># File 'lib/openpayu/document.rb', line 21</span>
|
385
|
+
|
386
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_generate_signature'>generate_signature</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_algorithm'>algorithm</span><span class='comma'>,</span> <span class='id identifier rubyid_signature_key'>signature_key</span><span class='rparen'>)</span>
|
387
|
+
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span> <span class='op'>+</span> <span class='id identifier rubyid_signature_key'>signature_key</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
388
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_algorithm'>algorithm</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>MD5</span><span class='tstring_end'>'</span></span>
|
389
|
+
<span class='id identifier rubyid_signature'>signature</span> <span class='op'>=</span> <span class='const'>Digest</span><span class='op'>::</span><span class='const'>MD5</span><span class='period'>.</span><span class='id identifier rubyid_hexdigest'>hexdigest</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
390
|
+
<span class='kw'>elsif</span> <span class='qwords_beg'>%w(</span><span class='tstring_content'>SHA</span><span class='words_sep'> </span><span class='tstring_content'>SHA1</span><span class='words_sep'> </span><span class='tstring_content'>SHA-1</span><span class='words_sep'>)</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_algorithm'>algorithm</span>
|
391
|
+
<span class='id identifier rubyid_signature'>signature</span> <span class='op'>=</span> <span class='const'>Digest</span><span class='op'>::</span><span class='const'>SHA1</span><span class='period'>.</span><span class='id identifier rubyid_hexdigest'>hexdigest</span> <span class='id identifier rubyid_data'>data</span>
|
392
|
+
<span class='kw'>elsif</span> <span class='qwords_beg'>%w(</span><span class='tstring_content'>SHA-256</span><span class='words_sep'> </span><span class='tstring_content'>SHA256</span><span class='words_sep'> </span><span class='tstring_content'>SHA_256</span><span class='words_sep'>)</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_algorithm'>algorithm</span>
|
393
|
+
<span class='id identifier rubyid_signature'>signature</span> <span class='op'>=</span> <span class='const'>Digest</span><span class='op'>::</span><span class='const'>SHA256</span><span class='period'>.</span><span class='id identifier rubyid_hexdigest'>hexdigest</span> <span class='id identifier rubyid_data'>data</span>
|
394
|
+
<span class='kw'>else</span>
|
395
|
+
<span class='id identifier rubyid_signature'>signature</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
|
396
|
+
<span class='kw'>end</span>
|
397
|
+
<span class='id identifier rubyid_signature'>signature</span>
|
398
|
+
<span class='kw'>end</span></pre>
|
399
|
+
</td>
|
400
|
+
</tr>
|
401
|
+
</table>
|
402
|
+
</div>
|
403
|
+
|
404
|
+
<div class="method_details ">
|
405
|
+
<h3 class="signature " id="generate_signature_structure-instance_method">
|
406
|
+
|
407
|
+
- (<tt>Object</tt>) <strong>generate_signature_structure</strong>(data, algorithm, pos_id = '', key = '')
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
</h3><div class="docstring">
|
414
|
+
<div class="discussion">
|
415
|
+
|
416
|
+
|
417
|
+
</div>
|
418
|
+
</div>
|
419
|
+
<div class="tags">
|
420
|
+
|
421
|
+
<p class="tag_title">Raises:</p>
|
422
|
+
<ul class="raise">
|
423
|
+
|
424
|
+
<li>
|
425
|
+
|
426
|
+
|
427
|
+
<span class='type'>(<tt><span class='object_link'><a href="../WrongConfigurationError.html" title="WrongConfigurationError (class)">WrongConfigurationError</a></span></tt>)</span>
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
</li>
|
432
|
+
|
433
|
+
</ul>
|
434
|
+
|
435
|
+
</div><table class="source_code">
|
436
|
+
<tr>
|
437
|
+
<td>
|
438
|
+
<pre class="lines">
|
439
|
+
|
440
|
+
|
441
|
+
8
|
442
|
+
9
|
443
|
+
10
|
444
|
+
11
|
445
|
+
12
|
446
|
+
13
|
447
|
+
14
|
448
|
+
15
|
449
|
+
16
|
450
|
+
17
|
451
|
+
18
|
452
|
+
19</pre>
|
453
|
+
</td>
|
454
|
+
<td>
|
455
|
+
<pre class="code"><span class="info file"># File 'lib/openpayu/document.rb', line 8</span>
|
456
|
+
|
457
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_generate_signature_structure'>generate_signature_structure</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_algorithm'>algorithm</span><span class='comma'>,</span> <span class='id identifier rubyid_pos_id'>pos_id</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
458
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
459
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>WrongConfigurationError</span><span class='comma'>,</span>
|
460
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Merchant Signature Key (signature_key)
|
461
|
+
should not be null or empty.</span><span class='tstring_end'>'</span></span>
|
462
|
+
<span class='kw'>end</span>
|
463
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>WrongConfigurationError</span><span class='comma'>,</span>
|
464
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Merchant Pos Id (merchant_pos_id) should
|
465
|
+
not be null or empty.</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_pos_id'>pos_id</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
466
|
+
<span class='id identifier rubyid_signature'>signature</span> <span class='op'>=</span> <span class='id identifier rubyid_generate_signature'>generate_signature</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_algorithm'>algorithm</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
467
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>sender=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pos_id'>pos_id</span><span class='rbrace'>}</span><span class='tstring_content'>;signature=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_signature'>signature</span><span class='rbrace'>}</span><span class='tstring_content'>;algorithm=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_algorithm'>algorithm</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
468
|
+
<span class='kw'>end</span></pre>
|
469
|
+
</td>
|
470
|
+
</tr>
|
471
|
+
</table>
|
472
|
+
</div>
|
473
|
+
|
474
|
+
<div class="method_details ">
|
475
|
+
<h3 class="signature " id="get_signature-instance_method">
|
476
|
+
|
477
|
+
- (<tt>Object</tt>) <strong>get_signature</strong>
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
</h3><table class="source_code">
|
484
|
+
<tr>
|
485
|
+
<td>
|
486
|
+
<pre class="lines">
|
487
|
+
|
488
|
+
|
489
|
+
78
|
490
|
+
79
|
491
|
+
80
|
492
|
+
81
|
493
|
+
82
|
494
|
+
83
|
495
|
+
84</pre>
|
496
|
+
</td>
|
497
|
+
<td>
|
498
|
+
<pre class="code"><span class="info file"># File 'lib/openpayu/document.rb', line 78</span>
|
499
|
+
|
500
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get_signature'>get_signature</span>
|
501
|
+
<span class='ivar'>@response</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>X-OpenPayU-Signature</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span>
|
502
|
+
<span class='ivar'>@response</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>x-openpayu-signature</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span>
|
503
|
+
<span class='ivar'>@response</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>openpayu-signature</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span>
|
504
|
+
<span class='ivar'>@response</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>x-openpayu-signature</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span>
|
505
|
+
<span class='ivar'>@response</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>openpayu-signature</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
506
|
+
<span class='kw'>end</span></pre>
|
507
|
+
</td>
|
508
|
+
</tr>
|
509
|
+
</table>
|
510
|
+
</div>
|
511
|
+
|
512
|
+
<div class="method_details ">
|
513
|
+
<h3 class="signature " id="parse_signature-instance_method">
|
514
|
+
|
515
|
+
- (<tt>Object</tt>) <strong>parse_signature</strong>
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
</h3><table class="source_code">
|
522
|
+
<tr>
|
523
|
+
<td>
|
524
|
+
<pre class="lines">
|
525
|
+
|
526
|
+
|
527
|
+
69
|
528
|
+
70
|
529
|
+
71
|
530
|
+
72
|
531
|
+
73
|
532
|
+
74
|
533
|
+
75
|
534
|
+
76</pre>
|
535
|
+
</td>
|
536
|
+
<td>
|
537
|
+
<pre class="code"><span class="info file"># File 'lib/openpayu/document.rb', line 69</span>
|
538
|
+
|
539
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_parse_signature'>parse_signature</span>
|
540
|
+
<span class='id identifier rubyid_parameters'>parameters</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
541
|
+
<span class='id identifier rubyid_get_signature'>get_signature</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>;</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_parameter'>parameter</span><span class='op'>|</span>
|
542
|
+
<span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span> <span class='op'>=</span> <span class='id identifier rubyid_parameter'>parameter</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>=</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
543
|
+
<span class='id identifier rubyid_parameters'>parameters</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
|
544
|
+
<span class='kw'>end</span>
|
545
|
+
<span class='id identifier rubyid_parameters'>parameters</span>
|
546
|
+
<span class='kw'>end</span></pre>
|
547
|
+
</td>
|
548
|
+
</tr>
|
549
|
+
</table>
|
550
|
+
</div>
|
551
|
+
|
552
|
+
<div class="method_details ">
|
553
|
+
<h3 class="signature " id="underscore_keys-instance_method">
|
554
|
+
|
555
|
+
- (<tt>Object</tt>) <strong>underscore_keys</strong>(hash)
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
</h3><table class="source_code">
|
562
|
+
<tr>
|
563
|
+
<td>
|
564
|
+
<pre class="lines">
|
565
|
+
|
566
|
+
|
567
|
+
86
|
568
|
+
87
|
569
|
+
88</pre>
|
570
|
+
</td>
|
571
|
+
<td>
|
572
|
+
<pre class="code"><span class="info file"># File 'lib/openpayu/document.rb', line 86</span>
|
573
|
+
|
574
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_underscore_keys'>underscore_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
575
|
+
<span class='id identifier rubyid_deep_transform_keys'>deep_transform_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_underscore'>underscore</span> <span class='rbrace'>}</span>
|
576
|
+
<span class='kw'>end</span></pre>
|
577
|
+
</td>
|
578
|
+
</tr>
|
579
|
+
</table>
|
580
|
+
</div>
|
581
|
+
|
582
|
+
<div class="method_details ">
|
583
|
+
<h3 class="signature " id="verify_response-instance_method">
|
584
|
+
|
585
|
+
- (<tt>Object</tt>) <strong>verify_response</strong>
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
</h3><table class="source_code">
|
592
|
+
<tr>
|
593
|
+
<td>
|
594
|
+
<pre class="lines">
|
595
|
+
|
596
|
+
|
597
|
+
35
|
598
|
+
36
|
599
|
+
37
|
600
|
+
38
|
601
|
+
39
|
602
|
+
40
|
603
|
+
41
|
604
|
+
42
|
605
|
+
43
|
606
|
+
44
|
607
|
+
45
|
608
|
+
46
|
609
|
+
47
|
610
|
+
48
|
611
|
+
49</pre>
|
612
|
+
</td>
|
613
|
+
<td>
|
614
|
+
<pre class="code"><span class="info file"># File 'lib/openpayu/document.rb', line 35</span>
|
615
|
+
|
616
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_verify_response'>verify_response</span>
|
617
|
+
<span class='kw'>unless</span> <span class='ivar'>@response</span>
|
618
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>EmptyResponseError</span><span class='comma'>,</span>
|
619
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Got empty response from request: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@request</span><span class='period'>.</span><span class='id identifier rubyid_try'>try</span><span class='lparen'>(</span><span class='symbol'>:body</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
620
|
+
<span class='kw'>end</span>
|
621
|
+
<span class='kw'>if</span> <span class='lparen'>(</span><span class='ivar'>@message_name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>OrderNotifyRequest</span><span class='tstring_end'>'</span></span> <span class='op'>||</span>
|
622
|
+
<span class='qwords_beg'>%w(</span><span class='tstring_content'>200</span><span class='words_sep'> </span><span class='tstring_content'>201</span><span class='words_sep'> </span><span class='tstring_content'>422</span><span class='words_sep'> </span><span class='tstring_content'>302</span><span class='words_sep'>)</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>&&</span>
|
623
|
+
<span class='id identifier rubyid_verify_signature'>verify_signature</span><span class='lparen'>(</span><span class='ivar'>@body</span><span class='rparen'>)</span>
|
624
|
+
<span class='kw'>true</span>
|
625
|
+
<span class='kw'>else</span>
|
626
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>HttpStatusException</span><span class='comma'>,</span>
|
627
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Invalid HTTP response code (</span><span class='embexpr_beg'>#{</span><span class='ivar'>@response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='rbrace'>}</span><span class='tstring_content'>).
|
628
|
+
Response body: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@body</span><span class='rbrace'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span>
|
629
|
+
<span class='kw'>end</span>
|
630
|
+
<span class='kw'>end</span></pre>
|
631
|
+
</td>
|
632
|
+
</tr>
|
633
|
+
</table>
|
634
|
+
</div>
|
635
|
+
|
636
|
+
<div class="method_details ">
|
637
|
+
<h3 class="signature " id="verify_signature-instance_method">
|
638
|
+
|
639
|
+
- (<tt>Object</tt>) <strong>verify_signature</strong>(message)
|
640
|
+
|
641
|
+
|
642
|
+
|
643
|
+
|
644
|
+
|
645
|
+
</h3><table class="source_code">
|
646
|
+
<tr>
|
647
|
+
<td>
|
648
|
+
<pre class="lines">
|
649
|
+
|
650
|
+
|
651
|
+
51
|
652
|
+
52
|
653
|
+
53
|
654
|
+
54
|
655
|
+
55
|
656
|
+
56
|
657
|
+
57
|
658
|
+
58
|
659
|
+
59
|
660
|
+
60
|
661
|
+
61
|
662
|
+
62
|
663
|
+
63
|
664
|
+
64
|
665
|
+
65
|
666
|
+
66
|
667
|
+
67</pre>
|
668
|
+
</td>
|
669
|
+
<td>
|
670
|
+
<pre class="code"><span class="info file"># File 'lib/openpayu/document.rb', line 51</span>
|
671
|
+
|
672
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_verify_signature'>verify_signature</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
|
673
|
+
<span class='id identifier rubyid_signature'>signature</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_signature'>parse_signature</span>
|
674
|
+
<span class='id identifier rubyid_generated_signature'>generated_signature</span> <span class='op'>=</span> <span class='id identifier rubyid_generate_signature'>generate_signature</span><span class='lparen'>(</span>
|
675
|
+
<span class='id identifier rubyid_message'>message</span><span class='comma'>,</span>
|
676
|
+
<span class='id identifier rubyid_signature'>signature</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>algorithm</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
677
|
+
<span class='const'>OpenPayU</span><span class='op'>::</span><span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_signature_key'>signature_key</span>
|
678
|
+
<span class='rparen'>)</span>
|
679
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_generated_signature'>generated_signature</span> <span class='op'>==</span> <span class='id identifier rubyid_signature'>signature</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>signature</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
680
|
+
<span class='kw'>true</span>
|
681
|
+
<span class='kw'>else</span>
|
682
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>WrongSignatureException</span><span class='comma'>,</span>
|
683
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Invalid signature: Got message signed with:
|
684
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_signature'>signature</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>signature</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>. Generated signature:
|
685
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_generated_signature'>generated_signature</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
686
|
+
<span class='kw'>end</span>
|
687
|
+
|
688
|
+
<span class='kw'>end</span></pre>
|
689
|
+
</td>
|
690
|
+
</tr>
|
691
|
+
</table>
|
692
|
+
</div>
|
693
|
+
|
694
|
+
</div>
|
695
|
+
|
696
|
+
</div>
|
697
|
+
|
698
|
+
<div id="footer">
|
699
|
+
Generated on Tue Dec 17 15:20:58 2013 by
|
700
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
701
|
+
0.8.7.2 (ruby-1.9.3).
|
702
|
+
</div>
|
703
|
+
|
704
|
+
</body>
|
705
|
+
</html>
|