Completed
Pull Request — master (#1556)
by wannanbigpig
14:01
created

Client   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 52
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A modifyContactInfo() 0 10 1
A modifyArchives() 0 10 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
     * modify settlement card
26
     *
27
     * @param $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 \EasyWeChat\MicroMerchant\Kernel\Exceptions\InvalidExtensionException
35
     * @throws \EasyWeChat\MicroMerchant\Kernel\Exceptions\InvalidSignException
36
     * @throws \Psr\SimpleCache\InvalidArgumentException
37
     */
38
    public function modifyArchives($params)
39
    {
40
        $params['sub_mch_id'] = $params['sub_mch_id'] ?? $this->app['config']->sub_mch_id;
41
        $params               = $this->processingParams(array_merge($params, [
42
            'version'   => '1.0',
43
            'cert_sn'   => '',
44
            'sign_type' => 'HMAC-SHA256',
45
            'nonce_str' => uniqid('micro'),
46
        ]));
47
        return $this->safeRequest('applyment/micro/modifyarchives', $params);
48
    }
49
50
    /**
51
     * modifyContactInfo
52
     *
53
     * @param $params
54
     *
55
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
56
     *
57
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
58
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
59
     * @throws \EasyWeChat\MicroMerchant\Kernel\Exceptions\EncryptException
60
     * @throws \EasyWeChat\MicroMerchant\Kernel\Exceptions\InvalidExtensionException
61
     * @throws \EasyWeChat\MicroMerchant\Kernel\Exceptions\InvalidSignException
62
     * @throws \Psr\SimpleCache\InvalidArgumentException
63
     */
64
    public function modifyContactInfo($params)
65
    {
66
        $params['sub_mch_id'] = $params['sub_mch_id'] ?? $this->app['config']->sub_mch_id;
67
        $params               = $this->processingParams(array_merge($params, [
68
            'version'   => '1.0',
69
            'cert_sn'   => '',
70
            'sign_type' => 'HMAC-SHA256',
71
            'nonce_str' => uniqid('micro'),
72
        ]));
73
        return $this->safeRequest('applyment/micro/modifycontactinfo', $params);
74
    }
75
}
76