Commit 742cbe8eac13cd86cbe09df7e87548c9cde7c3a5
1 parent
96e86ac8
Exists in
master
add gettransferinfo for service
Showing
1 changed file
with
23 additions
and
0 deletions
Show diff stats
lib/wx_pay/service.rb
... | ... | @@ -159,6 +159,29 @@ module WxPay |
159 | 159 | r |
160 | 160 | end |
161 | 161 | |
162 | + GETTRANSFERINFO_FIELDS = [:partner_trade_no] | |
163 | + def self.gettransferinfo(params, options = {}) | |
164 | + params = { | |
165 | + mch_appid: options.delete(:appid) || WxPay.appid, | |
166 | + mchid: options.delete(:mch_id) || WxPay.mch_id, | |
167 | + nonce_str: SecureRandom.uuid.tr('-', '') | |
168 | + }.merge(params) | |
169 | + | |
170 | + check_required_options(params, GETTRANSFERINFO_FIELDS) | |
171 | + | |
172 | + options = { | |
173 | + ssl_client_cert: options.delete(:apiclient_cert) || WxPay.apiclient_cert, | |
174 | + ssl_client_key: options.delete(:apiclient_key) || WxPay.apiclient_key, | |
175 | + verify_ssl: OpenSSL::SSL::VERIFY_NONE | |
176 | + }.merge(options) | |
177 | + | |
178 | + r = WxPay::Result.new(Hash.from_xml(invoke_remote("#{GATEWAY_URL}/mmpaymkttransfers/gettransferinfo", make_payload(params), options))) | |
179 | + | |
180 | + yield r if block_given? | |
181 | + | |
182 | + r | |
183 | + end | |
184 | + | |
162 | 185 | INVOKE_REVERSE_REQUIRED_FIELDS = [:out_trade_no] |
163 | 186 | def self.invoke_reverse(params, options = {}) |
164 | 187 | params = { | ... | ... |