Remove outdated edge gateway object classes, add new agent implementation
Transitioned from obsolete gateway object classes (`edge_gateway_shell_action_jobs_o`, `edge_gateway_shell_events_o`, `edge_gateway_shell_sessions_o`, `edge_gateway_update_jobs_o`) to the new agent implementation (`edge-gateway-agent/agent.php`).
This commit is contained in:
@@ -39,6 +39,8 @@ use Psr\Http\Client\ClientExceptionInterface;
|
||||
|
||||
#[AllowDynamicProperties] class email implements email_i
|
||||
{
|
||||
public static array $fake_deliveries = [];
|
||||
|
||||
/**
|
||||
* Configuration for the email service
|
||||
* @var email_c
|
||||
@@ -125,6 +127,17 @@ use Psr\Http\Client\ClientExceptionInterface;
|
||||
*/
|
||||
private function sendEmailMailerSend(string $to, string $recipient_name, string $subject, string $message, string $html = null, string $references = null, array $attachments = []): void
|
||||
{
|
||||
if (self::isFakeDeliveryEnabled()) {
|
||||
self::$fake_deliveries[] = [
|
||||
'to' => $to,
|
||||
'recipient_name' => $recipient_name,
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
'html' => $html,
|
||||
];
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the email is blacklisted
|
||||
$blacklisted_emails = [
|
||||
'invoice.dk@freja.com', // TODO: Make this dynamic.
|
||||
@@ -209,6 +222,16 @@ use Psr\Http\Client\ClientExceptionInterface;
|
||||
$this->sendEmailMailerSend($to, $recipient_name, 'Betalingslink for bestilling #' . $order_id, '', $html);
|
||||
}
|
||||
|
||||
public static function resetFakeDeliveries(): void
|
||||
{
|
||||
self::$fake_deliveries = [];
|
||||
}
|
||||
|
||||
private static function isFakeDeliveryEnabled(): bool
|
||||
{
|
||||
return getenv('EMAIL_FAKE_MODE') === '1';
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a booking confirmation email
|
||||
* @throws MailerSendException
|
||||
@@ -488,4 +511,4 @@ use Psr\Http\Client\ClientExceptionInterface;
|
||||
$this->attachments
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user