Transfers.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | WeChatDeveloper
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2020 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://think.ctolog.com
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // +----------------------------------------------------------------------
  11. // | github开源项目:https://github.com/zoujingli/WeChatDeveloper
  12. // +----------------------------------------------------------------------
  13. namespace WePay;
  14. use WeChat\Contracts\BasicWePay;
  15. /**
  16. * 微信商户打款到零钱
  17. * Class Transfers
  18. * @package WePay
  19. */
  20. class Transfers extends BasicWePay
  21. {
  22. /**
  23. * 企业付款到零钱
  24. * @param array $options
  25. * @return array
  26. * @throws \WeChat\Exceptions\InvalidResponseException
  27. * @throws \WeChat\Exceptions\LocalCacheException
  28. */
  29. public function create(array $options)
  30. {
  31. $this->params->offsetUnset('appid');
  32. $this->params->offsetUnset('mch_id');
  33. $this->params->set('mchid', $this->config->get('mch_id'));
  34. $this->params->set('mch_appid', $this->config->get('appid'));
  35. $url = 'https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers';
  36. return $this->callPostApi($url, $options, true, 'MD5', false);
  37. }
  38. /**
  39. * 查询企业付款到零钱
  40. * @param string $partnerTradeNo 商户调用企业付款API时使用的商户订单号
  41. * @return array
  42. * @throws \WeChat\Exceptions\InvalidResponseException
  43. * @throws \WeChat\Exceptions\LocalCacheException
  44. */
  45. public function query($partnerTradeNo)
  46. {
  47. $this->params->offsetUnset('mchid');
  48. $this->params->offsetUnset('mch_appid');
  49. $this->params->set('appid', $this->config->get('appid'));
  50. $this->params->set('mch_id', $this->config->get('mch_id'));
  51. $url = 'https://api.mch.weixin.qq.com/mmpaymkttransfers/gettransferinfo';
  52. return $this->callPostApi($url, ['partner_trade_no' => $partnerTradeNo], true, 'MD5', false);
  53. }
  54. }