new_alipay 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -0
- data/lib/new_alipay/batch_trans.rb +25 -0
- data/lib/new_alipay/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90c090f0b694b2ed3af227bf9a44bfbebbbfc3f6
|
4
|
+
data.tar.gz: 20b8e78fc95d33f3c869b2eb35788483abc6f7ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 527613c7693bae0eec616e826e18da37d8d07f29dbed52f8a6111493bf78853fe929e783898fdb13b9ea45649fedc63167de69edb3f6ac228c56874dae7bd268
|
7
|
+
data.tar.gz: f3ee623d64ae6b77e1b56e793b2304d3ee53b1de393aaf4b9077124ef5a90364abd6e56d8e10eac7ae0c31b140c856327548380c6f1e2f90f23109039cdb27a9
|
data/README.md
CHANGED
@@ -100,6 +100,23 @@ NewAlipay.account_name='xxxx公司/你的真实姓名'
|
|
100
100
|
end
|
101
101
|
|
102
102
|
```
|
103
|
+
|
104
|
+
####重新获取批量付款(url)
|
105
|
+
```ruby
|
106
|
+
|
107
|
+
request_url = NewAlipay::BatchTrans.resubmit({
|
108
|
+
notify_url: 'http://test.yourserver.com/callback',
|
109
|
+
batch_fee: 0.01,
|
110
|
+
batch_num: 1,
|
111
|
+
detail_data: "#{NewAlipay::BatchTrans.random_trade_no(26)}^152xxxxyyyy^某某^0.01^测试支付",
|
112
|
+
pay_date: '2016-05-27',
|
113
|
+
batch_no: '201605276309923730587826'
|
114
|
+
}) do |hash|
|
115
|
+
puts hash #=>submit的所有参数
|
116
|
+
end
|
117
|
+
|
118
|
+
```
|
119
|
+
|
103
120
|
####验证付款结果
|
104
121
|
|
105
122
|
```ruby
|
@@ -45,6 +45,31 @@ module NewAlipay
|
|
45
45
|
"#{ALIPAY_GATEWAY_NEW}#{sorted_signing_str_array.join('&')}"
|
46
46
|
end
|
47
47
|
|
48
|
+
def resubmit(para_temp)
|
49
|
+
parameters = {
|
50
|
+
"service" => "batch_trans_notify",
|
51
|
+
"partner" => NewAlipay.partner,
|
52
|
+
"notify_url" => para_temp[:notify_url],
|
53
|
+
"email" => NewAlipay.seller_email,
|
54
|
+
"account_name" => NewAlipay.account_name,
|
55
|
+
"pay_date" => para_temp[:pay_date],
|
56
|
+
"batch_no" => para_temp[:batch_no],
|
57
|
+
"batch_fee" => para_temp[:batch_fee],
|
58
|
+
"batch_num" => para_temp[:batch_num],
|
59
|
+
"detail_data" => para_temp[:detail_data],
|
60
|
+
"_input_charset" => "utf-8"
|
61
|
+
}
|
62
|
+
signing_str_array = parameters.inject([]) { |memo, (key, v)| memo << "#{key}=#{v}"; memo }
|
63
|
+
sorted_signing_str_array = signing_str_array.sort! { |m, n| m.to_s <=> n.to_s }
|
64
|
+
sign = Digest::MD5.hexdigest(sorted_signing_str_array.join('&')+NewAlipay.key)
|
65
|
+
|
66
|
+
sorted_signing_str_array << "sign=#{sign}" << 'sign_type=MD5'
|
67
|
+
|
68
|
+
yield parameters.symbolize_keys.merge({:sign => sign, :sign_type => 'MD5'}) if block_given?
|
69
|
+
|
70
|
+
"#{ALIPAY_GATEWAY_NEW}#{sorted_signing_str_array.join('&')}"
|
71
|
+
end
|
72
|
+
|
48
73
|
#params.except(*request.env.keys.push(:route_info))
|
49
74
|
# @param post_params 除去系统变量的参数
|
50
75
|
def verify_notify?(post_params)
|
data/lib/new_alipay/version.rb
CHANGED