feat(sms): simplify SMS settings to use only KAVENEGAR_API_KEY from env, remove other SMS-related fields from config

This commit is contained in:
hamed
2026-07-01 11:53:16 +03:30
parent 9d8d1014f1
commit b366baa64c
11 changed files with 352 additions and 92 deletions
@@ -35,13 +35,6 @@ class SiteConfigController extends BaseController
'mellat_username',
'mellat_password',
'sep_terminal_id',
// sms provider
'sms_provider',
'kavenegar_api_key',
'kavenegar_sender',
'rangineh_api_key',
'rangineh_sender',
'sms_price_rials',
];
public function __construct(
@@ -53,7 +46,10 @@ class SiteConfigController extends BaseController
#[Route('/api/v1/admin/settings', methods: ['GET'])]
public function get(): JsonResponse
{
return $this->success($this->configRepo->getAll());
$config = $this->configRepo->getAll();
// کلید API پیامک فقط از env؛ فقط وضعیت تنظیم‌بودن برگردانده می‌شود نه مقدار.
$config['sms_api_key_configured'] = ($_ENV['KAVENEGAR_API_KEY'] ?? '') !== '';
return $this->success($config);
}
#[Route('/api/v1/admin/settings', methods: ['PATCH'])]
@@ -28,13 +28,6 @@ class SiteConfigRepository extends ServiceEntityRepository
'mellat_username' => '',
'mellat_password' => '',
'sep_terminal_id' => '',
// sms provider
'sms_provider' => 'kavenegar',
'kavenegar_api_key' => '',
'kavenegar_sender' => '',
'rangineh_api_key' => '',
'rangineh_sender' => '',
'sms_price_rials' => '500',
];
public function __construct(ManagerRegistry $registry)