feat: add 'url' field to Integration model and update related requests and seeder

This commit is contained in:
ncoronel 2026-07-03 14:45:05 -03:00
parent 3887a4fcba
commit 21b8fa5f35
5 changed files with 17 additions and 0 deletions

View File

@ -11,6 +11,7 @@ class Integration extends Model
protected $fillable = [
'integration_code',
'name',
'url',
'integration_data_schema',
];

View File

@ -16,6 +16,7 @@ class StoreIntegrationRequest extends FormRequest
return [
'integration_code' => ['required', 'string', 'unique:integrations,integration_code'],
'name' => ['required', 'string', 'max:255'],
'url' => ['nullable', 'url', 'max:255'],
'integration_data_schema' => ['nullable', 'array'],
];
}

View File

@ -17,6 +17,7 @@ class UpdateIntegrationRequest extends FormRequest
return [
'name' => ['sometimes', 'required', 'string', 'max:255'],
'url' => ['nullable', 'url', 'max:255'],
'integration_data_schema' => ['nullable', 'array'],
// the code shouldn't ideally be updatable, but if it is:
'integration_code' => ['sometimes', 'required', 'string', 'unique:integrations,integration_code,' . ($integration->id ?? '')],

View File

@ -15,6 +15,7 @@ return new class extends Migration
$table->id();
$table->string('integration_code')->unique();
$table->string('name');
$table->string('url')->nullable();
$table->json('integration_data_schema')->nullable();
$table->timestamps();
});

View File

@ -16,6 +16,19 @@ class TelepagosIntegrationSeeder extends Seeder
['integration_code' => 'telepagos'],
[
'name' => 'Telepagos',
'url' => 'https://api.telepagos.com.ar',
'integration_data_schema' => [
'username' => 'required|string',
'password' => 'required|string',
]
]
);
Integration::updateOrCreate(
['integration_code' => 'telepagos_homo'],
[
'name' => 'Telepagos Homologación',
'url' => 'https://api.homo.telepagos.com.ar',
'integration_data_schema' => [
'username' => 'required|string',
'password' => 'required|string',