alipay 0.10.0 → 0.11.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: 8979f4b881f0f270d17d009910c709e5b263eefe
4
- data.tar.gz: dde95025f79b4a7fcdbebf2e8c59c0b27276318b
3
+ metadata.gz: 9aeabf26cfc19bfd71624654e8ff7a4f5c180d07
4
+ data.tar.gz: 47153e8fcae2972a8a879ea8e599e60c000e85b1
5
5
  SHA512:
6
- metadata.gz: 41cfd0dea75e28a73cbbb867d8e1360822450f7bc05bf09560c6a8706f4532ca53a240cc6306b6d28f75a8ca233322bf1230d26340ae7e012ba2d25be3b52de7
7
- data.tar.gz: b84f1540bfc9c3532efd437f625220c7522df1aee0f2deda25b591fc401dc2a521975369b7e62882f6cfee07f4c153f94e438d678880c87027a9e90273779a0f
6
+ metadata.gz: c3500226ba485796f48a64ecb9d49760e80714550e47940d6a83aa726485c3cfb9000cb3dd5a05dac6342565401393608693a5088704baac2bf4d935230a12f4
7
+ data.tar.gz: c8d7998647de1f69acdfd9fc2a432ac154f2ca7855600de160336a5e56bc6889bd79137819c1d8382486e06ecbffcfebdcb15904a13501c7f4ac5ab16fbfc33f
@@ -1,5 +1,9 @@
1
1
  ## master
2
2
 
3
+ ## v0.11.0 (2015-12-04)
4
+
5
+ - Add `Alipay::Wap::Service.security_risk_detect` method, thanks @jasl #55
6
+
3
7
  ## v0.10.0 (2015-11-03)
4
8
 
5
9
  - Add `Alipay::Service.account_page_query` method, thanks @xjz19901211 #53
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.10.0'
12
+ gem 'alipay', '~> 0.11.0'
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -538,6 +538,52 @@ Alipay::Wap::Service.auth_and_execute_url(request_token: token)
538
538
  | --- | ----------- | ----------- |
539
539
  | request_token | required | Get from trade_create_direct_token |
540
540
 
541
+ ### 风险探测服务接口
542
+
543
+ #### Name
544
+
545
+ ```ruby
546
+ alipay.security.risk.detect
547
+ ```
548
+
549
+ #### Definition
550
+
551
+ ```ruby
552
+ Alipay::Wap::Service.security_risk_detect({ARGUMENTS}, {OPTIONS})
553
+ ```
554
+
555
+ #### Example
556
+
557
+ ```ruby
558
+ Alipay::Wap::Service.security_risk_detect({
559
+ order_no: '1',
560
+ order_credate_time: '1970-01-01 00:00:00',
561
+ order_category: 'TestCase^AlipayGem^Ruby',
562
+ order_item_name: 'item',
563
+ order_amount: '0.01',
564
+ buyer_account_no: '2088123123',
565
+ buyer_bind_mobile: '13600000000',
566
+ buyer_reg_date: '1970-01-01 00:00:00',
567
+ terminal_type: 'WAP'
568
+ }, {
569
+ sign_type: 'RSA',
570
+ key: RSA_PRIVATE_KEY
571
+ })
572
+ ```
573
+ #### ARGUMENTS
574
+
575
+ | Key | Requirement | Description |
576
+ | --- | ----------- | ----------- |
577
+ | order_no | optional | Order id in your application. |
578
+ | order_credate_time | optional | Order created time. |
579
+ | order_category | optional | Categories of Order's items. using `^` as splitter. |
580
+ | order_item_name | optional | Order subject. |
581
+ | order_amount | optional | Order item's price. |
582
+ | buyer_account_no | optional | User id in your application. |
583
+ | buyer_reg_date | optional | User created time. |
584
+ | buyer_bind_mobile | optional | User mobile phone. |
585
+ | 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. |
586
+
541
587
  ### 验证通知
542
588
 
543
589
  #### Name
@@ -1,3 +1,3 @@
1
1
  module Alipay
2
- VERSION = "0.10.0"
2
+ VERSION = "0.11.0"
3
3
  end
@@ -30,7 +30,6 @@ module Alipay
30
30
  end
31
31
 
32
32
  AUTH_AND_EXECUTE_REQUIRED_PARAMS = %w( request_token )
33
-
34
33
  def self.auth_and_execute_url(params, options = {})
35
34
  params = Utils.stringify_keys(params)
36
35
  Alipay::Service.check_required_params(params, AUTH_AND_EXECUTE_REQUIRED_PARAMS)
@@ -48,6 +47,22 @@ module Alipay
48
47
  request_uri(params, options).to_s
49
48
  end
50
49
 
50
+ def self.security_risk_detect(params, options)
51
+ params = Utils.stringify_keys(params)
52
+
53
+ params = {
54
+ 'service' => 'alipay.security.risk.detect',
55
+ '_input_charset' => 'utf-8',
56
+ 'partner' => options[:pid] || Alipay.pid,
57
+ 'timestamp' => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
58
+ 'scene_code' => 'PAYMENT'
59
+ }.merge(params)
60
+
61
+ sign_params(params, options)
62
+
63
+ Net::HTTP.post_form(URI(GATEWAY_URL), params)
64
+ end
65
+
51
66
  def self.request_uri(params, options = {})
52
67
  uri = URI(GATEWAY_URL)
53
68
  uri.query = URI.encode_www_form(sign_params(params, options))
@@ -37,4 +37,31 @@ class Alipay::Wap::ServiceTest < Minitest::Test
37
37
  def test_auth_and_execute_url
38
38
  assert_equal 'https://wappaygw.alipay.com/service/rest.htm?service=alipay.wap.auth.authAndExecute&req_data=%3Cauth_and_execute_req%3E%3Crequest_token%3Etoken_test%3C%2Frequest_token%3E%3C%2Fauth_and_execute_req%3E&partner=1000000000000000&format=xml&v=2.0&sec_id=MD5&sign=3efe60d4a9b7960ba599da6764c959df', Alipay::Wap::Service.auth_and_execute_url(request_token: 'token_test')
39
39
  end
40
+
41
+ def test_security_risk_detect
42
+ FakeWeb.register_uri(
43
+ :post,
44
+ %r|https://wappaygw\.alipay\.com/service/rest\.htm.*|,
45
+ body: ''
46
+ )
47
+
48
+ params = {
49
+ order_no: '1',
50
+ order_credate_time: Time.now.strftime('%Y-%m-%d %H:%M:%S'),
51
+ order_category: 'TestCase^AlipayGem^Ruby',
52
+ order_item_name: 'item',
53
+ order_amount: '0.01',
54
+ buyer_account_no: '2088123123',
55
+ buyer_bind_mobile: '13600000000',
56
+ buyer_reg_date: '1970-01-01 00:00:00',
57
+ terminal_type: 'WAP'
58
+ }
59
+
60
+ options = {
61
+ sign_type: 'RSA',
62
+ key: TEST_RSA_PRIVATE_KEY
63
+ }
64
+
65
+ assert_equal '', Alipay::Wap::Service.security_risk_detect(params, options).body
66
+ end
40
67
  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.10.0
4
+ version: 0.11.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-11-03 00:00:00.000000000 Z
11
+ date: 2015-12-04 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.7
131
+ rubygems_version: 2.4.5.1
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: An unofficial simple alipay gem