alipay 0.9.0 → 0.10.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +31 -2
- data/lib/alipay/service.rb +14 -14
- data/lib/alipay/version.rb +1 -1
- data/test/alipay/service_test.rb +62 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8979f4b881f0f270d17d009910c709e5b263eefe
|
4
|
+
data.tar.gz: dde95025f79b4a7fcdbebf2e8c59c0b27276318b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41cfd0dea75e28a73cbbb867d8e1360822450f7bc05bf09560c6a8706f4532ca53a240cc6306b6d28f75a8ca233322bf1230d26340ae7e012ba2d25be3b52de7
|
7
|
+
data.tar.gz: b84f1540bfc9c3532efd437f625220c7522df1aee0f2deda25b591fc401dc2a521975369b7e62882f6cfee07f4c153f94e438d678880c87027a9e90273779a0f
|
data/CHANGELOG.md
CHANGED
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.
|
12
|
+
gem 'alipay', '~> 0.10.0'
|
13
13
|
```
|
14
14
|
|
15
15
|
And then execute:
|
@@ -463,7 +463,7 @@ Alipay::Mobile::Service.mobile_securitypay_pay_string(
|
|
463
463
|
|
464
464
|
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 .
|
465
465
|
|
466
|
-
## Wap::Service
|
466
|
+
## Wap::Service
|
467
467
|
|
468
468
|
### 授权接口
|
469
469
|
|
@@ -562,6 +562,35 @@ notify_params = params.except(*request.path_parameters.keys)
|
|
562
562
|
Alipay::Wap::Notify.verify?(notify_params)
|
563
563
|
```
|
564
564
|
|
565
|
+
|
566
|
+
### 账单明细分页查询接口
|
567
|
+
|
568
|
+
#### Name
|
569
|
+
|
570
|
+
```ruby
|
571
|
+
account.page.query
|
572
|
+
```
|
573
|
+
|
574
|
+
#### Definition
|
575
|
+
|
576
|
+
```ruby
|
577
|
+
Alipay::Service::account_page_query({PARAMS}, {OPTIONS})
|
578
|
+
```
|
579
|
+
|
580
|
+
#### Arguments
|
581
|
+
|
582
|
+
It's an unpublic api, contact support for permission and document.
|
583
|
+
|
584
|
+
#### Example
|
585
|
+
|
586
|
+
```ruby
|
587
|
+
Alipay::Service.account_page_query(
|
588
|
+
page_no: 1,
|
589
|
+
gmt_start_time: '2015-10-25 00:00:00',
|
590
|
+
gmt_end_time: '2015-10-26 00:00:00'
|
591
|
+
)
|
592
|
+
```
|
593
|
+
|
565
594
|
## Contributing
|
566
595
|
|
567
596
|
Bug report or pull request are welcome.
|
data/lib/alipay/service.rb
CHANGED
@@ -3,7 +3,6 @@ module Alipay
|
|
3
3
|
GATEWAY_URL = 'https://mapi.alipay.com/gateway.do'
|
4
4
|
|
5
5
|
CREATE_PARTNER_TRADE_BY_BUYER_REQUIRED_PARAMS = %w( out_trade_no subject logistics_type logistics_fee logistics_payment price quantity )
|
6
|
-
# alipayescow
|
7
6
|
def self.create_partner_trade_by_buyer_url(params, options = {})
|
8
7
|
params = Utils.stringify_keys(params)
|
9
8
|
check_required_params(params, CREATE_PARTNER_TRADE_BY_BUYER_REQUIRED_PARAMS)
|
@@ -20,7 +19,6 @@ module Alipay
|
|
20
19
|
end
|
21
20
|
|
22
21
|
TRADE_CREATE_BY_BUYER_REQUIRED_PARAMS = %w( out_trade_no subject logistics_type logistics_fee logistics_payment price quantity )
|
23
|
-
# alipaydualfun
|
24
22
|
def self.trade_create_by_buyer_url(params, options = {})
|
25
23
|
params = Utils.stringify_keys(params)
|
26
24
|
check_required_params(params, TRADE_CREATE_BY_BUYER_REQUIRED_PARAMS)
|
@@ -37,7 +35,6 @@ module Alipay
|
|
37
35
|
end
|
38
36
|
|
39
37
|
CREATE_DIRECT_PAY_BY_USER_REQUIRED_PARAMS = %w( out_trade_no subject )
|
40
|
-
# direct
|
41
38
|
def self.create_direct_pay_by_user_url(params, options = {})
|
42
39
|
params = Utils.stringify_keys(params)
|
43
40
|
check_required_params(params, CREATE_DIRECT_PAY_BY_USER_REQUIRED_PARAMS)
|
@@ -58,7 +55,6 @@ module Alipay
|
|
58
55
|
end
|
59
56
|
|
60
57
|
CREATE_DIRECT_PAY_BY_USER_WAP_REQUIRED_PARAMS = %w( out_trade_no subject total_fee )
|
61
|
-
# direct wap
|
62
58
|
def self.create_direct_pay_by_user_wap_url(params, options = {})
|
63
59
|
params = Utils.stringify_keys(params)
|
64
60
|
check_required_params(params, CREATE_DIRECT_PAY_BY_USER_WAP_REQUIRED_PARAMS)
|
@@ -75,7 +71,6 @@ module Alipay
|
|
75
71
|
end
|
76
72
|
|
77
73
|
CREATE_REFUND_URL_REQUIRED_PARAMS = %w( batch_no data notify_url )
|
78
|
-
# 支付宝即时到帐批量退款有密接口(此为异步接口,有密指通过此接口打开 url 后需要用户输入支付宝的支付密码进行退款)
|
79
74
|
def self.refund_fastpay_by_platform_pwd_url(params, options = {})
|
80
75
|
params = Utils.stringify_keys(params)
|
81
76
|
check_required_params(params, CREATE_REFUND_URL_REQUIRED_PARAMS)
|
@@ -87,24 +82,19 @@ module Alipay
|
|
87
82
|
end.join('#')
|
88
83
|
|
89
84
|
params = {
|
90
|
-
'service' => 'refund_fastpay_by_platform_pwd',
|
85
|
+
'service' => 'refund_fastpay_by_platform_pwd',
|
91
86
|
'_input_charset' => 'utf-8',
|
92
87
|
'partner' => options[:pid] || Alipay.pid,
|
93
88
|
'seller_user_id' => options[:pid] || Alipay.pid,
|
94
|
-
'refund_date' => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
|
95
|
-
'batch_num' => data.size,
|
96
|
-
'detail_data' => detail_data
|
89
|
+
'refund_date' => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
|
90
|
+
'batch_num' => data.size,
|
91
|
+
'detail_data' => detail_data
|
97
92
|
}.merge(params)
|
98
93
|
|
99
94
|
request_uri(params, options).to_s
|
100
95
|
end
|
101
96
|
|
102
97
|
CREATE_FOREX_SINGLE_REFUND_URL_REQUIRED_PARAMS = %w( out_return_no out_trade_no return_amount currency reason )
|
103
|
-
# 支付宝境外收单单笔退款接口
|
104
|
-
# out_return_no 退款流水单号
|
105
|
-
# out_trade_no 交易创建时的订单号
|
106
|
-
# return_amount 退款金额
|
107
|
-
# currency 退款币种,与交易创建时的币种一致
|
108
98
|
def self.forex_refund_url(params, options = {})
|
109
99
|
params = Utils.stringify_keys(params)
|
110
100
|
check_required_params(params, CREATE_FOREX_SINGLE_REFUND_URL_REQUIRED_PARAMS)
|
@@ -179,6 +169,16 @@ module Alipay
|
|
179
169
|
Net::HTTP.get(request_uri(params, options))
|
180
170
|
end
|
181
171
|
|
172
|
+
def self.account_page_query(params, options = {})
|
173
|
+
params = {
|
174
|
+
service: 'account.page.query',
|
175
|
+
_input_charset: 'utf-8',
|
176
|
+
partner: options[:pid] || Alipay.pid,
|
177
|
+
}.merge(params)
|
178
|
+
|
179
|
+
Net::HTTP.get(request_uri(params, options))
|
180
|
+
end
|
181
|
+
|
182
182
|
def self.request_uri(params, options = {})
|
183
183
|
uri = URI(GATEWAY_URL)
|
184
184
|
uri.query = URI.encode_www_form(sign_params(params, options))
|
data/lib/alipay/version.rb
CHANGED
data/test/alipay/service_test.rb
CHANGED
@@ -174,4 +174,66 @@ class Alipay::ServiceTest < Minitest::Test
|
|
174
174
|
transport_type: 'DIRECT'
|
175
175
|
)
|
176
176
|
end
|
177
|
+
|
178
|
+
def test_account_page_query
|
179
|
+
body = <<-EOF
|
180
|
+
<?xml version="1.0" encoding="utf-8"?>
|
181
|
+
<alipay>
|
182
|
+
<is_success>T</is_success>
|
183
|
+
<request>
|
184
|
+
<param name="sign">sign_data</param>
|
185
|
+
<param name="_input_charset">utf-8</param>
|
186
|
+
<param name="gmt_end_time">2015-10-26 06:20:29</param>
|
187
|
+
<param name="sign_type">MD5</param>
|
188
|
+
<param name="service">account.page.query</param>
|
189
|
+
<param name="partner">2088123123</param>
|
190
|
+
<param name="page_no">1</param>
|
191
|
+
<param name="gmt_start_time">2015-10-25 06:20:29</param>
|
192
|
+
</request>
|
193
|
+
<response>
|
194
|
+
<account_page_query_result>
|
195
|
+
<account_log_list>
|
196
|
+
<AccountQueryAccountLogVO>
|
197
|
+
<balance>1234</balance>
|
198
|
+
<buyer_account>2088123123</buyer_account>
|
199
|
+
<currency>123</currency>
|
200
|
+
<deposit_bank_no>20151025123123</deposit_bank_no>
|
201
|
+
<goods_title>商品名称</goods_title>
|
202
|
+
<income>100.00</income>
|
203
|
+
<iw_account_log_id>12345678910</iw_account_log_id>
|
204
|
+
<memo> </memo>
|
205
|
+
<merchant_out_order_no>1234567</merchant_out_order_no>
|
206
|
+
<outcome>0.00</outcome>
|
207
|
+
<partner_id>2088123123</partner_id>
|
208
|
+
<rate>0.015</rate>
|
209
|
+
<seller_account>2088123123123</seller_account>
|
210
|
+
<seller_fullname>xxxx有限公司</seller_fullname>
|
211
|
+
<service_fee>0.00</service_fee>
|
212
|
+
<service_fee_ratio> </service_fee_ratio>
|
213
|
+
<sign_product_name>快捷手机安全支付</sign_product_name>
|
214
|
+
<sub_trans_code_msg>快速支付,支付给个人,支付宝帐户全额</sub_trans_code_msg>
|
215
|
+
<total_fee>100.00</total_fee>
|
216
|
+
<trade_no>20151025123123</trade_no>
|
217
|
+
<trade_refund_amount>0.00</trade_refund_amount>
|
218
|
+
<trans_code_msg>在线支付</trans_code_msg>
|
219
|
+
<trans_date>2015-10-25 06:33:07</trans_date>
|
220
|
+
</AccountQueryAccountLogVO>
|
221
|
+
</account_log_list>
|
222
|
+
<has_next_page>F</has_next_page>
|
223
|
+
<page_no>1</page_no>
|
224
|
+
<page_size>5000</page_size>
|
225
|
+
</account_page_query_result>
|
226
|
+
</response>
|
227
|
+
<sign>sign_data</sign>
|
228
|
+
<sign_type>MD5</sign_type>
|
229
|
+
</alipay>
|
230
|
+
EOF
|
231
|
+
FakeWeb.register_uri(:get, %r|https://mapi\.alipay\.com/gateway\.do.*|, :body => body)
|
232
|
+
|
233
|
+
assert_equal body, Alipay::Service.account_page_query(
|
234
|
+
page_no: 1,
|
235
|
+
gmt_start_time: (Time.now - 1).strftime('%Y-%m-%d %H:%M:%S'),
|
236
|
+
gmt_end_time: Time.now.strftime('%Y-%m-%d %H:%M:%S')
|
237
|
+
)
|
238
|
+
end
|
177
239
|
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.
|
4
|
+
version: 0.10.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
|
+
date: 2015-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|