wx_pay 0.5.0 → 0.6.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: 9e4ff8a9db77a3f0ffc5f688dbcd0bbac1822269
4
- data.tar.gz: b18cab6268a175308bb8da33319baa0946b49f6c
3
+ metadata.gz: 7f76516d5b03953110ccaf4f1153856cee03a043
4
+ data.tar.gz: 50b500cf6d00a3cd46cddffcc154c82b039590e8
5
5
  SHA512:
6
- metadata.gz: d04e10f3a41f1ed112af69f212c545b88d13c1d69a390ff1f9ed423d7d38e4daec0d5c2dbc83e2528d567ede86a57d2d3956e9539f83b6208d3a0f47afa1bcf3
7
- data.tar.gz: f189bf78b1623317aab634f591f3f5175c8c5ef3e9414bb95e224a4a4d7dad7b81085a030daf65b61591312e10416949c44466f6fdadc4b27c508e68f6ca5743
6
+ metadata.gz: 1419915c3c87f393ea839e66378512f11feef67555e87083c67fabcacf241f9b5046bf879598abdcdfca7aa575b80559c591f05df66146477a2e295753c09260
7
+ data.tar.gz: 35c0818e44d419a5a6aaaff6016dd20732fdc205f62c42330861869cb6969ce21b3f6278acfbf4c3eaedb9f83a1a3616eb9bf5d7f8ceab5430c1488e477d26a0
@@ -10,6 +10,7 @@ module WxPay
10
10
  params = {
11
11
  appid: options.delete(:appid) || WxPay.appid,
12
12
  mch_id: options.delete(:mch_id) || WxPay.mch_id,
13
+ key: options.delete(:key) || WxPay.key,
13
14
  nonce_str: SecureRandom.uuid.tr('-', '')
14
15
  }.merge(params)
15
16
 
@@ -27,6 +28,7 @@ module WxPay
27
28
  params = {
28
29
  appid: options.delete(:appid) || WxPay.appid,
29
30
  partnerid: options.delete(:mch_id) || WxPay.mch_id,
31
+ key: options.delete(:key) || WxPay.key,
30
32
  package: 'Sign=WXPay',
31
33
  timestamp: Time.now.to_i.to_s
32
34
  }.merge(params)
@@ -38,6 +40,21 @@ module WxPay
38
40
  params
39
41
  end
40
42
 
43
+ GENERATE_JS_PAY_REQ_REQUIRED_FIELDS = %i(appId nonceStr package)
44
+ def self.generate_js_pay_req(params, options = {})
45
+ params = {
46
+ appId: options.delete(:appid) || WxPay.appid,
47
+ timeStamp: Time.now.to_i.to_s,
48
+ signType: 'MD5'
49
+ }.merge(params)
50
+
51
+ check_required_options(params, GENERATE_JS_PAY_REQ_REQUIRED_FIELDS)
52
+
53
+ params[:paySign] = WxPay::Sign.generate(params)
54
+
55
+ params
56
+ end
57
+
41
58
  INVOKE_REFUND_REQUIRED_FIELDS = %i(out_refund_no total_fee refund_fee op_user_id)
42
59
  def self.invoke_refund(params, options = {})
43
60
  params = {
@@ -1,3 +1,3 @@
1
1
  module WxPay
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.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.5.0
4
+ version: 0.6.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-02-18 00:00:00.000000000 Z
11
+ date: 2016-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client