Completed
Pull Request — master (#1272)
by
unknown
02:56
created

MemberCardClient::updateUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 0
cts 3
cp 0
crap 2
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
/**
15
 * Class MemberCardClient.
16
 *
17
 * @author overtrue <[email protected]>
18
 */
19
class MemberCardClient extends Client
20
{
21
    /**
22
     * 会员卡接口激活.
23
     *
24
     * @param array $info
25
     *
26
     * @return mixed
27
     */
28
    public function activate(array $info = [])
29
    {
30
        return $this->httpPostJson('card/membercard/activate', $info);
31
    }
32
33
    /**
34
     * 设置开卡字段接口.
35
     *
36
     * @param string $cardId
37
     * @param array  $settings
38
     *
39
     * @return mixed
40
     */
41
    public function setActivationForm(string $cardId, array $settings)
42
    {
43
        $params = array_merge(['card_id' => $cardId], $settings);
44
45
        return $this->httpPostJson('card/membercard/activateuserform/set', $params);
46
    }
47
48
    /**
49
     * 拉取会员信息接口.
50
     *
51
     * @param string $cardId
52
     * @param string $code
53
     *
54
     * @return mixed
55
     */
56
    public function getUser(string $cardId, string $code)
57
    {
58
        $params = [
59
            'card_id' => $cardId,
60
            'code' => $code,
61
        ];
62
63
        return $this->httpPostJson('card/membercard/userinfo/get', $params);
64
    }
65
66
    /**
67
     * 更新会员信息.
68
     *
69
     * @param array $params
70
     *
71
     * @return mixed
72
     */
73
    public function updateUser(array $params = [])
74
    {
75
        return $this->httpPostJson('card/membercard/updateuser', $params);
76
    }
77
78
    /**
79
     * 获取用户提交资料.
80
     *
81
     * @param string $activateTicket
82
     *
83
     * @return mixed
84
     */
85
    public function getActivationForm($activateTicket)
86
    {
87
        $params = [
88
            'activate_ticket' => $activateTicket,
89
        ];
90
91
        return $this->httpPostJson('card/membercard/activatetempinfo/get', $params);
92
    }
93
  
94
   /**
95
     * 获取开卡组件链接接口
96
     *
97
     * @param array  $params 包含会员卡ID和随机字符串
98
     * 
99
     * @return string 开卡组件链接
100
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
101
     */
102
    public function getActivateUrl(array $params = [])
103
    {
104
        return $this->httpPostJson('card/membercard/activate/geturl', $params);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->httpPostJs...ivate/geturl', $params) also could return the type object|array which is incompatible with the documented return type string.
Loading history...
105
    }
106
}
107