@@ -16,9 +16,12 @@ public function index()
16
16
17
17
$ this ->session ->data ['success ' ] = $ this ->language ->get ('text_success ' );
18
18
19
- $ this ->response ->redirect ($ this ->url ->link ('marketplace/extension ' , 'user_token= ' . $ this ->session ->data ['user_token ' ]. '&type=payment ' , true ));
19
+ $ this ->response ->redirect ($ this ->url ->link ('marketplace/extension ' , 'user_token= ' . $ this ->session ->data ['user_token ' ] . '&type=payment ' , true ));
20
20
}
21
21
22
+ // Set webhook url
23
+ $ data ['webhook_url ' ] = HTTPS_CATALOG . 'index.php?route=extension/payment/paystack/callback ' ;
24
+
22
25
if (isset ($ this ->error ['warning ' ])) {
23
26
$ data ['error_warning ' ] = $ this ->error ['warning ' ];
24
27
} else {
@@ -32,18 +35,18 @@ public function index()
32
35
}
33
36
34
37
$ data ['breadcrumbs ' ][] = array (
35
- 'text ' => $ this ->language ->get ('text_home ' ),
36
- 'href ' => $ this ->url ->link ('common/dashboard ' , 'user_token= ' . $ this ->session ->data ['user_token ' ], true )
38
+ 'text ' => $ this ->language ->get ('text_home ' ),
39
+ 'href ' => $ this ->url ->link ('common/dashboard ' , 'user_token= ' . $ this ->session ->data ['user_token ' ], true )
37
40
);
38
41
39
42
$ data ['breadcrumbs ' ][] = array (
40
- 'text ' => $ this ->language ->get ('text_payment ' ),
41
- 'href ' => $ this ->url ->link ('marketplace/extension ' , 'user_token= ' . $ this ->session ->data ['user_token ' ]. '&type=payment ' , true )
43
+ 'text ' => $ this ->language ->get ('text_payment ' ),
44
+ 'href ' => $ this ->url ->link ('marketplace/extension ' , 'user_token= ' . $ this ->session ->data ['user_token ' ] . '&type=payment ' , true )
42
45
);
43
46
44
47
$ data ['breadcrumbs ' ][] = array (
45
- 'text ' => $ this ->language ->get ('heading_title ' ),
46
- 'href ' => $ this ->url ->link ('extension/payment/paystack ' , 'user_token= ' . $ this ->session ->data ['user_token ' ], true )
48
+ 'text ' => $ this ->language ->get ('heading_title ' ),
49
+ 'href ' => $ this ->url ->link ('extension/payment/paystack ' , 'user_token= ' . $ this ->session ->data ['user_token ' ], true )
47
50
);
48
51
49
52
$ data ['action ' ] = $ this ->url ->link ('extension/payment/paystack ' , 'user_token= ' . $ this ->session ->data ['user_token ' ], true );
@@ -55,25 +58,25 @@ public function index()
55
58
} else {
56
59
$ data ['payment_paystack_live_secret ' ] = $ this ->config ->get ('payment_paystack_live_secret ' );
57
60
}
58
-
61
+
59
62
if (isset ($ this ->request ->post ['payment_paystack_live_public ' ])) {
60
63
$ data ['payment_paystack_live_public ' ] = $ this ->request ->post ['payment_paystack_live_public ' ];
61
64
} else {
62
65
$ data ['payment_paystack_live_public ' ] = $ this ->config ->get ('payment_paystack_live_public ' );
63
66
}
64
-
67
+
65
68
if (isset ($ this ->request ->post ['payment_paystack_test_secret ' ])) {
66
69
$ data ['payment_paystack_test_secret ' ] = $ this ->request ->post ['payment_paystack_test_secret ' ];
67
70
} else {
68
71
$ data ['payment_paystack_test_secret ' ] = $ this ->config ->get ('payment_paystack_test_secret ' );
69
72
}
70
-
73
+
71
74
if (isset ($ this ->request ->post ['payment_paystack_test_public ' ])) {
72
75
$ data ['payment_paystack_test_public ' ] = $ this ->request ->post ['payment_paystack_test_public ' ];
73
76
} else {
74
77
$ data ['payment_paystack_test_public ' ] = $ this ->config ->get ('payment_paystack_test_public ' );
75
78
}
76
-
79
+
77
80
if (isset ($ this ->request ->post ['payment_paystack_live ' ])) {
78
81
$ data ['payment_paystack_live ' ] = $ this ->request ->post ['payment_paystack_live ' ];
79
82
} else {
@@ -148,10 +151,10 @@ public function index()
148
151
149
152
$ this ->response ->setOutput ($ this ->load ->view ('extension/payment/paystack ' , $ data ));
150
153
}
151
-
154
+
152
155
private function valid_key ($ value , $ mode , $ access )
153
156
{
154
- return (substr_compare ($ value , (substr ($ access , 0 , 1 )). 'k_ ' . $ mode. '_ ' , 0 , 8 , true )===0 );
157
+ return (substr_compare ($ value , (substr ($ access , 0 , 1 )) . 'k_ ' . $ mode . '_ ' , 0 , 8 , true ) === 0 );
155
158
}
156
159
157
160
private function validate ()
@@ -163,7 +166,7 @@ private function validate()
163
166
$ live_public = $ this ->request ->post ['payment_paystack_live_public ' ];
164
167
$ test_secret = $ this ->request ->post ['payment_paystack_test_secret ' ];
165
168
$ test_public = $ this ->request ->post ['payment_paystack_test_public ' ];
166
-
169
+
167
170
if ($ this ->request ->post ['payment_paystack_live ' ] && (!$ this ->valid_key ($ live_secret , 'live ' , 'secret ' ) || !$ this ->valid_key ($ live_public , 'live ' , 'public ' ))) {
168
171
$ this ->error ['keys ' ] = $ this ->language ->get ('error_live_keys ' );
169
172
}
0 commit comments