feat(chat): recarga con transferencia bancaria, fix OTP y mejoras UI
- Fix: autocomplete="off" en campo OTP (evita que el correo aparezca ahí) - Recarga: nuevo paso elegir método (MercadoPago o Transferencia bancaria) - Transferencia: muestra card con banco/clave/titular/monto y aviso de comprobante - Validación automática al enviar foto del comprobante (flujo existente) - Config admin: nuevos campos banco/clave/titular para transferencia - UI: card de banco con estilo diferenciado (azul), aviso destacado en ámbar Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
9d0940873d
commit
9b76f63aa0
@@ -324,7 +324,9 @@ class PublicChat extends Component
|
||||
$action === 'promo.comprar.saldo' => $this->comprarPromoConSaldo((int) ($data['id'] ?? 0)),
|
||||
$action === 'promo.comprar.mp' => $this->comprarPromoConMP((int) ($data['id'] ?? 0)),
|
||||
$action === 'recarga.iniciar' => $this->mostrarFormRecarga(),
|
||||
$action === 'recarga.elegir_metodo' => $this->elegirMetodoRecarga((int) ($data['monto'] ?? 0)),
|
||||
$action === 'recarga.mp' => $this->generarLinkRecargaMP((int) ($data['monto'] ?? 0)),
|
||||
$action === 'recarga.transferencia' => $this->mostrarTransferencia((int) ($data['monto'] ?? 0)),
|
||||
$action === 'credenciales.listar' => $this->listarCredenciales(),
|
||||
$action === 'historial.ver' => $this->verHistorial(),
|
||||
$action === 'perfil.ver' => $this->verPerfil(),
|
||||
@@ -821,7 +823,7 @@ class PublicChat extends Component
|
||||
{
|
||||
$botones = [];
|
||||
foreach ([20000, 50000, 100000, 200000, 500000] as $m) {
|
||||
$botones[] = ['label' => '$' . number_format($m), 'action' => 'recarga.mp', 'data' => ['monto' => $m]];
|
||||
$botones[] = ['label' => '$' . number_format($m), 'action' => 'recarga.elegir_metodo', 'data' => ['monto' => $m]];
|
||||
}
|
||||
$botones[] = ['label' => 'Volver', 'action' => 'menu.principal', 'data' => []];
|
||||
|
||||
@@ -835,6 +837,59 @@ class PublicChat extends Component
|
||||
]);
|
||||
}
|
||||
|
||||
private function elegirMetodoRecarga(int $monto): void
|
||||
{
|
||||
if ($monto <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ChatMessage::create([
|
||||
'conversation_id' => $this->convId,
|
||||
'tipo' => 'bot',
|
||||
'tipo_ui' => 'buttons',
|
||||
'contenido' => "Recarga de $" . number_format($monto) . "\n¿Como quieres pagar?",
|
||||
'payload' => ['botones' => [
|
||||
['label' => 'MercadoPago', 'action' => 'recarga.mp', 'data' => ['monto' => $monto]],
|
||||
['label' => 'Transferencia bancaria', 'action' => 'recarga.transferencia', 'data' => ['monto' => $monto]],
|
||||
['label' => 'Volver', 'action' => 'recarga.iniciar', 'data' => []],
|
||||
]],
|
||||
'leido' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
private function mostrarTransferencia(int $monto): void
|
||||
{
|
||||
if ($monto <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$banco = \App\Models\ChatConfig::get('recarga_banco_nombre', '');
|
||||
$clave = \App\Models\ChatConfig::get('recarga_banco_clave', '');
|
||||
$titular = \App\Models\ChatConfig::get('recarga_banco_titular', '');
|
||||
|
||||
if (! $clave) {
|
||||
$this->guardarMensajeBot($this->convId, "La transferencia bancaria no esta disponible en este momento. Usa MercadoPago o contacta a un asesor.");
|
||||
return;
|
||||
}
|
||||
|
||||
ChatMessage::create([
|
||||
'conversation_id' => $this->convId,
|
||||
'tipo' => 'bot',
|
||||
'tipo_ui' => 'banco',
|
||||
'contenido' => 'Datos para transferencia:',
|
||||
'payload' => [
|
||||
'banco' => $banco,
|
||||
'clave' => $clave,
|
||||
'titular' => $titular,
|
||||
'monto' => $monto,
|
||||
],
|
||||
'leido' => true,
|
||||
]);
|
||||
|
||||
$this->guardarMensajeBot($this->convId, "Cuando hayas transferido, envia el comprobante usando el icono de camara (📷) y el sistema lo validara automaticamente.");
|
||||
$this->volver('menu.principal');
|
||||
}
|
||||
|
||||
private function generarLinkRecargaMP(int $monto): void
|
||||
{
|
||||
if ($monto <= 0) {
|
||||
|
||||
Reference in New Issue
Block a user