Client   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
eloc 11
dl 0
loc 43
ccs 0
cts 12
cp 0
rs 10
c 3
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A requestWithdraw() 0 7 2
A queryWithdrawalStatus() 0 7 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\MicroMerchant\Withdraw;
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
     * Query withdrawal status.
26
     *
27
     * @param string $date
28
     * @param string $subMchId
29
     *
30
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
31
     *
32
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
33
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
34
     * @throws \GuzzleHttp\Exception\GuzzleException
35
     */
36
    public function queryWithdrawalStatus($date, $subMchId = '')
37
    {
38
        return $this->safeRequest('fund/queryautowithdrawbydate', [
39
            'date' => $date,
40
            'sign_type' => 'HMAC-SHA256',
41
            'nonce_str' => uniqid('micro'),
42
            'sub_mch_id' => $subMchId ?: $this->app['config']->sub_mch_id,
43
        ]);
44
    }
45
46
    /**
47
     * Re-initiation of withdrawal.
48
     *
49
     * @param string $date
50
     * @param string $subMchId
51
     *
52
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
53
     *
54
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
55
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
56
     * @throws \GuzzleHttp\Exception\GuzzleException
57
     */
58
    public function requestWithdraw($date, $subMchId = '')
59
    {
60
        return $this->safeRequest('fund/reautowithdrawbydate', [
61
            'date' => $date,
62
            'sign_type' => 'HMAC-SHA256',
63
            'nonce_str' => uniqid('micro'),
64
            'sub_mch_id' => $subMchId ?: $this->app['config']->sub_mch_id,
65
        ]);
66
    }
67
}
68