feat(settings): enable_automation gate; reject stale montzar quote jumps

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-24 16:15:52 +03:30
co-authored by Cursor
parent b28a98938e
commit 352bb9976d
9 changed files with 212 additions and 18 deletions
+11 -4
View File
@@ -341,7 +341,8 @@ class ReportController extends Controller
$config->applyMontzarSyncFailure();
if (!$config->getBool('montzar_closed', true)) {
$montzarLivePrice = $config->getInt('montzar_live_price', 0);
$stale = $config->getInt('montzar_live_price', 0);
$montzarLivePrice = $config->isPlausibleQuotePrice((float) $stale) ? $stale : 0;
}
}
}
@@ -392,7 +393,12 @@ class ReportController extends Controller
if ($priceProvider === 'zaarbox' && $zaarbox_price > 0 && !$closed) {
$priceValue = $zaarbox_price;
$priceSource = 'zaarbox';
} elseif ($priceProvider === 'montzar' && ($montzarLivePrice ?? 0) !== 0 && !$closed) {
} elseif (
$priceProvider === 'montzar'
&& ($montzarLivePrice ?? 0) !== 0
&& !$closed
&& $config->isPlausibleQuotePrice((float) $montzarLivePrice)
) {
$priceValue = (int) $montzarLivePrice;
$priceSource = 'montzar';
} elseif ($priceProvider === 'main_product' && ($pr_price ?? 0) !== 0 && !$closed) {
@@ -581,13 +587,14 @@ class ReportController extends Controller
$montzar = 0;
$config->applyMontzarSyncFailure();
if (!$config->getBool('montzar_closed', true)) {
$montzar = $config->getInt('montzar_live_price', 0);
$stale = $config->getInt('montzar_live_price', 0);
$montzar = $config->isPlausibleQuotePrice((float) $stale) ? $stale : 0;
}
\Log::error('STORE MONZAR PRICE ERROR', ['message' => $e->getMessage()]);
}
}
if ($montzarEnabled && $montzar !== 0) {
if ($montzarEnabled && $montzar !== 0 && $config->isPlausibleQuotePrice((float) $montzar)) {
$priceValue = $montzar;
$priceSource = 'montzar';
} else {