✏️ 正在编辑: AxeptaPaymentRecurring.php
路径:
/home/bpioifn/www/pigmentse/modules/axepta/classes/AxeptaPaymentRecurring.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php /** * 1961-2020 BNP Paribas * * 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 1961-2019 BNP Paribas * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ class AxeptaPaymentRecurring extends ObjectModel { const ID_TYPE_PAYMENT_SIMPLE = 1; const ID_TYPE_PAYMENT_RECURRING = 2; const STATUS_ACTIVE = 1; const STATUS_PAUSE = 2; /** * ID * @var integer */ public $id_axepta_payment_recurring; /** * ID PRODUCT * @var integer */ public $id_product; /** * TYPE * @var integer */ public $type; /** * PERIODICITY * @var string */ public $periodicity; /** * NUMBER OF OCCURENCES * @var integer */ public $number_occurences; /** * RECURRING AMOUNT * @var float */ public $recurring_amount; /** * @see ObjectModel::$definition */ public static $definition = array( 'table' => 'axepta_payment_recurring', 'primary' => 'id_axepta_payment_recurring', 'multilang' => false, 'fields' => array( 'id_product' => array( 'type' => self::TYPE_INT, 'required' => true, 'validate' => 'isInt', ), 'type' => array( 'type' => self::TYPE_INT, 'required' => true, 'validate' => 'isInt', ), 'periodicity' => array( 'type' => self::TYPE_INT, 'required' => true, 'validate' => 'isInt', ), 'number_occurences' => array( 'type' => self::TYPE_INT, 'required' => true, 'size' => 3, 'validate' => 'isInt', ), 'recurring_amount' => array( 'type' => self::TYPE_FLOAT, 'required' => false, ), ) ); public static function getShedulesToCapture() { return Db::getInstance()->executeS(' SELECT * FROM `' . _DB_PREFIX_ . 'axepta_customer_payment_recurring` WHERE `status` = 1 AND DATEDIFF(NOW(), `next_schedule`) >= 0 ORDER BY date_add DESC '); } /** * Retrieve the configuration for * @param int $id_product * @param int $type * @return array */ public static function getPaymentRecurringByProductId($id_product, $type = null) { return Db::getInstance()->getRow(' SELECT * FROM `' . _DB_PREFIX_ . 'axepta_payment_recurring` WHERE `id_product` = ' . (int) $id_product . ' ' . pSQL($type) . ' '); } /** * Retrieve the id of a configuration product * @param int $id_product * @param int $type * @return int */ public static function getIdPaymentRecurringByProductId($id_product, $type = null) { if (!is_null($type)) { $type = 'AND type = ' . (int) $type; } return Db::getInstance()->getValue(' SELECT id_axepta_payment_recurring FROM `' . _DB_PREFIX_ . 'axepta_payment_recurring` WHERE `id_product` = ' . (int) $id_product . ' ' . pSQL($type) . ' '); } /** * Return types of payments */ public static function getTypes() { $module = Module::getInstanceByName('axepta'); return array( self::ID_TYPE_PAYMENT_SIMPLE => Translate::getModuleTranslation($module, 'Paiement simple', 'AxeptaPaymentRecurring'), self::ID_TYPE_PAYMENT_RECURRING => Translate::getModuleTranslation($module, 'Paiement par abonnement', 'AxeptaPaymentRecurring') ); } /** * Return the periodicities */ public static function getPeriodicities() { $module = Module::getInstanceByName('axepta'); return array( 1 => array( 'days' => 'D', 'name' => Translate::getModuleTranslation($module, 'Jour', 'AxeptaPaymentRecurring'), ), 2 => array( 'days' => 'M', 'name' => Translate::getModuleTranslation($module, 'Mois', 'AxeptaPaymentRecurring'), ) ); } public static function isThisProductPaymentRecurring($id_product) { $result = Db::getInstance()->getRow( 'SELECT * FROM `' . _DB_PREFIX_ . 'axepta_payment_recurring` WHERE `id_product` = ' . (int) $id_product ); if (!empty($result)) { if ((int) $result['type'] == (int) self::ID_TYPE_PAYMENT_RECURRING) { return true; } } return false; } }
💾 保存文件
← 返回文件管理器