GiftCardClient::bind()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 8
rs 10
ccs 4
cts 4
cp 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of the overtrue/wechat.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace EasyWeChat\OfficialAccount\Card;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class GiftCardClient.
18
 *
19
 * @author overtrue <[email protected]>
20
 */
21
class GiftCardClient extends BaseClient
22
{
23
    /**
24
     * 申请微信支付礼品卡权限接口.
25
     *
26
     * @param string $subMchId
27
     *
28
     * @return mixed
29
     */
30 1
    public function add(string $subMchId)
31
    {
32
        $params = [
33 1
            'sub_mch_id' => $subMchId,
34
        ];
35
36 1
        return $this->httpPostJson('card/giftcard/pay/whitelist/add', $params);
37
    }
38
39
    /**
40
     * 绑定商户号到礼品卡小程序接口(商户号必须为公众号申请的商户号,否则报错).
41
     *
42
     * @param string $subMchId
43
     * @param string $wxaAppid
44
     *
45
     * @return mixed
46
     */
47 1
    public function bind(string $subMchId, string $wxaAppid)
48
    {
49
        $params = [
50 1
            'sub_mch_id' => $subMchId,
51 1
            'wxa_appid' => $wxaAppid,
52
        ];
53
54 1
        return $this->httpPostJson('card/giftcard/pay/submch/bind', $params);
55
    }
56
57
    /**
58
     * 上传小程序代码.
59
     *
60
     * @param string $wxaAppid
61
     * @param string $pageId
62
     *
63
     * @return mixed
64
     */
65 1
    public function set(string $wxaAppid, string $pageId)
66
    {
67
        $params = [
68 1
            'wxa_appid' => $wxaAppid,
69 1
            'page_id' => $pageId,
70
        ];
71
72 1
        return $this->httpPostJson('card/giftcard/wxa/set', $params);
73
    }
74
}
75