إضافة كود بوابة الواتساب وملفات التهيئة والتحكم في الطريقة
This commit is contained in:
@@ -102,18 +102,23 @@ $otpCode = str_pad((string) random_int(0, 9999), 4, '0', STR_PAD_LEFT);
|
||||
|
||||
// Determine delivery method
|
||||
$method = 'flash_call'; // Default fallback
|
||||
$whatsappAvailable = false;
|
||||
$methodInput = isset($input['method']) ? strtolower(trim($input['method'])) : null;
|
||||
|
||||
try {
|
||||
$whatsappAvailable = WhatsAppClient::isAvailable($phone);
|
||||
} catch (\Throwable $e) {
|
||||
error_log('WhatsApp check failed: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
if ($whatsappAvailable) {
|
||||
$method = 'whatsapp';
|
||||
if ($methodInput && in_array($methodInput, ['flash_call', 'sms', 'whatsapp', 'telegram'], true)) {
|
||||
$method = $methodInput;
|
||||
} else {
|
||||
$method = ($deviceType === 'ios') ? 'sms' : 'flash_call';
|
||||
$whatsappAvailable = false;
|
||||
try {
|
||||
$whatsappAvailable = WhatsAppClient::isAvailable($phone);
|
||||
} catch (\Throwable $e) {
|
||||
error_log('WhatsApp check failed: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
if ($whatsappAvailable) {
|
||||
$method = 'whatsapp';
|
||||
} else {
|
||||
$method = ($deviceType === 'ios') ? 'sms' : 'flash_call';
|
||||
}
|
||||
}
|
||||
|
||||
$db = Database::getInstance();
|
||||
|
||||
Reference in New Issue
Block a user