✏️ 正在编辑: AxeptaTransaction.php
路径:
/home/bpioifn/www/pigmentse/modules/axepta/classes/AxeptaTransaction.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php /** * 1997-2016 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-2016 Quadra Informatique * @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ class AxeptaTransaction extends ObjectModel { const PAYMENT = 'payment'; const REFUND = 'refund'; const CANCEL = 'cancel'; const RECURRING = 'recurring'; public $id_axepta_transaction; public $id_axepta_configuration_account; public $merchant_id; public $transaction_reference; public $transaction_date; public $id_order; public $id_order_slip; public $pay_id; public $xid; public $amount; public $trigram; public $transaction_type; public $payment_mean_brand; public $payment_mean_type; public $response_code; public $pcnr; public $bid; public $ccexpiry; public $status; public $description; public $raw_data; public $scheme_reference_id; public static $definition = array( 'table' => 'axepta_transaction', 'primary' => 'id_axepta_transaction', 'multilang' => false, 'fields' => array( 'id_axepta_configuration_account' => array( 'type' => ObjectModel :: TYPE_INT, 'required' => true, ), 'merchant_id' => array( 'type' => self::TYPE_STRING, 'required' => true, ), 'transaction_reference' => array( 'type' => self::TYPE_STRING, ), 'transaction_date' => array( 'type' => self::TYPE_DATE, ), 'id_order' => array( 'type' => self::TYPE_INT, ), 'id_order_slip' => array( 'type' => self::TYPE_INT, ), 'trigram' => array( 'type' => self::TYPE_STRING, ), 'pay_id' => array( 'type' => self::TYPE_STRING, ), 'xid' => array( 'type' => self::TYPE_STRING, ), 'amount' => array( 'type' => self::TYPE_FLOAT, ), 'transaction_type' => array( 'type' => self::TYPE_STRING, ), 'payment_mean_brand' => array( 'type' => self::TYPE_STRING, ), 'payment_mean_type' => array( 'type' => self::TYPE_STRING, ), 'response_code' => array( 'type' => self::TYPE_STRING, ), 'pcnr' => array( 'type' => self::TYPE_STRING, ), 'bid' => array( 'type' => self::TYPE_STRING, ), 'ccexpiry' => array( 'type' => self::TYPE_STRING, ), 'status' => array( 'type' => self::TYPE_STRING, ), 'description' => array( 'type' => self::TYPE_STRING, ), 'scheme_reference_id' => array( 'type' => self::TYPE_STRING, ), 'raw_data' => array( 'type' => self::TYPE_STRING, ), ), ); public static function checkTransactionOkByOrderId($id_order = 0) { if ((int) $id_order) { return Db::getInstance()->getRow('SELECT * FROM ' . _DB_PREFIX_ . 'axepta_transaction WHERE order_id = ' . (int) $id_order . ' AND response_code = "00000000" ORDER BY id_axepta_transaction DESC LIMIT 1'); } return false; } public static function getTransactionSuccessByIdOrder($id_order) { if ((int) $id_order) { return Db::getInstance()->getRow('SELECT * FROM ' . _DB_PREFIX_ . 'axepta_transaction WHERE id_order = ' . (int) $id_order . ' AND response_code = 00000000'); } return false; } /** * Return the transaction for a reference * @param string $reference * @return boolean|array */ public static function getTransactionByReference($reference) { if (empty($reference)) { return false; } return Db::getInstance()->getRow(' SELECT * FROM `' . _DB_PREFIX_ . 'axepta_transaction` WHERE transaction_reference = "' . pSQL($reference) . '" '); } public static function getTransactionsByReference($reference) { if (empty($reference)) { return false; } return Db::getInstance()->executeS(' SELECT * FROM `' . _DB_PREFIX_ . 'axepta_transaction` WHERE transaction_reference = "' . pSQL($reference) . '" '); } /** * Return the transaction for an order id * @param int $id_order * @return boolean|array */ public static function getTransactionByOrderId($id_order) { if (empty($id_order)) { return false; } return Db::getInstance()->executeS(' SELECT * FROM `' . _DB_PREFIX_ . 'axepta_transaction` WHERE `id_order` = "' . (int) $id_order . '" '); } /** * Return the transaction for a pay_id * @param string $pay_id * @return boolean|array */ public static function getTransactionByPayId($pay_id) { if (empty($pay_id)) { return false; } $sql = ' SELECT `'.self::$definition['primary'].'` FROM `' . _DB_PREFIX_ . 'axepta_transaction` WHERE `pay_id` = "' . pSQL($pay_id) . '" '; $id_axepta_transaction = Db::getInstance()->getValue($sql); return new AxeptaTransaction($id_axepta_transaction); } /** * Return the transaction for an order id, ordered by date * @param string $id_order * @return boolean|array */ public static function getTransactionByOrderIdOrderByDate($id_order) { if (empty($id_order)) { return false; } return Db::getInstance()->executeS(' SELECT * FROM `' . _DB_PREFIX_ . 'axepta_transaction` WHERE `id_order` = "' . pSQL((int) $id_order) . '" ORDER BY `transaction_date` ASC '); } /** * Return the transaction for an order id * @param int $id_order * @return boolean|array */ public static function getTransactionByReferenceAndType($reference) { if (empty($reference)) { return false; } return Db::getInstance()->getRow(' SELECT * FROM `' . _DB_PREFIX_ . 'axepta_transaction` WHERE `transaction_reference` = "' . pSQL($reference) . '" and transaction_type = "payment" OR transaction_type = "oneclick" OR transaction_type = "initial_recurring_payment" '); } /** * Return the slips for an order wich are not already used for refund * * @param type $id_order */ public static function getRefundableSlips($id_order) { if (empty($id_order)) { return false; } $sql = ' SELECT * FROM `'._DB_PREFIX_.'order_slip` WHERE `id_order` = '.(int)$id_order.' AND `id_order_slip` NOT IN ( SELECT IFNULL(`id_order_slip`, 0) AS `id_order_slip` FROM `'._DB_PREFIX_.self::$definition['table'].'` WHERE `id_order` = '.(int)$id_order.' AND `transaction_type` = "'.self::REFUND.'" ) '; return Db::getInstance()->executeS($sql); } /** * Return the transaction for a xid * @param string $xid * @return boolean|array */ public static function getTransactionByXid($xid) { if (empty($xid)) { return false; } $id_axepta_transaction = Db::getInstance()->getValue(' SELECT `id_axepta_transaction` FROM `' . _DB_PREFIX_ . 'axepta_transaction` WHERE `xid` = "' . pSQL($xid) . '" '); return new AxeptaTransaction($id_axepta_transaction); } }
💾 保存文件
← 返回文件管理器