This commit is contained in:
2026-02-02 17:30:17 +01:00
parent ae0ee002ec
commit 68c2d651c6
16 changed files with 173 additions and 44 deletions

View File

@@ -29,7 +29,7 @@ RewriteRule ^145-materace-180x200/?$ https://lulandia.pl/s/680/materace-180x200-
SecRuleEngine Off
SecRuleEngine On

View File

@@ -0,0 +1,33 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License (MIT)
* that is bundled with this package in the file LICENSE.md.
*
* @author mElements S.A.
* @copyright mElements S.A.
* @license MIT License
*/
class PaynowCompatibilityHelper
{
public static function encrypt($to_encrypt)
{
if (method_exists('Tools', 'hash')) {
return Tools::hash($to_encrypt);
} else {
return Tools::encrypt($to_encrypt);
}
}
public static function redirect($url)
{
if (method_exists('Tools', 'redirect')) {
return Tools::redirect($url);
} else {
return Tools::redirectLink($url);
}
}
}

View File

@@ -36,7 +36,7 @@ class PaynowFrontController extends ModuleFrontControllerCore
public function generateToken(): string
{
return Tools::encrypt($this->context->customer->secure_key);
return PaynowCompatibilityHelper::encrypt($this->context->customer->secure_key);
}
public function isTokenValid(): bool

View File

@@ -29,7 +29,7 @@ class PaynowLinkHelper
);
}
return PaynowLinkHelper::getReturnUrl($external_id, Tools::encrypt($secure_key));
return PaynowLinkHelper::getReturnUrl($external_id, PaynowCompatibilityHelper::encrypt($secure_key));
}
public static function getPaymentUrl($url_params = null): string

View File

@@ -21,7 +21,7 @@ class PaynowLogger
{
if ((int)Configuration::get('PAYNOW_DEBUG_LOGS_ENABLED') === 1) {
$file_name = 'paynow-' . date('Y-m-d');
$file_path = dirname(__FILE__) . '/../log/' . $file_name . '-' . Tools::encrypt($file_name) . '.log';
$file_path = dirname(__FILE__) . '/../log/' . $file_name . '-' . PaynowCompatibilityHelper::encrypt($file_name) . '.log';
file_put_contents($file_path, self::processRecord($type, $message, $context), FILE_APPEND);
}

View File

@@ -272,7 +272,16 @@ class PaynowOrderStateProcessor
} else {
$payment->status = $data['status'];
$payment->sent_at = $data['modifiedAt'];
$payment->save();
$result = $payment->save();
if (!$result) {
PaynowLogger::debug(
'Can\'t update paynow data entry on notification processing end',
[
'DB error' => Db::getInstance()->getMsgError(),
]
);
}
}
$this->lockingHelper->delete($externalIdForLockingSystem);

View File

@@ -160,7 +160,7 @@ class PaynowPaymentOptions
'paymentMethodId' => $payment_method->getId()
]
),
'action_token' => Tools::encrypt($this->context->customer->secure_key ?? ''),
'action_token' => PaynowCompatibilityHelper::encrypt($this->context->customer->secure_key ?? ''),
'action_token_refresh' => Context::getContext()->link->getModuleLink('paynow', 'customerToken'),
'error_message' => $this->getMessage('An error occurred during the payment process'),
'terms_message' => $this->getMessage('First accept the terms of service, then click pay.'),
@@ -175,7 +175,7 @@ class PaynowPaymentOptions
'paynow',
'removeSavedInstrument'
),
'action_remove_saved_instrument_token' => Tools::encrypt($this->context->customer->secure_key ?? ''),
'action_remove_saved_instrument_token' => PaynowCompatibilityHelper::encrypt($this->context->customer->secure_key ?? ''),
'default_card_image' => Media::getMediaPath(_PS_MODULE_DIR_ . $this->module->name . '/views/img/card-default.svg'),
'paynow_card_instruments' => $payment_method->getSavedInstruments(),
]);

View File

