Add per-customer SMS and Bird Integrations for event messaging.
Deploy Ladill Events / deploy (push) Successful in 28s

Attendee and speaker comms use encrypted tenant relay credentials and skip platform-key fallback and Bird wallet double-debit.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-12 17:05:54 +00:00
co-authored by Cursor
parent 13b2bd9702
commit 6e42cd1cb2
21 changed files with 1095 additions and 80 deletions
+40 -4
View File
@@ -2,15 +2,32 @@
namespace App\Services\Billing;
use App\Services\Messaging\CustomerSmsClient;
use App\Services\Messaging\MessagingCredentialsService;
class SmsService
{
public function __construct(private readonly PlatformSmsClient $platform) {}
private ?string $lastError = null;
public function send(string $ownerPublicId, string $to, string $message): void
public function __construct(
private readonly CustomerSmsClient $customer,
private readonly MessagingCredentialsService $credentials,
) {}
public function lastError(): ?string
{
return $this->lastError;
}
public function send(string $ownerPublicId, string $to, string $message): bool
{
$this->lastError = null;
$phone = preg_replace('/\D+/', '', $to);
if (strlen($phone) < 9) {
return;
$this->lastError = 'Enter a valid phone number.';
return false;
}
if (strlen($phone) === 9) {
@@ -19,6 +36,25 @@ class SmsService
$phone = '233'.substr($phone, 1);
}
$this->platform->send($ownerPublicId, $phone, $message);
$credential = $this->credentials->forOwner($ownerPublicId);
if (! $credential->hasValidSms()) {
$this->lastError = 'Connect Ladill SMS in Integrations before sending attendee SMS.';
return false;
}
$apiKey = $credential->smsApiKey();
if (! $apiKey) {
$this->lastError = 'SMS credentials could not be decrypted. Reconnect SMS in Integrations.';
return false;
}
$sent = $this->customer->send($apiKey, $phone, $message, (string) $credential->sms_sender_id);
if (! $sent) {
$this->lastError = $this->customer->lastError() ?: 'The SMS could not be sent.';
}
return $sent;
}
}