Completed
Push — master ( 32869d...8a9333 )
by Carlos
04:33 queued 30s
created

CoinClient::orders()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
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\OfficialAccount\Card;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class CoinClient.
18
 *
19
 * @author overtrue <[email protected]>
20
 */
21
class CoinClient extends BaseClient
22
{
23
    /**
24
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
25
     */
26 1
    public function activate()
27
    {
28 1
        return $this->httpGet('card/pay/activate');
29
    }
30
31
    /**
32
     * @param string $cardId
33
     * @param int    $quantity
34
     *
35
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
36
     */
37 1
    public function getPrice(string $cardId, int $quantity)
38
    {
39 1
        return $this->httpPostJson('card/pay/getpayprice', [
40 1
            'card_id' => $cardId,
41 1
            'quantity' => $quantity,
42
        ]);
43
    }
44
45
    /**
46
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
47
     */
48 1
    public function summary()
49
    {
50 1
        return $this->httpGet('card/pay/getcoinsinfo');
51
    }
52
53
    /**
54
     * @param int $count
55
     *
56
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
57
     */
58 1
    public function recharge(int $count)
59
    {
60 1
        return $this->httpPostJson('card/pay/recharge', [
61 1
            'coin_count' => $count,
62
        ]);
63
    }
64
65
    /**
66
     * @param string $orderId
67
     *
68
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
69
     */
70 1
    public function order(string $orderId)
71
    {
72 1
        return $this->httpPostJson('card/pay/getorder', ['order_id' => $orderId]);
73
    }
74
75
    /**
76
     * @param array $filters
77
     *
78
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
79
     */
80 1
    public function orders(array $filters)
81
    {
82 1
        return $this->httpPostJson('card/pay/getorderlist', $filters);
83
    }
84
85
    /**
86
     * @param string $cardId
87
     * @param string $orderId
88
     * @param int    $quantity
89
     *
90
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
91
     */
92 1
    public function confirm(string $cardId, string $orderId, int $quantity)
93
    {
94 1
        return $this->httpPostJson('card/pay/confirm', [
95 1
            'card_id' => $cardId,
96 1
            'order_id' => $orderId,
97 1
            'quantity' => $quantity,
98
        ]);
99
    }
100
}
101