Custom.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | WeChatDeveloper
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2022 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: https://thinkadmin.top
  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 Custom
  18. * @package WePay
  19. */
  20. class Custom 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 add(array $options = [])
  30. {
  31. $url = 'https://api.mch.weixin.qq.com/cgi-bin/mch/customs/customdeclareorder';
  32. return $this->callPostApi($url, $options, false, 'MD5', false, false);
  33. }
  34. /**
  35. * 订单附加信息查询接口
  36. * @param array $options
  37. * @return array
  38. * @throws \WeChat\Exceptions\InvalidResponseException
  39. * @throws \WeChat\Exceptions\LocalCacheException
  40. */
  41. public function get(array $options = [])
  42. {
  43. $url = 'https://api.mch.weixin.qq.com/cgi-bin/mch/customs/customdeclarequery';
  44. return $this->callPostApi($url, $options, false, 'MD5', true, 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 reset(array $options = [])
  54. {
  55. $url = 'https://api.mch.weixin.qq.com/cgi-bin/mch/newcustoms/customdeclareredeclare';
  56. return $this->callPostApi($url, $options, false, 'MD5', true, false);
  57. }
  58. }