alipay 0.11.0 → 0.12.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: 9aeabf26cfc19bfd71624654e8ff7a4f5c180d07
4
- data.tar.gz: 47153e8fcae2972a8a879ea8e599e60c000e85b1
3
+ metadata.gz: a6c47eb0017c87754f2dfbe7725e7f12532740db
4
+ data.tar.gz: 4db8b524aa7e1eaaa3436fa5137f8e72d2b487b4
5
5
  SHA512:
6
- metadata.gz: c3500226ba485796f48a64ecb9d49760e80714550e47940d6a83aa726485c3cfb9000cb3dd5a05dac6342565401393608693a5088704baac2bf4d935230a12f4
7
- data.tar.gz: c8d7998647de1f69acdfd9fc2a432ac154f2ca7855600de160336a5e56bc6889bd79137819c1d8382486e06ecbffcfebdcb15904a13501c7f4ac5ab16fbfc33f
6
+ metadata.gz: 0818757fdbbbe1d3785fab7c18c4eec38ef00d24fa41c7607ad407f843aff3d1363500cd30fa2d20d407153f839c4cb434457a22b8053af6670d0599713cfbaf
7
+ data.tar.gz: fd2402ebf88fa4da70d6fb9365368a71a1cd7e882761ace065445cebce017ae8c6787edf6d6a5254e89d21885fd71b5a19210dc6705419d5550de052a834907a
@@ -1,5 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.1
4
- - 2.1.5
5
- - 2.0.0
3
+ - 2.3.0
4
+ - 2.2.4
5
+ - 2.1.8
@@ -1,5 +1,9 @@
1
1
  ## master
2
2
 
3
+ ## v0.12.0 (2016-03-07)
4
+
5
+ - Add `Alipay::Service::batch_trans_notify_url` method, thanks @ryancheung #58
6
+
3
7
  ## v0.11.0 (2015-12-04)
4
8
 
5
9
  - Add `Alipay::Wap::Service.security_risk_detect` method, thanks @jasl #55
