diff --git a/app/Http/Livewire/Chat/PublicChat.php b/app/Http/Livewire/Chat/PublicChat.php index 7fbd380..21e6f90 100755 --- a/app/Http/Livewire/Chat/PublicChat.php +++ b/app/Http/Livewire/Chat/PublicChat.php @@ -416,8 +416,9 @@ class PublicChat extends Component // Capturar nombre del titular bancario para validación de recarga if ($this->flujo === 'pago.esperando_nombre') { $nombre = trim($texto); - if (strlen($nombre) < 3) { - $this->guardarMensajeBot($this->convId, "Por favor escribe tu nombre completo (mínimo 3 caracteres)."); + $palabras = array_filter(explode(' ', $nombre), fn($p) => strlen($p) >= 2); + if (count($palabras) < 2) { + $this->guardarMensajeBot($this->convId, "Escribe al menos nombre y apellido. Ejemplo: *Juan Garcia*"); $this->cargarMensajes(); $this->dispatchBrowserEvent('scroll-chat'); return; diff --git a/app/Services/PagoValidadorService.php b/app/Services/PagoValidadorService.php index 7ba0288..d334aa5 100755 --- a/app/Services/PagoValidadorService.php +++ b/app/Services/PagoValidadorService.php @@ -197,12 +197,13 @@ class PagoValidadorService $re = $normalizar($remitenteEmail); $nu = $normalizar($nombreUsuario); + $coincidencias = 0; foreach (explode(' ', $nu) as $palabra) { if (strlen($palabra) >= 3 && str_contains($re, $palabra)) { - return true; + $coincidencias++; } } - return false; + return $coincidencias >= 2; } private function fetchCorreos(): array diff --git a/app/Services/TelegramBotService.php b/app/Services/TelegramBotService.php index dd7dc86..724b25a 100755 --- a/app/Services/TelegramBotService.php +++ b/app/Services/TelegramBotService.php @@ -1276,9 +1276,10 @@ class TelegramBotService private function processRemitenteNombre(string $chatId, string $texto): void { - $nombre = trim($texto); - if (strlen($nombre) < 3) { - $this->send($chatId, "Por favor escribe tu nombre completo (mínimo 3 caracteres)."); + $nombre = trim($texto); + $palabras = array_filter(explode(' ', $nombre), fn ($p) => strlen($p) >= 2); + if (count($palabras) < 2) { + $this->send($chatId, "Escribe al menos nombre y apellido. Ejemplo: *Juan Garcia*"); return; }