- Create pagos_confirmados table to track consumed email receipts - PagoValidadorService now validates: valor + fecha + hora (±10min) + llave Bancolombia - Each matched email is hashed (sha1 body+date) and marked as used; a second match returns estado=ya_usado instead of confirmado - Add partial remitente name matching against the registered user's name - GeminiVisionService prompt now extracts llave (@xxx) from the receipt image - TelegramBotService shows distinct message for ya_usado state Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
672 B
PHP
35 lines
672 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class PagoConfirmado extends Model
|
|
{
|
|
public $timestamps = false;
|
|
|
|
protected $fillable = [
|
|
'email_hash',
|
|
'usuario_id',
|
|
'valor',
|
|
'canal',
|
|
'banco',
|
|
'referencia',
|
|
'confirmado_en',
|
|
];
|
|
|
|
protected $casts = [
|
|
'confirmado_en' => 'datetime',
|
|
];
|
|
|
|
public static function yaUsado(string $hash): bool
|
|
{
|
|
return static::where('email_hash', $hash)->exists();
|
|
}
|
|
|
|
public static function marcar(string $hash, array $datos): void
|
|
{
|
|
static::create(array_merge(['email_hash' => $hash], $datos));
|
|
}
|
|
}
|