diff --git a/composer.json b/composer.json index cd10dd9a..7f887c40 100755 --- a/composer.json +++ b/composer.json @@ -21,13 +21,17 @@ "php": "5.6" } }, - "repositories": [ - { + "repositories": { + "knapsack": { + "type": "vcs", + "url": "https://github.com/Invertus/Knapsack.git" + }, + "lock": { "type": "vcs", "url": "https://github.com/Invertus/lock.git", "no-api": true } - ], + }, "require": { "vlucas/phpdotenv": "^3.6", "symfony/expression-language": "^3.4", @@ -37,14 +41,16 @@ "apimatic/unirest-php": "^2.3", "symfony/yaml": "^3.4", "league/container": "2.5.0", - "invertus/lock": "^1.0.0" + "invertus/lock": "^1.0.0", + "invertus/knapsack": "^10.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "*", "phpunit/phpunit": "*", "behat/behat": "*", "symfony/translation": "*", - "prestashop/php-dev-tools": "^3.16" + "prestashop/php-dev-tools": "^3.16", + "invertus/knapsack": "^10.0" }, "scripts": { "test-integration": "./vendor/bin/phpunit --configuration ./tests/Integration/phpunit.xml", diff --git a/saferpayofficial.php b/saferpayofficial.php index a4a4e230..4437fc62 100755 --- a/saferpayofficial.php +++ b/saferpayofficial.php @@ -40,7 +40,7 @@ public function __construct($name = null) { $this->name = 'saferpayofficial'; $this->author = 'Invertus'; - $this->version = '1.2.3'; + $this->version = '1.2.4'; $this->module_key = '3d3506c3e184a1fe63b936b82bda1bdf'; $this->displayName = 'SaferpayOfficial'; $this->description = 'Saferpay Payment module'; diff --git a/src/Entity/SaferPayLog.php b/src/Entity/SaferPayLog.php index c5842965..10069edd 100755 --- a/src/Entity/SaferPayLog.php +++ b/src/Entity/SaferPayLog.php @@ -27,18 +27,30 @@ class SaferPayLog extends ObjectModel { - public $message; + public $id_saferpay_log; - public $date_add; + public $id_log; + + public $id_shop; + + public $message; public $payload; + public $context; + + public $date_add; + public static $definition = [ 'table' => 'saferpay_log', 'primary' => 'id_saferpay_log', 'fields' => [ + 'id_log' => ['type' => self::TYPE_INT, 'validate' => 'isInt'], + 'id_shop' => ['type' => self::TYPE_INT, 'validate' => 'isInt'], 'message' => ['type' => self::TYPE_STRING, 'validate' => 'isString'], - 'payload' => ['type' => self::TYPE_STRING, 'validate' => 'isString'], + 'request' => ['type' => self::TYPE_STRING, 'validate' => 'isString'], + 'response' => ['type' => self::TYPE_STRING, 'validate' => 'isString'], + 'context' => ['type' => self::TYPE_STRING, 'validate' => 'isString'], 'date_add' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'], ], ]; diff --git a/src/Install/Installer.php b/src/Install/Installer.php index d005c53b..e7b3c727 100755 --- a/src/Install/Installer.php +++ b/src/Install/Installer.php @@ -299,12 +299,18 @@ private function installSaferPayCardAlias() private function installSaferPayLog() { return Db::getInstance()->execute( - 'CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . 'saferpay_log' . '( - `id_saferpay_log` INTEGER(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY, - `message` TEXT NOT NULL, - `payload` TEXT NOT NULL, - `date_add` datetime NOT NULL - ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci' + 'CREATE TABLE IF NOT EXISTS ' . _DB_PREFIX_ . pSQL(\SaferPayLog::$definition['table']) . '( + `id_saferpay_log` INTEGER(10) UNSIGNED AUTO_INCREMENT, + `id_log` INT(10) DEFAULT 0, + `id_shop` INT(10) DEFAULT ' . (int) Configuration::get('PS_SHOP_DEFAULT') . ', + `message` TEXT DEFAULT NULL, + `request` MEDIUMTEXT DEFAULT NULL, + `response` MEDIUMTEXT DEFAULT NULL, + `context` TEXT DEFAULT NULL, + `date_add` datetime NOT NULL, + PRIMARY KEY (`id_saferpay_log`, `id_log`, `id_shop`), + INDEX (`id_log`) + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci' ); } diff --git a/upgrade/install-1.2.4.php b/upgrade/install-1.2.4.php new file mode 100644 index 00000000..e3ced5e0 --- /dev/null +++ b/upgrade/install-1.2.4.php @@ -0,0 +1,41 @@ + + *@copyright SIX Payment Services + *@license SIX Payment Services + */ + +if (!defined('_PS_VERSION_')) { + exit; +} + +function upgrade_module_1_2_4(SaferPayOfficial $module) +{ + return Db::getInstance()->execute( + 'ALTER TABLE ' . _DB_PREFIX_ . pSQL(SaferPayLog::$definition['table']) . ' + ADD COLUMN `id_log` INT(10) DEFAULT 0, + ADD COLUMN `id_shop` INT(10) DEFAULT ' . (int) Configuration::get('PS_SHOP_DEFAULT') . ', + CHANGE `payload` `request` TEXT, + ADD COLUMN `response` MEDIUMTEXT DEFAULT NULL, + ADD COLUMN `context` MEDIUMTEXT DEFAULT NULL, + DROP PRIMARY KEY, + PRIMARY KEY (`id_saferpay_log`, `id_log`, `id_shop`), + ADD INDEX (`id_log`),' + ); +}