maxAttempts; $attempt++) { $response = $this->http->getWithToken( "pull_updates/getStatusPartGenerationByNewCoreJson?operation_identity={$operationIdentity}", $accessToken ); $body = $response->json(); $status = $body['status'] ?? -2; Log::channel('vikon')->info('Vikon poll part status', [ 'operation' => $operationIdentity, 'status' => $status, 'attempt' => $attempt + 1, ]); // VIKON API returns numeric status: -1 = failed, 1 = completed if ($status === 1) { return ['status' => 'completed']; } if ($status === -1) { return [ 'status' => 'failed', 'error' => $body['message'] ?? 'Generation failed on server', ]; } if ($attempt < $this->maxAttempts - 1) { sleep($this->interval); } } return ['status' => 'timeout']; } }