Commit 01d9e84eeb182185dc0c410f397ee7763b0fc72e
1 parent
2db6f048
Exists in
master
bug fix
Showing
2 changed files
with
4 additions
and
2 deletions
Show diff stats
lib/wx_pay.rb
@@ -4,7 +4,7 @@ require 'wx_pay/service' | @@ -4,7 +4,7 @@ require 'wx_pay/service' | ||
4 | require 'openssl' | 4 | require 'openssl' |
5 | 5 | ||
6 | module WxPay | 6 | module WxPay |
7 | - @rest_client_options = {} | 7 | + @extra_rest_client_options = {} |
8 | 8 | ||
9 | class<< self | 9 | class<< self |
10 | attr_accessor :appid, :mch_id, :key, :apiclient_cert, :apiclient_key, :extra_rest_client_options | 10 | attr_accessor :appid, :mch_id, :key, :apiclient_cert, :apiclient_key, :extra_rest_client_options |
lib/wx_pay/service.rb
@@ -173,13 +173,15 @@ module WxPay | @@ -173,13 +173,15 @@ module WxPay | ||
173 | end | 173 | end |
174 | 174 | ||
175 | def self.invoke_remote(url, payload, options = {}) | 175 | def self.invoke_remote(url, payload, options = {}) |
176 | + options = WxPay.extra_rest_client_options.merge(options) | ||
177 | + | ||
176 | r = RestClient::Request.execute( | 178 | r = RestClient::Request.execute( |
177 | { | 179 | { |
178 | method: :post, | 180 | method: :post, |
179 | url: url, | 181 | url: url, |
180 | payload: payload, | 182 | payload: payload, |
181 | headers: { content_type: 'application/xml' } | 183 | headers: { content_type: 'application/xml' } |
182 | - }.merge(WxPay.extra_rest_client_options).merge(options) | 184 | + }.merge(options) |
183 | ) | 185 | ) |
184 | 186 | ||
185 | if r | 187 | if r |