create payment and gateway resources

This commit is contained in:
2026-05-17 13:57:39 +03:30
parent 53f2303253
commit e53a89016f
21 changed files with 355 additions and 5 deletions

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Database\Factories\GatewayFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Gateway extends Model
{
/** @use HasFactory<GatewayFactory> */
use HasFactory;
protected $guarded = ['id'];
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class GatewayCategory extends Model
{
/** @use HasFactory<\Database\Factories\GatewayCategoryFactory> */
use HasFactory;
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Database\Factories\PaymentFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Payment extends Model
{
/** @use HasFactory<PaymentFactory> */
use HasFactory;
protected $guarded = ['id'];
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PaymentStatus extends Model
{
/** @use HasFactory<\Database\Factories\PaymentStatusFactory> */
use HasFactory;
}

View File

@@ -1,6 +1,6 @@
<?php
namespace App\User\Services\FIB;
namespace App\Services\FIB;
use Exception;
use Illuminate\Http\Client\ConnectionException;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\User\Services\FIB;
namespace App\Services\FIB;
use Exception;
use Illuminate\Http\Client\ConnectionException;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\User\Services\FIB;
namespace App\Services\FIB;
use Exception;
use Illuminate\Http\Client\ConnectionException;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\User\Services\FIB;
namespace App\Services\FIB;
use Exception;
use Illuminate\Http\Client\ConnectionException;

View File

@@ -1,6 +1,6 @@
<?php
namespace App\User\Services\FIB;
namespace App\Services\FIB;
use Exception;
use Illuminate\Http\Client\ConnectionException;

View File

@@ -0,0 +1,24 @@
<?php
namespace Database\Factories;
use App\Models\GatewayCategory;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<GatewayCategory>
*/
class GatewayCategoryFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Database\Factories;
use App\Models\Gateway;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Gateway>
*/
class GatewayFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Database\Factories;
use App\Models\Payment;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Payment>
*/
class PaymentFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Database\Factories;
use App\Models\PaymentStatus;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<PaymentStatus>
*/
class PaymentStatusFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('payment_statuses', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('payment_statuses');
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('gateway_categories', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('gateway_categories');
}
};

View File

@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('gateways', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users');
$table->string('username');
$table->string('name');
$table->string('domain');
$table->string('tax_id');
$table->string('bank_name');
$table->string('account_holder');
$table->string('logo')->nullable();
$table->string('iban');
$table->foreignId('category_id')->constrained('gateway_categories');
$table->string('category_name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('gateways');
}
};

View File

@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('payments', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users');
$table->string('username');
$table->uuid('track_id');
$table->string('amount');
$table->string('currency');
$table->string('callback_url');
$table->dateTime('expires_at');
$table->foreignId('status_id')->constrained('payment_statuses');
$table->string('status_name');
$table->ipAddress('ip');
$table->foreignId('gateway_id')->constrained('gateways');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('payments');
}
};

View File

@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class GatewayCategorySeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class GatewaySeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class PaymentSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class PaymentStatusSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}