Prevent double-confirmation of same payment by different users
- 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>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
157691e166
commit
ba4ec8b6cf
@@ -0,0 +1,34 @@
|
||||
<?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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user