@@ -16,9 +16,12 @@ public function index()
1616
1717 $ this ->session ->data ['success ' ] = $ this ->language ->get ('text_success ' );
1818
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 ));
2020 }
2121
22+ // Set webhook url
23+ $ data ['webhook_url ' ] = HTTPS_CATALOG . 'index.php?route=extension/payment/paystack/callback ' ;
24+
2225 if (isset ($ this ->error ['warning ' ])) {
2326 $ data ['error_warning ' ] = $ this ->error ['warning ' ];
2427 } else {
@@ -32,18 +35,18 @@ public function index()
3235 }
3336
3437 $ 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 )
3740 );
3841
3942 $ 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 )
4245 );
4346
4447 $ 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 )
4750 );
4851
4952 $ data ['action ' ] = $ this ->url ->link ('extension/payment/paystack ' , 'user_token= ' . $ this ->session ->data ['user_token ' ], true );
@@ -55,25 +58,25 @@ public function index()
5558 } else {
5659 $ data ['payment_paystack_live_secret ' ] = $ this ->config ->get ('payment_paystack_live_secret ' );
5760 }
58-
61+
5962 if (isset ($ this ->request ->post ['payment_paystack_live_public ' ])) {
6063 $ data ['payment_paystack_live_public ' ] = $ this ->request ->post ['payment_paystack_live_public ' ];
6164 } else {
6265 $ data ['payment_paystack_live_public ' ] = $ this ->config ->get ('payment_paystack_live_public ' );
6366 }
64-
67+
6568 if (isset ($ this ->request ->post ['payment_paystack_test_secret ' ])) {
6669 $ data ['payment_paystack_test_secret ' ] = $ this ->request ->post ['payment_paystack_test_secret ' ];
6770 } else {
6871 $ data ['payment_paystack_test_secret ' ] = $ this ->config ->get ('payment_paystack_test_secret ' );
6972 }
70-
73+
7174 if (isset ($ this ->request ->post ['payment_paystack_test_public ' ])) {
7275 $ data ['payment_paystack_test_public ' ] = $ this ->request ->post ['payment_paystack_test_public ' ];
7376 } else {
7477 $ data ['payment_paystack_test_public ' ] = $ this ->config ->get ('payment_paystack_test_public ' );
7578 }
76-
79+
7780 if (isset ($ this ->request ->post ['payment_paystack_live ' ])) {
7881 $ data ['payment_paystack_live ' ] = $ this ->request ->post ['payment_paystack_live ' ];
7982 } else {
@@ -148,10 +151,10 @@ public function index()
148151
149152 $ this ->response ->setOutput ($ this ->load ->view ('extension/payment/paystack ' , $ data ));
150153 }
151-
154+
152155 private function valid_key ($ value , $ mode , $ access )
153156 {
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 );
155158 }
156159
157160 private function validate ()
@@ -163,7 +166,7 @@ private function validate()
163166 $ live_public = $ this ->request ->post ['payment_paystack_live_public ' ];
164167 $ test_secret = $ this ->request ->post ['payment_paystack_test_secret ' ];
165168 $ test_public = $ this ->request ->post ['payment_paystack_test_public ' ];
166-
169+
167170 if ($ this ->request ->post ['payment_paystack_live ' ] && (!$ this ->valid_key ($ live_secret , 'live ' , 'secret ' ) || !$ this ->valid_key ($ live_public , 'live ' , 'public ' ))) {
168171 $ this ->error ['keys ' ] = $ this ->language ->get ('error_live_keys ' );
169172 }
0 commit comments