Skip to content

Commit 3bdf0e5

Browse files
authored
Merge pull request #4 from steveamaza/master
Update logo and module version
2 parents 4ab7511 + d1ff85b commit 3bdf0e5

File tree

3 files changed

+62
-65
lines changed

3 files changed

+62
-65
lines changed

paystack/config.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<module>
33
<name>paystack</name>
44
<displayName><![CDATA[Paystack]]></displayName>
5-
<version><![CDATA[1.0.2]]></version>
5+
<version><![CDATA[1.1.0]]></version>
66
<description><![CDATA[Accept payments for your products via Paystack. Compatible with Prestashop 1.7 and higher]]></description>
7-
<author><![CDATA[Douglas Kendyson]]></author>
7+
<author><![CDATA[Paystack]]></author>
88
<tab><![CDATA[payments_gateways]]></tab>
99
<confirmUninstall><![CDATA[Are you sure about removing these details?]]></confirmUninstall>
1010
<is_configurable>1</is_configurable>

paystack/logo.png

35.4 KB
Loading

paystack/paystack.php

Lines changed: 60 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct()
4646
$this->tab = 'payments_gateways';
4747
$this->version = '1.0.2';
4848
$this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_);
49-
$this->author = 'Douglas Kendyson';
49+
$this->author = 'Paystack';
5050
$this->controllers = array('payment', 'validation');
5151
$this->is_eu_compatible = 0;
5252

@@ -78,7 +78,7 @@ public function __construct()
7878