@@ -872,7 +872,7 @@
},
{
"name": "symfony/polyfill-php80",
"version": "v1.32.0",
"version": "v1.33.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
@@ -932,7 +932,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.33.0"
},
"funding": [
{
@@ -943,6 +943,10 @@
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
@@ -1025,16 +1029,16 @@
},
{
"name": "composer/semver",
"version": "3.4.3",
"version": "3.4.4",
"source": {
"type": "git",
"url": "https://github.com/composer/semver.git",
"reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12"
"reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12",
"reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12",
"url": "https://api.github.com/repos/composer/semver/zipball/198166618906cb2de69b95d7d47e5fa8aa1b2b95",
"reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95",
"shasum": ""
},
"require": {
@@ -1086,7 +1090,7 @@
"support": {
"irc": "ircs://irc.libera.chat:6697/composer",
"issues": "https://github.com/composer/semver/issues",
"source": "https://github.com/composer/semver/tree/3.4.3"
"source": "https://github.com/composer/semver/tree/3.4.4"
},
"funding": [
{
@@ -1096,13 +1100,9 @@
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2024-09-19T14:15:21+00:00"
"time": "2025-08-20T19:15:30+00:00"
},
{
"name": "composer/xdebug-handler",
@@ -1244,6 +1244,7 @@
"issues": "https://github.com/doctrine/annotations/issues",
"source": "https://github.com/doctrine/annotations/tree/1.14.4"
},
"abandoned": true,
"time": "2024-09-05T10:15:52+00:00"
},
{
@@ -1787,16 +1788,16 @@
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.13.2",
"version": "3.13.4",
"source": {
"type": "git",
"url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
"reference": "5b5e3821314f947dd040c70f7992a64eac89025c"
"reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5b5e3821314f947dd040c70f7992a64eac89025c",
"reference": "5b5e3821314f947dd040c70f7992a64eac89025c",
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ad545ea9c1b7d270ce0fc9cbfb884161cd706119",
"reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119",
"shasum": ""
},
"require": {
@@ -1867,7 +1868,7 @@
"type": "thanks_dev"
}
],
"time": "2025-06-17T22:17:01+00:00"
"time": "2025-09-05T05:47:09+00:00"
},
{
"name": "symfony/console",
@@ -2311,7 +2312,7 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.32.0",
"version": "v1.33.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
@@ -2370,7 +2371,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.0"
},
"funding": [
{
@@ -2381,6 +2382,10 @@
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
@@ -2390,7 +2395,7 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.32.0",
"version": "v1.33.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
@@ -2451,7 +2456,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0"
},
"funding": [
{
@@ -2462,6 +2467,10 @@
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"

View File

@@ -81,7 +81,7 @@ class PaynowChargeBlikModuleFrontController extends PaynowFrontController
'external_id' => $payment_data['external_id'],
'paymentId' => $payment_data['payment_id'],
'paymentStatus' => $payment_data['status'],
'token' => Tools::encrypt($this->context->customer->secure_key)
'token' => PaynowCompatibilityHelper::encrypt($this->context->customer->secure_key)
])
]);

View File

@@ -155,7 +155,7 @@ class PaynowPaymentModuleFrontController extends PaynowFrontController
])) {
return PaynowLinkHelper::getReturnUrl(
$payment_data['external_id'],
Tools::encrypt($payment_data['external_id'])
PaynowCompatibilityHelper::encrypt($payment_data['external_id'])
);
}

View File

@@ -66,12 +66,14 @@ class PaynowReturnModuleFrontController extends PaynowFrontController
PaynowLogger::debug('Return: status processing failed', $statusToProcess);
}
Tools::redirectLink(PaynowLinkHelper::getContinueUrl(
$this->order->id_cart,
$this->module->id,
$this->order->secure_key,
$this->payment->external_id
));
PaynowCompatibilityHelper::redirect(
PaynowLinkHelper::getContinueUrl(
$this->order->id_cart,
$this->module->id,
$this->context->customer->secure_key,
$this->payment->external_id
)
);
}
$currentState = $this->order->getCurrentStateFull($this->context->language->id);

