Trade.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 AliPay;
  16. use WeChat\Contracts\BasicAliPay;
  17. /**
  18. * 支付宝标准接口
  19. * Class Trade
  20. * @package AliPay
  21. */
  22. class Trade extends BasicAliPay
  23. {
  24. /**
  25. * 设置交易接口地址
  26. * @param string $method
  27. * @return $this
  28. */
  29. public function setMethod($method)
  30. {
  31. $this->options->set('method', $method);
  32. return $this;
  33. }
  34. /**
  35. * 获取交易接口地址
  36. * @return string
  37. */
  38. public function getMethod()
  39. {
  40. return $this->options->get('method');
  41. }
  42. /**
  43. * 设置接口公共参数
  44. * @param array $option
  45. * @return Trade
  46. */
  47. public function setOption($option = [])
  48. {
  49. foreach ($option as $key => $vo) {
  50. $this->options->set($key, $vo);
  51. }
  52. return $this;
  53. }
  54. /**
  55. * 获取接口公共参数
  56. * @return array|string|null
  57. */
  58. public function getOption()
  59. {
  60. return $this->options->get();
  61. }
  62. /**
  63. * 执行通过接口
  64. * @param array $options
  65. * @return array|boolean
  66. * @throws \WeChat\Exceptions\InvalidResponseException
  67. * @throws \WeChat\Exceptions\LocalCacheException
  68. */
  69. public function apply($options)
  70. {
  71. return $this->getResult($options);
  72. }
  73. }