1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Digikraaft\Paystack; |
4
|
|
|
|
5
|
|
|
class Transfer extends ApiResource |
6
|
|
|
{ |
7
|
|
|
const OBJECT_NAME = 'transfer'; |
8
|
|
|
|
9
|
|
|
use ApiOperations\All; |
10
|
|
|
use ApiOperations\Fetch; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @param array $params |
14
|
|
|
* |
15
|
|
|
* @link https://paystack.com/docs/api/#transfer-initiate |
16
|
|
|
* |
17
|
|
|
* @return array|object |
18
|
|
|
*/ |
19
|
|
|
public static function initiate($params) |
20
|
|
|
{ |
21
|
|
|
self::validateParams($params, true); |
22
|
|
|
$url = static::classUrl(); |
23
|
|
|
|
24
|
|
|
return static::staticRequest('POST', $url, $params); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param string $reference Transfer reference. Details at |
29
|
|
|
* |
30
|
|
|
* @link https://paystack.com/docs/api/#transfer-verify |
31
|
|
|
* |
32
|
|
|
* @return array|object |
33
|
|
|
*/ |
34
|
|
|
public static function verify($reference) |
35
|
|
|
{ |
36
|
|
|
$url = "verify/{$reference}"; |
37
|
|
|
$url = static::endPointUrl($url); |
38
|
|
|
|
39
|
|
|
return static::staticRequest('GET', $url); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param array $params |
44
|
|
|
* |
45
|
|
|
* @link https://paystack.com/docs/api/#transfer-finalize |
46
|
|
|
* |
47
|
|
|
* @return array|object |
48
|
|
|
*/ |
49
|
|
|
public static function finalize($params) |
50
|
|
|
{ |
51
|
|
|
self::validateParams($params, true); |
52
|
|
|
$url = static::endPointUrl('finalize_transfer'); |
53
|
|
|
|
54
|
|
|
return static::staticRequest('POST', $url, $params); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @param array $params |
59
|
|
|
* |
60
|
|
|
* @link https://paystack.com/docs/api/#transfer-bulk |
61
|
|
|
* |
62
|
|
|
* @return array|object |
63
|
|
|
*/ |
64
|
|
|
public static function initiateBulkTransfer($params) |
65
|
|
|
{ |
66
|
|
|
self::validateParams($params, true); |
67
|
|
|
$url = static::endPointUrl('bulk'); |
68
|
|
|
|
69
|
|
|
return static::staticRequest('POST', $url, $params); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param array $params details at |
74
|
|
|
* |
75
|
|
|
* @link https://developers.paystack.co/reference#resend-otp-for-transfer |
76
|
|
|
* |
77
|
|
|
* @return array|object |
78
|
|
|
*/ |
79
|
|
|
public static function resendOtp($params) |
80
|
|
|
{ |
81
|
|
|
self::validateParams($params, true); |
82
|
|
|
$url = static::classUrl().'/resend_otp'; |
83
|
|
|
|
84
|
|
|
return static::staticRequest('POST', $url, $params); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @param null|array $params details at |
89
|
|
|
* |
90
|
|
|
* @link https://developers.paystack.co/reference#disable-otp-requirement-for-transfers |
91
|
|
|
* |
92
|
|
|
* @return array|object |
93
|
|
|
*/ |
94
|
|
|
public static function disableOtp($params = null) |
95
|
|
|
{ |
96
|
|
|
self::validateParams($params); |
97
|
|
|
$url = static::endPointUrl('resend_otp'); |
98
|
|
|
|
99
|
|
|
return static::staticRequest('POST', $url, $params); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @param array $params details at |
104
|
|
|
* |
105
|
|
|
* @link https://developers.paystack.co/reference#finalize-disabling-of-otp-requirement-for-transfers |
106
|
|
|
* |
107
|
|
|
* @return array|object |
108
|
|
|
*/ |
109
|
|
|
public static function disableOtpFinalize($params) |
110
|
|
|
{ |
111
|
|
|
self::validateParams($params, true); |
112
|
|
|
$url = static::endPointUrl('disable_otp_finalize'); |
113
|
|
|
|
114
|
|
|
return static::staticRequest('POST', $url, $params); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param array $params details at |
119
|
|
|
* |
120
|
|
|
* @link https://developers.paystack.co/reference#enable-otp-requirement-for-transfers |
121
|
|
|
* |
122
|
|
|
* @return array|object |
123
|
|
|
*/ |
124
|
|
|
public static function enableOtp($params = null) |
125
|
|
|
{ |
126
|
|
|
self::validateParams($params); |
127
|
|
|
$url = static::endPointUrl('enable_otp'); |
128
|
|
|
|
129
|
|
|
return static::staticRequest('POST', $url, $params); |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|