1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Yabacon\Paystack\Routes; |
4
|
|
|
|
5
|
|
|
use Yabacon\Paystack\Contracts\RouteInterface; |
6
|
|
|
|
7
|
|
|
class Transfer implements RouteInterface |
8
|
|
|
{ |
9
|
|
|
|
10
|
3 |
|
public static function root() |
11
|
|
|
{ |
12
|
3 |
|
return '/transfer'; |
13
|
|
|
} |
14
|
|
|
|
15
|
2 |
|
public static function initiate() |
16
|
|
|
{ |
17
|
|
|
return [ |
18
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
19
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transfer::root(), |
20
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
21
|
2 |
|
'source', |
22
|
2 |
|
'amount', |
23
|
2 |
|
'currency', |
24
|
2 |
|
'reason', |
25
|
2 |
|
'recipient', |
26
|
2 |
|
], |
27
|
2 |
|
]; |
28
|
|
|
} |
29
|
|
|
|
30
|
2 |
View Code Duplication |
public static function finalizeTransfer() |
|
|
|
|
31
|
|
|
{ |
32
|
|
|
return [ |
33
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
34
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transfer::root() . '/finalize_transfer', |
35
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
36
|
2 |
|
'reference', |
37
|
2 |
|
'transfer_code', |
38
|
2 |
|
'otp', |
39
|
2 |
|
], |
40
|
2 |
|
]; |
41
|
|
|
} |
42
|
|
|
|
43
|
2 |
View Code Duplication |
public static function resendOtp() |
|
|
|
|
44
|
|
|
{ |
45
|
|
|
return [ |
46
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
47
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transfer::root() . '/resend_otp', |
48
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
49
|
2 |
|
'transfer_code', |
50
|
2 |
|
'reason', |
51
|
2 |
|
], |
52
|
2 |
|
]; |
53
|
|
|
} |
54
|
|
|
|
55
|
2 |
|
public static function disableOtp() |
56
|
|
|
{ |
57
|
|
|
return [ |
58
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
59
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transfer::root() . '/disable_otp', |
60
|
2 |
|
]; |
61
|
|
|
} |
62
|
|
|
|
63
|
2 |
|
public static function enableOtp() |
64
|
|
|
{ |
65
|
|
|
return [ |
66
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
67
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transfer::root() . '/enable_otp', |
68
|
2 |
|
]; |
69
|
|
|
} |
70
|
|
|
|
71
|
2 |
View Code Duplication |
public static function disableOtpFinalize() |
|
|
|
|
72
|
|
|
{ |
73
|
|
|
return [ |
74
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
75
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transfer::root() . '/disable_otp_finalize', |
76
|
2 |
|
RouteInterface::PARAMS_KEY => ['otp'], |
77
|
2 |
|
]; |
78
|
|
|
} |
79
|
|
|
|
80
|
2 |
View Code Duplication |
public static function fetch() |
|
|
|
|
81
|
|
|
{ |
82
|
|
|
return [ |
83
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
84
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transfer::root() . '/{id}', |
85
|
2 |
|
RouteInterface::ARGS_KEY => ['id'], |
86
|
2 |
|
]; |
87
|
|
|
} |
88
|
|
|
|
89
|
2 |
|
public static function getList() |
90
|
|
|
{ |
91
|
|
|
return [ |
92
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
93
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transfer::root(), |
94
|
2 |
|
]; |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.