Refactor SMS sending to use KavehNegar VerifyLookup templates
- Removed SmsTextResolver dependency from multiple services and controllers. - Introduced dispatchTemplate method in SmsService to handle SMS sending with templates. - Updated existing SMS sending logic across various services (OtpService, PreRegistrationController, ClinicInvitationService, PaymentManager, SecretaryController, RepresentationActionController) to utilize the new dispatchTemplate method. - Enhanced SmsMessageTemplate entity to include kavenegar_template and token_map fields. - Created migration to add new fields to the sms_message_templates table and populate them with existing data. - Updated SeedSmsMessageTemplatesCommand to handle new template structure. - Added documentation for the new SMS template structure and usage.
This commit is contained in:
@@ -12,7 +12,6 @@ use App\Shared\Constant\ErrorCodes;
|
||||
use App\Shared\Controller\BaseController;
|
||||
use App\Sms\Entity\SmsLog;
|
||||
use App\Sms\Service\SmsService;
|
||||
use App\Sms\Service\SmsTextResolver;
|
||||
use App\Subscription\Service\SubscriptionService;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -34,7 +33,6 @@ class SecretaryController extends BaseController
|
||||
private readonly UserPasswordHasherInterface $hasher,
|
||||
private readonly SubscriptionService $subscriptionService,
|
||||
private readonly SmsService $smsService,
|
||||
private readonly SmsTextResolver $smsText,
|
||||
private readonly string $appUrl,
|
||||
) {}
|
||||
|
||||
@@ -130,13 +128,11 @@ class SecretaryController extends BaseController
|
||||
|
||||
$link = rtrim($this->appUrl, '/') . '/login';
|
||||
|
||||
$message = $this->smsText->resolve(SmsLog::TAG_SECRETARY, [
|
||||
$this->smsService->dispatchTemplate(SmsLog::TAG_SECRETARY, $mobile, [
|
||||
'owner' => $ownerName,
|
||||
'username' => $mobile,
|
||||
'link' => $link,
|
||||
]);
|
||||
|
||||
$this->smsService->dispatchAsync($mobile, $message, tag: SmsLog::TAG_SECRETARY);
|
||||
}
|
||||
|
||||
#[Route('/api/v1/secretary/{uuid}', methods: ['GET'])]
|
||||
|
||||
Reference in New Issue
Block a user