Passed
Push — master ( f86309...3fa716 )
by Mr
01:59 queued 22s
created

Payments::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace UON\Endpoint;
4
5
use UON\Client;
6
7
/**
8
 * Class Payments
9
 * @package UON
10
 */
11
class Payments extends Client
12
{
13
    /**
14
     * Create new payment
15
     *
16
     * @link    https://api.u-on.ru/{key}/payment/create.{_format}
17
     * @param   array $parameters - List of parameters
18
     * @return  array|false
19
     */
20
    public function create(array $parameters)
21
    {
22
        $endpoint = '/payment/create';
23
        return $this->doRequest('post', $endpoint, $parameters);
24
    }
25
26
    /**
27
     * Get full list of payments in dates range
28
     *
29
     * @link    https://api.u-on.ru/{key}/payment/list/{date_from}/{date_to}.{_format}
30
     * @param   string $date_from
31
     * @param   string $date_to
32
     * @return  array|false
33
     */
34
    public function all($date_from, $date_to)
35
    {
36
        $endpoint = '/payment/list/' . $date_from . '/' . $date_to;
37
        return $this->doRequest('get', $endpoint);
38
    }
39
40
    /**
41
     * Get a single payment
42
     *
43
     * @link    https://api.u-on.ru/{key}/payment/{id}.{_format}
44
     * @param   int $id - Unique payment ID
45
     * @return  array|false
46
     */
47
    public function get($id)
48
    {
49
        $endpoint = '/payment/' . $id;
50
        return $this->doRequest('get', $endpoint);
51
    }
52
53
    /**
54
     * Update selected payment by id
55
     *
56
     * @link    https://api.u-on.ru/{key}/payment/update/{id}.{_format}
57
     * @param   int $id - Unique payment ID
58
     * @param   array $parameters - List of parameters
59
     * @return  array|false
60
     */
61
    public function update($id, array $parameters)
62
    {
63
        $endpoint = '/payment/update/' . $id;
64
        return $this->doRequest('post', $endpoint, $parameters);
65
    }
66
67
    /**
68
     * Delete selected payment from database
69
     *
70
     * @link    https://api.u-on.ru/{key}/payment/delete/{id}.{_format}
71
     * @param   int $id - Unique payment ID
72
     * @return  array|false
73
     */
74
    public function delete($id)
75
    {
76
        $endpoint = '/payment/delete/' . $id;
77
        return $this->doRequest('post', $endpoint);
78
    }
79
80
}
81