feat(Reminder process): add 4 reminder phases for membership (Retzien)
All checks were successful
Deploy Roxane to Preprod / deploy (push) Successful in 1m21s

This commit is contained in:
2026-09-06 17:03:14 +02:00
parent 98893924ac
commit ba11ee7120
61 changed files with 967 additions and 162 deletions

View File

@@ -18,9 +18,9 @@ class ISPConfigMailService extends ISPConfigService
public function getAllMailDomains(): array
{
return Cache::remember(
"ispconfig.mail.domains.all",
'ispconfig.mail.domains.all',
config('services.ispconfig.cache_ttl'),
fn() => $this->call('mail_domain_get', ['primary_id' => -1])
fn () => $this->call('mail_domain_get', ['primary_id' => -1])
);
}
@@ -30,9 +30,9 @@ class ISPConfigMailService extends ISPConfigService
public function getAllMailUsers(): array
{
return Cache::remember(
"ispconfig.mail.users.all",
'ispconfig.mail.users.all',
config('services.ispconfig.cache_ttl'),
fn() => $this->call('mail_user_get', ['primary_id' => -1])
fn () => $this->call('mail_user_get', ['primary_id' => -1])
);
}
@@ -56,7 +56,7 @@ class ISPConfigMailService extends ISPConfigService
$allUsers = $this->getAllMailUsers();
return collect($allUsers)->filter(function ($user) use ($domain) {
return str_ends_with($user['email'], '@' . $domain);
return str_ends_with($user['email'], '@'.$domain);
});
}
@@ -69,7 +69,7 @@ class ISPConfigMailService extends ISPConfigService
$user = collect($allUsers)->firstWhere('email', $email);
if (!$user) {
if (! $user) {
return null;
}
@@ -97,7 +97,7 @@ class ISPConfigMailService extends ISPConfigService
$user = collect($this->getAllMailUsers())
->firstWhere('email', $email);
if (!$user) {
if (! $user) {
return false;
}
@@ -105,10 +105,10 @@ class ISPConfigMailService extends ISPConfigService
// On récupère l'enregistrement COMPLET (OBLIGATOIRE)
$mailUserRecord = $this->call('mail_user_get', [
$mailuserId
$mailuserId,
]);
if (!is_array($mailUserRecord)) {
if (! is_array($mailUserRecord)) {
throw new \RuntimeException('mail_user_get did not return array');
}
@@ -121,11 +121,9 @@ class ISPConfigMailService extends ISPConfigService
$result = $this->call('mail_user_update', [
0, // client_id (ADMIN)
$mailuserId, // primary_id
$mailUserRecord // FULL RECORD
$mailUserRecord, // FULL RECORD
]);
return (bool) $result;
}
}

View File

@@ -4,15 +4,18 @@ namespace App\Services\ISPConfig;
use Exception;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
use SoapClient;
use SoapFault;
use Illuminate\Support\Facades\Log;
class ISPConfigService
{
protected ?SoapClient $client = null;
protected ?string $sessionId = null;
protected array $config;
protected string $serverType;
/**
@@ -23,7 +26,7 @@ class ISPConfigService
$this->serverType = $serverType;
$this->config = config("services.ispconfig.servers.{$serverType}");
if (!$this->config) {
if (! $this->config) {
throw new Exception("ISPConfig server configuration not found for: {$serverType}");
}
}
@@ -44,8 +47,8 @@ class ISPConfigService
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
]
])
],
]),
]);
$this->sessionId = $this->client->login(
@@ -53,17 +56,17 @@ class ISPConfigService
$this->config['password']
);
Log::info("ISPConfig connected", [
Log::info('ISPConfig connected', [
'server' => $this->serverType,
'session_id' => $this->sessionId
'session_id' => $this->sessionId,
]);
} catch (SoapFault $e) {
Log::error("ISPConfig connection failed", [
Log::error('ISPConfig connection failed', [
'server' => $this->serverType,
'error' => $e->getMessage()
'error' => $e->getMessage(),
]);
throw new Exception("Failed to connect to ISPConfig: " . $e->getMessage());
throw new Exception('Failed to connect to ISPConfig: '.$e->getMessage());
}
}
@@ -72,11 +75,11 @@ class ISPConfigService
if ($this->client && $this->sessionId) {
try {
$this->client->logout($this->sessionId);
Log::info("ISPConfig disconnected", ['server' => $this->serverType]);
Log::info('ISPConfig disconnected', ['server' => $this->serverType]);
} catch (SoapFault $e) {
Log::warning("ISPConfig logout failed", [
Log::warning('ISPConfig logout failed', [
'server' => $this->serverType,
'error' => $e->getMessage()
'error' => $e->getMessage(),
]);
}
@@ -97,21 +100,21 @@ class ISPConfigService
$result = $this->client->__soapCall($method, $params);
Log::debug("ISPConfig API call", [
Log::debug('ISPConfig API call', [
'method' => $method,
'server' => $this->serverType,
'success' => true
'success' => true,
]);
return $result;
} catch (SoapFault $e) {
Log::error("ISPConfig API call failed", [
Log::error('ISPConfig API call failed', [
'method' => $method,
'server' => $this->serverType,
'error' => $e->getMessage()
'error' => $e->getMessage(),
]);
throw new Exception("ISPConfig API call failed: " . $e->getMessage());
throw new Exception('ISPConfig API call failed: '.$e->getMessage());
}
}
@@ -126,9 +129,9 @@ class ISPConfigService
public function getAllClients(): array
{
return Cache::remember(
"ispconfig.mail.clients.all",
'ispconfig.mail.clients.all',
config('services.ispconfig.cache_ttl'),
fn() => $this->call('client_get_all')
fn () => $this->call('client_get_all')
);
}