@@ -39,12 +39,12 @@ class Paystack extends PaymentModule
3939 public $ owner ;
4040 public $ address ;
4141 public $ extra_mail_vars ;
42-
42+
4343 public function __construct ()
4444 {
4545 $ this ->name = 'paystack ' ;
4646 $ this ->tab = 'payments_gateways ' ;
47- $ this ->version = '1.0.2 ' ;
47+ $ this ->version = '1.0.3 ' ;
4848 $ this ->ps_versions_compliancy = array ('min ' => '1.7 ' , 'max ' => _PS_VERSION_ );
4949 $ this ->author = 'Paystack ' ;
5050 $ this ->controllers = array ('payment ' , 'validation ' );
@@ -54,8 +54,8 @@ public function __construct()
5454 $ this ->currencies = true ;
5555 $ this ->currencies_mode = 'checkbox ' ;
5656
57- $ config = Configuration::getMultiple (array ('PAYSTACK_TEST_SECRETKEY ' ,'PAYSTACK_TEST_PUBLICKEY ' ,'PAYSTACK_LIVE_SECRETKEY ' ,'PAYSTACK_LIVE_PUBLICKEY ' ,'PAYSTACK_MODE ' ));
58-
57+ $ config = Configuration::getMultiple (array ('PAYSTACK_TEST_SECRETKEY ' , 'PAYSTACK_TEST_PUBLICKEY ' , 'PAYSTACK_LIVE_SECRETKEY ' , 'PAYSTACK_LIVE_PUBLICKEY ' , 'PAYSTACK_MODE ' ));
58+
5959 $ this ->bootstrap = true ;
6060 parent ::__construct ();
6161
@@ -85,7 +85,7 @@ public function install()
8585
8686 // TODO : Cek insert new state, Custom CSS
8787 $ newState = new OrderState ();
88-
88+
8989 $ newState ->send_email = true ;
9090 $ newState ->module_name = $ this ->name ;
9191 $ newState ->invoice = true ;
@@ -110,7 +110,7 @@ public function install()
110110
111111 if ($ newState ->add ()) {
112112 Configuration::updateValue ('PS_OS_PAYSTACK ' , $ newState ->id );
113- copy (dirname (__FILE__ ). '/logo.png ' , _PS_IMG_DIR_ . 'tmp/order_state_mini_ ' . (int )$ newState ->id . '_1.png ' );
113+ copy (dirname (__FILE__ ) . '/logo.png ' , _PS_IMG_DIR_ . 'tmp/order_state_mini_ ' . (int )$ newState ->id . '_1.png ' );
114114 } else {
115115 return false ;
116116 }
@@ -121,7 +121,8 @@ public function install()
121121 public function uninstall ()
122122 {
123123
124- if (!Configuration::deleteByName ('PAYSTACK_TEST_SECRETKEY ' )
124+ if (
125+ !Configuration::deleteByName ('PAYSTACK_TEST_SECRETKEY ' )
125126 || !Configuration::deleteByName ('PAYSTACK_TEST_PUBLICKEY ' )
126127 || !Configuration::deleteByName ('PAYSTACK_LIVE_PUBLICKEY ' )
127128 || !Configuration::deleteByName ('PAYSTACK_LIVE_SECRETKEY ' )
@@ -191,9 +192,8 @@ public function hookPaymentOptions($params)
191192 $ key = $ config ['PAYSTACK_TEST_PUBLICKEY ' ];
192193 } else {
193194 $ key = $ config ['PAYSTACK_LIVE_PUBLICKEY ' ];
194-
195195 }
196-
196+
197197 if ($ key == '' ) {
198198 return ;
199199 }
@@ -205,44 +205,44 @@ public function hookPaymentOptions($params)
205205 $ amount = $ cart ->getOrderTotal (true , Cart::BOTH );
206206 $ currency_order = new Currency ($ cart ->id_currency );
207207 $ params = array (
208- "reference " => 'order_ ' . $ params ['cart ' ]->id . '_ ' . time (),
209- "amount " => number_format ($ amount , 2 ),
210- "pcolor " => '' ,
211- "scolor " => '' ,
212- "total_amount " => $ amount* 100 ,
213- "key " => $ key ,
214- "currency " => $ currency_order ->iso_code ,
215- "email " => $ customer ->email ,
208+ "reference " => 'order_ ' . $ params ['cart ' ]->id . '_ ' . time (),
209+ "amount " => number_format ($ amount , 2 ),
210+ "pcolor " => '' ,
211+ "scolor " => '' ,
212+ "total_amount " => $ amount * 100 ,
213+ "key " => $ key ,
214+ "currency " => $ currency_order ->iso_code ,
215+ "email " => $ customer ->email ,
216216 );
217217 $ this ->context ->smarty ->assign (
218218 array (
219- 'gateway_chosen ' => 'paystack ' ,
220- 'form_url ' => $ this ->context ->link ->getModuleLink ($ this ->name , 'paystacksuccess ' , array (), true ),
219+ 'gateway_chosen ' => 'paystack ' ,
220+ 'form_url ' => $ this ->context ->link ->getModuleLink ($ this ->name , 'paystacksuccess ' , array (), true ),
221221 )
222222 );
223223 $ this ->context ->smarty ->assign (
224224 $ params
225225 );
226226 }
227-
227+
228228 $ newOption = new PaymentOption ();
229229 $ newOption ->setCallToActionText ($ this ->trans ('Paystack (Debit/credit cards) ' , array (), 'Modules.Paystack.Shop ' ))
230230 ->setAction ($ this ->context ->link ->getModuleLink ($ this ->name , 'validation ' , array (), true ))
231231 ->setAdditionalInformation ($ this ->context ->smarty ->fetch ('module:paystack/views/templates/hook/intro.tpl ' ))
232- ->setLogo (Media::getMediaPath (_PS_MODULE_DIR_ . $ this ->name . '/card-logos.png ' ))
232+ ->setLogo (Media::getMediaPath (_PS_MODULE_DIR_ . $ this ->name . '/card-logos.png ' ))
233233 ->setInputs (
234234 array (
235- 'wcst_iframe ' => array (
236- 'name ' =>'wcst_iframe ' ,
237- 'type ' =>'hidden ' ,
238- 'value ' =>'1 ' ,
239- )
235+ 'wcst_iframe ' => array (
236+ 'name ' => 'wcst_iframe ' ,
237+ 'type ' => 'hidden ' ,
238+ 'value ' => '1 ' ,
239+ )
240240 )
241241 );
242242 if ($ gateway_chosen == 'paystack ' ) {
243- $ newOption ->setAdditionalInformation (
244- $ this ->context ->smarty ->fetch ('module:paystack/views/templates/front/embedded.tpl ' )
245- );
243+ $ newOption ->setAdditionalInformation (
244+ $ this ->context ->smarty ->fetch ('module:paystack/views/templates/front/embedded.tpl ' )
245+ );
246246 }
247247 $ payment_options = [
248248 $ newOption ,
@@ -269,24 +269,23 @@ public function hookPaymentReturn($params)
269269 Configuration::get ('PS_OS_OUTOFSTOCK ' ),
270270 Configuration::get ('PS_OS_OUTOFSTOCK_UNPAID ' ),
271271 )
272- )
273- ) {
272+ )) {
274273 $ paystackOwner = $ this ->owner ;
275-
274+
276275 $ this ->smarty ->assign (
277276 array (
278- 'shop_name ' => $ this ->context ->shop ->name ,
279- 'total ' => Tools::displayPrice (
280- $ params ['order ' ]->getOrdersTotalPaid (),
281- new Currency ($ params ['order ' ]->id_currency ),
282- false
283- ),
284- 'paystackDetails ' => $ paystackDetails ,
285- 'paystackAddress ' => $ paystackAddress ,
286- 'paystackOwner ' => $ paystackOwner ,
287- 'status ' => 'ok ' ,
288- 'reference ' => $ reference ,
289- 'contact_url ' => $ this ->context ->link ->getPageLink ('contact ' , true )
277+ 'shop_name ' => $ this ->context ->shop ->name ,
278+ 'total ' => Tools::displayPrice (
279+ $ params ['order ' ]->getOrdersTotalPaid (),
280+ new Currency ($ params ['order ' ]->id_currency ),
281+ false
282+ ),
283+ 'paystackDetails ' => $ paystackDetails ,
284+ 'paystackAddress ' => $ paystackAddress ,
285+ 'paystackOwner ' => $ paystackOwner ,
286+ 'status ' => 'ok ' ,
287+ 'reference ' => $ reference ,
288+ 'contact_url ' => $ this ->context ->link ->getPageLink ('contact ' , true )
290289 )
291290 );
292291 } else {
@@ -319,7 +318,7 @@ public function checkCurrency($cart)
319318 public function checkCurrencyNGN ($ cart )
320319 {
321320 $ currency_order = new Currency ($ cart ->id_currency );
322- if ($ currency_order ->iso_code == 'NGN ' || $ currency_order ->iso_code == 'GHS ' ) {
321+ if ($ currency_order ->iso_code == 'NGN ' || $ currency_order ->iso_code == 'GHS ' || $ currency_order -> iso_code == ' ZAR ' || $ currency_order -> iso_code == ' USD ' ) {
323322 return true ;
324323 }
325324 return false ;
@@ -333,20 +332,20 @@ public function renderForm()
333332 'title ' => $ this ->trans ('User details ' , array (), 'Modules.Paystack.Admin ' ),
334333 'icon ' => 'icon-user '
335334 ),
336-
335+
337336 'input ' => array (
338337 array (
339338 'type ' => 'switch ' ,
340339 'label ' => $ this ->trans ('Test Mode ' , array (), 'Modules.Paystack.Admin ' ),
341340 'name ' => 'PAYSTACK_MODE ' ,
342341 'is_bool ' => true ,
343342 'required ' => true ,
344- 'values ' =>array (
343+ 'values ' => array (
345344 array (
346345 'id ' => 'active_on ' ,
347346 'value ' => true ,
348347 'label ' => $ this ->trans ('Test ' , array (), 'Modules.Paystack.Admin ' )
349- ),array (
348+ ), array (
350349 'id ' => 'active_off ' ,
351350 'value ' => false ,
352351 'label ' => $ this ->trans ('False ' , array (), 'Modules.Paystack.Admin ' )
@@ -357,9 +356,9 @@ public function renderForm()
357356 'type ' => 'text ' ,
358357 'label ' => $ this ->trans ('Test Secret key ' , array (), 'Modules.Paystack.Admin ' ),
359358 'name ' => 'PAYSTACK_TEST_SECRETKEY ' ,
360-
359+
361360 ),
362- array (
361+ array (
363362 'type ' => 'text ' ,
364363 'label ' => $ this ->trans ('Test Public key ' , array (), 'Modules.Paystack.Admin ' ),
365364 'name ' => 'PAYSTACK_TEST_PUBLICKEY ' ,
@@ -368,13 +367,13 @@ public function renderForm()
368367 'type ' => 'text ' ,
369368 'label ' => $ this ->trans ('Live Secret key ' , array (), 'Modules.Paystack.Admin ' ),
370369 'name ' => 'PAYSTACK_LIVE_SECRETKEY ' ,
371-
370+
372371 ),
373372 array (
374373 'type ' => 'text ' ,
375374 'label ' => $ this ->trans ('Live Public key ' , array (), 'Modules.Paystack.Admin ' ),
376375 'name ' => 'PAYSTACK_LIVE_PUBLICKEY ' ,
377- ),
376+ ),
378377 ),
379378 'submit ' => array (
380379 'title ' => $ this ->trans ('Save ' , array (), 'Admin.Actions ' ),
@@ -388,13 +387,13 @@ public function renderForm()
388387 $ helper ->table = $ this ->table ;
389388 $ lang = new Language ((int )Configuration::get ('PS_LANG_DEFAULT ' ));
390389 $ helper ->default_form_language = $ lang ->id ;
391- $ helper ->allow_employee_form_lang = Configuration::get ('PS_BO_ALLOW_EMPLOYEE_FORM_LANG ' ) ? : 0 ;
390+ $ helper ->allow_employee_form_lang = Configuration::get ('PS_BO_ALLOW_EMPLOYEE_FORM_LANG ' ) ?: 0 ;
392391 $ this ->fields_form = array ();
393392 $ helper ->id = (int )Tools::getValue ('id_carrier ' );
394393 $ helper ->identifier = $ this ->identifier ;
395394 $ helper ->submit_action = 'btnSubmit ' ;
396- $ helper ->currentIndex = $ this ->context ->link ->getAdminLink ('AdminModules ' , false ). '&configure= '
397- .$ this ->name . '&tab_module= ' . $ this ->tab . '&module_name= ' . $ this ->name ;
395+ $ helper ->currentIndex = $ this ->context ->link ->getAdminLink ('AdminModules ' , false ) . '&configure= '
396+ . $ this ->name . '&tab_module= ' . $ this ->tab . '&module_name= ' . $ this ->name ;
398397 $ helper ->token = Tools::getAdminTokenLite ('AdminModules ' );
399398 $ helper ->tpl_vars = array (
400399 'fields_value ' => $ this ->getConfigFieldsValues (),
0 commit comments