wx_pay 0.8.0 → 0.8.1

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: d986c63e59418f4f41abdf7964f439a044335012
4
- data.tar.gz: 74505540b958d4f1725f0763e62caaff2db4d911
3
+ metadata.gz: e4ff7a9ba32dc3cea756ed66865b66f5ef440311
4
+ data.tar.gz: ce07f1c5496ff7ac19c3f6ae1381eda0603bb804
5
5
  SHA512:
6
- metadata.gz: 974a4df080f52a1269cb7890adf235b8d27671bb66a6f10bd320871b88eaa5975d9e11643f3909c30a2b7653985e61d46305433b41b03285a276e6f32daac756
7
- data.tar.gz: 5356b1639c8a8a141406267fdf595b5affe729f179dc78558802eee50d06e6305f3c2f81f1ddd539fc24890a807034ebbd58c156d076ef8aa4f5f2c173aacab1
6
+ metadata.gz: 7ede1fdd18df2e2bb111b8ada4d8a1073a9f22414d35df9269553d4330ad704a692a598473ddcef5ccdda1ae3cbdc31b8178527b7d2273ad9f1a774ca3063c5b
7
+ data.tar.gz: b2d5d04eed82a6a0450aa17c08637d23f20785a1d7db7569141ab4410705ed85d24b29383cb1ff17c854189425515483dfea128f5184951c20d0f9ca92225784
data/lib/wx_pay.rb CHANGED
@@ -5,9 +5,11 @@ require 'openssl'
5
5
 
6
6
  module WxPay
7
7
  @extra_rest_client_options = {}
8
+ @debug_mode = true
8
9
 
9
10
  class<< self
10
- attr_accessor :appid, :mch_id, :key, :apiclient_cert, :apiclient_key, :extra_rest_client_options
11
+ attr_accessor :appid, :mch_id, :key, :extra_rest_client_options, :debug_mode
12
+ attr_reader :apiclient_cert, :apiclient_key
11
13
 
12
14
  def set_apiclient_by_pkcs12(str, pass)
13
15
  pkcs12 = OpenSSL::PKCS12.new(str, pass)
@@ -24,5 +26,9 @@ module WxPay
24
26
  def apiclient_key=(key)
25
27
  @apiclient_key = OpenSSL::PKey::RSA.new(key)
26
28
  end
29
+
30
+ def debug_mode?
31
+ @debug_mode
32
+ end
27
33
  end
28
34
  end
@@ -249,6 +249,7 @@ module WxPay
249
249
  private
250
250
 
251
251
  def check_required_options(options, names)
252
+ return if !WxPay.debug_mode?
252
253
  names.each do |name|
253
254
  warn("WxPay Warn: missing required option: #{name}") unless options.has_key?(name)
254
255
  end
data/lib/wx_pay/sign.rb CHANGED
@@ -5,8 +5,8 @@ module WxPay
5
5
  def self.generate(params)
6
6
  key = params.delete(:key)
7
7
 
8
- query = params.sort.map do |key, value|
9
- "#{key}=#{value}" if value != "" && !value.nil?
8
+ query = params.sort.map do |k, v|
9
+ "#{k}=#{v}" if v.to_s != ''
10
10
  end.compact.join('&')
11
11
 
12
12
  Digest::MD5.hexdigest("#{query}&key=#{key || WxPay.key}").upcase
@@ -1,3 +1,3 @@
1
1
  module WxPay
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
data/test/test_helper.rb CHANGED
@@ -6,3 +6,4 @@ require 'fakeweb'
6
6
  WxPay.appid = 'wxd930ea5d5a258f4f'
7
7
  WxPay.key = '8934e7d15453e97507ef794cf7b0519d'
8
8
  WxPay.mch_id = '1900000109'
9
+ WxPay.debug_mode = true
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.8.0
4
+ version: 0.8.1
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-12 00:00:00.000000000 Z
11
+ date: 2016-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10'
61
+ version: '11.2'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10'
68
+ version: '11.2'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: fakeweb
71
71
  requirement: !ruby/object:Gem::Requirement