View File

@@ -16,6 +16,7 @@ if (!defined('_PS_VERSION_')) {
include_once(dirname(__FILE__) . '/vendor/autoload.php');
include_once(dirname(__FILE__) . '/classes/PaynowFrontController.php');
include_once(dirname(__FILE__) . '/classes/PaynowCompatibilityHelper.php');
include_once(dirname(__FILE__) . '/classes/PaynowLogger.php');
include_once(dirname(__FILE__) . '/classes/PaynowHelper.php');
include_once(dirname(__FILE__) . '/classes/PaynowKeysGenerator.php');
@@ -50,7 +51,7 @@ class Paynow extends PaymentModule
{
$this->name = 'paynow';
$this->tab = 'payments_gateways';
$this->version = '1.7.12';
$this->version = '1.7.13';
$this->ps_versions_compliancy = ['min' => '1.6.0', 'max' => _PS_VERSION_];
$this->author = 'mElements S.A.';
$this->is_eu_compatible = 1;
@@ -522,7 +523,7 @@ class Paynow extends PaymentModule
'paymentMethodId' => $payment_method->getId()
]
),
'action_token' => Tools::encrypt($this->context->customer->secure_key),
'action_token' => PaynowCompatibilityHelper::encrypt($this->context->customer->secure_key),
'action_token_refresh' => Context::getContext()->link->getModuleLink('paynow', 'customerToken'),
'error_message' => $this->getTranslationsArray()['An error occurred during the payment process'],
'terms_message' => $this->getTranslationsArray()['First accept the terms of service, then click pay.'],
@@ -548,7 +549,7 @@ class Paynow extends PaymentModule
'paynow',
'removeSavedInstrument'
),
'action_token' => Tools::encrypt($this->context->customer->secure_key),
'action_token' => PaynowCompatibilityHelper::encrypt($this->context->customer->secure_key),
'default_card_image' => Media::getMediaPath(_PS_MODULE_DIR_ . $this->name . '/views/img/card-default.svg'),
'instruments' => $payment_method->getSavedInstruments(),
]);
@@ -680,7 +681,7 @@ class Paynow extends PaymentModule
public function hookDisplayAdminAfterHeader()
{
$file_name = 'paynow-' . date('Y-m-d');
$file_path = dirname(__FILE__) . '/log/' . $file_name . '-' . Tools::encrypt($file_name) . '.log';
$file_path = dirname(__FILE__) . '/log/' . $file_name . '-' . PaynowCompatibilityHelper::encrypt($file_name) . '.log';
if (Tools::getValue('show_paynow_logs')) {
echo '<pre>';
@@ -708,7 +709,9 @@ class Paynow extends PaymentModule
public function hookActionAdminControllerSetMedia($params)
{
if (Tools::getValue("configure") && Tools::getValue("configure") == "paynow") {
ContextCore::getContext()->controller->addJquery();
if (method_exists(ContextCore::getContext()->controller, 'addJquery')) {
ContextCore::getContext()->controller->addJquery();
}
ContextCore::getContext()->controller->addJS(($this->_path) . '/views/js/admin.js', 'all');
}
}

View File

@@ -0,0 +1,64 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License (MIT)
* that is bundled with this package in the file LICENSE.md.
*
* @author mElements S.A.
* @copyright mElements S.A.
* @license MIT License
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* @throws PrestaShopDatabaseException
*/
function upgrade_module_1_7_13($module)
{
try {
if (Db::getInstance()->executeS('SHOW COLUMNS FROM ' . _DB_PREFIX_ . 'paynow_payments LIKE "external_id"') == false) {
Db::getInstance()->execute('ALTER TABLE ' . _DB_PREFIX_ . 'paynow_payments ADD external_id VARCHAR(50) NOT NULL AFTER `order_reference`');
}
if (Db::getInstance()->ExecuteS('SHOW COLUMNS FROM ' . _DB_PREFIX_ . 'paynow_payments LIKE "total"') == false) {
Db::getInstance()->Execute("ALTER TABLE `" . _DB_PREFIX_ . "paynow_payments` ADD `total` DECIMAL(20,6) NOT NULL DEFAULT '0.000000' AFTER `status`;");
}
if (Db::getInstance()->ExecuteS('SHOW COLUMNS FROM ' . _DB_PREFIX_ . 'paynow_payments LIKE "locked"') == false) {
Db::getInstance()->Execute("ALTER TABLE `" . _DB_PREFIX_ . "paynow_payments` ADD `locked` TINYINT(1) NOT NULL DEFAULT 0 AFTER `total`;");
}
if (Db::getInstance()->ExecuteS('SHOW COLUMNS FROM ' . _DB_PREFIX_ . 'paynow_payments LIKE "counter"') == false) {
Db::getInstance()->Execute("ALTER TABLE `" . _DB_PREFIX_ . "paynow_payments` ADD `counter` TINYINT(1) NOT NULL DEFAULT 0 AFTER `locked`;");
}
if (Db::getInstance()->ExecuteS('SHOW COLUMNS FROM ' . _DB_PREFIX_ . 'paynow_payments LIKE "active"') == false) {
Db::getInstance()->Execute("ALTER TABLE `" . _DB_PREFIX_ . "paynow_payments` ADD `active` TINYINT(1) NOT NULL DEFAULT 0 AFTER `counter`;");
}
if (Db::getInstance()->ExecuteS('SHOW COLUMNS FROM ' . _DB_PREFIX_ . 'paynow_payments LIKE "sent_at"') == false) {
Db::getInstance()->Execute("ALTER TABLE `" . _DB_PREFIX_ . "paynow_payments` ADD `sent_at` datetime NULL AFTER `active`;");
}
Db::getInstance()->Execute('CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'paynow_payment_locks` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`id_order` INT(10) UNSIGNED NOT NULL DEFAULT 0,
`id_cart` INT(10) UNSIGNED NOT NULL DEFAULT 0,
`counter` tinyint(1) NOT NULL DEFAULT 0,
`created_at` datetime,
`modified_at` datetime,
INDEX `index_payment_cart_reference` (`id_cart`),
INDEX `index_payment_order_reference` (`id_order`)
)');
} catch (PrestaShopDatabaseException $exception) {
PaynowLogger::error('Fatal error on upgrade: ' . $exception->getMessage() . ' ' . $exception->getTraceAsString());
}
return true;
}

View File

@@ -908,8 +908,8 @@
},
{
"name": "symfony/polyfill-php80",
"version": "v1.32.0",
"version_normalized": "1.32.0.0",
"version": "v1.33.0",
"version_normalized": "1.33.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
@@ -971,7 +971,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.33.0"
},
"funding": [
{
@@ -982,6 +982,10 @@
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"

View File

@@ -99,6 +99,7 @@ p.payment_module .paynow img {
padding: 0;
}
button.payment__option,
button.payment-option {
width: 100%;
padding: 33px 40px 34px 17px;
@@ -137,6 +138,8 @@ p.payment_module.paynow button:after {
height: auto !important;
}
.payment__option img,
.payment-option img {
max-height: 1rem !important;
/*max-width: 80px !important;*/
@@ -145,6 +148,7 @@ p.payment_module.paynow button:after {
margin-left: 10px;
}
.paynow .payment__option:disabled img,
.paynow .payment-option:disabled img {
opacity: 0.3;
filter: grayscale(1);

View File

@@ -177,6 +177,7 @@ var paynow = {
} else if ($(paynow.selectors.cardMethodOptions).is(':visible') && !$(paynow.selectors.cardMethod + ':checked').length) {
paynow.paymentButton.disable()
} else if ($('div.paynow-payment-pbls .paynow-payment-option-pbl').is(':visible')) {
paynow.paymentButton.show()
paynow.pblValidate()
} else {
paynow.paymentButton.enable()