omni_kassa 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,632 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: OmniKassa::Request</title>
9
+
10
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="../js/jquery.js" type="text/javascript"
13
+ charset="utf-8"></script>
14
+ <script src="../js/thickbox-compressed.js" type="text/javascript"
15
+ charset="utf-8"></script>
16
+ <script src="../js/quicksearch.js" type="text/javascript"
17
+ charset="utf-8"></script>
18
+ <script src="../js/darkfish.js" type="text/javascript"
19
+ charset="utf-8"></script>
20
+
21
+ </head>
22
+ <body class="class">
23
+
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="../index.html">Home</a>
29
+ <a href="../index.html#classes">Classes</a>
30
+ <a href="../index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="file-metadata">
36
+ <div id="file-list-section" class="section">
37
+ <h3 class="section-header">In Files</h3>
38
+ <div class="section-body">
39
+ <ul>
40
+
41
+ <li><a href="../lib/omni_kassa/request_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
+ class="thickbox" title="lib/omni_kassa/request.rb">lib/omni_kassa/request.rb</a></li>
43
+
44
+ </ul>
45
+ </div>
46
+ </div>
47
+
48
+
49
+ </div>
50
+
51
+ <div id="class-metadata">
52
+
53
+ <!-- Parent Class -->
54
+
55
+ <div id="parent-class-section" class="section">
56
+ <h3 class="section-header">Parent</h3>
57
+
58
+ <p class="link">Object</p>
59
+
60
+ </div>
61
+
62
+
63
+ <!-- Namespace Contents -->
64
+
65
+ <div id="namespace-list-section" class="section">
66
+ <h3 class="section-header">Namespace</h3>
67
+ <ul class="link-list">
68
+
69
+ <li><span class="type">CLASS</span> <a href="Request/RequestError.html">OmniKassa::Request::RequestError</a></li>
70
+
71
+ </ul>
72
+ </div>
73
+
74
+
75
+ <!-- Method Quickref -->
76
+
77
+ <div id="method-list-section" class="section">
78
+ <h3 class="section-header">Methods</h3>
79
+ <ul class="link-list">
80
+
81
+ <li><a href="#method-c-new">::new</a></li>
82
+
83
+ <li><a href="#method-i-data">#data</a></li>
84
+
85
+ <li><a href="#method-i-data_hash">#data_hash</a></li>
86
+
87
+ <li><a href="#method-i-perform">#perform</a></li>
88
+
89
+ <li><a href="#method-i-query">#query</a></li>
90
+
91
+ <li><a href="#method-i-seal">#seal</a></li>
92
+
93
+ <li><a href="#method-i-transaction_reference">#transaction_reference</a></li>
94
+
95
+ </ul>
96
+ </div>
97
+
98
+
99
+ <!-- Included Modules -->
100
+
101
+ </div>
102
+
103
+ <div id="project-metadata">
104
+
105
+
106
+ <div id="fileindex-section" class="section project-section">
107
+ <h3 class="section-header">Files</h3>
108
+ <ul>
109
+
110
+ <li class="file"><a href="../Gemfile.html">Gemfile</a></li>
111
+
112
+ <li class="file"><a href="../Rakefile.html">Rakefile</a></li>
113
+
114
+ </ul>
115
+ </div>
116
+
117
+
118
+ <div id="classindex-section" class="section project-section">
119
+ <h3 class="section-header">Class Index
120
+ <span class="search-toggle"><img src="../images/find.png"
121
+ height="16" width="16" alt="[+]"
122
+ title="show/hide quicksearch" /></span></h3>
123
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
124
+ <fieldset>
125
+ <legend>Quicksearch</legend>
126
+ <input type="text" name="quicksearch" value=""
127
+ class="quicksearch-field" />
128
+ </fieldset>
129
+ </form>
130
+
131
+ <ul class="link-list">
132
+
133
+ <li><a href="../OmniKassa.html">OmniKassa</a></li>
134
+
135
+ <li><a href="../OmniKassa/ConfigError.html">OmniKassa::ConfigError</a></li>
136
+
137
+ <li><a href="../OmniKassa/OmniKassaError.html">OmniKassa::OmniKassaError</a></li>
138
+
139
+ <li><a href="../OmniKassa/Request.html">OmniKassa::Request</a></li>
140
+
141
+ <li><a href="../OmniKassa/Request/RequestError.html">OmniKassa::Request::RequestError</a></li>
142
+
143
+ <li><a href="../OmniKassa/Response.html">OmniKassa::Response</a></li>
144
+
145
+ <li><a href="../OmniKassa/Response/ResponseCodeError.html">OmniKassa::Response::ResponseCodeError</a></li>
146
+
147
+ <li><a href="../OmniKassa/Response/SealMismatchError.html">OmniKassa::Response::SealMismatchError</a></li>
148
+
149
+ <li><a href="../HelloWorldTest.html">HelloWorldTest</a></li>
150
+
151
+ </ul>
152
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
153
+ </div>
154
+
155
+
156
+ </div>
157
+ </div>
158
+
159
+ <div id="documentation">
160
+ <h1 class="class">OmniKassa::Request</h1>
161
+
162
+ <div id="description">
163
+
164
+ </div>
165
+
166
+ <!-- Constants -->
167
+
168
+ <div id="constants-list" class="section">
169
+ <h3 class="section-header">Constants</h3>
170
+ <dl>
171
+
172
+ <dt><a name="KEY_VERSION">KEY_VERSION</a></dt>
173
+
174
+ <dd class="description"><p>
175
+ <a href="../OmniKassa.html">OmniKassa</a> requirement, doesn&#8217;t do
176
+ anything
177
+ </p></dd>
178
+
179
+
180
+ <dt><a name="INTERFACE_VERSION">INTERFACE_VERSION</a></dt>
181
+
182
+ <dd class="description"><p>
183
+ <a href="../OmniKassa.html">OmniKassa</a> requirement, doesn&#8217;t do
184
+ anything
185
+ </p></dd>
186
+
187
+
188
+ <dt><a name="REQUIRED">REQUIRED</a></dt>
189
+
190
+ <dd class="description"></dd>
191
+
192
+
193
+ </dl>
194
+ </div>
195
+
196
+
197
+ <!-- Attributes -->
198
+
199
+ <div id="attribute-method-details" class="method-section section">
200
+ <h3 class="section-header">Attributes</h3>
201
+
202
+
203
+ <div id="merchant-id-attribute-method" class="method-detail">
204
+ <a name="merchant_id"></a>
205
+
206
+ <a name="merchant_id="></a>
207
+
208
+ <div class="method-heading attribute-method-heading">
209
+ <span class="method-name">merchant_id</span><span
210
+ class="attribute-access-type">[RW]</span>
211
+ </div>
212
+
213
+ <div class="method-description">
214
+
215
+
216
+
217
+ </div>
218
+ </div>
219
+
220
+ <div id="currency-code-attribute-method" class="method-detail">
221
+ <a name="currency_code"></a>
222
+
223
+ <a name="currency_code="></a>
224
+
225
+ <div class="method-heading attribute-method-heading">
226
+ <span class="method-name">currency_code</span><span
227
+ class="attribute-access-type">[RW]</span>
228
+ </div>
229
+
230
+ <div class="method-description">
231
+
232
+
233
+
234
+ </div>
235
+ </div>
236
+
237
+ <div id="transaction-reference-attribute-method" class="method-detail">
238
+ <a name="transaction_reference"></a>
239
+
240
+ <a name="transaction_reference="></a>
241
+
242
+ <div class="method-heading attribute-method-heading">
243
+ <span class="method-name">transaction_reference</span><span
244
+ class="attribute-access-type">[RW]</span>
245
+ </div>
246
+
247
+ <div class="method-description">
248
+
249
+
250
+
251
+ </div>
252
+ </div>
253
+
254
+ <div id="order-id-attribute-method" class="method-detail">
255
+ <a name="order_id"></a>
256
+
257
+ <a name="order_id="></a>
258
+
259
+ <div class="method-heading attribute-method-heading">
260
+ <span class="method-name">order_id</span><span
261
+ class="attribute-access-type">[RW]</span>
262
+ </div>
263
+
264
+ <div class="method-description">
265
+
266
+
267
+
268
+ </div>
269
+ </div>
270
+
271
+ <div id="amount-attribute-method" class="method-detail">
272
+ <a name="amount"></a>
273
+
274
+ <a name="amount="></a>
275
+
276
+ <div class="method-heading attribute-method-heading">
277
+ <span class="method-name">amount</span><span
278
+ class="attribute-access-type">[RW]</span>
279
+ </div>
280
+
281
+ <div class="method-description">
282
+
283
+
284
+
285
+ </div>
286
+ </div>
287
+
288
+ <div id="normal-return-url-attribute-method" class="method-detail">
289
+ <a name="normal_return_url"></a>
290
+
291
+ <a name="normal_return_url="></a>
292
+
293
+ <div class="method-heading attribute-method-heading">
294
+ <span class="method-name">normal_return_url</span><span
295
+ class="attribute-access-type">[RW]</span>
296
+ </div>
297
+
298
+ <div class="method-description">
299
+
300
+
301
+
302
+ </div>
303
+ </div>
304
+
305
+ <div id="key-version-attribute-method" class="method-detail">
306
+ <a name="key_version"></a>
307
+
308
+ <a name="key_version="></a>
309
+
310
+ <div class="method-heading attribute-method-heading">
311
+ <span class="method-name">key_version</span><span
312
+ class="attribute-access-type">[RW]</span>
313
+ </div>
314
+
315
+ <div class="method-description">
316
+
317
+
318
+
319
+ </div>
320
+ </div>
321
+
322
+ <div id="automatic-return-url-attribute-method" class="method-detail">
323
+ <a name="automatic_return_url"></a>
324
+
325
+ <a name="automatic_return_url="></a>
326
+
327
+ <div class="method-heading attribute-method-heading">
328
+ <span class="method-name">automatic_return_url</span><span
329
+ class="attribute-access-type">[RW]</span>
330
+ </div>
331
+
332
+ <div class="method-description">
333
+
334
+
335
+
336
+ </div>
337
+ </div>
338
+
339
+ </div>
340
+
341
+
342
+ <!-- Methods -->
343
+
344
+ <div id="public-class-method-details" class="method-section section">
345
+ <h3 class="section-header">Public Class Methods</h3>
346
+
347
+
348
+ <div id="new-method" class="method-detail ">
349
+ <a name="method-c-new"></a>
350
+
351
+ <div class="method-heading">
352
+
353
+ <span class="method-name">new</span><span
354
+ class="method-args">()</span>
355
+ <span class="method-click-advice">click to toggle source</span>
356
+
357
+ </div>
358
+
359
+ <div class="method-description">
360
+
361
+
362
+
363
+
364
+
365
+ <div class="method-source-code"
366
+ id="new-source">
367
+ <pre>
368
+ <span class="ruby-comment cmt"># File lib/omni_kassa/request.rb, line 16</span>
369
+ 16: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
370
+ 17: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">key_version</span> = <span class="ruby-constant">KEY_VERSION</span>
371
+ 18:
372
+ 19: <span class="ruby-comment cmt"># Load default settings into the request</span>
373
+ 20: <span class="ruby-constant">OmniKassa</span>.<span class="ruby-identifier">request_settings</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
374
+ 21: <span class="ruby-identifier">send</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'='</span>, <span class="ruby-identifier">value</span>
375
+ 22: <span class="ruby-keyword kw">end</span>
376
+ 23: <span class="ruby-keyword kw">end</span></pre>
377
+ </div>
378
+
379
+ </div>
380
+
381
+
382
+
383
+
384
+ </div>
385
+
386
+
387
+ </div>
388
+
389
+ <div id="public-instance-method-details" class="method-section section">
390
+ <h3 class="section-header">Public Instance Methods</h3>
391
+
392
+
393
+ <div id="perform-method" class="method-detail ">
394
+ <a name="method-i-perform"></a>
395
+
396
+ <div class="method-heading">
397
+
398
+ <span class="method-name">perform</span><span
399
+ class="method-args">()</span>
400
+ <span class="method-click-advice">click to toggle source</span>
401
+
402
+ </div>
403
+
404
+ <div class="method-description">
405
+
406
+
407
+
408
+
409
+
410
+ <div class="method-source-code"
411
+ id="perform-source">
412
+ <pre>
413
+ <span class="ruby-comment cmt"># File lib/omni_kassa/request.rb, line 25</span>
414
+ 25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">perform</span>
415
+ 26: <span class="ruby-constant">HTTParty</span>.<span class="ruby-identifier">post</span>(<span class="ruby-constant">OmniKassa</span>.<span class="ruby-identifier">url</span>, <span class="ruby-identifier">query</span><span class="ruby-operator">:</span> <span class="ruby-identifier">query</span>).<span class="ruby-identifier">body</span>
416
+ 27: <span class="ruby-keyword kw">end</span></pre>
417
+ </div>
418
+
419
+ </div>
420
+
421
+
422
+
423
+
424
+ </div>
425
+
426
+
427
+ <div id="transaction-reference-method" class="method-detail ">
428
+ <a name="method-i-transaction_reference"></a>
429
+
430
+ <div class="method-heading">
431
+
432
+ <span class="method-name">transaction_reference</span><span
433
+ class="method-args">()</span>
434
+ <span class="method-click-advice">click to toggle source</span>
435
+
436
+ </div>
437
+
438
+ <div class="method-description">
439
+
440
+
441
+
442
+
443
+
444
+ <div class="method-source-code"
445
+ id="transaction-reference-source">
446
+ <pre>
447
+ <span class="ruby-comment cmt"># File lib/omni_kassa/request.rb, line 29</span>
448
+ 29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">transaction_reference</span>
449
+ 30: <span class="ruby-ivar">@transaction_reference</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">order_id</span>)
450
+ 31: <span class="ruby-keyword kw">end</span></pre>
451
+ </div>
452
+
453
+ </div>
454
+
455
+
456
+
457
+
458
+ </div>
459
+
460
+
461
+ </div>
462
+
463
+ <div id="protected-instance-method-details" class="method-section section">
464
+ <h3 class="section-header">Protected Instance Methods</h3>
465
+
466
+
467
+ <div id="data-method" class="method-detail ">
468
+ <a name="method-i-data"></a>
469
+
470
+ <div class="method-heading">
471
+
472
+ <span class="method-name">data</span><span
473
+ class="method-args">()</span>
474
+ <span class="method-click-advice">click to toggle source</span>
475
+
476
+ </div>
477
+
478
+ <div class="method-description">
479
+
480
+
481
+
482
+
483
+
484
+ <div class="method-source-code"
485
+ id="data-source">
486
+ <pre>
487
+ <span class="ruby-comment cmt"># File lib/omni_kassa/request.rb, line 42</span>
488
+ 42: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">data</span>
489
+ 43: <span class="ruby-identifier">data_hash</span>.<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'='</span>) }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'|'</span>)
490
+ 44: <span class="ruby-keyword kw">end</span></pre>
491
+ </div>
492
+
493
+ </div>
494
+
495
+
496
+
497
+
498
+ </div>
499
+
500
+
501
+ <div id="data-hash-method" class="method-detail ">
502
+ <a name="method-i-data_hash"></a>
503
+
504
+ <div class="method-heading">
505
+
506
+ <span class="method-name">data_hash</span><span
507
+ class="method-args">()</span>
508
+ <span class="method-click-advice">click to toggle source</span>
509
+
510
+ </div>
511
+
512
+ <div class="method-description">
513
+
514
+
515
+
516
+
517
+
518
+ <div class="method-source-code"
519
+ id="data-hash-source">
520
+ <pre>
521
+ <span class="ruby-comment cmt"># File lib/omni_kassa/request.rb, line 46</span>
522
+ 46: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">data_hash</span>
523
+ 47: <span class="ruby-constant">REQUIRED</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attr</span><span class="ruby-operator">|</span>
524
+ 48: <span class="ruby-identifier">value</span> = <span class="ruby-identifier">send</span> <span class="ruby-identifier">attr</span>
525
+ 49: <span class="ruby-identifier">raise</span> <span class="ruby-constant">RequestError</span>, <span class="ruby-node">&quot;attribute '#{attr}' missing&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
526
+ 50:
527
+ 51: [<span class="ruby-identifier">attr</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">camelcase</span>(<span class="ruby-value">:lower</span>), <span class="ruby-identifier">value</span>]
528
+ 52: <span class="ruby-keyword kw">end</span>
529
+ 53: <span class="ruby-keyword kw">end</span></pre>
530
+ </div>
531
+
532
+ </div>
533
+
534
+
535
+
536
+
537
+ </div>
538
+
539
+
540
+ <div id="query-method" class="method-detail ">
541
+ <a name="method-i-query"></a>
542
+
543
+ <div class="method-heading">
544
+
545
+ <span class="method-name">query</span><span
546
+ class="method-args">()</span>
547
+ <span class="method-click-advice">click to toggle source</span>
548
+
549
+ </div>
550
+
551
+ <div class="method-description">
552
+
553
+
554
+
555
+
556
+
557
+ <div class="method-source-code"
558
+ id="query-source">
559
+ <pre>
560
+ <span class="ruby-comment cmt"># File lib/omni_kassa/request.rb, line 34</span>
561
+ 34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">query</span>
562
+ 35: {
563
+ 36: <span class="ruby-constant">InterfaceVersion</span><span class="ruby-operator">:</span> <span class="ruby-constant">INTERFACE_VERSION</span>,
564
+ 37: <span class="ruby-constant">Data</span><span class="ruby-operator">:</span> <span class="ruby-identifier">data</span>,
565
+ 38: <span class="ruby-constant">Seal</span><span class="ruby-operator">:</span> <span class="ruby-identifier">seal</span>
566
+ 39: }
567
+ 40: <span class="ruby-keyword kw">end</span></pre>
568
+ </div>
569
+
570
+ </div>
571
+
572
+
573
+
574
+
575
+ </div>
576
+
577
+
578
+ <div id="seal-method" class="method-detail ">
579
+ <a name="method-i-seal"></a>
580
+
581
+ <div class="method-heading">
582
+
583
+ <span class="method-name">seal</span><span
584
+ class="method-args">()</span>
585
+ <span class="method-click-advice">click to toggle source</span>
586
+
587
+ </div>
588
+
589
+ <div class="method-description">
590
+
591
+
592
+
593
+
594
+
595
+ <div class="method-source-code"
596
+ id="seal-source">
597
+ <pre>
598
+ <span class="ruby-comment cmt"># File lib/omni_kassa/request.rb, line 55</span>
599
+ 55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">seal</span>
600
+ 56: <span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">SHA2</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">update</span> <span class="ruby-identifier">data</span> <span class="ruby-operator">+</span> <span class="ruby-constant">OmniKassa</span>.<span class="ruby-identifier">secret_key</span>
601
+ 57: <span class="ruby-keyword kw">end</span></pre>
602
+ </div>
603
+
604
+ </div>
605
+
606
+
607
+
608
+
609
+ </div>
610
+
611
+
612
+ </div>
613
+
614
+
615
+ </div>
616
+
617
+
618
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
619
+
620
+ <p>Disabled; run with --debug to generate this.</p>
621
+
622
+ </div>
623
+
624
+ <div id="validator-badges">
625
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
626
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
627
+ Rdoc Generator</a> 1.1.6</small>.</p>
628
+ </div>
629
+
630
+ </body>
631
+ </html>
632
+