Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
4.2.9
- FN-14233 Fixed a bug in extra commission calculation for loan amount (priceModifier) and in plugin update notification display logic.

4.2.8
- FN-14209 Fixed some bugs.

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [4.2.9](https://github.com/comfino/PrestaShop/tree/4.2.9) (2026-03-06)

[Full Changelog](https://github.com/comfino/PrestaShop/compare/4.2.8...4.2.9)

**Merged pull requests:**

- FN-14233 Fixed a bug in extra commission calculation for loan amount (priceModifier) and in plugin update notification display logic. [\#113](https://github.com/comfino/PrestaShop/pull/113) ([akozubskicr](https://github.com/akozubskicr))

## [4.2.8](https://github.com/comfino/PrestaShop/tree/4.2.8) (2026-03-04)

[Full Changelog](https://github.com/comfino/PrestaShop/compare/4.2.7...4.2.8)
Expand Down
17 changes: 12 additions & 5 deletions comfino.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
}

if (!defined('COMFINO_VERSION')) {
define('COMFINO_VERSION', '4.2.8');
define('COMFINO_VERSION', '4.2.9');
}

if (!defined('COMFINO_BUILD_TS')) {
define('COMFINO_BUILD_TS', 1772632040);
define('COMFINO_BUILD_TS', 1772806598);
}

if (!defined('WIDGET_INIT_SCRIPT_HASH')) {
Expand All @@ -63,7 +63,7 @@ public function __construct()
{
$this->name = 'comfino';
$this->tab = 'payments_gateways';
$this->version = '4.2.8';
$this->version = '4.2.9';
$this->author = 'Comfino';
$this->module_key = '3d3e14c65281e816da083e34491d5a7f';

Expand Down Expand Up @@ -426,8 +426,15 @@ private function checkGithubVersion()
$lastCheckTime = Configuration::get('COMFINO_GITHUB_VERSION_CHECK_TIME');

if ($lastCheckTime && (time() - (int) $lastCheckTime) < 86400) {
// Checked within last 24 hours, skip.
return;
// Checked within last 24 hours - but bypass if the running version changed (e.g. after an update).
if (is_array($cachedInfo = json_decode(Configuration::get('COMFINO_GITHUB_VERSION_INFO'), true))
&& (isset($cachedInfo['current_version']) ? $cachedInfo['current_version'] : '') === COMFINO_VERSION
) {
return;
}

// Version changed since last cache - force refresh.
Comfino\Update\UpdateManager::forceCheckForUpdates();
}

$updateInfo = Comfino\Update\UpdateManager::checkForUpdates();
Expand Down
80 changes: 40 additions & 40 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion controllers/front/payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,15 @@ public function postProcess(): void
}

$initLoanAmount = (int) filter_var($cookie->loan_amount, FILTER_VALIDATE_INT);
$priceModifier = (int) filter_var($cookie->price_modifier, FILTER_VALIDATE_INT);
$loanType = trim(filter_var($cookie->loan_type, FILTER_SANITIZE_STRING));
$loanTerm = (int) filter_var($cookie->loan_term, FILTER_VALIDATE_INT);

$priceModifier = filter_var($cookie->price_modifier, FILTER_VALIDATE_INT);

if ($priceModifier === false || $priceModifier < 0 || $priceModifier > 1000000) {
$priceModifier = 0;
}

$psOrder = new \Order($this->module->currentOrder);

try {
Expand Down
17 changes: 12 additions & 5 deletions controllers/front/paywall.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@

class ComfinoPaywallModuleFrontController extends ModuleFrontController
{
/**
* @throws Exception
*/
public function initContent(): void
{
ErrorLogger::init();
Expand All @@ -55,13 +58,17 @@ public function initContent(): void
return;
}

if (!Tools::isEmpty('priceModifier') && is_numeric(Tools::getValue('priceModifier'))) {
$priceModifier = (int) filter_var(Tools::getValue('priceModifier'), FILTER_VALIDATE_INT);
if (!Tools::isEmpty('priceModifier') && ctype_digit(Tools::getValue('priceModifier'))) {
$priceModifier = filter_var(Tools::getValue('priceModifier'), FILTER_VALIDATE_INT);

if ($priceModifier === false || $priceModifier < 0 || $priceModifier > 1000000) {
$priceModifier = 0;
}
} else {
$priceModifier = 0;
}

$loanAmount = (int) round(round($this->context->cart->getOrderTotal(), 2) * 100);
$cartTotal = (int) round(round($this->context->cart->getOrderTotal(), 2) * 100);

$shopCart = OrderManager::getShopCart($this->context->cart, $priceModifier);
$allowedProductTypes = SettingsManager::getAllowedProductTypes(
Expand All @@ -80,7 +87,7 @@ public function initContent(): void
'[PAYWALL]',
'renderPaywall',
[
'$loanAmount' => $loanAmount,
'$cartTotal' => $cartTotal,
'$priceModifier' => $priceModifier,
'$cartTotalValue' => $shopCart->getTotalValue(),
'$allowedProductTypes' => $allowedProductTypes,
Expand All @@ -99,7 +106,7 @@ public function initContent(): void

try {
$paywallContents = ApiClient::getInstance()->getPaywall(
new LoanQueryCriteria($loanAmount, null, null, $allowedProductTypes),
new LoanQueryCriteria($cartTotal, null, null, $priceModifier, $allowedProductTypes),
$paywallUrl
);

Expand Down
6 changes: 3 additions & 3 deletions src/View/FrontendManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,13 @@ public static function displayGithubVersionNotice(\Comfino $module): string
}

$updateInfo = json_decode($updateInfoJson, true);
$githubVersion = $updateInfo['github_version'] ?? '';

if (!isset($updateInfo['update_available']) || !$updateInfo['update_available']) {
// Re-evaluate against current version to avoid showing stale cached notice after an update.
if (empty($githubVersion) || !version_compare($githubVersion, COMFINO_VERSION, '>')) {
return '';
}

$githubVersion = $updateInfo['github_version'] ?? '';

// Check if this version was already dismissed.
if ($dismissedVersion === $githubVersion) {
return '';
Expand Down
Loading
Loading