7979
public function install()
8080
{
81-
if (!parent::install() || !$this->registerHook('paymentReturn') || !$this->registerHook('paymentOptions') || !$this->registerHook('header')) {
81+
if (!parent::install() || !$this->registerHook('paymentReturn') || !$this->registerHook('paymentOptions') || !$this->registerHook('header')) {
8282
return false;
8383
}
8484

@@ -121,10 +121,11 @@ public function uninstall()
121121
{
122122

123123
if (!Configuration::deleteByName('PAYSTACK_TEST_SECRETKEY')
124-
|| !Configuration::deleteByName('PAYSTACK_TEST_PUBLICKEY')
125-
|| !Configuration::deleteByName('PAYSTACK_LIVE_PUBLICKEY')
126-
|| !Configuration::deleteByName('PAYSTACK_LIVE_SECRETKEY')
127-
|| !parent::uninstall()) {
124+
|| !Configuration::deleteByName('PAYSTACK_TEST_PUBLICKEY')
125+
|| !Configuration::deleteByName('PAYSTACK_LIVE_PUBLICKEY')
126+
|| !Configuration::deleteByName('PAYSTACK_LIVE_SECRETKEY')
127+
|| !parent::uninstall()
128+
) {
128129
return false;
129130
}
130131
return true;
@@ -146,11 +147,8 @@ private function _displayPaystack()
146147
{
147148
return $this->display(__FILE__, 'infos.tpl');
148149
}
149-
150-
151-
152-
153-
public function addJsRC($js_uri)
150+
151+
public function addJsRC($js_uri)
154152
{
155153
$this->context->controller->addJS($js_uri);
156154
}
@@ -177,76 +175,72 @@ public function getContent()
177175

178176
public function hookPaymentOptions($params)
179177
{
180-
181-
182-
if (!$this->active) {
178+
if (!$this->active) {
183179
return;
184180
}
185181

186182
if (!$this->checkCurrency($params['cart'])) {
187183
return;
188184
}
189-
190-
if (!$this->checkCurrencyNGN($params['cart'])) {
185+
if (!$this->checkCurrencyNGN($params['cart'])) {
191186
return;
192187
}
193-
$config = $this->getConfigFieldsValues();
188+
$config = $this->getConfigFieldsValues();
194189
if ($config['PAYSTACK_MODE'] == 1) {
195-
$key = $config['PAYSTACK_TEST_PUBLICKEY'];
196-
}else{
197-
$key = $config['PAYSTACK_LIVE_PUBLICKEY'];
190+
$key = $config['PAYSTACK_TEST_PUBLICKEY'];
191+
} else {
192+
$key = $config['PAYSTACK_LIVE_PUBLICKEY'];
198193

199194
}
200-
201-
if($key == ''){
202-
return;
203-
}
195+
196+
if ($key == '') {
197+
return;
198+
}
204199
$gateway_chosen = 'none';
205200
if (Tools::getValue('gateway') == 'paystack') {
206201
$cart = $this->context->cart;
207202
$gateway_chosen = 'paystack';
208-
$customer = new Customer((int)($cart->id_customer));
209-
210-
$amount = $cart->getOrderTotal(true, Cart::BOTH);
211-
212-
$params = array(
213-
"reference" => 'order_'.$params['cart']->id.'_'.time(),
214-
"amount" => number_format($amount, 2),
215-
"pcolor" => '',
216-
"scolor" => '',
217-
"total_amount" => $amount*100,
218-
"key" => $key,
219-
"email" => $customer->email,
220-
);
221-
$this->context->smarty->assign(array(
203+
$customer = new Customer((int)($cart->id_customer));
204+
$amount = $cart->getOrderTotal(true, Cart::BOTH);
205+
$params = array(
206+
"reference" => 'order_'.$params['cart']->id.'_'.time(),
207+
"amount" => number_format($amount, 2),
208+
"pcolor" => '',
209+
"scolor" => '',
210+
"total_amount"=> $amount*100,
211+
"key" => $key,
212+
"email" => $customer->email,
213+
);
214+
$this->context->smarty->assign(
215+
array(
222216
'gateway_chosen' => 'paystack',
223-
'form_url' => $this->context->link->getModuleLink($this->name, 'paystacksuccess', array(), true),
224-
));
217+
'form_url' => $this->context->link->getModuleLink($this->name, 'paystacksuccess', array(), true),
218+
)
219+
);
225220
$this->context->smarty->assign(
226-
$params
221+
$params
227222
);
228-
229223
}
230224

231-
232225
$newOption = new PaymentOption();
233226
$newOption->setCallToActionText($this->trans('Paystack (Debit/credit cards)', array(), 'Modules.Paystack.Shop'))
234-
->setAction($this->context->link->getModuleLink($this->name, 'validation', array(), true))
235-
->setAdditionalInformation($this->context->smarty->fetch('module:paystack/views/templates/hook/intro.tpl'))
236-
->setLogo(Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/card-logos.png'))
237-
->setInputs(array(
238-
'wcst_iframe' => array(
239-
'name' =>'wcst_iframe',
240-
'type' =>'hidden',
241-
'value' =>'1',
242-
)
243-
));
244-
if ($gateway_chosen == 'paystack') {
245-
$newOption->setAdditionalInformation(
246-
$this->context->smarty->fetch('module:paystack/views/templates/front/embedded.tpl')
227+
->setAction($this->context->link->getModuleLink($this->name, 'validation', array(), true))
228+
->setAdditionalInformation($this->context->smarty->fetch('module:paystack/views/templates/hook/intro.tpl'))
229+
->setLogo(Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/card-logos.png'))
230+
->setInputs(
231+
array(
232+
'wcst_iframe' => array(
233+
'name' =>'wcst_iframe',
234+
'type' =>'hidden',
235+
'value' =>'1',
236+
)
237+
)
247238
);
239+
if ($gateway_chosen == 'paystack') {
240+
$newOption->setAdditionalInformation(
241+
$this->context->smarty->fetch('module:paystack/views/templates/front/embedded.tpl')
242+
);
248243
}
249-
250244
$payment_options = [
251245
$newOption,
252246
];
@@ -272,10 +266,12 @@ public function hookPaymentReturn($params)
272266
Configuration::get('PS_OS_OUTOFSTOCK'),
273267
Configuration::get('PS_OS_OUTOFSTOCK_UNPAID'),
274268
)
275-
)) {
269+
)
270+
) {
276271
$paystackOwner = $this->owner;
277272

278-
$this->smarty->assign(array(
273+
$this->smarty->assign(
274+
array(
279275
'shop_name' => $this->context->shop->name,
280276
'total' => Tools::displayPrice(
281277
$params['order']->getOrdersTotalPaid(),
@@ -288,7 +284,8 @@ public function hookPaymentReturn($params)
288284
'status' => 'ok',
289285
'reference' => $reference,
290286
'contact_url' => $this->context->link->getPageLink('contact', true)
291-
));
287+
)
288+
);
292289
} else {
293290
$this->smarty->assign(
294291
array(
@@ -315,12 +312,12 @@ public function checkCurrency($cart)
315312
}
316313
return false;
317314
}
318-
319-
public function checkCurrencyNGN($cart)
315+
316+
public function checkCurrencyNGN($cart)
320317
{
321318
$currency_order = new Currency($cart->id_currency);
322319
if ($currency_order->iso_code == 'NGN') {
323-
return true;
320+
return true;
324321
}
325322
return false;
326323
}

0 commit comments

Comments
 (0)