Client   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 121
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 16
c 2
b 1
f 0
dl 0
loc 121
ccs 24
cts 24
cp 1
rs 10
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A listProviders() 0 3 1
A getWaybill() 0 3 1
A getBalance() 0 5 1
A deleteWaybill() 0 3 1
A getWaybillTrack() 0 3 1
A createWaybill() 0 3 1
A bindPrinter() 0 5 1
A getPrinter() 0 3 1
A unbindPrinter() 0 5 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\MiniProgram\Express;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 *
19
 * @author kehuanhuan <[email protected]>
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
25
     *
26
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
27
     */
28 1
    public function listProviders()
29
    {
30 1
        return $this->httpGet('cgi-bin/express/business/delivery/getall');
31
    }
32
33
    /**
34
     * @param array $params
35
     *
36
     * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
37
     *
38
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
39
     * @throws \GuzzleHttp\Exception\GuzzleException
40
     */
41 1
    public function createWaybill(array $params = [])
42
    {
43 1
        return $this->httpPostJson('cgi-bin/express/business/order/add', $params);
44
    }
45
46
    /**
47
     * @param array $params
48
     *
49
     * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
50
     *
51
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
52
     * @throws \GuzzleHttp\Exception\GuzzleException
53
     */
54 1
    public function deleteWaybill(array $params = [])
55
    {
56 1
        return $this->httpPostJson('cgi-bin/express/business/order/cancel', $params);
57
    }
58
59
    /**
60
     * @param array $params
61
     *
62
     * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
63
     *
64
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
65
     * @throws \GuzzleHttp\Exception\GuzzleException
66
     */
67 1
    public function getWaybill(array $params = [])
68
    {
69 1
        return $this->httpPostJson('cgi-bin/express/business/order/get', $params);
70
    }
71
72
    /**
73
     * @param array $params
74
     *
75
     * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
76
     *
77
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
78
     * @throws \GuzzleHttp\Exception\GuzzleException
79
     */
80 1
    public function getWaybillTrack(array $params = [])
81
    {
82 1
        return $this->httpPostJson('cgi-bin/express/business/path/get', $params);
83
    }
84
85
    /**
86
     * @param string $deliveryId
87
     * @param string $bizId
88
     *
89
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
90
     *
91
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
92
     * @throws \GuzzleHttp\Exception\GuzzleException
93
     */
94 1
    public function getBalance(string $deliveryId, string $bizId)
95
    {
96 1
        return $this->httpPostJson('cgi-bin/express/business/quota/get', [
97 1
            'delivery_id' => $deliveryId,
98 1
            'biz_id' => $bizId,
99
        ]);
100
    }
101
102
    /**
103
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
104
     *
105
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
106
     * @throws \GuzzleHttp\Exception\GuzzleException
107
     */
108 1
    public function getPrinter()
109
    {
110 1
        return $this->httpPostJson('cgi-bin/express/business/printer/getall');
111
    }
112
113
    /**
114
     * @param string $openid
115
     *
116
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
117
     *
118
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
119
     * @throws \GuzzleHttp\Exception\GuzzleException
120
     */
121 1
    public function bindPrinter(string $openid)
122
    {
123 1
        return $this->httpPostJson('cgi-bin/express/business/printer/update', [
124 1
            'update_type' => 'bind',
125 1
            'openid' => $openid,
126
        ]);
127
    }
128
129
    /**
130
     * @param string $openid
131
     *
132
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
133
     *
134
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
135
     * @throws \GuzzleHttp\Exception\GuzzleException
136
     */
137 1
    public function unbindPrinter(string $openid)
138
    {
139 1
        return $this->httpPostJson('cgi-bin/express/business/printer/update', [
140 1
            'update_type' => 'unbind',
141 1
            'openid' => $openid,
142
        ]);
143
    }
144
}
145