Test Failed
Push — master ( 8a0687...d273b7 )
by Olayemi
14:11
created

TransferRecipient::deactivate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Iamolayemi\Paystack\Endpoints;
4
5
class TransferRecipient extends Endpoint
6
{
7
    protected const ENDPOINT = '/transferrecipient';
8
9
    /**
10
     * Creates a new recipient.
11
     *
12
     * @param array $payload
13
     * @return TransferRecipient
14
     * @link https://paystack.com/docs/api/#transfer-recipient-create
15
     */
16
    public function create(array $payload): self
17
    {
18
        $this->post($this->url(self::ENDPOINT), $payload);
19
        return $this;
20
    }
21
22
    /**
23
     * Creates a new recipient.
24
     *
25
     * @param array $payload
26
     * @return TransferRecipient
27
     * @link https://paystack.com/docs/api/#transfer-recipient-bulk
28
     */
29
    public function createBulk(array $payload): self
30
    {
31
        $this->post($this->url(self::ENDPOINT). '/bulk',  $payload);
32
        return $this;
33
    }
34
35
    /**
36
     * List transfer recipients available on your integration.
37
     *
38
     * @param array $query
39
     * @return TransferRecipient
40
     * @link https://paystack.com/docs/api/#transfer-recipient-list
41
     */
42
    public function list(array $query = []): self
43
    {
44
        $this->get($this->url(self::ENDPOINT), $query);
45
        return $this;
46
    }
47
48
    /**
49
     * Fetch the details of a transfer recipient.
50
     *
51
     * @param string $customer_email
52
     * @return TransferRecipient
53
     * @link https://paystack.com/docs/api/#transfer-recipient-fetch
54
     */
55
    public function fetch(string $customer_email): self
56
    {
57
        $this->get($this->url(self::ENDPOINT) . '/' . $customer_email);
58
        return $this;
59
    }
60
61
    /**
62
     * Update an existing recipient.
63
     *
64
     * @param string $recipient_code
65
     * @param array $payload
66
     * @return TransferRecipient
67
     * @link https://paystack.com/docs/api/#transfer-recipient-update
68
     */
69
    public function update(string $recipient_code, array $payload = []): self
70
    {
71
        $this->put($this->url(self::ENDPOINT) . '/' . $recipient_code, $payload);
72
        return $this;
73
    }
74
75
    /**
76
     * Deletes a transfer recipient (sets the transfer recipient to inactive).
77
     *
78
     * @param string $recipient_code
79
     * @return TransferRecipient
80
     * @link https://paystack.com/docs/api/#transfer-recipient-delete
81
     */
82
    public function deactivate(string $recipient_code): self
83
    {
84
        $this->delete($this->url(self::ENDPOINT) . '/' . $recipient_code);
85
        return $this;
86
    }
87
}
88