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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce59ea0f8783024b53fc99e72c4d177811451569
4
- data.tar.gz: e521b26ad9c4c64243a3d1b452b94259a15384ea
3
+ metadata.gz: 90c090f0b694b2ed3af227bf9a44bfbebbbfc3f6
4
+ data.tar.gz: 20b8e78fc95d33f3c869b2eb35788483abc6f7ad
5
5
  SHA512:
6
- metadata.gz: 47c05b04f92ae3c58c3fa14fe5935eefc307fd1abdf1cba75a254b1fe8cb0acf98494bd30d6a4d0e35466e38b70e306456452b9221bbf4066ff378da97f880f2
7
- data.tar.gz: 3e41ba035734090916c796aee90fe215f80667c36aff107ff42aa06214156efae1ccd25f5d4bace2bfcaca80e30bad5a507893cd3f01493058ad0c8ab0d6c864
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)
@@ -1,3 +1,3 @@
1
1
  module NewAlipay
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: new_alipay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - saxer