Custom.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | WeChatDeveloper
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2023 ThinkAdmin [ thinkadmin.top ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: https://thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // | 免责声明 ( https://thinkadmin.top/disclaimer )
  11. // +----------------------------------------------------------------------
  12. // | gitee 代码仓库:https://gitee.com/zoujingli/WeChatDeveloper
  13. // | github 代码仓库:https://github.com/zoujingli/WeChatDeveloper
  14. // +----------------------------------------------------------------------
  15. namespace WePay;
  16. use WeChat\Contracts\BasicWePay;
  17. /**
  18. * 微信扩展上报海关
  19. * Class Custom
  20. * @package WePay
  21. */
  22. class Custom extends BasicWePay
  23. {
  24. /**
  25. * 订单附加信息提交接口
  26. * @param array $options
  27. * @return array
  28. * @throws \WeChat\Exceptions\InvalidResponseException
  29. * @throws \WeChat\Exceptions\LocalCacheException
  30. */
  31. public function add(array $options = [])
  32. {
  33. $url = 'https://api.mch.weixin.qq.com/cgi-bin/mch/customs/customdeclareorder';
  34. return $this->callPostApi($url, $options, false, 'MD5', false, false);
  35. }
  36. /**
  37. * 订单附加信息查询接口
  38. * @param array $options
  39. * @return array
  40. * @throws \WeChat\Exceptions\InvalidResponseException
  41. * @throws \WeChat\Exceptions\LocalCacheException
  42. */
  43. public function get(array $options = [])
  44. {
  45. $url = 'https://api.mch.weixin.qq.com/cgi-bin/mch/customs/customdeclarequery';
  46. return $this->callPostApi($url, $options, false, 'MD5', true, false);
  47. }
  48. /**
  49. * 订单附加信息重推接口
  50. * @param array $options
  51. * @return array
  52. * @throws \WeChat\Exceptions\InvalidResponseException
  53. * @throws \WeChat\Exceptions\LocalCacheException
  54. */
  55. public function reset(array $options = [])
  56. {
  57. $url = 'https://api.mch.weixin.qq.com/cgi-bin/mch/newcustoms/customdeclareredeclare';
  58. return $this->callPostApi($url, $options, false, 'MD5', true, false);
  59. }
  60. }