Commit 02ce28670c84137211bf2f8f0c753a50cf3ceab4
1 parent
7887f036
Exists in
master
move check_required_options to func start
Showing
1 changed file
with
4 additions
and
5 deletions
Show diff stats
lib/wx_pay/service.rb
... | ... | @@ -60,18 +60,17 @@ module WxPay |
60 | 60 | |
61 | 61 | GENERATE_JS_PAY_REQ_REQUIRED_FIELDS = [:prepayid, :noncestr] |
62 | 62 | def self.generate_js_pay_req(params, options = {}) |
63 | + check_required_options(params, GENERATE_JS_PAY_REQ_REQUIRED_FIELDS) | |
64 | + | |
63 | 65 | params = { |
64 | 66 | appId: options.delete(:appid) || WxPay.appid, |
65 | - package: "prepay_id=#{params[:prepayid]}", | |
66 | - nonceStr: params[:noncestr], | |
67 | + package: "prepay_id=#{params.delete(:prepayid)}", | |
68 | + nonceStr: params.delete(:noncestr), | |
67 | 69 | timeStamp: Time.now.to_i.to_s, |
68 | 70 | signType: 'MD5' |
69 | 71 | }.merge(params) |
70 | 72 | |
71 | - check_required_options(params, GENERATE_JS_PAY_REQ_REQUIRED_FIELDS) | |
72 | - | |
73 | 73 | params[:paySign] = WxPay::Sign.generate(params) |
74 | - | |
75 | 74 | params |
76 | 75 | end |
77 | 76 | ... | ... |