Update: 2026-07-21 19:24:57

This commit is contained in:
Hamza-Ayed
2026-07-21 19:24:57 +03:00
parent 1103f6ffcf
commit f3905bcb2c
+12 -6
View File
@@ -72,6 +72,7 @@ function getNabehBearerToken(): ?string {
if (!$email || !$password) {
$msg = "⚠️ [Nabeh Auth] Missing NABEH_EMAIL or NABEH_PASSWORD environment variables.";
$GLOBALS['last_otp_error'] = $msg;
error_log($msg);
return null;
}
@@ -110,10 +111,12 @@ function getNabehBearerToken(): ?string {
}
return $token;
}
$msg = "❌ [Nabeh Auth] Failed to extract token from login response: " . $response;
$msg = "❌ [Nabeh Auth Login Failed] Response: " . $response;
$GLOBALS['last_otp_error'] = $msg;
error_log($msg);
} else {
$msg = "❌ [Nabeh Auth] Empty response from login API cURL.";
$msg = "❌ [Nabeh Auth Login Failed] Empty response from login API.";
$GLOBALS['last_otp_error'] = $msg;
error_log($msg);
}
return null;
@@ -131,8 +134,9 @@ function getNabehBearerToken(): ?string {
function sendNabehOtp(string $receiver, string $otp, string $method = '', string $user_type = 'passenger'): bool {
$bearerToken = getNabehBearerToken();
if (!$bearerToken) {
$msg = "⚠️ [Nabeh OTP] Failed to obtain dynamic JWT Bearer token.";
error_log($msg);
if (empty($GLOBALS['last_otp_error'])) {
$GLOBALS['last_otp_error'] = "⚠️ [Nabeh OTP] Failed to obtain dynamic JWT Bearer token.";
}
return false;
}
@@ -185,10 +189,12 @@ function sendNabehOtp(string $receiver, string $otp, string $method = '', string
return true;
}
}
$msg = "❌ [Nabeh OTP] API returned failure/unrecognized response: " . $response;
$msg = "❌ [Nabeh OTP Response Failed] Raw: " . $response;
$GLOBALS['last_otp_error'] = $msg;
error_log($msg);
} else {
$msg = "❌ [Nabeh OTP] Empty response from cURL.";
$msg = "❌ [Nabeh OTP cURL Failed] Empty response from cURL.";
$GLOBALS['last_otp_error'] = $msg;
error_log($msg);
}
return false;