data/README.md CHANGED
@@ -9,7 +9,7 @@ Alipay official document: https://b.alipay.com/order/techService.htm .
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'alipay', '~> 0.11.0'
12
+ gem 'alipay', '~> 0.12.0'
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -396,6 +396,77 @@ Alipay::Service.forex_refund_url(
396
396
 
397
397
  \* Auto set Time.now if not set.
398
398
 
399
+ ### 账单明细分页查询接口
400
+
401
+ #### Name
402
+
403
+ ```ruby
404
+ account.page.query
405
+ ```
406
+
407
+ #### Definition
408
+
409
+ ```ruby
410
+ Alipay::Service::account_page_query({PARAMS}, {OPTIONS})
411
+ ```
412
+
413
+ #### Example
414
+
415
+ ```ruby
416
+ Alipay::Service.account_page_query(
417
+ page_no: 1,
418
+ gmt_start_time: '2015-10-25 00:00:00',
419
+ gmt_end_time: '2015-10-26 00:00:00'
420
+ )
421
+ ```
422
+
423
+ #### Arguments
424
+
425
+ It's an unpublic api, contact support for permission and document.
426
+
427
+ ### 批量付款到支付宝账户接口
428
+
429
+ #### Name
430
+
431
+ ```ruby
432
+ batch_trans_notify
433
+ ```
434
+
435
+ #### Definition
436
+
437
+ ```ruby
438
+ Alipay::Service::batch_trans_notify_url({PARAMS}, {OPTIONS})
439
+ ```
440
+
441
+ #### Example
442
+
443
+ ```ruby
444
+ Alipay::Service.batch_trans_notify_url(
445
+ notify_url: 'https://example.com/orders/20150401000-0001/notify',
446
+ account_name: '毛毛',
447
+ detail_data: '0315006^testture0002@126.com^常炜买家^1000.00^hello',
448
+ batch_no: '20080107001',
449
+ batch_num: 1,
450
+ batch_fee: 1000.00,
451
+ email: 'biz_932@alitest.com'
452
+ )
453
+ #=> 'https://mapi.alipay.com/gateway.do?service=batch_trans_notify&...'
454
+ ```
455
+
456
+ #### Arguments
457
+
458
+ | Key | Requirement | Description |
459
+ | --- | ----------- | ----------- |
460
+ | notify_url | required | Alipay asyn notify url. |
461
+ | account_name | required | Alipay account name of payer. |
462
+ | detail_data | required | Payment data. |
463
+ | batch_no | required | Batch transaction number. |
464
+ | batch_num | required | Batch transaction count. |
465
+ | batch_fee | required | Batch transaction total amount. |
466
+ | email | required | Alipay email account of payer. |
467
+
468
+ Document: https://doc.open.alipay.com/doc2/detail?treeId=64&articleId=103773&docType=1
469
+
399
470
  ### 验证通知
400
471
 
401
472
  #### Name
@@ -608,35 +679,6 @@ notify_params = params.except(*request.path_parameters.keys)
608
679
  Alipay::Wap::Notify.verify?(notify_params)
609
680
  ```
610
681
 
611
-
612
- ### 账单明细分页查询接口
613
-
614
- #### Name
615
-
616
- ```ruby
617
- account.page.query
618
- ```
619
-
620
- #### Definition
621
-
622
- ```ruby
623
- Alipay::Service::account_page_query({PARAMS}, {OPTIONS})
624
- ```
625
-
626
- #### Arguments
627
-
628
- It's an unpublic api, contact support for permission and document.
629
-
630
- #### Example
631
-
632
- ```ruby
633
- Alipay::Service.account_page_query(
634
- page_no: 1,
635
- gmt_start_time: '2015-10-25 00:00:00',
636
- gmt_end_time: '2015-10-26 00:00:00'
637
- )
638
- ```
639
-
640
682
  ## Contributing
641
683
 
642
684
  Bug report or pull request are welcome.
@@ -179,6 +179,21 @@ module Alipay
179
179
  Net::HTTP.get(request_uri(params, options))
180
180
  end
181
181
 
182
+ BATCH_TRANS_NOTIFY_REQUIRED_PARAMS = %w( notify_url account_name detail_data batch_no batch_num batch_fee email )
183
+ def self.batch_trans_notify_url(params, options = {})
184
+ params = Utils.stringify_keys(params)
185
+ check_required_params(params, BATCH_TRANS_NOTIFY_REQUIRED_PARAMS)
186
+
187
+ params = {
188
+ 'service' => 'batch_trans_notify',
189
+ '_input_charset' => 'utf-8',
190
+ 'partner' => options[:pid] || Alipay.pid,
191
+ 'pay_date' => Time.now.strftime("%Y%m%d")
192
+ }.merge(params)
193
+
194
+ request_uri(params, options).to_s
195
+ end
196
+
182
197
  def self.request_uri(params, options = {})
183
198
  uri = URI(GATEWAY_URL)
184
199
  uri.query = URI.encode_www_form(sign_params(params, options))
@@ -1,3 +1,3 @@
1
1
  module Alipay
2
- VERSION = "0.11.0"
2
+ VERSION = "0.12.0"
3
3
  end
@@ -236,4 +236,19 @@ class Alipay::ServiceTest < Minitest::Test
236
236
  gmt_end_time: Time.now.strftime('%Y-%m-%d %H:%M:%S')
237
237
  )
238
238
  end
239
+
240
+ def test_batch_trans_notify_url
241
+ options = {
242
+ notify_url: 'https://example.com/orders/20150401000-0001/notify',
243
+ account_name: '毛毛',
244
+ detail_data: '0315006^testture0002@126.com^常炜买家^1000.00^hello',
245
+ batch_no: '20080107001',
246
+ batch_num: 1,
247
+ batch_fee: 1000.00,
248
+ email: 'biz_932@alitest.com',
249
+ pay_date: '20080107'
250
+ }
251
+
252
+ assert_equal 'https://mapi.alipay.com/gateway.do?service=batch_trans_notify&_input_charset=utf-8&partner=1000000000000000&pay_date=20080107&notify_url=https%3A%2F%2Fexample.com%2Forders%2F20150401000-0001%2Fnotify&account_name=%E6%AF%9B%E6%AF%9B&detail_data=0315006%5Etestture0002%40126.com%5E%E5%B8%B8%E7%82%9C%E4%B9%B0%E5%AE%B6%5E1000.00%5Ehello&batch_no=20080107001&batch_num=1&batch_fee=1000.0&email=biz_932%40alitest.com&sign_type=MD5&sign=59c611607daafd1337e96b22404bd521', Alipay::Service.batch_trans_notify_url(options)
253
+ end
239
254
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alipay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rei
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-04 00:00:00.000000000 Z
11
+ date: 2016-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 2.4.5.1
131
+ rubygems_version: 2.5.1
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: An unofficial simple alipay gem