Completed
Pull Request — master (#1556)
by wannanbigpig
04:17
created

Client::queryWithdrawalStatus()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 1
nop 2
dl 0
loc 7
rs 10
c 0
b 0
f 0
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        $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 \EasyWeChat\MicroMerchant\Kernel\Exceptions\InvalidSignException
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        $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 \EasyWeChat\MicroMerchant\Kernel\Exceptions\InvalidSignException
57
     */
58
    public function reAutoWithdrawByDate($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