shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

wechat_pay.php (1357B)


      1 <?php
      2 /**
      3  * @package		OpenCart
      4  * @author		Meng Wenbin
      5  * @copyright	Copyright (c) 2010 - 2017, Chengdu Guangda Network Technology Co. Ltd. (https://www.opencart.cn/)
      6  * @license		https://opensource.org/licenses/GPL-3.0
      7  * @link		https://www.opencart.cn
      8  */
      9 
     10 class ModelExtensionPaymentWechatPay extends Model {
     11 	public function getMethod($address, $total) {
     12 		$this->load->language('extension/payment/wechat_pay');
     13 
     14 		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('payment_wechat_pay_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");
     15 
     16 		if ($this->config->get('payment_wechat_pay_total') > 0 && $this->config->get('payment_wechat_pay_total') > $total) {
     17 			$status = false;
     18 		} elseif (!$this->config->get('payment_wechat_pay_geo_zone_id')) {
     19 			$status = true;
     20 		} elseif ($query->num_rows) {
     21 			$status = true;
     22 		} else {
     23 			$status = false;
     24 		}
     25 
     26 		$method_data = array();
     27 
     28 		if ($status) {
     29 			$method_data = array(
     30 				'code'       => 'wechat_pay',
     31 				'title'      => $this->language->get('text_title'),
     32 				'terms'      => '',
     33 				'sort_order' => $this->config->get('payment_wechat_pay_sort_order')
     34 			);
     35 		}
     36 
     37 		return $method_data;
     38 	}
     39 }