Client.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /*
  3. * This file is part of the overtrue/wechat.
  4. *
  5. * (c) overtrue <i@overtrue.me>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace EasyWeChat\Payment\Contract;
  11. use EasyWeChat\Payment\Kernel\BaseClient;
  12. /**
  13. * Class Client.
  14. *
  15. * @author tianyong90 <412039588@qq.com>
  16. */
  17. class Client extends BaseClient
  18. {
  19. /**
  20. * entrust official account.
  21. *
  22. * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
  23. *
  24. * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
  25. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  26. * @throws \GuzzleHttp\Exception\GuzzleException
  27. */
  28. public function web(array $params)
  29. {
  30. $params['appid'] = $this->app['config']->app_id;
  31. return $this->safeRequest('papay/entrustweb', $params);
  32. }
  33. /**
  34. * entrust app.
  35. *
  36. * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
  37. *
  38. * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
  39. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  40. * @throws \GuzzleHttp\Exception\GuzzleException
  41. */
  42. public function app(array $params)
  43. {
  44. $params['appid'] = $this->app['config']->app_id;
  45. return $this->safeRequest('papay/preentrustweb', $params);
  46. }
  47. /**
  48. * entrust html 5.
  49. *
  50. * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
  51. *
  52. * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
  53. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  54. * @throws \GuzzleHttp\Exception\GuzzleException
  55. */
  56. public function h5(array $params)
  57. {
  58. $params['appid'] = $this->app['config']->app_id;
  59. return $this->safeRequest('papay/h5entrustweb', $params);
  60. }
  61. /**
  62. * apply papay.
  63. *
  64. * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
  65. *
  66. * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
  67. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  68. * @throws \GuzzleHttp\Exception\GuzzleException
  69. */
  70. public function apply(array $params)
  71. {
  72. $params['appid'] = $this->app['config']->app_id;
  73. return $this->safeRequest('pay/pappayapply', $params);
  74. }
  75. /**
  76. * delete papay contrace.
  77. *
  78. * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
  79. *
  80. * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
  81. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  82. * @throws \GuzzleHttp\Exception\GuzzleException
  83. */
  84. public function delete(array $params)
  85. {
  86. $params['appid'] = $this->app['config']->app_id;
  87. @file_put_contents("quanju.txt", json_encode($params) . "-解除签约传参\r\n", 8);
  88. return $this->request($this->wrap('papay/deletecontract'), $params);
  89. // return $this->safeRequest('papay/deletecontract', $params);
  90. }
  91. }