Total Complexity | 5 |
Total Lines | 63 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class Transactions |
||
6 | { |
||
7 | const ENDPOINT = 'transaction'; |
||
8 | |||
9 | /** |
||
10 | * @var Client |
||
11 | */ |
||
12 | private $client; |
||
13 | |||
14 | /** |
||
15 | * Payments constructor. |
||
16 | * @param Client $client |
||
17 | */ |
||
18 | public function __construct(Client $client) |
||
19 | { |
||
20 | $this->client = $client; |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * @see https://revolutdev.github.io/business-api/#get-transactions |
||
25 | * |
||
26 | * @param array $filters |
||
27 | * @return mixed |
||
28 | */ |
||
29 | public function all($filters = []) |
||
30 | { |
||
31 | return $this->client->get('transactions?'.http_build_query($filters)); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @see https://revolutdev.github.io/business-api/#cancel-payment |
||
36 | * |
||
37 | * @param string $id |
||
38 | * @return mixed |
||
39 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
40 | */ |
||
41 | public function cancel($id) |
||
42 | { |
||
43 | return $this->client->delete(self::ENDPOINT.'/'.$id); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @see https://revolutdev.github.io/business-api/#check-payment-status |
||
48 | * |
||
49 | * @param string $id |
||
50 | * @return mixed |
||
51 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
52 | */ |
||
53 | public function get(string $id) |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @see https://revolutdev.github.io/business-api/#check-payment-status |
||
60 | * |
||
61 | * @param string $requestId |
||
62 | * @return mixed |
||
63 | */ |
||
64 | public function getByRequestId(string $requestId) |
||
68 | } |
||
69 | } |
||
70 |