Passed
Push — master ( 9dc2ea...7eaf7d )
by Carlos
02:23
created

Client::select()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 7
rs 9.4285
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\Work\Invoice;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 *
19
 * @author mingyoung <[email protected]>
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * @param string $cardId
25
     * @param string $encryptCode
26
     *
27
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
28
     *
29
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
30
     */
31
    public function get(string $cardId, string $encryptCode)
32
    {
33
        $params = [
34
            'card_id' => $cardId,
35
            'encrypt_code' => $encryptCode,
36
        ];
37
38
        return $this->httpPostJson('cgi-bin/card/invoice/reimburse/getinvoiceinfo', $params);
39
    }
40
41
    /**
42
     * @param array $invoices
43
     *
44
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
45
     *
46
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
47
     */
48
    public function select(array $invoices)
49
    {
50
        $params = [
51
            'item_list' => $invoices,
52
        ];
53
54
        return $this->httpPostJson('cgi-bin/card/invoice/reimburse/getinvoiceinfobatch', $params);
55
    }
56
57
    /**
58
     * @param string $cardId
59
     * @param string $encryptCode
60
     * @param string $status
61
     *
62
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
63
     *
64
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
65
     */
66
    public function update(string $cardId, string $encryptCode, string $status)
67
    {
68
        $params = [
69
            'card_id' => $cardId,
70
            'encrypt_code' => $encryptCode,
71
            'reimburse_status' => $status,
72
        ];
73
74
        return $this->httpPostJson('cgi-bin/card/invoice/reimburse/updateinvoicestatus', $params);
75
    }
76
77
    /**
78
     * @param array  $invoices
79
     * @param string $openid
80
     * @param string $status
81
     *
82
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
83
     *
84
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
85
     */
86
    public function batchUpdate(array $invoices, string $openid, string $status)
87
    {
88
        $params = [
89
            'openid' => $openid,
90
            'reimburse_status' => $status,
91
            'invoice_list' => $invoices,
92
        ];
93
94
        return $this->httpPostJson('cgi-bin/card/invoice/reimburse/updatestatusbatch', $params);
95
    }
96
}
97