Client   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 36
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A authCodeToOpenid() 0 5 1
A pay() 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\Payment\Base;
13
14
use EasyWeChat\Payment\Kernel\BaseClient;
15
16
class Client extends BaseClient
17
{
18
    /**
19
     * Pay the order.
20
     *
21
     * @param array $params
22
     *
23
     * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
24
     *
25
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
26
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
27
     * @throws \GuzzleHttp\Exception\GuzzleException
28
     */
29 1
    public function pay(array $params)
30
    {
31 1
        $params['appid'] = $this->app['config']->app_id;
32
33 1
        return $this->request($this->wrap('pay/micropay'), $params);
34
    }
35
36
    /**
37
     * Get openid by auth code.
38
     *
39
     * @param string $authCode
40
     *
41
     * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
42
     *
43
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
44
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
45
     * @throws \GuzzleHttp\Exception\GuzzleException
46
     */
47 1
    public function authCodeToOpenid(string $authCode)
48
    {
49 1
        return $this->request('tools/authcodetoopenid', [
50 1
            'appid' => $this->app['config']->app_id,
51 1
            'auth_code' => $authCode,
52
        ]);
53
    }
54
}
55