Coupon.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 Coupon
  18. * @package WePay
  19. */
  20. class Coupon 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. $url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/send_coupon";
  32. return $this->callPostApi($url, $options, true);
  33. }
  34. /**
  35. * 查询代金券批次
  36. * @param array $options
  37. * @return array
  38. * @throws \WeChat\Exceptions\InvalidResponseException
  39. * @throws \WeChat\Exceptions\LocalCacheException
  40. */
  41. public function queryStock(array $options)
  42. {
  43. $url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/query_coupon_stock";
  44. return $this->callPostApi($url, $options, false);
  45. }
  46. /**
  47. * 查询代金券信息
  48. * @param array $options
  49. * @return array
  50. * @throws \WeChat\Exceptions\InvalidResponseException
  51. * @throws \WeChat\Exceptions\LocalCacheException
  52. */
  53. public function queryInfo(array $options)
  54. {
  55. $url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/query_coupon_stock";
  56. return $this->callPostApi($url, $options, false);
  57. }
  58. }