fixed price

This commit is contained in:
2026-06-28 10:51:56 +03:30
parent dec13e8537
commit 14055c5770
4 changed files with 28 additions and 48 deletions
+9 -22
View File
@@ -497,39 +497,26 @@ class ConfigService
public function applyMontzarSyncFailure(): void
{
$staleLive = $this->getInt('montzar_live_price', 0);
$stillOpen = $this->getBool('montzar_open_buy', false)
|| $this->getBool('montzar_open_sell', false);
$this->UpdateConfig(
'montzar_closed',
($staleLive > 0 && $stillOpen) ? 'false' : 'true'
);
$this->UpdateConfig('montzar_closed', $staleLive > 0 ? 'false' : 'true');
}
public function assertMontzarOrderAllowed(int $direction): void
public function syncMontzarOpenFlagsFromProduct(array $montzarProduct): array
{
if (!$this->usesMontzarPricing()) {
return;
}
$direction = (int) $direction;
$openBuy = $this->getBool('montzar_open_buy', true);
$openSell = $this->getBool('montzar_open_sell', true);
if ($direction === 1 && !$openBuy) {
throw new UnprocessableEntityHttpException('عدم ارائه سرویس.');
if (array_key_exists('open_buy', $montzarProduct)) {
$openBuy = filter_var($montzarProduct['open_buy'], FILTER_VALIDATE_BOOLEAN);
$this->UpdateConfig('montzar_open_buy', $openBuy ? 'true' : 'false');
}
if ($direction === 2 && !$openSell) {
throw new UnprocessableEntityHttpException('عدم ارائه سرویس.');
if (array_key_exists('open_sell', $montzarProduct)) {
$openSell = filter_var($montzarProduct['open_sell'], FILTER_VALIDATE_BOOLEAN);
$this->UpdateConfig('montzar_open_sell', $openSell ? 'true' : 'false');
}
if ($this->getBool('montzar_closed', false)) {
$basePrice = app(ProductDisplayPriceService::class)->resolveOrderBasePrice();
if ($basePrice <= 0) {
throw new UnprocessableEntityHttpException('عدم ارائه سرویس.');
}
}
return ['open_buy' => $openBuy, 'open_sell' => $openSell];
}
public function formatTradingTimeForDisplay(string $time): string