TransferRecipient::createBulk()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
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. A duplicate account number will lead to the retrieval of the existing record.
11
     *
12
     * @param  array<string, mixed>  $payload
13
     *
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
20
        return $this;
21
    }
22
23
    /**
24
     * Creates multiple transfer recipients in batches. A duplicate account number will lead to the retrieval of the existing record.
25
     *
26
     * @param  array<string, mixed>  $payload
27
     *
28
     * @link https://paystack.com/docs/api/#transfer-recipient-bulk
29
     */
30
    public function createBulk(array $payload): self
31
    {
32
        $this->post($this->url(self::ENDPOINT).'/bulk', $payload);
33
34
        return $this;
35
    }
36
37
    /**
38
     * List transfer recipients available on your integration.
39
     *
40
     * @param  array<string, mixed>  $query
41
     *
42
     * @link https://paystack.com/docs/api/#transfer-recipient-list
43
     */
44
    public function list(array $query = []): self
45
    {
46
        $this->get($this->url(self::ENDPOINT), $query);
47
48
        return $this;
49
    }
50
51
    /**
52
     * Get details of a transfer recipient on your integration.
53
     *
54
     * @link https://paystack.com/docs/api/#transfer-recipient-fetch
55
     */
56
    public function fetch(string $recipient_code): self
57
    {
58
        $this->get($this->url(self::ENDPOINT).'/'.$recipient_code);
59
60
        return $this;
61
    }
62
63
    /**
64
     * Update a transfer recipient details on your integration.
65
     *
66
     * @param  array<string, mixed>  $payload
67
     *
68
     * @link https://paystack.com/docs/api/#transfer-recipient-update
69
     */
70
    public function update(string $recipient_code, array $payload = []): self
71
    {
72
        $this->put($this->url(self::ENDPOINT).'/'.$recipient_code, $payload);
73
74
        return $this;
75
    }
76
77
    /**
78
     * Delete a transfer recipient (sets the transfer recipient to inactive).
79
     *
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
86
        return $this;
87
    }
88
}
89