wx_pay 0.7.1 → 0.8.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: 2889c7c63f867890b44ccc84346b0a70fecd6e01
4
- data.tar.gz: b29dbcf70425ab41baa544676e2b356af1e07b4d
3
+ metadata.gz: d986c63e59418f4f41abdf7964f439a044335012
4
+ data.tar.gz: 74505540b958d4f1725f0763e62caaff2db4d911
5
5
  SHA512:
6
- metadata.gz: be61b6c9e360b21b5d1d399507845b387843f24d6c235acc62459ce5f3ad54797304fb0c81a0f955c64ed33d27ada41c453db6fa5384edd980ab9372a68e58b5
7
- data.tar.gz: 7ef54888d1a249ad4d72ebd2ea376c94a1195b9c44fb509307a6d42f475c79e7b1625152c5e160456bf7e5d39e3c6d235e7e655bc1857fec24642d92e9d68500
6
+ metadata.gz: 974a4df080f52a1269cb7890adf235b8d27671bb66a6f10bd320871b88eaa5975d9e11643f3909c30a2b7653985e61d46305433b41b03285a276e6f32daac756
7
+ data.tar.gz: 5356b1639c8a8a141406267fdf595b5affe729f179dc78558802eee50d06e6305f3c2f81f1ddd539fc24890a807034ebbd58c156d076ef8aa4f5f2c173aacab1
@@ -183,7 +183,24 @@ module WxPay
183
183
 
184
184
  r
185
185
  end
186
-
186
+
187
+ DOWNLOAD_BILL_REQUIRED_FIELDS = [:bill_date, :bill_type]
188
+ def self.download_bill(params, options = {})
189
+ params = {
190
+ appid: options.delete(:appid) || WxPay.appid,
191
+ mch_id: options.delete(:mch_id) || WxPay.mch_id,
192
+ nonce_str: SecureRandom.uuid.tr('-', ''),
193
+ }.merge(params)
194
+
195
+ check_required_options(params, DOWNLOAD_BILL_REQUIRED_FIELDS)
196
+
197
+ r = invoke_remote("#{GATEWAY_URL}/pay/downloadbill", make_payload(params), options)
198
+
199
+ yield r if block_given?
200
+
201
+ r
202
+ end
203
+
187
204
  def self.sendgroupredpack(params, options={})
188
205
  params = {
189
206
  wxappid: options.delete(:appid) || WxPay.appid,
@@ -255,10 +272,10 @@ module WxPay
255
272
  }.merge(options)
256
273
  )
257
274
 
258
- if r
275
+ begin
259
276
  WxPay::Result.new(Hash.from_xml(r))
260
- else
261
- nil
277
+ rescue REXML::ParseException
278
+ r
262
279
  end
263
280
  end
264
281
  end
@@ -1,3 +1,3 @@
1
1
  module WxPay
2
- VERSION = "0.7.1"
2
+ VERSION = "0.8.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wx_pay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jasl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-05 00:00:00.000000000 Z
11
+ date: 2016-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client