alipay 0.14.0 → 0.15.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56fa9ffb9a707c4c25b499f1391790d4f6cc5474
4
- data.tar.gz: 884b4d906a4081cba248165663911dd5280a35d1
3
+ metadata.gz: fcc10137b698d1560fed86a1706776346054e24c
4
+ data.tar.gz: 9aef05704cc836dca1b3002386915ec5b87c6940
5
5
  SHA512:
6
- metadata.gz: 85c28557052f7817d5b9723d8030b77b11c6f9c7ea91d6d242b4938e0afece3669174fe3cc46e709d40c46c647f35d126df8da78c641a3b9ef2faa61b822328f
7
- data.tar.gz: 75865ab5a939cad580640768e240f4fae552fd26bdde50ae0a208253f64b9d61435c1e67be33409c0175375a4d11b136f288f51f4af3ae9d35d53cef21827ea1
6
+ metadata.gz: b210fcf41f1713729caf7e9364c3d8b1729569fc283bc11f642a751166c9ea0526c2ceaf1aabf9715abed0425a9ce8c1eae246f977aacf1c9d8823289b28ff77
7
+ data.tar.gz: 5e66105cb20ee264b430ab66ead5d89209d6b26035cf8ffa0aaacb4bdb88e06d6c958306530bb799f95f977510c84537531e3442698879f806189b08979cd276
data/.gitignore CHANGED
@@ -8,7 +8,6 @@ Gemfile.lock
8
8
  InstalledFiles
9
9
  _yardoc
10
10
  coverage
11
- doc/
12
11
  lib/bundler/man
13
12
  pkg
14
13
  rdoc
@@ -16,3 +15,4 @@ spec/reports
16
15
  test/tmp
17
16
  test/version_tmp
18
17
  tmp
18
+ config.yml
@@ -1,6 +1,11 @@
1
1
  ## master
2
2
 
3
- ## v0.13.0 (2016-12-28)
3
+ ## v0.15.0 (2017-08-27)
4
+
5
+ - Add `Alipay::Client` for open API.
6
+ - Stop adding new feature to Alipay::Service, Alipay::App::Service, Alipay::Wap::Service, Alipay::Mobile::Service.
7
+
8
+ ## v0.14.0 (2016-12-28)
4
9
 
5
10
  - Add `Alipay::App::Service.create_forex_trade_wap_url` method, thanks @xiaohesong #61
6
11
 
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Rei
1
+ Copyright (c) 2017 Rei
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,781 +1,49 @@
1
1
  # Alipay
2
2
 
3
- A unofficial alipay ruby gem.
3
+ Unofficial alipay ruby gem.
4
4
 
