|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Yabacon\Paystack\Routes; |
|
4
|
|
|
|
|
5
|
|
|
use Yabacon\Paystack\Contracts\RouteInterface; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Plan |
|
9
|
|
|
* Insert description here |
|
10
|
|
|
* |
|
11
|
|
|
* @category |
|
12
|
|
|
* @package |
|
13
|
|
|
* @author |
|
14
|
|
|
* @copyright |
|
15
|
|
|
* @license |
|
16
|
|
|
* @version |
|
17
|
|
|
* @link |
|
18
|
|
|
* @see |
|
19
|
|
|
* @since |
|
20
|
|
|
*/ |
|
21
|
|
|
class Plan implements RouteInterface |
|
22
|
|
|
{ |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
Root |
|
26
|
|
|
*/ |
|
27
|
3 |
|
public static function root() |
|
28
|
|
|
{ |
|
29
|
3 |
|
return '/plan'; |
|
30
|
|
|
} |
|
31
|
|
|
/* |
|
32
|
|
|
Create plan |
|
33
|
|
|
*/ |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* create |
|
37
|
|
|
* Insert description here |
|
38
|
|
|
* |
|
39
|
|
|
* @return |
|
40
|
|
|
* |
|
41
|
|
|
* @access |
|
42
|
|
|
* @static |
|
43
|
|
|
* @see |
|
44
|
|
|
* @since |
|
45
|
|
|
*/ |
|
46
|
2 |
|
public static function create() |
|
47
|
|
|
{ |
|
48
|
2 |
|
return [RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
|
49
|
2 |
|
RouteInterface::ENDPOINT_KEY => Plan::root(), |
|
50
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
|
51
|
2 |
|
'name', |
|
52
|
2 |
|
'description', |
|
53
|
2 |
|
'amount', |
|
54
|
2 |
|
'interval', |
|
55
|
2 |
|
'send_invoices', |
|
56
|
2 |
|
'send_sms', |
|
57
|
2 |
|
'hosted_page', |
|
58
|
2 |
|
'hosted_page_url', |
|
59
|
2 |
|
'hosted_page_summary', |
|
60
|
2 |
|
'currency' ] |
|
61
|
2 |
|
]; |
|
62
|
|
|
} |
|
63
|
|
|
/* |
|
64
|
|
|
Get plan |
|
65
|
|
|
*/ |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* fetch |
|
69
|
|
|
* Insert description here |
|
70
|
|
|
* |
|
71
|
|
|
* @return |
|
72
|
|
|
* |
|
73
|
|
|
* @access |
|
74
|
|
|
* @static |
|
75
|
|
|
* @see |
|
76
|
|
|
* @since |
|
77
|
|
|
*/ |
|
78
|
2 |
|
public static function fetch() |
|
79
|
|
|
{ |
|
80
|
2 |
|
return [RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
|
81
|
2 |
|
RouteInterface::ENDPOINT_KEY => Plan::root() . '/{id}', |
|
82
|
2 |
|
RouteInterface::ARGS_KEY => ['id' ] ]; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/* |
|
86
|
|
|
List plan |
|
87
|
|
|
*/ |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* getList |
|
91
|
|
|
* Insert description here |
|
92
|
|
|
* |
|
93
|
|
|
* @return |
|
94
|
|
|
* |
|
95
|
|
|
* @access |
|
96
|
|
|
* @static |
|
97
|
|
|
* @see |
|
98
|
|
|
* @since |
|
99
|
|
|
*/ |
|
100
|
2 |
|
public static function getList() |
|
101
|
|
|
{ |
|
102
|
2 |
|
return [RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
|
103
|
2 |
|
RouteInterface::ENDPOINT_KEY => Plan::root() ]; |
|
104
|
|
|
} |
|
105
|
|
|
/* |
|
106
|
|
|
Update plan |
|
107
|
|
|
*/ |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* update |
|
111
|
|
|
* Insert description here |
|
112
|
|
|
* |
|
113
|
|
|
* @return |
|
114
|
|
|
* |
|
115
|
|
|
* @access |
|
116
|
|
|
* @static |
|
117
|
|
|
* @see |
|
118
|
|
|
* @since |
|
119
|
|
|
*/ |
|
120
|
2 |
|
public static function update() |
|
121
|
|
|
{ |
|
122
|
2 |
|
return [RouteInterface::METHOD_KEY => RouteInterface::PUT_METHOD, |
|
123
|
2 |
|
RouteInterface::ENDPOINT_KEY => Plan::root() . '/{id}', |
|
124
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
|
125
|
2 |
|
'name', |
|
126
|
2 |
|
'description', |
|
127
|
2 |
|
'amount', |
|
128
|
2 |
|
'interval', |
|
129
|
2 |
|
'send_invoices', |
|
130
|
2 |
|
'send_sms', |
|
131
|
2 |
|
'hosted_page', |
|
132
|
2 |
|
'hosted_page_url', |
|
133
|
2 |
|
'hosted_page_summary', |
|
134
|
2 |
|
'currency' ], |
|
135
|
2 |
|
RouteInterface::ARGS_KEY => ['id' ] ]; |
|
136
|
|
|
} |
|
137
|
|
|
} |
|
138
|
|
|
|