checkExtensionOrThrowError(); /** * run kerio service */ $result = $this->kerioRunService($params); return $result; }catch (\Exception $ex) { /** * return some crit error */ return $ex->getMessage(); } } /** * @param null $params * @return string */ protected function kerioRunService($params = null) { $productManager = new ProductManager(); $productManager->loadById($params['pid']); $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0'); try { $api->login($params['serverhostname'], $params['serverusername'], $params['serverpassword']); $result = $api->getDomains(['name', 'id']); } catch (KerioApiException $error) { logModuleCall( 'kerioEmail', __FUNCTION__, $error, 'Debug Error', $error->getMessage() ); return ['error' => $error->getMessage()]; } logModuleCall( 'kerioEmail', __FUNCTION__, $result, 'Debug ChangePackage', $params ); $api->logout(); return Response::SUCCESS; } }