Client.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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\MicroMerchant\Material;
  11. use EasyWeChat\MicroMerchant\Kernel\BaseClient;
  12. /**
  13. * Class Client.
  14. *
  15. * @author liuml <liumenglei0211@163.com>
  16. * @DateTime 2019-05-30 14:19
  17. */
  18. class Client extends BaseClient
  19. {
  20. /**
  21. * update settlement card.
  22. *
  23. * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
  24. *
  25. * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
  26. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  27. * @throws \EasyWeChat\MicroMerchant\Kernel\Exceptions\EncryptException
  28. * @throws \GuzzleHttp\Exception\GuzzleException
  29. */
  30. public function setSettlementCard(array $params)
  31. {
  32. $params['sub_mch_id'] = $params['sub_mch_id'] ?? $this->app['config']->sub_mch_id;
  33. $params = $this->processParams(array_merge($params, [
  34. 'version' => '1.0',
  35. 'cert_sn' => '',
  36. 'sign_type' => 'HMAC-SHA256',
  37. 'nonce_str' => uniqid('micro'),
  38. ]));
  39. return $this->safeRequest('applyment/micro/modifyarchives', $params);
  40. }
  41. /**
  42. * update contact info.
  43. *
  44. * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
  45. *
  46. * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
  47. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  48. * @throws \EasyWeChat\MicroMerchant\Kernel\Exceptions\EncryptException
  49. * @throws \GuzzleHttp\Exception\GuzzleException
  50. */
  51. public function updateContact(array $params)
  52. {
  53. $params['sub_mch_id'] = $params['sub_mch_id'] ?? $this->app['config']->sub_mch_id;
  54. $params = $this->processParams(array_merge($params, [
  55. 'version' => '1.0',
  56. 'cert_sn' => '',
  57. 'sign_type' => 'HMAC-SHA256',
  58. 'nonce_str' => uniqid('micro'),
  59. ]));
  60. return $this->safeRequest('applyment/micro/modifycontactinfo', $params);
  61. }
  62. }