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 +4 -4
- data/lib/wx_pay/service.rb +17 -0
- data/lib/wx_pay/version.rb +1 -1
- 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: 7f76516d5b03953110ccaf4f1153856cee03a043
|
4
|
+
data.tar.gz: 50b500cf6d00a3cd46cddffcc154c82b039590e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1419915c3c87f393ea839e66378512f11feef67555e87083c67fabcacf241f9b5046bf879598abdcdfca7aa575b80559c591f05df66146477a2e295753c09260
|
7
|
+
data.tar.gz: 35c0818e44d419a5a6aaaff6016dd20732fdc205f62c42330861869cb6969ce21b3f6278acfbf4c3eaedb9f83a1a3616eb9bf5d7f8ceab5430c1488e477d26a0
|
data/lib/wx_pay/service.rb
CHANGED
@@ -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 = {
|
data/lib/wx_pay/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|