Commit 743ead12c60598bdef57f823556bb09312978919

Authored by jasl
1 parent e9cebb69
Exists in master

fix sandbox mode

Showing 2 changed files with 3 additions and 4 deletions   Show diff stats
lib/wx_pay/service.rb
... ... @@ -27,9 +27,10 @@ module WxPay
27 27 ), quirks_mode: true)
28 28 end
29 29  
30   - def self.get_sandbox_signkey(mch_id = WxPay.mch_id)
  30 + def self.get_sandbox_signkey(mch_id = WxPay.mch_id, options = {})
31 31 params = {
32 32 mch_id: mch_id,
  33 + key: options.delete(:key) || WxPay.key,
33 34 nonce_str: SecureRandom.uuid.tr('-', '')
34 35 }
35 36 r = WxPay::Result.new(Hash.from_xml(invoke_remote("/pay/getsignkey", xmlify_payload(params))))
... ...
lib/wx_pay/sign.rb
... ... @@ -25,11 +25,9 @@ module WxPay
25 25 end
26 26  
27 27 def self.verify?(params, options = {})
  28 + return true if WxPay.sandbox_mode?
28 29 params = params.dup
29 30 params = params.merge(options)
30   - if WxPay.sandbox_mode? && !params[:key]
31   - params[:key] = WxPay.sandbox_key
32   - end
33 31 sign = params.delete('sign') || params.delete(:sign)
34 32 generate(params) == sign
35 33 end
... ...