|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Yabacon\Paystack\Routes; |
|
4
|
|
|
|
|
5
|
|
|
use Yabacon\Paystack\Contracts\RouteInterface; |
|
6
|
|
|
|
|
7
|
|
|
class Invoice implements RouteInterface |
|
8
|
|
|
{ |
|
9
|
3 |
|
public static function root() |
|
10
|
|
|
{ |
|
11
|
3 |
|
return '/paymentrequest'; |
|
12
|
|
|
} |
|
13
|
|
|
|
|
14
|
2 |
|
public static function create() |
|
15
|
|
|
{ |
|
16
|
|
|
return [ |
|
17
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
|
18
|
2 |
|
RouteInterface::ENDPOINT_KEY => Invoice::root(), |
|
19
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
|
20
|
2 |
|
'line_items', |
|
21
|
2 |
|
'description', |
|
22
|
2 |
|
'amount', |
|
23
|
2 |
|
'customer', |
|
24
|
2 |
|
'send_notification', |
|
25
|
2 |
|
'tax', |
|
26
|
2 |
|
'due_date', |
|
27
|
2 |
|
'metadata', |
|
28
|
2 |
|
'draft', |
|
29
|
2 |
|
'currency', |
|
30
|
2 |
|
'has_invoice', |
|
31
|
2 |
|
'invoice_number', |
|
32
|
2 |
|
], |
|
33
|
2 |
|
RouteInterface::REQUIRED_KEY => [ |
|
34
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
|
35
|
2 |
|
'customer', |
|
36
|
2 |
|
'amount', |
|
37
|
2 |
|
'due_date', |
|
38
|
2 |
|
], |
|
39
|
2 |
|
], |
|
40
|
2 |
|
]; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
2 |
|
public static function fetch() |
|
44
|
|
|
{ |
|
45
|
|
|
return [ |
|
46
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
|
47
|
2 |
|
RouteInterface::ENDPOINT_KEY => Invoice::root() . '/{invoice_id_or_code}', |
|
48
|
2 |
|
RouteInterface::ARGS_KEY => ['invoice_id_or_code'], |
|
49
|
2 |
|
RouteInterface::REQUIRED_KEY => [RouteInterface::ARGS_KEY => ['invoice_id_or_code']], |
|
50
|
2 |
|
]; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
2 |
|
public static function getList() |
|
54
|
|
|
{ |
|
55
|
|
|
return [ |
|
56
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
|
57
|
2 |
|
RouteInterface::ENDPOINT_KEY => Invoice::root(), |
|
58
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
|
59
|
2 |
|
'currency', |
|
60
|
2 |
|
'customer', 'status', 'paid', 'include_archive', |
|
61
|
2 |
|
], |
|
62
|
2 |
|
]; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
2 |
|
public static function verify() |
|
66
|
|
|
{ |
|
67
|
|
|
return [ |
|
68
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
|
69
|
2 |
|
RouteInterface::ENDPOINT_KEY => Invoice::root() . '/verify/{invoice_id_or_code}', |
|
70
|
2 |
|
RouteInterface::ARGS_KEY => ['invoice_id_or_code'], |
|
71
|
2 |
|
RouteInterface::REQUIRED_KEY => [RouteInterface::ARGS_KEY => ['invoice_id_or_code']], |
|
72
|
2 |
|
]; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
2 |
|
public static function notify() |
|
76
|
|
|
{ |
|
77
|
|
|
return [ |
|
78
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
|
79
|
2 |
|
RouteInterface::ENDPOINT_KEY => Invoice::root() . '/notify/{invoice_id_or_code}', |
|
80
|
2 |
|
]; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
2 |
|
public static function metrics() |
|
84
|
|
|
{ |
|
85
|
|
|
return [ |
|
86
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
|
87
|
2 |
|
RouteInterface::ENDPOINT_KEY => Invoice::root() . '/totals', |
|
88
|
2 |
|
]; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
2 |
|
public static function finalize() |
|
92
|
|
|
{ |
|
93
|
|
|
return [ |
|
94
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
|
95
|
2 |
|
RouteInterface::ENDPOINT_KEY => Invoice::root() . '/finalize/{invoice_id_or_code}', |
|
96
|
2 |
|
RouteInterface::ARGS_KEY => ['invoice_id_or_code'], |
|
97
|
2 |
|
RouteInterface::REQUIRED_KEY => [RouteInterface::ARGS_KEY => ['invoice_id_or_code']], |
|
98
|
2 |
|
]; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
2 |
|
public static function update() |
|
102
|
|
|
{ |
|
103
|
|
|
return [ |
|
104
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::PUT_METHOD, |
|
105
|
2 |
|
RouteInterface::ENDPOINT_KEY => Invoice::root() . '/update/{invoice_id_or_code}', |
|
106
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
|
107
|
2 |
|
'line_items', |
|
108
|
2 |
|
'description', |
|
109
|
2 |
|
'amount', |
|
110
|
2 |
|
'customer', |
|
111
|
2 |
|
'send_notification', |
|
112
|
2 |
|
'tax', |
|
113
|
2 |
|
'due_date', |
|
114
|
2 |
|
'metadata', |
|
115
|
2 |
|
'currency', |
|
116
|
2 |
|
], |
|
117
|
2 |
|
]; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
2 |
|
public static function archive() |
|
121
|
|
|
{ |
|
122
|
|
|
return [ |
|
123
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
|
124
|
2 |
|
RouteInterface::ENDPOINT_KEY => Invoice::root() . '/archive/{invoice_id_or_code}', |
|
125
|
2 |
|
]; |
|
126
|
|
|
} |
|
127
|
|
|
} |
|
128
|
|
|
|