GiftCardClient.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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\OfficialAccount\Card;
  11. use EasyWeChat\Kernel\BaseClient;
  12. /**
  13. * Class GiftCardClient.
  14. *
  15. * @author overtrue <i@overtrue.me>
  16. */
  17. class GiftCardClient extends BaseClient
  18. {
  19. /**
  20. * 申请微信支付礼品卡权限接口.
  21. *
  22. * @param string $subMchId
  23. *
  24. * @return mixed
  25. */
  26. public function add(string $subMchId)
  27. {
  28. $params = [
  29. 'sub_mch_id' => $subMchId,
  30. ];
  31. return $this->httpPostJson('card/giftcard/pay/whitelist/add', $params);
  32. }
  33. /**
  34. * 绑定商户号到礼品卡小程序接口(商户号必须为公众号申请的商户号,否则报错).
  35. *
  36. * @param string $subMchId
  37. * @param string $wxaAppid
  38. *
  39. * @return mixed
  40. */
  41. public function bind(string $subMchId, string $wxaAppid)
  42. {
  43. $params = [
  44. 'sub_mch_id' => $subMchId,
  45. 'wxa_appid' => $wxaAppid,
  46. ];
  47. return $this->httpPostJson('card/giftcard/pay/submch/bind', $params);
  48. }
  49. /**
  50. * 上传小程序代码.
  51. *
  52. * @param string $wxaAppid
  53. * @param string $pageId
  54. *
  55. * @return mixed
  56. */
  57. public function set(string $wxaAppid, string $pageId)
  58. {
  59. $params = [
  60. 'wxa_appid' => $wxaAppid,
  61. 'page_id' => $pageId,
  62. ];
  63. return $this->httpPostJson('card/giftcard/wxa/set', $params);
  64. }
  65. }