Commit 25d70c04b16726543dc968d27cf6d0bb5e528d90

Authored by moohao
Committed by GitHub
1 parent c7dc42e3
Exists in master

add gethbinfo method

Showing 1 changed file with 25 additions and 0 deletions   Show diff stats
lib/wx_pay/service.rb
... ... @@ -450,6 +450,31 @@ module WxPay
450 450  
451 451 r
452 452 end
  453 +
  454 + # 用于商户对已发放的红包进行查询红包的具体信息,可支持普通红包和裂变包。
  455 + GETHBINFO_FIELDS = [:mch_billno, :bill_type]
  456 + def self.gethbinfo(params, options = {})
  457 + params = {
  458 + appid: options.delete(:appid) || WxPay.appid,
  459 + mch_id: options.delete(:mch_id) || WxPay.mch_id,
  460 + nonce_str: SecureRandom.uuid.tr('-', ''),
  461 + key: options.delete(:key) || WxPay.key
  462 + }.merge(params)
  463 +
  464 + check_required_options(params, GETHBINFO_FIELDS)
  465 +
  466 + options = {
  467 + ssl_client_cert: options.delete(:apiclient_cert) || WxPay.apiclient_cert,
  468 + ssl_client_key: options.delete(:apiclient_key) || WxPay.apiclient_key,
  469 + verify_ssl: OpenSSL::SSL::VERIFY_NONE
  470 + }.merge(options)
  471 +
  472 + r = WxPay::Result.new(Hash.from_xml(invoke_remote("/mmpaymkttransfers/gethbinfo", make_payload(params), options)))
  473 +
  474 + yield r if block_given?
  475 +
  476 + r
  477 + end
453 478  
454 479 class << self
455 480 private
... ...