fix price force refresh

This commit is contained in:
2026-06-14 12:01:20 +03:30
parent 50a726f251
commit 1abddfbab8
6 changed files with 229 additions and 37 deletions
+10 -1
View File
@@ -4,6 +4,7 @@ namespace App\Services;
use App\Models\Cnt;
use App\Models\Order;
use App\Models\Setting;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
@@ -44,10 +45,18 @@ class MontzarService
$token = $response['access_token'] ?? $response['token'] ?? null;
if (!$token) {
Log::error('Montzar login failed', [
'base_url' => $this->baseUrl(),
'mobile' => $this->config()->Config('montzar_mobile'),
'response' => $response,
]);
throw new \Exception('Montzar login failed: ' . json_encode($response, JSON_UNESCAPED_UNICODE));
}
$this->config()->UpdateConfig('montzar_token', $token);
Setting::updateOrCreate(
['key' => 'montzar_token'],
['value' => $token, 'is_active' => 1]
);
return $token;
}