5
- Alipay official document: https://b.alipay.com/order/techService.htm .
5
+ Note: Alipay::Client Api have not enough feedback in production yet, please fully test in your staging environment before production. You can find legacy API document [here](doc/legacy_api.md).
6
+
7
+ You should read [https://doc.open.alipay.com](https://doc.open.alipay.com) before using this gem.
6
8
 
7
9
  ## Installation
8
10
 
9
11
  Add this line to your application's Gemfile:
10
12
 
11
13
  ```ruby
12
- gem 'alipay', '~> 0.14.0'
14
+ gem 'alipay', '~> 0.15.0'
13
15
  ```
14
16
 
15
- And then execute:
17
+ Then run:
16
18
 
17
19
  ```console
18
20
  $ bundle
19
21
  ```
20
22
 
21
- ## Configuration
22
-
23
- ```ruby
24
- Alipay.pid = 'YOUR_PID'
25
- Alipay.key = 'YOUR_KEY'
26
-
27
- #Alipay.sign_type = 'MD5' # Available values: MD5, RSA. Default is MD5
28
- #Alipay.debug_mode = true # Enable parameter check. Default is true.
29
- ```
30
-
31
- You can set default key, or pass a key directly to service method:
32
-
33
- ```ruby
34
- Service.create_partner_trade_by_buyer_url({
35
- out_trade_no: 'OUT_TRADE_NO',
36
- # Order params...
37
- }, {
38
- pid: 'ANOTHER_PID',
39
- key: 'ANOTHER_KEY',
40
- })
41
- ```
42
-
43
- ## Service
44
-
45
- ### 担保交易收款接口
46
-
47
- #### Name
48
-
49
- ```ruby
50
- create_partner_trade_by_buyer
51
- ```
52
-
53
- #### Definition
54
-
55
- ```ruby
56
- Alipay::Service.create_partner_trade_by_buyer_url({ARGUMENTS}, {OPTIONS})
57
- ```
58
-
59
- #### Example
60
-
61
- ```ruby
62
- Alipay::Service.create_partner_trade_by_buyer_url(
63
- out_trade_no: '20150401000-0001',
64
- subject: 'Order Name',
65
- price: '10.00',
66
- quantity: 12,
67
- logistics_type: 'DIRECT',
68
- logistics_fee: '0',
69
- logistics_payment: 'SELLER_PAY',
70
- return_url: 'https://example.com/orders/20150401000-0001',
71
- notify_url: 'https://example.com/orders/20150401000-0001/notify'
72
- )
73
- # => 'https://mapi.alipay.com/gateway.do?service=create_partner_trade_by_buyer&...'
74
- ```
75
-
76
- Guide consumer to this address to complete payment
77
-
78
- #### Arguments
79
-
80
- | Key | Requirement | Description |
81
- | --- | ----------- | ----------- |
82
- | out_order_no | required | Order id in your application. |
83
- | subject | required | Order subject. |
84
- | price | required | Order item's price. |
85
- | quantity | required | Order item's quantity, total price is price * quantity. |
86
- | logistics_type | required | Logistics type. Available values: POST, EXPRESS, EMS, DIRECT. |
87
- | logistics_fee | required | Logistics fee. |
88
- | logistics_payment | required | Who pay the logistics fee. Available values: BUYER_PAY, SELLER_PAY, BUYER_PAY_AFTER_RECEIVE. |
89
- | return_url | optional | Redirect customer to this url after payment. |
90
- | notify_url | optional | Alipay asyn notify url. |
91
-
92
- This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/alipayescow.zip .
93
-
94
- ### 确认发货接口
95
-
96
- #### Name
97
-
98
- ```ruby
99
- send_goods_confirm_by_platform
100
- ```
101
-
102
- #### Definition
103
-
104
- ```ruby
105
- Alipay::Service.send_goods_confirm_by_platform({ARGUMENTS}, {OPTIONS})
106
- ```
107
-
108
- #### Example
109
-
110
- ```ruby
111
- Alipay::Service.send_goods_confirm_by_platform(
112
- trade_no: '201504010000001',
113
- logistics_name: 'example.com',
114
- transport_type: 'DIRECT'
115
- )
116
- # => '<!xml version="1.0" encoding="utf-8"?><alipay><is_success>T</is_success></alipay>'
117
- ```
118
-
119
- #### Arguments
120
-
121
- | Key | Requirement | Description |
122
- | --- | ----------- | ----------- |
123
- | trade_no | required | Trade number in Alipay system, should get from notify message. |
124
- | logistics_name | required | Logistics Name. |
125
- | transport_type/create_transport_type | required | Allowed values: POST, EXPRESS, EMS, DIRECT. |
126
-
127
- This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/alipayescow.zip .
128
-
129
- ### 即时到账收款接口
130
-
131
- #### Name
23
+ ## Usage
132
24
 
133
25
  ```ruby
134
- create_direct_pay_by_user
135
- ```
136
-
137
- #### Definition
138
-
139
- ```ruby
140
- Alipay::Service.create_direct_pay_by_user_url({ARGUMENTS}, {OPTIONS})
141
- ```
142
-
143
- #### Example
144
-
145
- ```ruby
146
- Alipay::Service.create_direct_pay_by_user_url(
147
- out_trade_no: '20150401000-0001',
148
- subject: 'Order Name',
149
- total_fee: '10.00',
150
- return_url: 'https://example.com/orders/20150401000-0001',
151
- notify_url: 'https://example.com/orders/20150401000-0001/notify'
26
+ alipay_client = Alipay::Client.new(
27
+ url: 'https://openapi.alipaydev.com/gateway.do',
28
+ app_id: '2016000000000000',
29
+ app_private_key: APP_PRIVATE_KEY,
30
+ alipay_public_key: ALIPAY_PUBLIC_KEY
152
31
  )
153
- ```
154
-
155
- #### Arguments
156
-
157
- | Key | Requirement | Description |
158
- | --- | ----------- | ----------- |
159
- | out_order_no | required | Order id in your application. |
160
- | subject | required | Order subject. |
161
- | total_fee | required | Order's total fee. |
162
- | return_url | optional | Redirect customer to this url after payment. |
163
- | notify_url | optional | Alipay asyn notify url. |
164
-
165
- This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/alipaydirect.zip .
166
-
167
- ### 手机网站支付接口
168
-
169
- #### Name
170
-
171
- ```ruby
172
- alipay.wap.create.direct.pay.by.user
173
- ```
174
-
175
- #### Definition
176
-
177
- ```ruby
178
- Alipay::Service.create_direct_pay_by_user_wap_url({ARGUMENTS}, {OPTIONS})
179
- ```
180
-
181
- #### Example
182
32
 
183
- ```ruby
184
- Alipay::Service.create_direct_pay_by_user_wap_url(
185
- out_trade_no: '20150401000-0001',
186
- subject: 'Order Name',
187
- total_fee: '10.00',
188
- return_url: 'https://example.com/orders/20150401000-0001',
189
- notify_url: 'https://example.com/orders/20150401000-0001/notify'
33
+ alipay_client.page_execute_url(
34
+ method: 'alipay.trade.page.pay',
35
+ biz_content: {
36
+ out_trade_no: '20160401000000',
37
+ product_code: 'FAST_INSTANT_TRADE_PAY',
38
+ total_amount: '0.01',
39
+ subject: 'test'
40
+ }.to_json, # to_json is important!
41
+ timestamp: '2016-04-01 00:00:00'
190
42
  )
43
+ # => 'https://openapi.alipaydev.com/gateway.do?app_id=201600...'
191
44
  ```
192
45
 
193
- #### Arguments
194
-
195
- | Key | Requirement | Description |
196
- | --- | ----------- | ----------- |
197
- | out_order_no | required | Order id in your application. |
198
- | subject | required | Order subject. |
199
- | total_fee | required | Order's total fee. |
200
- | return_url | optional | Redirect customer to this url after payment. |
201
- | notify_url | optional | Alipay asyn notify url. |
202
-
203
- This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/alipaywapdirect.zip .
204
-
205
-
206
-
207
-
208
- ### 国际支付宝移动接口
209
-
210
- #### Name
211
-
212
- ```ruby
213
- create_forex_trade_wap
214
- ```
215
-
216
- #### Definition
217
-
218
- ```ruby
219
- Alipay::Service.create_forex_trade_wap_url({ARGUMENTS}, {OPTIONS})
220
- ```
221
-
222
- #### Example
223
-
224
- ```ruby
225
- Alipay::Service.create_forex_trade_wap_url(
226
- out_trade_no: '20150401000-0001',
227
- subject: 'Order Name',
228
- merchant_url: 'http://example.com/itemback',
229
- total_fee: '10.00', #or rmb_fee, only one
230
- currency: 'USD',
231
- return_url: 'https://example.com/orders/20150401000-0001',
232
- notify_url: 'https://example.com/orders/20150401000-0001/notify'
233
- )
234
- ```
235
-
236
- #### Arguments
237
-
238
- | Key | Requirement | Description |
239
- | --- | ----------- | ----------- |
240
- | out_order_no | required | Order id in your application. |
241
- | subject | required | Order subject. |
242
- | merchant_url | required | The link which customer could jump back to merchant page from Alipay cashier. |
243
- | total_fee or rmb_fee | required | Order's total fee. |
244
- | currency | required | currency type. |
245
- | return_url | optional | Redirect customer to this url after payment. |
246
- | notify_url | optional | Alipay asyn notify url. |
247
-
248
- This is not a complete list of arguments, please read official document: https://global.alipay.com/product/mobilepayments.html .
249
-
250
-
251
- ### 即时到账批量退款有密接口
252
-
253
- #### Name
254
-
255
- ```ruby
256
- refund_fastpay_by_platform_pwd
257
- ```
258
-
259
- #### Definition
260
-
261
- ```ruby
262
- Alipay::Service.refund_fastpay_by_platform_pwd_url
263
- ```
264
-
265
- #### Example
266
-
267
- ```ruby
268
- batch_no = Alipay::Utils.generate_batch_no # refund batch no, you SHOULD store it to db to avoid alipay duplicate refund
269
- Alipay::Service.refund_fastpay_by_platform_pwd_url(
270
- batch_no: batch_no,
271
- data: [{
272
- trade_no: '201504010000001',
273
- amount: '10.0',
274
- reason: 'REFUND_REASON'
275
- }],
276
- notify_url: 'https://example.com/orders/20150401000-0001/refund_notify'
277
- )
278
- # => https://mapi.alipay.com/gateway.do?service=refund_fastpay_by_platform_pwd&...
279
- ```
280
-
281
- #### Arguments
282
-
283
- | Key | Requirement | Description |
284
- | --- | ----------- | ----------- |
285
- | batch_no | required | Refund batch no, you should store it to db to avoid alipay duplicate refund. |
286
- | data | required | Refund data, a hash array. |
287
- | notify_url | required | Alipay notify url. |
288
-
289
- ##### Data Item
290
-
291
- | Key | Requirement | Description |
292
- | --- | ----------- | ----------- |
293
- | trade_no | required | Trade number in alipay system. |
294
- | amount | required | Refund amount. |
295
- | reason | required | Refund reason. Less than 256 bytes, could not contain special characters: ^ $ &#124; #. |
296
-
297
- This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/alipaydirect.zip .
298
-
299
- ### 关闭交易接口
300
-
301
- #### Name
302
-
303
- ```ruby
304
- close_trade
305
- ```
306
-
307
- #### Definition
308
-
309
- ```ruby
310
- Alipay::Service.close_trade({ARGUMENTS}, {OPTIONS})
311
- ```
312
-
313
- #### Example
314
-
315
- ```ruby
316
- Alipay::Service.close_trade(
317
- trade_no: '201504010000001'
318
- )
319
- # => '<?xml version="1.0" encoding="utf-8"?><alipay><is_success>T</is_success></alipay>'
320
-
321
- # When fail
322
- # => '<?xml version="1.0" encoding="utf-8"?><alipay><is_success>F</is_success> <error>TRADE_STATUS_NOT_AVAILD</error></alipay>'
323
- ```
324
-
325
- #### ARGUMENTS
326
-
327
- | Key | Requirement | Description |
328
- | --- | ----------- | ----------- |
329
- | out_order_no | optional * | Order number in your application. |
330
- | trade_no | optional * | Trade number in alipay system. |
331
-
332
- \* out_order_no and trade_no must have one.
333
-
334
- ### 单笔交易查询接口
335
-
336
- #### Name
337
-
338
- ```ruby
339
- single_trade_query
340
- ```
341
-
342
- #### Definition
343
-
344
- ```ruby
345
- Alipay::Service.single_trade_query({ARGUMENTS}, {OPTIONS})
346
- ```
347
-
348
- #### Example
349
-
350
- ```ruby
351
- Alipay::Service.single_trade_query(
352
- trade_no: '201504010000001'
353
- )
354
- # => '<?xml version="1.0" encoding="utf-8"?><alipay><is_success>T</is_success>...
355
- ```
356
-
357
- #### ARGUMENTS
358
-
359
- | Key | Requirement | Description |
360
- | --- | ----------- | ----------- |
361
- | out_trade_no | optional * | Order number in your application. |
362
- | trade_no | optional * | Trade number in alipay system. |
363
-
364
- \* out_trade_no and trade_no must have one.
365
-
366
- ### 境外收单接口
367
-
368
- #### Name
369
-
370
- ```ruby
371
- create_forex_trade
372
- ```
373
-
374
- #### Definition
375
-
376
- ```ruby
377
- Alipay::Service.create_forex_trade_url({ARGUMENTS}, {OPTIONS})
378
- ```
379
-
380
- #### Example
381
-
382
- ```ruby
383
- Alipay::Service.create_forex_trade_url(
384
- out_trade_no: '20150401000-0001',
385
- subject: 'Subject',
386
- currency: 'USD',
387
- total_fee: '10.00',
388
- notify_url: 'https://example.com/orders/20150401000-0001/notify'
389
- )
390
- # => 'https://mapi.alipay.com/gateway.do?service=create_forex_trade...'
391
- ```
392
-
393
- #### ARGUMENTS
394
-
395
- | Key | Requirement | Description |
396
- | --- | ----------- | ----------- |
397
- | out_trade_no | required | Order number in your application. |
398
- | subject | required | Order subject. |
399
- | currency | required | Abbreviated currency name. |
400
- | total_fee | required * | Order total price. |
401
- | notify_url | optional | Alipay asyn notify url. |
402
-
403
- \* total_fee can be replace by rmb_fee.
404
-
405
- ### 境外收单单笔退款接口
406
-
407
- #### Name
408
-
409
- ```ruby
410
- forex_refund
411
- ```
412
-
413
- #### Definition
414
-
415
- ```ruby
416
- Alipay::Service.forex_refund_url({ARGUMENTS}, {OPTIONS})
417
- ```
418
-
419
- #### Example
420
-
421
- ```ruby
422
- Alipay::Service.forex_refund_url(
423
- out_return_no: '20150401000-0001',
424
- out_trade_no: '201504010000001',
425
- return_amount: '10.00',
426
- currency: 'USD',
427
- reason: 'Reason',
428
- gmt_return: '20150401000000'
429
- )
430
- ```
431
-
432
- #### ARGUMENTS
433
-
434
- | Key | Requirement | Description |
435
- | --- | ----------- | ----------- |
436
- | out_return_no | required | Refund no, you should store it to db to avoid alipay duplicate refund. |
437
- | out_trade_no | required | Order number in your application. |
438
- | return_amount | required | Refund amount. |
439
- | currency | required | Abbreviated currency name. |
440
- | reason | required | Refun reason. |
441
- | gmt_return | required * | YYYYMMDDHHMMSS Beijing Time. |
442
-
443
- \* Auto set Time.now if not set.
444
-
445
- ### 账单明细分页查询接口
446
-
447
- #### Name
448
-
449
- ```ruby
450
- account.page.query
451
- ```
452
-
453
- #### Definition
454
-
455
- ```ruby
456
- Alipay::Service::account_page_query({PARAMS}, {OPTIONS})
457
- ```
458
-
459
- #### Example
460
-
461
- ```ruby
462
- Alipay::Service.account_page_query(
463
- page_no: 1,
464
- gmt_start_time: '2015-10-25 00:00:00',
465
- gmt_end_time: '2015-10-26 00:00:00'
466
- )
467
- ```
468
-
469
- #### Arguments
470
-
471
- It's an unpublic api, contact support for permission and document.
472
-
473
- ### 批量付款到支付宝账户接口
474
-
475
- #### Name
476
-
477
- ```ruby
478
- batch_trans_notify
479
- ```
480
-
481
- #### Definition
482
-
483
- ```ruby
484
- Alipay::Service::batch_trans_notify_url({PARAMS}, {OPTIONS})
485
- ```
486
-
487
- #### Example
488
-
489
- ```ruby
490
- Alipay::Service.batch_trans_notify_url(
491
- notify_url: 'https://example.com/orders/20150401000-0001/notify',
492
- account_name: '毛毛',
493
- detail_data: '0315006^testture0002@126.com^常炜买家^1000.00^hello',
494
- batch_no: '20080107001',
495
- batch_num: 1,
496
- batch_fee: 1000.00,
497
- email: 'biz_932@alitest.com'
498
- )
499
- #=> 'https://mapi.alipay.com/gateway.do?service=batch_trans_notify&...'
500
- ```
501
-
502
- #### Arguments
503
-
504
- | Key | Requirement | Description |
505
- | --- | ----------- | ----------- |
506
- | notify_url | required | Alipay asyn notify url. |
507
- | account_name | required | Alipay account name of payer. |
508
- | detail_data | required | Payment data. |
509
- | batch_no | required | Batch transaction number. |
510
- | batch_num | required | Batch transaction count. |
511
- | batch_fee | required | Batch transaction total amount. |
512
- | email | required | Alipay email account of payer. |
513
-
514
- Document: https://doc.open.alipay.com/doc2/detail?treeId=64&articleId=103773&docType=1
515
-
516
- ### 验证通知
517
-
518
- #### Name
519
-
520
- ```ruby
521
- notify_verify
522
- ```
523
-
524
- #### Definition
525
-
526
- ```ruby
527
- Alipay::Notify.verify?({PARAMS}, {OPTIONS})
528
- ```
529
-
530
- #### Example
531
-
532
- ```ruby
533
- # Rails
534
- # params except :controller_name, :action_name, :host, etc.
535
- notify_params = params.except(*request.path_parameters.keys)
536
-
537
- Alipay::Notify.verify?(notify_params, options = {})
538
- ```
539
-
540
- ## Mobile::Service
541
-
542
- ### 移动支付接口
543
-
544
- #### Name
545
-
546
- ```ruby
547
- mobile.securitypay.pay
548
- ```
549
-
550
- #### Definition
551
-
552
- ```ruby
553
- Alipay::Mobile::Service.mobile_securitypay_pay_string({ARGUMENTS}, {OPTIONS})
554
- ```
555
-
556
- #### Example
557
-
558
- ```ruby
559
- Alipay::Mobile::Service.mobile_securitypay_pay_string(
560
- out_trade_no: '20150401000-0001',
561
- notify_url: 'https://example.com/orders/20150401000-0001/notify'
562
- subject: 'subject',
563
- total_fee: '10.00',
564
- body: 'text'
565
- )
566
- # => service="mobile.securitypay.pay"&_input_charset="utf-8"&partner=...
567
- ```
568
-
569
- #### ARGUMENTS
570
-
571
- | Key | Requirement | Description |
572
- | --- | ----------- | ----------- |
573
- | out_trade_no | required | Order number in your application. |
574
- | notify_url | required | Alipay asyn notify url. |
575
- | subject | required | Order subject. |
576
- | total_fee | required | Order total price. |
577
- | body | required | Order body, less than 512 bytes. |
578
-
579
- \* This service only support RSA sign_type.
580
-
581
- This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/WS_MOBILE_PAY_SDK_BASE.zip .
582
-
583
- ### APP支付接口
584
-
585
- #### Name
586
-
587
- ```ruby
588
- alipay.trade.app.pay
589
- ```
590
-
591
- #### Definition
592
-
593
- ```ruby
594
- Alipay::App::Service.alipay_trade_app_pay({ARGUMENTS}, {OPTIONS})
595
- ```
596
-
597
- #### Example
598
-
599
- ```ruby
600
- biz_content = {
601
- 'body': body, 'out_trade_no': out_trade_no, 'passback_params': passback_params,
602
- 'product_code': 'QUICK_MSECURITY_PAY', 'subject': subject, 'total_amount': total_amount
603
- }.to_json
604
-
605
- Alipay::App::Service.alipay_trade_app_pay(
606
- notify_url: 'https://example.com/orders/20150401000-0001/notify',
607
- app_id: '1234567890',
608
- biz_content: biz_content
609
- )
610
- # => service="alipay.trade.app.pay"&_input_charset="utf-8"&partner=...
611
- ```
612
-
613
- #### ARGUMENTS
614
-
615
- | Key | Requirement | Description |
616
- | --- | ----------- | ----------- |
617
- | app_id | required | Application-assigned id |
618
- | out_trade_no | required | Order number in your application. |
619
- | notify_url | required | Alipay asyn notify url. |
620
- | subject | required | Order subject. |
621
- | total_amount | required | Order total price. |
622
- | body | required | Order body, less than 512 bytes. |
623
- | biz_content | required | A list of business parameters |
624
-
625
- \* This service only support RSA sign_type.
626
-
627
- This is not a complete list of arguments, please read official document: https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7629140.0.0.vwh1xQ&treeId=193&articleId=105465&docType=1 .
628
-
629
- #### APP支付验证通知
630
-
631
- ```ruby
632
- Alipay::App::Sign.verify?(params)
633
- ```
634
-
635
- ## Wap::Service
636
-
637
- ### 授权接口
638
-
639
- #### Name
640
-
641
- ```ruby
642
- alipay.wap.trade.create.direct
643
- ```
644
-
645
- #### Definition
646
-
647
- ```ruby
648
- Alipay::Wap::Service.trade_create_direct_token({ARGUMENTS}, {OPTIONS}}
649
- ```
650
-
651
- #### Example
652
-
653
- ```ruby
654
- token = Alipay::Wap::Service.trade_create_direct_token(
655
- req_data: {
656
- seller_account_name: 'account@example.com',
657
- out_trade_no: '20150401000-0001',
658
- subject: 'Subject',
659
- total_fee: '10.0',
660
- call_back_url: 'https://example.com/orders/20150401000-0001',
661
- notify_url: 'https://example.com/orders/20150401000-0001/notify'
662
- }
663
- )
664
- ```
665
-
666
- #### ARGUMENTS
667
-
668
- | Key | Requirement | Description |
669
- | --- | ----------- | ----------- |
670
- | req_data | required | See req_data ARGUMENTS |
671
-
672
- ##### req_data ARGUMENTS
673
-
674
- | Key | Requirement | Description |
675
- | --- | ----------- | ----------- |
676
- | seller_account_name | required | Alipay seller account. |
677
- | out_order_no | required | Order id in your application. |
678
- | subject | required | Order subject. |
679
- | total_fee | required | Order total price. |
680
- | return_url | optional | Redirect customer to this url after payment. |
681
- | notify_url | optional | Alipay asyn notify url. |
682
-
683
- This is not a complete list of arguments, please read official document: http://download.alipay.com/public/api/base/WS_WAP_PAYWAP.zip .
684
-
685
- ### 交易接口
686
-
687
- #### Name
688
-
689
- ```ruby
690
- alipay.wap.auth.authAndExecute
691
- ```
692
-
693
- #### Definition
694
-
695
- ```ruby
696
- Alipay::Wap::Service.auth_and_execute_url({ARGUMENTS}, {OPTIONS})
697
- ```
698
-
699
- #### Example
700
-
701
- ```ruby
702
- Alipay::Wap::Service.auth_and_execute_url(request_token: token)
703
- ```
704
- #### ARGUMENTS
705
-
706
- | Key | Requirement | Description |
707
- | --- | ----------- | ----------- |
708
- | request_token | required | Get from trade_create_direct_token |
709
-
710
- ### 风险探测服务接口
711
-
712
- #### Name
713
-
714
- ```ruby
715
- alipay.security.risk.detect
716
- ```
717
-
718
- #### Definition
719
-
720
- ```ruby
721
- Alipay::Wap::Service.security_risk_detect({ARGUMENTS}, {OPTIONS})
722
- ```
723
-
724
- #### Example
725
-
726
- ```ruby
727
- Alipay::Wap::Service.security_risk_detect({
728
- order_no: '1',
729
- order_credate_time: '1970-01-01 00:00:00',
730
- order_category: 'TestCase^AlipayGem^Ruby',
731
- order_item_name: 'item',
732
- order_amount: '0.01',
733
- buyer_account_no: '2088123123',
734
- buyer_bind_mobile: '13600000000',
735
- buyer_reg_date: '1970-01-01 00:00:00',
736
- terminal_type: 'WAP'
737
- }, {
738
- sign_type: 'RSA',
739
- key: RSA_PRIVATE_KEY
740
- })
741
- ```
742
- #### ARGUMENTS
743
-
744
- | Key | Requirement | Description |
745
- | --- | ----------- | ----------- |
746
- | order_no | optional | Order id in your application. |
747
- | order_credate_time | optional | Order created time. |
748
- | order_category | optional | Categories of Order's items. using `^` as splitter. |
749
- | order_item_name | optional | Order subject. |
750
- | order_amount | optional | Order item's price. |
751
- | buyer_account_no | optional | User id in your application. |
752
- | buyer_reg_date | optional | User created time. |
753
- | buyer_bind_mobile | optional | User mobile phone. |
754
- | terminal_type | optional | The terminal type which user are using to request the payment, can be `MOBILE` for App, `WAP` for mobile, `WEB` for PC. |
755
-
756
- ### 验证通知
757
-
758
- #### Name
759
-
760
- ```ruby
761
- notify_verify
762
- ```
763
-
764
- #### Definition
765
-
766
- ```ruby
767
- Alipay::Wap::Notify.verify?({PARAMS}, {OPTIONS})
768
- ```
769
-
770
- #### Example
771
-
772
- ```ruby
773
- # Rails
774
- # params except :controller_name, :action_name, :host, etc.
775
- notify_params = params.except(*request.path_parameters.keys)
776
-
777
- Alipay::Wap::Notify.verify?(notify_params)
778
- ```
46
+ Read [Alipay::Client](lib/alipay/client.rb) for usage detail.
779
47
 
780
48
  ## Contributing
781
49
 
@@ -791,8 +59,6 @@ Bug report or pull request are welcome.
791
59
 
792
60
  Please write unit test with your code if necessary.
793
61
 
794
- ## Donate
795
-
796
- Donate to maintainer let him make this gem better.
62
+ ## License
797
63
 
798
- Alipay donate link: http://chloerei.com/donate/ .
64
+ MIT License