✏️ 正在编辑: AxeptaConfigurationAccount.php
路径:
/home/bpioifn/www/pigmentse/modules/axepta/classes/AxeptaConfigurationAccount.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php /** * 1997-2020 Quadra Informatique * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) that is available * through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0 * If you are unable to obtain it through the world-wide-web, please send an email * to modules@quadra-informatique.fr so we can send you a copy immediately. * * @author Quadra Informatique <modules@quadra-informatique.fr> * @copyright 1997-2020 Quadra Informatique * @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ class AxeptaConfigurationAccount extends ObjectModel { const MODE_VIEW_REDIRECTION = 1; const MODE_VIEW_IFRAME = 2; const FRICTION_LESS_VALUE = 30; public $id_axepta_configuration_account; public $id_country; public $id_currency; public $front_label; public $mid; public $password; public $hmac_key; public $activation_key; public $mode_view; public $secure_exemption; public $secure_exemption_amount; public $oneclick; public $recurring; public $banked; public $banked_delay; public $capture_method; public $presto_product_category; public $capture_hours; public $return_after_pay; public $ticket; public $logs; public $test_mode; public $active; public static $definition = array( 'table' => 'axepta_configuration_account', 'primary' => 'id_axepta_configuration_account', 'multilang' => false, //'multishop' => true, 'fields' => array( 'id_country' => array( 'type' => ObjectModel :: TYPE_STRING, 'required' => true, ), 'id_currency' => array( 'type' => ObjectModel :: TYPE_INT, 'required' => true, ), 'front_label' => array( 'type' => self::TYPE_STRING, 'required' => false, ), 'mid' => array( 'type' => self::TYPE_STRING, 'required' => true, ), 'password' => array( 'type' => self::TYPE_STRING, 'required' => true, ), 'hmac_key' => array( 'type' => self::TYPE_STRING, 'required' => true, ), 'activation_key' => array( 'type' => self::TYPE_STRING, 'required' => true, ), 'mode_view' => array( 'type' => self::TYPE_STRING, ), 'secure_exemption' => array( 'type' => self::TYPE_BOOL, 'validate' => 'isBool', ), 'secure_exemption_amount' => array( 'type' => self::TYPE_FLOAT, ), 'oneclick' => array( 'type' => self::TYPE_BOOL, 'validate' => 'isBool', ), 'recurring' => array( 'type' => self::TYPE_BOOL, 'validate' => 'isBool', ), 'banked' => array( 'type' => self::TYPE_STRING, ), 'banked_delay' => array( 'type' => self::TYPE_STRING, ), 'return_after_pay' => array( 'type' => self::TYPE_BOOL, 'validate' => 'isBool', ), 'capture_method' => array( 'type' => self::TYPE_STRING, ), 'presto_product_category' => array( 'type' => self::TYPE_INT, ), 'capture_hours' => array( 'type' => self::TYPE_STRING, ), 'ticket' => array( 'type' => self::TYPE_BOOL, 'validate' => 'isBool', ), 'logs' => array( 'type' => self::TYPE_BOOL, 'validate' => 'isBool', ), 'test_mode' => array( 'type' => self::TYPE_BOOL, 'validate' => 'isBool', ), 'active' => array( 'type' => self::TYPE_BOOL, 'validate' => 'isBool', ), ), ); public static function getAvailablePayments($operation, $id_currency = 0, $id_country = 0, $id_shop = 0) { if ((int)$id_currency && (int)$id_country) { $iso_code = Country::getIsoById($id_country); if (!Shop::isFeatureActive()) { $result = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'axepta_configuration_account WHERE id_currency = '.(int)$id_currency.' AND id_country LIKE "%'.pSQL($iso_code).'%" AND active = 1'); if (!$result) { $result = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'axepta_configuration_account WHERE id_currency = '.(int)$id_currency.' AND id_country = "ALL" AND active = 1'); } } else { $result = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'axepta_configuration_account aca' .' INNER JOIN '._DB_PREFIX_.'axepta_configuration_account_shop acas' .' ON acas.id_axepta_configuration_account = aca.id_axepta_configuration_account WHERE id_shop = '.(int)$id_shop.' AND id_currency = '.(int)$id_currency.' AND id_country LIKE "%'.pSQL($iso_code).'%" AND active = 1 LIMIT 1'); if (!$result) { $result = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'axepta_configuration_account aca' .' INNER JOIN '._DB_PREFIX_.'axepta_configuration_account_shop acas' .' ON acas.id_axepta_configuration_account = aca.id_axepta_configuration_account WHERE id_shop = '.(int)$id_shop.' AND id_currency = '.(int)$id_currency.' AND id_country LIKE "%ALL%" AND active = 1 LIMIT 1'); } } if ($result) { $payments = array(); foreach ($result as $row) { if (AxeptaApi::decryptActivationKey($row['activation_key'])) { $paygates = AxeptaConfigurationAccountPaygate::getActivePaygatesByIdAccountAndIdCountry( $iso_code, $id_currency, $operation, (int)$row['id_axepta_configuration_account'] ); if ($paygates) { $payments[] = array( 'axepta_configuration_account' => $row, 'paygates' => $paygates, ); } } } return $payments; } } return false; } public function add($auto_date = true, $null_values = false) { $result = parent::add($auto_date, $null_values); if ($this->id) { // Settings defaut paygate $payment_method = AxeptaApi::getPaymentMethodsWithoutMethods( $this->id_country, $this->id_currency ); $currency = new Currency($this->id_currency); foreach ($payment_method as $key => $method) { if (AxeptaApi::isFeatureActivated($method['trigram'], $this->activation_key)) { if (AxeptaApi::isMethodAllowedInCountry($method['method_id'], $currency->iso_code, $this->id_country) || AxeptaApi::isMethodAllowedInCountry($method['method_id'], 'ALL', 'ALL')) { $axepta_paygate = new AxeptaConfigurationAccountPaygate(); $axepta_paygate->id_axepta_configuration_account = (int)$this->id; $axepta_paygate->trigram = $method['trigram']; $axepta_paygate->active = 1; $axepta_paygate->save(); } } } } return $result; } public static function getIdByMid($mid) { return Db::getInstance()->getValue(' SELECT id_axepta_configuration_account FROM `' . _DB_PREFIX_ . 'axepta_configuration_account` WHERE mid = "' . pSQL($mid) . '" ' ); } }
💾 保存文件
← 返回文件管理器