1: | <?php
|
2: | namespace Opencart\Catalog\Model\Extension\Opencart\Payment;
|
3: | |
4: | |
5: | |
6: | |
7: |
|
8: | class Cheque extends \Opencart\System\Engine\Model {
|
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: |
|
16: | public function getMethods(array $address = []): array {
|
17: | $this->load->language('extension/opencart/payment/cheque');
|
18: |
|
19: | if ($this->cart->hasSubscription()) {
|
20: | $status = false;
|
21: | } elseif (!$this->config->get('config_checkout_payment_address')) {
|
22: | $status = true;
|
23: | } elseif (!$this->config->get('payment_cheque_geo_zone_id')) {
|
24: | $status = true;
|
25: | } else {
|
26: | $this->load->model('localisation/geo_zone');
|
27: |
|
28: | $results = $this->model_localisation_geo_zone->getGeoZone((int)$this->config->get('payment_cheque_geo_zone_id'), (int)$address['country_id'], (int)$address['zone_id']);
|
29: |
|
30: | if ($results) {
|
31: | $status = true;
|
32: | } else {
|
33: | $status = false;
|
34: | }
|
35: | }
|
36: |
|
37: | $method_data = [];
|
38: |
|
39: | if ($status) {
|
40: | $option_data['cheque'] = [
|
41: | 'code' => 'cheque.cheque',
|
42: | 'name' => $this->language->get('heading_title')
|
43: | ];
|
44: |
|
45: | $method_data = [
|
46: | 'code' => 'cheque',
|
47: | 'name' => $this->language->get('heading_title'),
|
48: | 'option' => $option_data,
|
49: | 'sort_order' => $this->config->get('payment_cheque_sort_order')
|
50: | ];
|
51: | }
|
52: |
|
53: | return $method_data;
|
54: | }
|
55: | }
|
56: | |