Completed
Pull Request — master (#1556)
by wannanbigpig
07:00 queued 03:07
created

Client   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 4

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        $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
     */
35
    public function queryWithdrawalStatus($date, $subMchId = '')
36
    {
37
        return $this->safeRequest('fund/queryautowithdrawbydate', [
38
            'date' => $date,
39
            'sign_type' => 'HMAC-SHA256',
40
            'nonce_str' => uniqid('micro'),
41
            'sub_mch_id' => $subMchId ?: $this->app['config']->sub_mch_id,
42
        ]);
43
    }
44
45
    /**
46
     * Re-initiation of withdrawal.
47
     *
48
     * @param        $date
49
     * @param string $subMchId
50
     *
51
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
52
     *
53
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
54
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
55
     */
56
    public function requestWithdraw($date, $subMchId = '')
57
    {
58
        return $this->safeRequest('fund/reautowithdrawbydate', [
59
            'date' => $date,
60
            'sign_type' => 'HMAC-SHA256',
61
            'nonce_str' => uniqid('micro'),
62
            'sub_mch_id' => $subMchId ?: $this->app['config']->sub_mch_id,
63
        ]);
64
    }
65
}
66