Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SV-33 Logger database schema changes #199

Merged
merged 21 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@
"php": "5.6"
}
},
"repositories": [
{
"repositories": {
"knapsack": {
"type": "vcs",
"url": "https://github.com/Invertus/Knapsack.git"
},
"0": {
MarijusCoding marked this conversation as resolved.
Show resolved Hide resolved
"type": "vcs",
"url": "https://github.com/Invertus/lock.git",
"no-api": true
}
],
},
"require": {
"vlucas/phpdotenv": "^3.6",
"symfony/expression-language": "^3.4",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion saferpayofficial.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
18 changes: 15 additions & 3 deletions src/Entity/SaferPayLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
],
];
Expand Down
16 changes: 10 additions & 6 deletions src/Install/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,16 @@ 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 PRIMARY KEY,
MarijusCoding marked this conversation as resolved.
Show resolved Hide resolved
`id_log` INTEGER(10) DEFAULT 0,
`id_shop` INTEGER(10) DEFAULT 1,
MarijusCoding marked this conversation as resolved.
Show resolved Hide resolved
`message` TEXT NOT NULL DEFAULT "",
`request` TEXT NOT NULL DEFAULT "",
MarijusCoding marked this conversation as resolved.
Show resolved Hide resolved
`response` TEXT NOT NULL DEFAULT "",
`context` TEXT NOT NULL DEFAULT "",
`date_add` datetime NOT NULL DEFAULT NOW()
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'
MarijusCoding marked this conversation as resolved.
Show resolved Hide resolved
);
}

Expand Down
42 changes: 42 additions & 0 deletions upgrade/install-1.2.4.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
*NOTICE OF LICENSE
*
*This source file is subject to the Open Software License (OSL 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/osl-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 [email protected] 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 INVERTUS UAB www.invertus.eu <[email protected]>
*@copyright SIX Payment Services
*@license SIX Payment Services
*/

use Invertus\SaferPay\Config\SaferPayConfig;
use Invertus\SaferPay\DTO\Request\RequestHeader;
MarijusCoding marked this conversation as resolved.
Show resolved Hide resolved

if (!defined('_PS_VERSION_')) {
exit;
}

function upgrade_module_1_2_4(SaferPayOfficial $module)
{
return Db::getInstance()->execute(
'ALTER TABLE ' . _DB_PREFIX_ . SaferPayLog::$definition['table'] . '
MarijusCoding marked this conversation as resolved.
Show resolved Hide resolved
ADD COLUMN `id_log` INTEGER(10) DEFAULT 0,
MarijusCoding marked this conversation as resolved.
Show resolved Hide resolved
ADD COLUMN `id_shop` INTEGER(10) DEFAULT 1,
MarijusCoding marked this conversation as resolved.
Show resolved Hide resolved
CHANGE `payload` `request` TEXT,
ADD COLUMN `response` TEXT DEFAULT "",
ADD COLUMN `context` TEXT DEFAULT "",
ADD PRIMARY KEY (`id_log`, `id_shop`);'
MarijusCoding marked this conversation as resolved.
Show resolved Hide resolved
);
}