Client   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 15
dl 0
loc 50
ccs 0
cts 16
cp 0
rs 10
c 2
b 0
f 0

2 Methods

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