✏️ 正在编辑: install.php
路径:
/home/bpioifn/www/pigmentse/modules/axepta/sql/install.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php /** * 2007-2019 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <contact@prestashop.com> * @copyright 2007-2019 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ $sql = array(); $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_configuration_account` ( `id_axepta_configuration_account` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id_currency` int(10) NOT NULL, `id_country` varchar(255) DEFAULT NULL, `mid` varchar(255) DEFAULT NULL, `front_label` varchar(50) NOT NULL, `password` varchar(255) DEFAULT NULL, `hmac_key` varchar(255) DEFAULT NULL, `activation_key` varchar(500) DEFAULT NULL, `mode_view` varchar(20) DEFAULT NULL, `secure` TINYINT(1) NOT NULL, `oneclick` TINYINT(1) NOT NULL, `recurring` TINYINT(1) NOT NULL, `banked` varchar(30) DEFAULT NULL, `banked_delay` varchar(20) DEFAULT NULL, `return_after_pay` TINYINT(1) NOT NULL, `capture_method` VARCHAR (50) NOT NULL, `presto_product_category` INT(3) NOT NULL, `capture_hours` INT NOT NULL DEFAULT 1, `ticket` TINYINT(1) NOT NULL, `logs` TINYINT(1) NOT NULL, `test_mode` TINYINT(1) NOT NULL, `active` TINYINT(1) NOT NULL, PRIMARY KEY (`id_axepta_configuration_account`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_configuration_account_paygate` ( `id_axepta_configuration_account_paygate` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id_axepta_configuration_account` int(10) NOT NULL, `trigram` varchar(10) NOT NULL, `active` TINYINT(1) NOT NULL, PRIMARY KEY (`id_axepta_configuration_account_paygate`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_configuration_account_shop` ( `id_axepta_configuration_account` int(10) UNSIGNED NOT NULL, `id_shop` int(11) UNSIGNED NOT NULL, PRIMARY KEY (`id_axepta_configuration_account`,`id_shop`), KEY `id_shop` (`id_shop`) ) ENGINE= '. _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_customer_oneclick_payment_card` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `id_customer` int(11) NULL, `holder_name` varchar(255) NULL, `pcnr` varchar(255) NULL, `ccexpiry` varchar(255) NULL, `ccbrand` varchar(255) NULL, PRIMARY KEY (`id`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'; $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_customer_recurring_payment_card` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `id_customer` int(11) NULL, `id_axepta_customer_payment_recurring` int(10) UNSIGNED NULL, `holder_name` varchar(255) NULL, `pcnr` varchar(255) NULL, `ccexpiry` varchar(255) NULL, `ccbrand` varchar(255) NULL, `bid` varchar(255) NULL, PRIMARY KEY (`id`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'; // Table axepta_xml_paygate_action_code $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_xml_paygate_action_code` ( `code` varchar(11) DEFAULT NULL, `message` varchar(255) DEFAULT NULL, `description` varchar(255) DEFAULT NULL, KEY `code` (`code`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; // Table axepta_xml_paygate_category_code $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_xml_paygate_category_code` ( `code` varchar(11) DEFAULT NULL, `message` varchar(255) DEFAULT NULL, `description` varchar(255) DEFAULT NULL, KEY `code` (`code`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; // Table axepta_xml_paygate_detail_code $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_xml_paygate_detail_code` ( `code` varchar(11) DEFAULT NULL, `message` varchar(255) DEFAULT NULL, `description` varchar(255) DEFAULT NULL, KEY `code` (`code`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; // Table axepta_xml_parameter $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_xml_parameter` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, `format` varchar(255) DEFAULT NULL, `required` varchar(255) DEFAULT NULL, `parameter_set_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `parameter_set_id` (`parameter_set_id`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; // Table axepta_xml_parameter_set $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_xml_parameter_set` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `operation` varchar(255) DEFAULT NULL, `url` varchar(255) DEFAULT NULL, `url_test` varchar(255) DEFAULT NULL, `method_id` int(11) NOT NULL, `parameter_set_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `method_id` (`method_id`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; // Table axepta_xml_method $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_xml_method` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `trigram` varchar(10) NOT NULL, `code` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; // Table axepta_xml_method_lang $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_xml_method_lang` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `method_id` int(11) NOT NULL, `iso` varchar(255) DEFAULT NULL, `label` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `method_id` (`method_id`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; // Table axepta_xml_allow_countries $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_xml_allow_countries` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `method_id` int(11) DEFAULT NULL, `currency` varchar(255) DEFAULT NULL, `country` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `method_id` (`method_id`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; // Table axepta_transaction $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_transaction` ( `id_axepta_transaction` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `id_axepta_configuration_account` int(11) NOT NULL, `merchant_id` varchar(255) DEFAULT NULL, `transaction_reference` varchar(255) DEFAULT NULL, `transaction_date` datetime DEFAULT NULL, `id_order` int(11) DEFAULT NULL, `id_order_slip` int(11) DEFAULT NULL, `trigram` varchar(3) DEFAULT NULL, `pay_id` varchar(255) DEFAULT NULL, `xid` varchar(255) DEFAULT NULL, `amount` decimal(20,2) DEFAULT NULL, `transaction_type` varchar(255) DEFAULT NULL, `payment_mean_brand` varchar(255) DEFAULT NULL, `payment_mean_type` varchar(255) DEFAULT NULL, `response_code` varchar(255) DEFAULT NULL, `pcnr` varchar(255) DEFAULT NULL, `ccexpiry` varchar(255) DEFAULT NULL, `bid` varchar(255) DEFAULT NULL, `status` varchar(255) DEFAULT NULL, `description` varchar(255) DEFAULT NULL, `scheme_reference_id` varchar(255) DEFAULT NULL, `raw_data` text, PRIMARY KEY (`id_axepta_transaction`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; // AXEPTA ORDER REFERENCE $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_order_reference` ( `id_cart` INT(10) UNSIGNED NOT NULL, `reference` VARCHAR(128) NOT NULL, PRIMARY KEY (`id_cart`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'; // AXEPTA PAYMENT RECURRING $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_payment_recurring` ( `id_axepta_payment_recurring` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id_product` INT(10) NOT NULL, `type` INT(10) NULL, `periodicity` VARCHAR(10) NOT NULL, `number_occurences` INT(10) NOT NULL, `recurring_amount` FLOAT(6) NULL, PRIMARY KEY (`id_axepta_payment_recurring`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'; // AXEPTA CUSTOMER PAYMENT RECURRING $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_customer_payment_recurring` ( `id_axepta_customer_payment_recurring` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id_product` INT(10) NOT NULL, `id_tax_rules_group` INT(10) NOT NULL, `id_order` INT(10) NOT NULL, `id_customer` INT(10) NOT NULL, `id_axepta_transaction` INT(10) NOT NULL, `status` INT(10) NOT NULL, `amount_tax_exclude` FLOAT(6) NOT NULL, `periodicity` VARCHAR(10) NOT NULL, `number_occurences` INT(10) NOT NULL, `current_occurence` INT(10) NOT NULL DEFAULT 0, `date_add` DATETIME, `last_schedule` DATETIME, `next_schedule` DATETIME, `current_specific_price` INT(10) NOT NULL DEFAULT 0, `id_cart_paused_currency` INT(10) NOT NULL DEFAULT 0, `scheme_reference_id` varchar(255) DEFAULT NULL, PRIMARY KEY (`id_axepta_customer_payment_recurring`), KEY (`id_product`), KEY (`id_tax_rules_group`), KEY (`id_order`), KEY (`id_axepta_transaction`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'; $query = ' SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME= "presto_product_category" AND TABLE_NAME= "'._DB_PREFIX_.'axepta_configuration_account" AND TABLE_SCHEMA = "'._DB_NAME_.'" '; $result = Db::getInstance()->ExecuteS($query); if (!$result) { $sql[] = 'ALTER TABLE `'._DB_PREFIX_.'axepta_configuration_account` ADD `presto_product_category` int(3) NOT NULL AFTER `capture_method`'; } $query = ' SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME= "front_label" AND TABLE_NAME= "'._DB_PREFIX_.'axepta_configuration_account" AND TABLE_SCHEMA = "'._DB_NAME_.'" '; $result = Db::getInstance()->ExecuteS($query); if (!$result) { $sql[] = 'ALTER TABLE `'._DB_PREFIX_.'axepta_configuration_account` ADD `front_label` VARCHAR (50) NOT NULL AFTER `mid`'; } $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_iso_country` ( `id_country` INT(10) UNSIGNED NOT NULL, `name` VARCHAR(64) NOT NULL, `iso_code_2` VARCHAR(3) NOT NULL, `iso_code_3` VARCHAR(3) NOT NULL, `num_code` INT(10) NOT NULL, `latitude` INT(10) NOT NULL, `longitude` INT(10) NOT NULL, PRIMARY KEY (`id_country`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'; // Create new table paygate_position $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_xml_paygate_position` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `position` INT(11) NOT NULL, `iso` VARCHAR(3) DEFAULT NULL, `trigram` VARCHAR(3) NOT NULL, `is_default` BOOL NOT NULL DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'; foreach ($sql as $query) { if (Db::getInstance()->execute($query) == false) { return false; } } if (AxeptaXml::paymentsNeedUpgrade()) { if (!AxeptaXml::insertXmlToDb()) { return false; } }
💾 保存文件
← 返回文件管理器