1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Yabacon\Paystack\Routes; |
4
|
|
|
|
5
|
|
|
use Yabacon\Paystack\Contracts\RouteInterface; |
6
|
|
|
|
7
|
|
|
class Transaction implements RouteInterface |
8
|
|
|
{ |
9
|
|
|
|
10
|
4 |
|
public static function root() |
11
|
|
|
{ |
12
|
4 |
|
return '/transaction'; |
13
|
|
|
} |
14
|
|
|
|
15
|
2 |
|
public static function initialize() |
16
|
|
|
{ |
17
|
|
|
return [ |
18
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
19
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transaction::root() . '/initialize', |
20
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
21
|
2 |
|
'reference', |
22
|
2 |
|
'callback_url', |
23
|
2 |
|
'amount', |
24
|
2 |
|
'email', |
25
|
2 |
|
'plan', |
26
|
2 |
|
], |
27
|
2 |
|
]; |
28
|
|
|
} |
29
|
|
|
|
30
|
2 |
|
public static function charge() |
31
|
|
|
{ |
32
|
|
|
return [ |
33
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
34
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transaction::root() . '/charge_authorization', |
35
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
36
|
2 |
|
'reference', |
37
|
2 |
|
'authorization_code', |
38
|
2 |
|
'email', |
39
|
2 |
|
'amount', |
40
|
2 |
|
], |
41
|
2 |
|
]; |
42
|
|
|
} |
43
|
|
|
|
44
|
2 |
|
public static function checkAuthorization() |
45
|
|
|
{ |
46
|
|
|
return [ |
47
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
48
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transaction::root() . '/check_authorization', |
49
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
50
|
2 |
|
'authorization_code', |
51
|
2 |
|
'email', |
52
|
2 |
|
'amount', |
53
|
2 |
|
], |
54
|
2 |
|
]; |
55
|
|
|
} |
56
|
|
|
|
57
|
2 |
|
public static function chargeAuthorization() |
58
|
|
|
{ |
59
|
2 |
|
return Transaction::charge(); |
60
|
|
|
} |
61
|
|
|
|
62
|
2 |
|
public static function chargeToken() |
63
|
|
|
{ |
64
|
2 |
|
trigger_error('This endpoint is deprecated!', E_USER_NOTICE); |
65
|
|
|
return [ |
66
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::POST_METHOD, |
67
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transaction::root() . '/charge_token', |
68
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
69
|
2 |
|
'reference', |
70
|
2 |
|
'token', |
71
|
2 |
|
'email', |
72
|
2 |
|
'amount', |
73
|
2 |
|
], |
74
|
2 |
|
]; |
75
|
|
|
} |
76
|
|
|
|
77
|
2 |
|
public static function fetch() |
78
|
|
|
{ |
79
|
|
|
return [ |
80
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
81
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transaction::root() . '/{id}', |
82
|
2 |
|
RouteInterface::ARGS_KEY => ['id'], |
83
|
2 |
|
]; |
84
|
|
|
} |
85
|
|
|
|
86
|
2 |
|
public static function getList() |
87
|
|
|
{ |
88
|
|
|
return [ |
89
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
90
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transaction::root(), |
91
|
2 |
|
]; |
92
|
|
|
} |
93
|
|
|
|
94
|
2 |
|
public static function export() |
95
|
|
|
{ |
96
|
|
|
return [ |
97
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
98
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transaction::root() . '/export', |
99
|
2 |
|
RouteInterface::PARAMS_KEY => [ |
100
|
2 |
|
'from', |
101
|
2 |
|
'to', |
102
|
2 |
|
'settled', |
103
|
2 |
|
'payment_page', |
104
|
2 |
|
], |
105
|
2 |
|
]; |
106
|
|
|
} |
107
|
|
|
|
108
|
2 |
|
public static function totals() |
109
|
|
|
{ |
110
|
|
|
return [ |
111
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
112
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transaction::root() . '/totals', |
113
|
2 |
|
]; |
114
|
|
|
} |
115
|
|
|
|
116
|
3 |
|
public static function verify() |
117
|
|
|
{ |
118
|
|
|
return [ |
119
|
3 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
120
|
3 |
|
RouteInterface::ENDPOINT_KEY => Transaction::root() . '/verify/{reference}', |
121
|
3 |
|
RouteInterface::ARGS_KEY => ['reference'], |
122
|
3 |
|
]; |
123
|
|
|
} |
124
|
|
|
|
125
|
2 |
|
public static function verifyAccessCode() |
126
|
|
|
{ |
127
|
|
|
return [ |
128
|
2 |
|
RouteInterface::METHOD_KEY => RouteInterface::GET_METHOD, |
129
|
2 |
|
RouteInterface::ENDPOINT_KEY => Transaction::root() . '/verify_access_code/{access_code}', |
130
|
2 |
|
RouteInterface::ARGS_KEY => ['access_code'], |
131
|
2 |
|
]; |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
|