Implementa registo e conferencia de pagamentos externos

This commit is contained in:
2026-10-28 14:51:53 +02:00
parent f0f7b8ce9d
commit c41628d738
25 changed files with 1279 additions and 10 deletions
@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('external_payments', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->constrained()->restrictOnDelete();
$table->foreignId('invoice_id')->constrained()->restrictOnDelete();
$table->foreignId('supplier_bank_detail_id')->constrained()->restrictOnDelete();
$table->foreignId('created_by')->constrained('users')->restrictOnDelete();
$table->foreignId('reviewed_by')->nullable()->constrained('users')->restrictOnDelete();
$table->string('status')->default('pending');
$table->bigInteger('amount_minor');
$table->string('currency', 3);
$table->date('paid_on');
$table->text('external_reference');
$table->string('reference_hash', 64);
$table->string('payload_hash', 64);
$table->text('evidence_reference');
$table->text('bank_snapshot');
$table->text('review_reason')->nullable();
$table->timestamp('reviewed_at')->nullable();
$table->timestamps();
$table->unique(['tenant_id', 'reference_hash']);
});
}
public function down(): void
{
throw new LogicException('Preservar registos e conferências de pagamentos externos.');
}
};