-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathpaystack.php
More file actions
executable file
·58 lines (49 loc) · 1.75 KB
/
paystack.php
File metadata and controls
executable file
·58 lines (49 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
class ModelExtensionPaymentPaystack extends Model
{
public function getMethod($address, $total)
{
$this->load->language('extension/payment/paystack');
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('payment_paystack_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");
if ($this->config->get('payment_paystack_total') > 0 && $this->config->get('payment_paystack_total') > $total) {
$status = false;
} elseif (!$this->config->get('payment_paystack_geo_zone_id')) {
$status = true;
} elseif ($query->num_rows) {
$status = true;
} else {
$status = false;
}
// Paystack only switches NGN, GHS, USD, ZAR, KES, EGP, and CIV for now
if ($status && (!in_array(
strtoupper($this->config->get('config_currency')),
[
'NGN',
'GHS',
'USD',
'ZAR'
'KES',
'EGP',
'CIV'
]
))
) {
$status = true;
}
$method_data = [];
$option_data = [];
if ($status) {
$option_data['paystack'] = [
'code' => 'paystack.paystack',
'name' => $this->language->get('heading_title')
];
$method_data = [
'code' => 'paystack',
'name' => $this->language->get('heading_title'),
'option' => $option_data,
'sort_order' => $this->config->get('payment_paystack_sort_order')
];
}
return $method_data;
}
}