feat: enhance staff management and payment gateway features
- Fix national code handling in staff creation and updates to support Persian digits. - Update ClinicStaff entity to allow longer national codes (up to 15 characters). - Implement support for clinic secretaries in SecretaryController, allowing creation without a doctor UUID. - Add a new endpoint to retrieve doctors associated with a clinic for secretary management. - Improve appointment management by ensuring doctors are selectable even when no appointments exist. - Extend PatientController to allow secretaries to create patient records if they have the appropriate permissions. - Introduce a PriceInput component for better price formatting in forms, supporting Persian digits. - Add a MockGateway for testing payment processes without real transactions. - Enhance SMS settings management with an approval flow for post-visit text messages, including new fields for pending text and status. - Update migrations to reflect changes in database schema for national codes and SMS settings.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Sms\Provider;
|
||||
|
||||
use App\Config\Repository\SiteConfigRepository;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class KavehNegarProvider implements SmsProviderInterface
|
||||
@@ -9,22 +10,26 @@ class KavehNegarProvider implements SmsProviderInterface
|
||||
private const BASE = 'https://api.kavenegar.com/v1';
|
||||
|
||||
public function __construct(
|
||||
private readonly HttpClientInterface $httpClient,
|
||||
private readonly string $apiKey,
|
||||
private readonly string $sender,
|
||||
private readonly HttpClientInterface $httpClient,
|
||||
private readonly SiteConfigRepository $configRepo,
|
||||
private readonly string $apiKey = '',
|
||||
private readonly string $sender = '',
|
||||
) {}
|
||||
|
||||
private function key(): string { return $this->configRepo->get('kavenegar_api_key') ?: $this->apiKey; }
|
||||
private function sender(): string { return $this->configRepo->get('kavenegar_sender') ?: $this->sender; }
|
||||
|
||||
public function getName(): string { return 'kavenegar'; }
|
||||
|
||||
public function send(string $mobile, string $message): bool
|
||||
{
|
||||
try {
|
||||
$resp = $this->httpClient->request('POST',
|
||||
self::BASE . '/' . $this->apiKey . '/sms/send.json', [
|
||||
self::BASE . '/' . $this->key() . '/sms/send.json', [
|
||||
'body' => http_build_query([
|
||||
'receptor' => $mobile,
|
||||
'message' => $message,
|
||||
'sender' => $this->sender,
|
||||
'sender' => $this->sender(),
|
||||
]),
|
||||
'timeout' => 10,
|
||||
]
|
||||
@@ -44,7 +49,7 @@ class KavehNegarProvider implements SmsProviderInterface
|
||||
$params['token' . ($i > 0 ? $i + 1 : '')] = $v;
|
||||
}
|
||||
$resp = $this->httpClient->request('POST',
|
||||
self::BASE . '/' . $this->apiKey . '/verify/lookup.json', [
|
||||
self::BASE . '/' . $this->key() . '/verify/lookup.json', [
|
||||
'body' => http_build_query($params),
|
||||
'timeout' => 10,
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user