PaymentDrafts   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 63
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A get() 0 3 1
A all() 0 3 1
A delete() 0 3 1
A create() 0 3 1
1
<?php
2
3
namespace RevolutPHP;
4
5
class PaymentDrafts
6
{
7
    const ENDPOINT = 'payment-drafts';
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://revolut-engineering.github.io/api-docs/#business-api-business-api-payment-drafts-create-a-payment-draft
25
     *
26
     * @param array $json
27
     * @return mixed
28
     * @throws \GuzzleHttp\Exception\GuzzleException
29
     */
30
    public function create(array $json)
31
    {
32
        return $this->client->post(self::ENDPOINT, $json);
33
    }
34
35
    /**
36
     * @see https://revolut-engineering.github.io/api-docs/#business-api-get-payment-drafts
37
     *
38
     * @return mixed
39
     * @throws \GuzzleHttp\Exception\GuzzleException
40
     */
41
    public function all()
42
    {
43
        return $this->client->get(self::ENDPOINT);
44
    }
45
46
    /**
47
     * @see https://revolut-engineering.github.io/api-docs/#business-api-business-api-get-payment-drafts-get-payment-draft-by-id
48
     *
49
     * @param string $id
50
     * @return mixed
51
     * @throws \GuzzleHttp\Exception\GuzzleException
52
     */
53
    public function get(string $id)
54
    {
55
        return $this->client->get(self::ENDPOINT.'/'.$id);
56
    }
57
58
    /**
59
     * @see https://revolut-engineering.github.io/api-docs/#business-api-business-api-get-payment-drafts-delete-payment-draft
60
     *
61
     * @param string $id
62
     * @return mixed
63
     * @throws \GuzzleHttp\Exception\GuzzleException
64
     */
65
    public function delete($id)
66
    {
67
        return $this->client->delete(self::ENDPOINT.'/'.$id);
68
    }
69
}
70