Update: 2026-07-21 19:09:42
This commit is contained in:
@@ -174,10 +174,26 @@ function sendNabehOtp(string $receiver, string $otp, string $method = '', string
|
||||
|
||||
if ($response) {
|
||||
$decoded = json_decode($response, true);
|
||||
if ($decoded && (($decoded['success'] ?? false) || ($decoded['status'] ?? '') === 'success')) {
|
||||
return true;
|
||||
error_log("ℹ️ [Nabeh OTP Response] " . $response);
|
||||
if ($decoded) {
|
||||
$statusStr = strtolower((string)($decoded['status'] ?? ''));
|
||||
$msgStr = strtolower((string)($decoded['message'] ?? ''));
|
||||
if (
|
||||
!empty($decoded['success']) ||
|
||||
in_array($statusStr, ['success', 'ok', 'true', '200', 'sent', 'queued', '1'], true) ||
|
||||
($decoded['status'] ?? false) === true ||
|
||||
($decoded['code'] ?? 0) === 200 ||
|
||||
!empty($decoded['message_id']) ||
|
||||
!empty($decoded['id']) ||
|
||||
!empty($decoded['token']) ||
|
||||
strpos($msgStr, 'success') !== false ||
|
||||
strpos($msgStr, 'sent') !== false ||
|
||||
strpos($msgStr, 'تم') !== false
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
$msg = "❌ [Nabeh OTP] API returned failure response: " . $response;
|
||||
$msg = "❌ [Nabeh OTP] API returned failure/unrecognized response: " . $response;
|
||||
error_log($msg);
|
||||
} else {
|
||||
$msg = "❌ [Nabeh OTP] Empty response from cURL.";
|
||||
@@ -217,7 +233,7 @@ function sendIntaleqOtp(string $receiver, string &$otp, string $method = 'whatsa
|
||||
|
||||
if ($response) {
|
||||
$decoded = json_decode($response, true);
|
||||
if ($decoded && ($decoded['success'] ?? false)) {
|
||||
if ($decoded && (!empty($decoded['success']) || ($decoded['status'] ?? '') === 'success')) {
|
||||
if (isset($decoded['otp'])) {
|
||||
$otp = (string)$decoded['otp'];
|
||||
}
|
||||
@@ -225,9 +241,8 @@ function sendIntaleqOtp(string $receiver, string &$otp, string $method = 'whatsa
|
||||
}
|
||||
$msg = "❌ [Intaleq OTP] API returned failure response: " . $response;
|
||||
error_log($msg);
|
||||
echo $msg; // Temporarily echo the raw error so we can see it in the app logs!
|
||||
} else {
|
||||
echo "❌ [Intaleq OTP] Empty response or cURL failed.";
|
||||
error_log("❌ [Intaleq OTP] Empty response or cURL failed.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user