Client.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. /*
  8. * This file is part of the overtrue/wechat.
  9. *
  10. * (c) overtrue <i@overtrue.me>
  11. *
  12. * This source file is subject to the MIT license that is bundled
  13. * with this source code in the file LICENSE.
  14. */
  15. namespace ByteDance\MiniProgram\Order;
  16. use ByteDance\Kernel\Exceptions\InvalidArgumentException;
  17. use ByteDance\Kernel\Exceptions\InvalidConfigException;
  18. use ByteDance\Kernel\Support;
  19. use ByteDance\Kernel\Support\Collection;
  20. use ByteDance\Kernel\BaseClient;
  21. use Psr\Http\Message\ResponseInterface;
  22. class Client extends BaseClient
  23. {
  24. /**
  25. * Unify order.
  26. *
  27. * @param array $params
  28. *
  29. * @return ResponseInterface|Collection|array|object|string
  30. *
  31. * @throws \ByteDance\Kernel\Exceptions\InvalidArgumentException
  32. * @throws \ByteDance\Kernel\Exceptions\InvalidConfigException
  33. * @throws \GuzzleHttp\Exception\GuzzleException
  34. */
  35. public function unify(array $params)
  36. {
  37. return $this->httpPostJson('api/apps/ecpay/v1/create_order', $params);
  38. }
  39. /**
  40. * Refund order.
  41. *
  42. * @param array $params
  43. *
  44. * @return ResponseInterface|Collection|array|object|string
  45. *
  46. * @throws \ByteDance\Kernel\Exceptions\InvalidArgumentException
  47. * @throws \ByteDance\Kernel\Exceptions\InvalidConfigException
  48. * @throws \GuzzleHttp\Exception\GuzzleException
  49. */
  50. public function refund(array $params)
  51. {
  52. return $this->httpPostJson('api/apps/ecpay/v1/create_refund', $params);
  53. }
  54. }