Deploy: 2026-06-24 13:42:28

This commit is contained in:
Hamza-Ayed
2026-06-24 13:42:28 +03:00
parent e0c7f39ff6
commit 7085065fbe
2 changed files with 24 additions and 5 deletions

View File

@@ -251,15 +251,32 @@ class OTPController extends BaseController
}
// Send voice note
ConversationFlowEngine::sendReply($session, $phone, '', null, $audioBase64, $mimeType);
$success = ConversationFlowEngine::sendReply($session, $phone, '', null, $audioBase64, $mimeType);
if (!$success) {
$response->status(500)->json(['error' => 'Failed to send voice OTP via gateway.']);
return;
}
} else if ($type === 'image') {
// Generate OTP Image as Base64
$imageBase64 = $this->generateOtpImage($code);
ConversationFlowEngine::sendReply($session, $phone, '', null, null, null, $imageBase64);
$success = ConversationFlowEngine::sendReply($session, $phone, '', null, null, null, $imageBase64);
if (!$success) {
$response->status(500)->json(['error' => 'Failed to send image OTP via gateway.']);
return;
}
} else {
// Send text
$textMsg = "رمز التحقق الخاص بك لمتجر نابه هو: *{$code}* \n الرجاء عدم مشاركته مع أي شخص.";
ConversationFlowEngine::sendReply($session, $phone, $textMsg);
$customText = $body['message'] ?? null;
if ($customText) {
$textMsg = str_replace('{code}', $code, $customText);
} else {
$textMsg = "رمز التحقق الخاص بك لمتجر نابه هو: *{$code}* \n الرجاء عدم مشاركته مع أي شخص.";
}
$success = ConversationFlowEngine::sendReply($session, $phone, $textMsg);
if (!$success) {
$response->status(500)->json(['error' => 'Failed to send text OTP via gateway.']);
return;
}
}
// Increment usage stats