|
|
@@ -7,6 +7,7 @@ use ThurData\Servers\KerioEmail\App\Enums\Response;
|
|
|
use ThurData\Servers\KerioEmail\App\Helpers\KerioManager;
|
|
|
use ThurData\Servers\KerioEmail\App\Traits\ExtensionsCheckerTrait;
|
|
|
use ThurData\Servers\KerioEmail\Core\App\Controllers\Instances\AddonController;
|
|
|
+use ThurData\Servers\KerioEmail\Api\KerioWhmcs;
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
@@ -51,20 +52,43 @@ class SuspendAccount extends AddonController
|
|
|
*/
|
|
|
protected function kerioRunService($params = null)
|
|
|
{
|
|
|
- $service = (new KerioManager())
|
|
|
- ->getApiByServer($params['serverid'])
|
|
|
- ->soap
|
|
|
- ->service()
|
|
|
- ->suspendDomain()
|
|
|
- ->setFormData($params)
|
|
|
- ;
|
|
|
-
|
|
|
- $result = $service->run();
|
|
|
-
|
|
|
- if(!$result)
|
|
|
- {
|
|
|
- return $service->getError();
|
|
|
+ $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
|
|
|
+ try {
|
|
|
+ $api->login($params['serverhostname'], $params['serverusername'], $params['serverpassword']);
|
|
|
+ $domainID = $api->getDomainId($params['domain']);
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $error,
|
|
|
+ 'Debug Error',
|
|
|
+ $error->getMessage()
|
|
|
+ );
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
+ }
|
|
|
+ if ($domainID === FALSE) {
|
|
|
+ return "Error: Domain $domain not found";
|
|
|
}
|
|
|
+ try {
|
|
|
+ $users = $api->getUsers(['id'], $domainID);
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $error,
|
|
|
+ 'Debug Error',
|
|
|
+ $error->getMessage()
|
|
|
+ );
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
+ }
|
|
|
+
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $domainID,
|
|
|
+ 'Debug SuspendAccount',
|
|
|
+ $users
|
|
|
+ );
|
|
|
|
|
|
/**
|
|
|
* return success response
|