jyt_pay 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +72 -0
- data/Rakefile +16 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/doc/JytPay/Api/AuthCard.html +375 -0
- data/doc/JytPay/Api/QueryBalance.html +299 -0
- data/doc/JytPay/Api/QueryOrder.html +372 -0
- data/doc/JytPay/Api/QuickDraw.html +433 -0
- data/doc/JytPay/Api/QuickPay.html +435 -0
- data/doc/JytPay/Api.html +117 -0
- data/doc/JytPay/Client.html +323 -0
- data/doc/JytPay/Encrypt/Des.html +258 -0
- data/doc/JytPay/Encrypt/Rsa.html +232 -0
- data/doc/JytPay/Encrypt.html +127 -0
- data/doc/JytPay/Http/RetCode.html +391 -0
- data/doc/JytPay/Http.html +242 -0
- data/doc/JytPay/Sign/Rsa.html +178 -0
- data/doc/JytPay/Sign.html +115 -0
- data/doc/JytPay/Utils.html +358 -0
- data/doc/JytPay/Xml/MyPrecious.html +220 -0
- data/doc/JytPay/Xml.html +210 -0
- data/doc/JytPay.html +140 -0
- data/doc/_index.html +317 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +492 -0
- data/doc/file.README.html +150 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +150 -0
- data/doc/js/app.js +248 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +203 -0
- data/doc/top-level-namespace.html +110 -0
- data/jyt_pay.gemspec +34 -0
- data/lib/jyt_pay/api/auth_card.rb +60 -0
- data/lib/jyt_pay/api/query_balance.rb +50 -0
- data/lib/jyt_pay/api/query_order.rb +71 -0
- data/lib/jyt_pay/api/quick_draw.rb +75 -0
- data/lib/jyt_pay/api/quick_pay.rb +76 -0
- data/lib/jyt_pay/client.rb +37 -0
- data/lib/jyt_pay/encrypt/des.rb +30 -0
- data/lib/jyt_pay/encrypt/encrypt.rb +7 -0
- data/lib/jyt_pay/encrypt/rsa.rb +20 -0
- data/lib/jyt_pay/http/communicate.rb +77 -0
- data/lib/jyt_pay/http/ret_code.rb +60 -0
- data/lib/jyt_pay/sign/rsa.rb +14 -0
- data/lib/jyt_pay/utils.rb +42 -0
- data/lib/jyt_pay/version.rb +3 -0
- data/lib/jyt_pay/xml/xml.rb +74 -0
- data/lib/jyt_pay.rb +32 -0
- metadata +166 -0
@@ -0,0 +1,391 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: JytPay::Http::RetCode
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.9
|
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
|
+
pathId = "JytPay::Http::RetCode";
|
19
|
+
relpath = '../../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../../_index.html">Index (R)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../JytPay.html" title="JytPay (module)">JytPay</a></span></span> » <span class='title'><span class='object_link'><a href="../Http.html" title="JytPay::Http (module)">Http</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">RetCode</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: JytPay::Http::RetCode
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/jyt_pay/http/ret_code.rb</dd>
|
82
|
+
</dl>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
<h2>
|
95
|
+
Class Method Summary
|
96
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
97
|
+
</h2>
|
98
|
+
|
99
|
+
<ul class="summary">
|
100
|
+
|
101
|
+
<li class="public ">
|
102
|
+
<span class="summary_signature">
|
103
|
+
|
104
|
+
<a href="#draw_result-class_method" title="draw_result (class method)">.<strong>draw_result</strong>(resp_code, tran_state) ⇒ Object </a>
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
</span>
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<span class="summary_desc"><div class='inline'>
|
119
|
+
<p>提现的结果(目前和支付一样逻辑,但是不知道以后会不会改).</p>
|
120
|
+
</div></span>
|
121
|
+
|
122
|
+
</li>
|
123
|
+
|
124
|
+
|
125
|
+
<li class="public ">
|
126
|
+
<span class="summary_signature">
|
127
|
+
|
128
|
+
<a href="#general_error_response-class_method" title="general_error_response (class method)">.<strong>general_error_response</strong>(http_status) ⇒ Object </a>
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
</span>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<span class="summary_desc"><div class='inline'>
|
143
|
+
<p>默认的返回值.</p>
|
144
|
+
</div></span>
|
145
|
+
|
146
|
+
</li>
|
147
|
+
|
148
|
+
|
149
|
+
<li class="public ">
|
150
|
+
<span class="summary_signature">
|
151
|
+
|
152
|
+
<a href="#pay_result-class_method" title="pay_result (class method)">.<strong>pay_result</strong>(resp_code, tran_state) ⇒ Object </a>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
</span>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
<span class="summary_desc"><div class='inline'>
|
167
|
+
<p>支付的结果.</p>
|
168
|
+
</div></span>
|
169
|
+
|
170
|
+
</li>
|
171
|
+
|
172
|
+
|
173
|
+
</ul>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<div id="class_method_details" class="method_details_list">
|
179
|
+
<h2>Class Method Details</h2>
|
180
|
+
|
181
|
+
|
182
|
+
<div class="method_details first">
|
183
|
+
<h3 class="signature first" id="draw_result-class_method">
|
184
|
+
|
185
|
+
.<strong>draw_result</strong>(resp_code, tran_state) ⇒ <tt>Object</tt>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
</h3><div class="docstring">
|
192
|
+
<div class="discussion">
|
193
|
+
|
194
|
+
<p>提现的结果(目前和支付一样逻辑,但是不知道以后会不会改)</p>
|
195
|
+
|
196
|
+
|
197
|
+
</div>
|
198
|
+
</div>
|
199
|
+
<div class="tags">
|
200
|
+
|
201
|
+
|
202
|
+
</div><table class="source_code">
|
203
|
+
<tr>
|
204
|
+
<td>
|
205
|
+
<pre class="lines">
|
206
|
+
|
207
|
+
|
208
|
+
40
|
209
|
+
41
|
210
|
+
42
|
211
|
+
43
|
212
|
+
44
|
213
|
+
45
|
214
|
+
46
|
215
|
+
47
|
216
|
+
48
|
217
|
+
49
|
218
|
+
50
|
219
|
+
51
|
220
|
+
52
|
221
|
+
53
|
222
|
+
54
|
223
|
+
55
|
224
|
+
56</pre>
|
225
|
+
</td>
|
226
|
+
<td>
|
227
|
+
<pre class="code"><span class="info file"># File 'lib/jyt_pay/http/ret_code.rb', line 40</span>
|
228
|
+
|
229
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_draw_result'>draw_result</span><span class='lparen'>(</span><span class='id identifier rubyid_resp_code'>resp_code</span><span class='comma'>,</span> <span class='id identifier rubyid_tran_state'>tran_state</span><span class='rparen'>)</span>
|
230
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_resp_code'>resp_code</span>
|
231
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>S0000000</span><span class='tstring_end'>'</span></span>
|
232
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_tran_state'>tran_state</span>
|
233
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>01</span><span class='tstring_end'>'</span></span>
|
234
|
+
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>S</span><span class='tstring_end'>'</span></span>
|
235
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>03</span><span class='tstring_end'>'</span></span>
|
236
|
+
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>F</span><span class='tstring_end'>'</span></span>
|
237
|
+
<span class='kw'>else</span>
|
238
|
+
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>P</span><span class='tstring_end'>'</span></span>
|
239
|
+
<span class='kw'>end</span>
|
240
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>E0000000</span><span class='tstring_end'>'</span></span> <span class='comment'># jyt 处理中
|
241
|
+
</span> <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>P</span><span class='tstring_end'>'</span></span>
|
242
|
+
<span class='kw'>else</span>
|
243
|
+
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>F</span><span class='tstring_end'>'</span></span>
|
244
|
+
<span class='kw'>end</span>
|
245
|
+
<span class='kw'>end</span></pre>
|
246
|
+
</td>
|
247
|
+
</tr>
|
248
|
+
</table>
|
249
|
+
</div>
|
250
|
+
|
251
|
+
<div class="method_details ">
|
252
|
+
<h3 class="signature " id="general_error_response-class_method">
|
253
|
+
|
254
|
+
.<strong>general_error_response</strong>(http_status) ⇒ <tt>Object</tt>
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
</h3><div class="docstring">
|
261
|
+
<div class="discussion">
|
262
|
+
|
263
|
+
<p>默认的返回值</p>
|
264
|
+
|
265
|
+
|
266
|
+
</div>
|
267
|
+
</div>
|
268
|
+
<div class="tags">
|
269
|
+
|
270
|
+
|
271
|
+
</div><table class="source_code">
|
272
|
+
<tr>
|
273
|
+
<td>
|
274
|
+
<pre class="lines">
|
275
|
+
|
276
|
+
|
277
|
+
7
|
278
|
+
8
|
279
|
+
9
|
280
|
+
10
|
281
|
+
11
|
282
|
+
12
|
283
|
+
13
|
284
|
+
14
|
285
|
+
15
|
286
|
+
16
|
287
|
+
17
|
288
|
+
18</pre>
|
289
|
+
</td>
|
290
|
+
<td>
|
291
|
+
<pre class="code"><span class="info file"># File 'lib/jyt_pay/http/ret_code.rb', line 7</span>
|
292
|
+
|
293
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_general_error_response'>general_error_response</span><span class='lparen'>(</span><span class='id identifier rubyid_http_status'>http_status</span><span class='rparen'>)</span>
|
294
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
295
|
+
<span class='label'>head:</span> <span class='lbrace'>{</span>
|
296
|
+
<span class='label'>resp_code:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>S0000000</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
297
|
+
<span class='label'>resp_desc:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>网络错误( http 状态码:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_http_status'>http_status</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span>
|
298
|
+
<span class='rbrace'>}</span><span class='comma'>,</span>
|
299
|
+
<span class='label'>body:</span> <span class='lbrace'>{</span>
|
300
|
+
<span class='label'>tran_state:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>03</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
301
|
+
<span class='rbrace'>}</span><span class='comma'>,</span>
|
302
|
+
<span class='label'>xml_str:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
303
|
+
<span class='rbrace'>}</span>
|
304
|
+
<span class='kw'>end</span></pre>
|
305
|
+
</td>
|
306
|
+
</tr>
|
307
|
+
</table>
|
308
|
+
</div>
|
309
|
+
|
310
|
+
<div class="method_details ">
|
311
|
+
<h3 class="signature " id="pay_result-class_method">
|
312
|
+
|
313
|
+
.<strong>pay_result</strong>(resp_code, tran_state) ⇒ <tt>Object</tt>
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
</h3><div class="docstring">
|
320
|
+
<div class="discussion">
|
321
|
+
|
322
|
+
<p>支付的结果</p>
|
323
|
+
|
324
|
+
|
325
|
+
</div>
|
326
|
+
</div>
|
327
|
+
<div class="tags">
|
328
|
+
|
329
|
+
|
330
|
+
</div><table class="source_code">
|
331
|
+
<tr>
|
332
|
+
<td>
|
333
|
+
<pre class="lines">
|
334
|
+
|
335
|
+
|
336
|
+
21
|
337
|
+
22
|
338
|
+
23
|
339
|
+
24
|
340
|
+
25
|
341
|
+
26
|
342
|
+
27
|
343
|
+
28
|
344
|
+
29
|
345
|
+
30
|
346
|
+
31
|
347
|
+
32
|
348
|
+
33
|
349
|
+
34
|
350
|
+
35
|
351
|
+
36
|
352
|
+
37</pre>
|
353
|
+
</td>
|
354
|
+
<td>
|
355
|
+
<pre class="code"><span class="info file"># File 'lib/jyt_pay/http/ret_code.rb', line 21</span>
|
356
|
+
|
357
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_pay_result'>pay_result</span><span class='lparen'>(</span><span class='id identifier rubyid_resp_code'>resp_code</span><span class='comma'>,</span> <span class='id identifier rubyid_tran_state'>tran_state</span><span class='rparen'>)</span>
|
358
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_resp_code'>resp_code</span>
|
359
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>S0000000</span><span class='tstring_end'>'</span></span>
|
360
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_tran_state'>tran_state</span>
|
361
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>01</span><span class='tstring_end'>'</span></span>
|
362
|
+
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>S</span><span class='tstring_end'>'</span></span>
|
363
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>03</span><span class='tstring_end'>'</span></span>
|
364
|
+
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>F</span><span class='tstring_end'>'</span></span>
|
365
|
+
<span class='kw'>else</span>
|
366
|
+
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>P</span><span class='tstring_end'>'</span></span>
|
367
|
+
<span class='kw'>end</span>
|
368
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>E0000000</span><span class='tstring_end'>'</span></span> <span class='comment'># jyt 处理中
|
369
|
+
</span> <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>P</span><span class='tstring_end'>'</span></span>
|
370
|
+
<span class='kw'>else</span>
|
371
|
+
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>F</span><span class='tstring_end'>'</span></span>
|
372
|
+
<span class='kw'>end</span>
|
373
|
+
<span class='kw'>end</span></pre>
|
374
|
+
</td>
|
375
|
+
</tr>
|
376
|
+
</table>
|
377
|
+
</div>
|
378
|
+
|
379
|
+
</div>
|
380
|
+
|
381
|
+
</div>
|
382
|
+
|
383
|
+
<div id="footer">
|
384
|
+
Generated on Thu Nov 2 20:02:48 2017 by
|
385
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
386
|
+
0.9.9 (ruby-2.3.5).
|
387
|
+
</div>
|
388
|
+
|
389
|
+
</div>
|
390
|
+
</body>
|
391
|
+
</html>
|
@@ -0,0 +1,242 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: JytPay::Http
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.9
|
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
|
+
pathId = "JytPay::Http";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (H)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../JytPay.html" title="JytPay (module)">JytPay</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Http</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: JytPay::Http
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/jyt_pay/http/ret_code.rb<span class="defines">,<br />
|
82
|
+
lib/jyt_pay/http/communicate.rb</span>
|
83
|
+
</dd>
|
84
|
+
</dl>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<h2>Defined Under Namespace</h2>
|
89
|
+
<p class="children">
|
90
|
+
|
91
|
+
|
92
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Http/RetCode.html" title="JytPay::Http::RetCode (module)">RetCode</a></span>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
</p>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<h2>
|
107
|
+
Class Method Summary
|
108
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
109
|
+
</h2>
|
110
|
+
|
111
|
+
<ul class="summary">
|
112
|
+
|
113
|
+
<li class="public ">
|
114
|
+
<span class="summary_signature">
|
115
|
+
|
116
|
+
<a href="#post-class_method" title="post (class method)">.<strong>post</strong>(merchant_id, server_uri, tran_code, xml_str, rsa_private_key, rsa_jyt_public_key) ⇒ Object </a>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
</span>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
131
|
+
|
132
|
+
</li>
|
133
|
+
|
134
|
+
|
135
|
+
</ul>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
<div id="class_method_details" class="method_details_list">
|
141
|
+
<h2>Class Method Details</h2>
|
142
|
+
|
143
|
+
|
144
|
+
<div class="method_details first">
|
145
|
+
<h3 class="signature first" id="post-class_method">
|
146
|
+
|
147
|
+
.<strong>post</strong>(merchant_id, server_uri, tran_code, xml_str, rsa_private_key, rsa_jyt_public_key) ⇒ <tt>Object</tt>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
</h3><table class="source_code">
|
154
|
+
<tr>
|
155
|
+
<td>
|
156
|
+
<pre class="lines">
|
157
|
+
|
158
|
+
|
159
|
+
5
|
160
|
+
6
|
161
|
+
7
|
162
|
+
8
|
163
|
+
9
|
164
|
+
10
|
165
|
+
11
|
166
|
+
12
|
167
|
+
13
|
168
|
+
14
|
169
|
+
15
|
170
|
+
16
|
171
|
+
17
|
172
|
+
18
|
173
|
+
19
|
174
|
+
20
|
175
|
+
21
|
176
|
+
22
|
177
|
+
23
|
178
|
+
24
|
179
|
+
25
|
180
|
+
26
|
181
|
+
27
|
182
|
+
28
|
183
|
+
29
|
184
|
+
30
|
185
|
+
31
|
186
|
+
32
|
187
|
+
33
|
188
|
+
34
|
189
|
+
35</pre>
|
190
|
+
</td>
|
191
|
+
<td>
|
192
|
+
<pre class="code"><span class="info file"># File 'lib/jyt_pay/http/communicate.rb', line 5</span>
|
193
|
+
|
194
|
+
<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_merchant_id'>merchant_id</span><span class='comma'>,</span> <span class='id identifier rubyid_server_uri'>server_uri</span><span class='comma'>,</span>
|
195
|
+
<span class='id identifier rubyid_tran_code'>tran_code</span><span class='comma'>,</span> <span class='id identifier rubyid_xml_str'>xml_str</span><span class='comma'>,</span>
|
196
|
+
<span class='id identifier rubyid_rsa_private_key'>rsa_private_key</span><span class='comma'>,</span> <span class='id identifier rubyid_rsa_jyt_public_key'>rsa_jyt_public_key</span><span class='rparen'>)</span>
|
197
|
+
<span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
198
|
+
<span class='label'>merchant_id:</span> <span class='id identifier rubyid_merchant_id'>merchant_id</span><span class='comma'>,</span>
|
199
|
+
<span class='label'>xml_enc:</span> <span class='const'><span class='object_link'><a href="Encrypt.html" title="JytPay::Encrypt (module)">Encrypt</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Encrypt/Des.html" title="JytPay::Encrypt::Des (module)">Des</a></span></span><span class='period'>.</span><span class='id identifier rubyid_encrypt'><span class='object_link'><a href="Encrypt/Des.html#encrypt-class_method" title="JytPay::Encrypt::Des.encrypt (method)">encrypt</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_xml_str'>xml_str</span><span class='rparen'>)</span><span class='comma'>,</span>
|
200
|
+
<span class='label'>key_enc:</span> <span class='const'><span class='object_link'><a href="Encrypt.html" title="JytPay::Encrypt (module)">Encrypt</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Encrypt/Rsa.html" title="JytPay::Encrypt::Rsa (module)">Rsa</a></span></span><span class='period'>.</span><span class='id identifier rubyid_encrypt'><span class='object_link'><a href="Encrypt/Rsa.html#encrypt-class_method" title="JytPay::Encrypt::Rsa.encrypt (method)">encrypt</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_rsa_jyt_public_key'>rsa_jyt_public_key</span><span class='rparen'>)</span><span class='comma'>,</span>
|
201
|
+
<span class='label'>sign:</span> <span class='const'><span class='object_link'><a href="Sign.html" title="JytPay::Sign (module)">Sign</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Sign/Rsa.html" title="JytPay::Sign::Rsa (module)">Rsa</a></span></span><span class='period'>.</span><span class='id identifier rubyid_sign'><span class='object_link'><a href="Sign/Rsa.html#sign-class_method" title="JytPay::Sign::Rsa.sign (method)">sign</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_rsa_private_key'>rsa_private_key</span><span class='comma'>,</span> <span class='id identifier rubyid_xml_str'>xml_str</span><span class='rparen'>)</span>
|
202
|
+
<span class='rbrace'>}</span>
|
203
|
+
|
204
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n[</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_tran_code'>tran_code</span><span class='embexpr_end'>}</span><span class='tstring_content'>][</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_server_uri'>server_uri</span><span class='embexpr_end'>}</span><span class='tstring_content'>] 发送原始 xml 为:\n</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_xml_str'>xml_str</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span>
|
205
|
+
|
206
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
207
|
+
|
208
|
+
<span class='kw'>begin</span>
|
209
|
+
<span class='id identifier rubyid_response'>response</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_post_form'>post_form</span><span class='lparen'>(</span><span class='id identifier rubyid_server_uri'>server_uri</span><span class='comma'>,</span> <span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
210
|
+
|
211
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTPSuccess</span><span class='rparen'>)</span> <span class='comment'># 返回 200 才处理
|
212
|
+
</span> <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_unpack_body'>unpack_body</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='comma'>,</span> <span class='id identifier rubyid_rsa_private_key'>rsa_private_key</span><span class='rparen'>)</span>
|
213
|
+
<span class='kw'>else</span>
|
214
|
+
<span class='comment'># 非 200 请求
|
215
|
+
</span> <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" title="JytPay::Http (module)">Http</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Http/RetCode.html" title="JytPay::Http::RetCode (module)">RetCode</a></span></span><span class='period'>.</span><span class='id identifier rubyid_general_error_response'><span class='object_link'><a href="Http/RetCode.html#general_error_response-class_method" title="JytPay::Http::RetCode.general_error_response (method)">general_error_response</a></span></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>
|
216
|
+
<span class='kw'>end</span>
|
217
|
+
<span class='kw'>rescue</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>ReadTimeout</span> <span class='comment'># 请求超时
|
218
|
+
</span> <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" title="JytPay::Http (module)">Http</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Http/RetCode.html" title="JytPay::Http::RetCode (module)">RetCode</a></span></span><span class='period'>.</span><span class='id identifier rubyid_general_error_response'><span class='object_link'><a href="Http/RetCode.html#general_error_response-class_method" title="JytPay::Http::RetCode.general_error_response (method)">general_error_response</a></span></span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
|
219
|
+
<span class='kw'>end</span>
|
220
|
+
|
221
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n[</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_tran_code'>tran_code</span><span class='embexpr_end'>}</span><span class='tstring_content'>][</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_server_uri'>server_uri</span><span class='embexpr_end'>}</span><span class='tstring_content'>] 返回结果为:\n</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_result'>result</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n\n</span><span class='tstring_end'>"</span></span>
|
222
|
+
|
223
|
+
<span class='id identifier rubyid_result'>result</span>
|
224
|
+
<span class='kw'>end</span></pre>
|
225
|
+
</td>
|
226
|
+
</tr>
|
227
|
+
</table>
|
228
|
+
</div>
|
229
|
+
|
230
|
+
</div>
|
231
|
+
|
232
|
+
</div>
|
233
|
+
|
234
|
+
<div id="footer">
|
235
|
+
Generated on Thu Nov 2 20:02:48 2017 by
|
236
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
237
|
+
0.9.9 (ruby-2.3.5).
|
238
|
+
</div>
|
239
|
+
|
240
|
+
</div>
|
241
|
+
</body>
|
242
|
+
</html>
|