1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Yabacon\Paystack\Routes; |
4
|
|
|
|
5
|
|
|
use Yabacon\Paystack\Contracts\RouteInterface; |
6
|
|
|
|
7
|
|
|
class Customer implements RouteInterface |
8
|
|
|
{ |
9
|
|
|
|
10
|
4 |
|
public static function root() |
11
|
|
|
{ |
12
|
4 |
|
return '/customer'; |
13
|
|
|
} |
14
|
|
|
|
15
|
3 |
|
public static function create() |
16
|
|
|
{ |
17
|
|
|
return [ |
18
|
3 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
19
|
3 |
|
RouteInterface::ENDPOINT_KEY => Customer::root(), |
20
|
3 |
|
RouteInterface::PARAMS_KEY => [ |
21
|
3 |
|
'first_name', |
22
|
3 |
|
'last_name', |
23
|
3 |
|
'email', |
24
|
3 |
|
'metadata', |
25
|
3 |
|
'phone', |
26
|
3 |
|
], |
27
|
3 |
|
RouteInterface::REQUIRED_KEY => [ |
28
|
3 |
|
RouteInterface::PARAMS_KEY => [ |
29
|
3 |
|
'first_name', |
30
|
3 |
|
'last_name', |
31
|
3 |
|
'email', |
32
|
3 |
|
], |
33
|
3 |
|
], |
34
|
3 |
|
]; |
35
|
|
|
} |
36
|
|
|
|
37
|
2 |
|
public static function fetch() |
38
|
|
|
{ |
39
|
|
|
return [ |
40
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
41
|
2 |
|
RouteInterface::ENDPOINT_KEY => Customer::root() . '/{id}', |
42
|
2 |
|
RouteInterface::ARGS_KEY => ['id'], |
43
|
2 |
|
RouteInterface::REQUIRED_KEY => [RouteInterface::ARGS_KEY => ['id']], |
44
|
2 |
|
]; |
45
|
|
|
} |
46
|
|
|
|
47
|
3 |
|
public static function getList() |
48
|
|
|
{ |
49
|
|
|
return [ |
50
|
3 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
51
|
3 |
|
RouteInterface::ENDPOINT_KEY => Customer::root(), |
52
|
3 |
|
RouteInterface::PARAMS_KEY => [ |
53
|
3 |
|
'perPage', |
54
|
3 |
|
'page', |
55
|
3 |
|
], |
56
|
3 |
|
]; |
57
|
|
|
} |
58
|
|
|
|
59
|
2 |
|
public static function update() |
60
|
|
|
{ |
61
|
|
|
return [ |
62
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::PUT_METHOD, |
63
|
2 |
|
RouteInterface::ENDPOINT_KEY => Customer::root() . '/{id}', |
64
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
65
|
2 |
|
'first_name', |
66
|
2 |
|
'last_name', |
67
|
2 |
|
'email', |
68
|
2 |
|
'metadata', |
69
|
2 |
|
'phone', |
70
|
2 |
|
], |
71
|
2 |
|
RouteInterface::ARGS_KEY => ['id'], |
72
|
2 |
|
]; |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|