1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Iamolayemi\Paystack\Endpoints; |
4
|
|
|
|
5
|
|
|
class Transfer extends Endpoint |
6
|
|
|
{ |
7
|
|
|
protected const ENDPOINT = '/transfer'; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Initiate a transfer. |
11
|
|
|
* |
12
|
|
|
* @param array<string, mixed> $payload |
13
|
|
|
* |
14
|
|
|
* @link https://paystack.com/docs/api/#transfer-initiate |
15
|
|
|
*/ |
16
|
|
|
public function initiate(array $payload): self |
17
|
|
|
{ |
18
|
|
|
$this->post($this->url(self::ENDPOINT), $payload); |
19
|
|
|
|
20
|
|
|
return $this; |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Finalize an initiated transfer. |
25
|
|
|
* |
26
|
|
|
* @param array<string, mixed> $payload |
27
|
|
|
* |
28
|
|
|
* @link https://paystack.com/docs/api/#transfer-finalize |
29
|
|
|
*/ |
30
|
|
|
public function finalize(array $payload): self |
31
|
|
|
{ |
32
|
|
|
$this->post($this->url(self::ENDPOINT).'/finalize_transfer', $payload); |
33
|
|
|
|
34
|
|
|
return $this; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Initiate a bulk transfer. |
39
|
|
|
* |
40
|
|
|
* @param array<string, mixed> $payload |
41
|
|
|
* |
42
|
|
|
* @link https://paystack.com/docs/api/#transfer-bulk |
43
|
|
|
*/ |
44
|
|
|
public function bulk(array $payload): self |
45
|
|
|
{ |
46
|
|
|
$this->post($this->url(self::ENDPOINT).'/bulk', $payload); |
47
|
|
|
|
48
|
|
|
return $this; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* List transfers made on your integration. |
53
|
|
|
* |
54
|
|
|
* @param array<string, mixed> $query |
55
|
|
|
* |
56
|
|
|
* @link https://paystack.com/docs/api/#transfer-list |
57
|
|
|
*/ |
58
|
|
|
public function list(array $query = []): self |
59
|
|
|
{ |
60
|
|
|
$this->get($this->url(self::ENDPOINT), $query); |
61
|
|
|
|
62
|
|
|
return $this; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Get details of a transfer on your integration. |
67
|
|
|
* |
68
|
|
|
* @link https://paystack.com/docs/api/#transfer-fetch |
69
|
|
|
*/ |
70
|
|
|
public function fetch(string $transfer_code): self |
71
|
|
|
{ |
72
|
|
|
$this->get($this->url(self::ENDPOINT).'/'.$transfer_code); |
73
|
|
|
|
74
|
|
|
return $this; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Verify a transfer on your integration. |
79
|
|
|
* |
80
|
|
|
* @link https://paystack.com/docs/api/#transfer-verify |
81
|
|
|
*/ |
82
|
|
|
public function verify(string $transfer_code): self |
83
|
|
|
{ |
84
|
|
|
$this->get($this->url(self::ENDPOINT).'/verify/'.$transfer_code); |
85
|
|
|
|
86
|
|
|
return $this; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Resend OTP for a transfer. |
91
|
|
|
* |
92
|
|
|
* @param array<string, mixed> $payload |
93
|
|
|
* |
94
|
|
|
* @link https://paystack.com/docs/api/#transfer-resend-otp |
95
|
|
|
*/ |
96
|
|
|
public function resendOtp(array $payload): self |
97
|
|
|
{ |
98
|
|
|
$this->post($this->url(self::ENDPOINT).'/resend_otp', $payload); |
99
|
|
|
|
100
|
|
|
return $this; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Disable OTP requirement for transfers. |
105
|
|
|
* |
106
|
|
|
* @param array<string, mixed> $payload |
107
|
|
|
* |
108
|
|
|
* @link https://paystack.com/docs/api/#transfer-disable-otp |
109
|
|
|
*/ |
110
|
|
|
public function disableOtp(array $payload): self |
111
|
|
|
{ |
112
|
|
|
$this->post($this->url(self::ENDPOINT).'/disable_otp', $payload); |
113
|
|
|
|
114
|
|
|
return $this; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Finalize the request to disable OTP on your transfers. |
119
|
|
|
* |
120
|
|
|
* @param array<string, mixed> $payload |
121
|
|
|
* |
122
|
|
|
* @link https://paystack.com/docs/api/#transfer-disable-otp-finalize |
123
|
|
|
*/ |
124
|
|
|
public function disableOtpFinalize(array $payload): self |
125
|
|
|
{ |
126
|
|
|
$this->post($this->url(self::ENDPOINT).'/disable_otp_finalize', $payload); |
127
|
|
|
|
128
|
|
|
return $this; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Enable OTP. |
133
|
|
|
* |
134
|
|
|
* @link https://paystack.com/docs/api/#transfer-control-enable-otp |
135
|
|
|
*/ |
136
|
|
|
public function enableOtp(): self |
137
|
|
|
{ |
138
|
|
|
$this->post($this->url(self::ENDPOINT).'/enable_otp'); |
139
|
|
|
|
140
|
|
|
return $this; |
141
|
|
|
} |
142
|
|
|
} |
143
|
|
|
|