Compare commits

..

9 Commits

19 changed files with 234 additions and 401 deletions

View File

@@ -9,6 +9,4 @@ class FibTransaction extends Model
{
/** @use HasFactory<\Database\Factories\FibTransactionFactory> */
use HasFactory;
protected $guarded = ['id'];
}

View File

@@ -1,86 +0,0 @@
<?php
namespace App\Services\FIB;
use Illuminate\Support\Facades\Http;
class FIBClient
{
public $auth_service;
public $create_payment_service;
public function __construct()
{
}
public function client()
{
return Http::acceptJson()
->contentType('application/json')
->withToken($this->getAccessToken())
->timeout(30);
}
public function getAccessToken()
{
try {
if ($this->isNotProduction()) {
return json_decode(
file_get_contents(storage_path('app/mock/fib/token.json'))
);
}
$response = Http::withOptions([
'proxy' => 'http://host.docker.internal:10808',
])->asForm()->post('https://fib-stage.fib.iq/auth/realms/fib-online-shop/protocol/openid-connect/token', [
'grant_type' => 'client_credentials',
'client_id' => 'ipay-test-payment',
'client_secret' => '8dae3180-f39c-448e-8b45-a01c8f4c8c15',
]);
if ($response->failed()) {
throw new \Exception(
'Unable to authenticate with FIB: ' .
$response->body()
);
}
$data = $response->json();
if (!isset($data['access_token'])) {
throw new \Exception('FIB token missing in response');
}
return $data['access_token'];
} catch (\Exception $exception) {
return $exception->getMessage();
}
}
public function createPaymentService()
{
if ($this->isNotProduction()) {
return json_decode(
file_get_contents(storage_path('app/mock/fib/payment_create_success.json'))
);
}
$response = $this->client()->post("https://fib-stage.fib.iq/protected/v1/payments");
if ($response->failed()) {
throw new \Exception(
'Unable to authenticate with FIB: ' .
$response->body()
);
}
$data = $response->json();
if (!isset($data['paymentId'])) {
throw new \Exception('FIB paymentId missing in response');
}
return $data;
}
public function isNotProduction()
{
return env('APP_ENV') === 'local';
}
}

View File

@@ -1,38 +0,0 @@
<?php
namespace App\Services\Payments\DTO;
class FIBPaymentCreateDTO
{
public string $paymentId;
public string $readableCode;
public string $qrCode;
public string $validUntil;
public string $personalAppLink;
public string $businessAppLink;
public string $corporateAppLink;
public function __construct(array $data)
{
$this->paymentId = $data['paymentId'];
$this->readableCode = $data['readableCode'];
$this->qrCode = $data['qrCode'];
$this->validUntil = $data['validUntil'];
$this->personalAppLink = $data['personalAppLink'];
$this->businessAppLink = $data['businessAppLink'];
$this->corporateAppLink = $data['corporateAppLink'];
}
public static function fromResponse($data): FIBPaymentCreateDTO
{
return new self([
'paymentId' => $data->paymentId,
'readableCode' => $data->readableCode,
'qrCode' => $data->qrCode,
'validUntil' => $data->validUntil,
'personalAppLink' => $data->personalAppLink,
'businessAppLink' => $data->businessAppLink,
'corporateAppLink' => $data->corporateAppLink,
]);
}
}

View File

@@ -1,46 +0,0 @@
<?php
namespace App\Services\Payments\DTO;
use Illuminate\Http\Request;
class PaymentCreateDTO
{
public string $username;
public int $user_id;
public string $track_id;
public string $amount;
public string $currency;
public string $callback_url;
public string $ip;
public int $user_gateway_id;
public function __construct(array $data)
{
$this->username = $data['username'];
$this->user_id = $data['user_id'];
$this->track_id = $data['track_id'];
$this->amount = $data['amount'];
$this->currency = $data['currency'];
$this->callback_url = $data['callback_url'];
$this->ip = $data['ip'];
$this->user_gateway_id = $data['user_gateway_id'];
}
public static function fromRequest(Request $request): PaymentCreateDTO
{
return new self([
'username' => $request->username,
'user_id' => '2',
'track_id' => uuid_create(),
'amount' => $request->amount,
'currency' => $request->currency,
'callback_url' => $request->callback_url,
'ip' => $request->getClientIp(),
'user_gateway_id' => $request->user_gateway_id,
]);
}
}

View File

@@ -1,37 +0,0 @@
<?php
namespace App\Services\Payments;
use App\Models\Payment;
use App\Services\FIB\CreatePaymentService;
use App\Services\FIB\FIBClient;
class FibAdapter
{
public function __construct(
private CreatePaymentService $create_payment_service,
private FIBClient $fib_client
)
{
}
public function createPayment(array $data)
{
Payment::query()->create([
'user_id' => auth()->id(),
'username' => $data['username'],
'track_id' => $data['track_id'],
'amount' => $data['amount'],
'currency' => $data['currency'],
'callback_url' => $data['callback_url'],
'expires_at' => $data['expires_at'],
'status_id' => $data['status_id'],
'status_name' => $data['status_name'],
'ip' => $data['ip'],
'user_gateway_id' => $data['user_gateway_id'],
'created_at' => $data['created_at'],
'updated_at' => $data['updated_at'],
]);
$this->fib_client->client();
}
}

View File

@@ -1,72 +0,0 @@
<?php
namespace App\Services\Payments;
use App\Enums\PaymentStatusEnum;
use App\Models\FibTransaction;
use App\Models\Payment;
use App\Models\Transaction;
use App\Services\FIB\FIBClient;
use App\Services\Payments\DTO\FIBPaymentCreateDTO;
use App\Services\Payments\DTO\PaymentCreateDTO;
class PaymentService
{
public $fib_client;
public function __construct()
{
$this->fib_client = new FibClient();
}
public function createPayment(PaymentCreateDTO $dto)
{
try {
$payment = Payment::query()->create([
'user_id' => $dto->user_id,
'username' => $dto->username,
'track_id' => $dto->track_id,
'amount' => $dto->amount,
'currency' => $dto->currency,
'callback_url' => $dto->callback_url,
'status_id' => PaymentStatusEnum::Unpaid->value,
'status_name' => PaymentStatusEnum::Unpaid->name,
'ip' => $dto->ip,
'user_gateway_id' => $dto->user_gateway_id,
]);
$response = $this->fib_client->createPaymentService();
$fib_response_dto = FIBPaymentCreateDTO::fromResponse($response);
$transaction = Transaction::query()->create([
'user_id' => $payment->user_id,
'amount' => $payment->amount,
'currency' => $payment->currency,
'callback_url' => $payment->callback_url,
// 'description' => '',
// 'expires_in' => '',
'payment_id' => $payment->id,
'payment_track_id' => $payment->track_id,
'user_gateway_id' => $payment->user_gateway_id,
// 'status' => '',
]);
$fib_transactions = FibTransaction::query()->create([
'transaction_id' => $transaction->id,
'qrcode' => $fib_response_dto->qrCode,
'readable_code' => $fib_response_dto->readableCode,
'personalAppLink' => $fib_response_dto->personalAppLink,
'businessAppLink' => $fib_response_dto->businessAppLink,
'corporateAppLink' => $fib_response_dto->corporateAppLink,
'paymentId' => $fib_response_dto->paymentId,
'paymentMethod' => 'fib',
'validUntil' => $fib_response_dto->validUntil,
'status_id' => PaymentStatusEnum::Unpaid->value,
'status_name' => PaymentStatusEnum::Unpaid->name,
]);
return $payment;
} catch (\Exception $exception) {
throw new \Exception($exception->getMessage());
}
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\User\Controllers;
use App\Http\Controllers\Controller;
use App\Models\City;
use App\Models\Province;
use App\Traits\ApiResponse;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class CityController extends Controller
{
use ApiResponse;
public function list(Request $request): JsonResponse
{
$cities = City::query()
->where('province_id', '=', $request->query('province_id'))
->get(['id', 'name']);
return $this->successResponse($cities);
}
}

View File

@@ -1,35 +0,0 @@
<?php
namespace App\User\Controllers\Payment;
use App\Http\Controllers\Controller;
use App\Services\Payments\DTO\PaymentCreateDTO;
use App\Services\Payments\PaymentService;
use App\Traits\ApiResponse;
use App\User\Requests\Payment\FIB\StoreRequest;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class PaymentController extends Controller
{
use ApiResponse;
public $payment_service;
public function __construct(PaymentService $payment_service)
{
$this->payment_service = $payment_service;
}
public function createPayment(StoreRequest $request): JsonResponse
{
try {
$dto = PaymentCreateDTO::fromRequest($request);
$result = $this->payment_service->createPayment($dto);
return $this->successResponse($result);
} catch (\Exception $exception) {
throw $exception;
}
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\User\Controllers;
use App\Http\Controllers\Controller;
use App\Models\Province;
use App\Traits\ApiResponse;
use Illuminate\Http\JsonResponse;
class ProvinceController extends Controller
{
use ApiResponse;
public function list(): JsonResponse
{
return $this->successResponse(Province::all(['id', 'name']));
}
}

View File

@@ -1,36 +0,0 @@
<?php
namespace App\User\Requests\Payment\FIB;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
class StoreRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
return Auth::guard('web')->user()->kyc_status;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array|string>
*/
public function rules(): array
{
return [
'username' => ['required'],
'track_id' => ['required'],
'amount' => ['required'],
'currency' => ['required'],
'callback_url' => ['required'],
'user_gateway_id' => ['required'],
];
}
}

View File

@@ -4,7 +4,8 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
return new class extends Migration
{
/**
* Run the migrations.
*/
@@ -13,15 +14,15 @@ return new class extends Migration {
Schema::create('transactions', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users');
$table->string('amount')->nullable();
$table->string('currency')->nullable();
$table->string('callback_url')->nullable();
$table->string('description')->nullable();
$table->dateTime('expires_in')->nullable();
$table->string('amount');
$table->string('currency');
$table->string('callback_url');
$table->string('description');
$table->dateTime('expires_in');
$table->foreignId('payment_id')->constrained('payments');
$table->string('payment_track_id')->nullable();
$table->string('payment_track_id');
$table->foreignId('user_gateway_id')->constrained('user_gateways');
$table->integer('status')->nullable();
$table->integer('status');
$table->timestamps();
});
}

View File

@@ -4,7 +4,8 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
return new class extends Migration
{
/**
* Run the migrations.
*/
@@ -13,23 +14,23 @@ return new class extends Migration {
Schema::create('fib_transactions', function (Blueprint $table) {
$table->id();
$table->foreignId('transaction_id')->constrained('transactions');
$table->text('qrcode')->nullable();
$table->string('readable_code')->nullable();
$table->string('personalAppLink')->nullable();
$table->string('businessAppLink')->nullable();
$table->string('corporateAppLink')->nullable();
$table->string('paymentId')->nullable();
$table->string('paymentMethod')->nullable();
$table->timestamp('validUntil')->nullable();
$table->text('qrcode');
$table->string('readable_code');
$table->string('personalAppLink');
$table->string('businessAppLink');
$table->string('corporateAppLink');
$table->string('paymentId');
$table->string('paymentMethod');
$table->timestamp('validUntil');
$table->foreignId('status_id')->constrained('fib_transaction_statuses');
$table->string('status_name')->nullable();
$table->timestamp('paidAt')->nullable();
$table->string('paidAmount')->nullable();
$table->string('paidCurrency')->nullable();
$table->string('decliningReason')->nullable();
$table->timestamp('declinedAt')->nullable();
$table->string('paidByName')->nullable();
$table->string('paidByIban')->nullable();
$table->string('status_name');
$table->timestamp('paidAt');
$table->string('paidAmount');
$table->string('paidCurrency');
$table->string('decliningReason');
$table->timestamp('declinedAt');
$table->string('paidByName');
$table->string('paidByIban');
$table->timestamps();
});
}

View File

@@ -4,6 +4,7 @@ namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class CitySeeder extends Seeder
{
@@ -12,6 +13,125 @@ class CitySeeder extends Seeder
*/
public function run(): void
{
//
DB::table('cities')->insert([
// Baghdad
['province_id' => 1, 'name' => 'Baghdad', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 1, 'name' => 'Sadr City', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 1, 'name' => 'Kadhimiya', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 1, 'name' => 'Adhamiyah', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 1, 'name' => 'Abu Ghraib', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 1, 'name' => 'Mahmudiya', 'created_at' => now(), 'updated_at' => now()],
// Basra
['province_id' => 2, 'name' => 'Basra', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 2, 'name' => 'Al-Zubair', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 2, 'name' => 'Umm Qasr', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 2, 'name' => 'Al-Qurnah', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 2, 'name' => 'Shatt Al-Arab', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 2, 'name' => 'Abu Al-Khaseeb', 'created_at' => now(), 'updated_at' => now()],
// Nineveh
['province_id' => 3, 'name' => 'Mosul', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 3, 'name' => 'Tal Afar', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 3, 'name' => 'Sinjar', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 3, 'name' => 'Al-Hamdaniya', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 3, 'name' => 'Bashiqa', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 3, 'name' => 'Qayyarah', 'created_at' => now(), 'updated_at' => now()],
// Erbil
['province_id' => 4, 'name' => 'Erbil', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 4, 'name' => 'Shaqlawa', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 4, 'name' => 'Soran', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 4, 'name' => 'Koya', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 4, 'name' => 'Makhmur', 'created_at' => now(), 'updated_at' => now()],
// Sulaymaniyah
['province_id' => 5, 'name' => 'Sulaymaniyah', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 5, 'name' => 'Halabja', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 5, 'name' => 'Ranya', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 5, 'name' => 'Kalar', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 5, 'name' => 'Chamchamal', 'created_at' => now(), 'updated_at' => now()],
// Duhok
['province_id' => 6, 'name' => 'Duhok', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 6, 'name' => 'Zakho', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 6, 'name' => 'Amedi', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 6, 'name' => 'Akre', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 6, 'name' => 'Semel', 'created_at' => now(), 'updated_at' => now()],
// Kirkuk
['province_id' => 7, 'name' => 'Kirkuk', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 7, 'name' => 'Hawija', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 7, 'name' => 'Dibis', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 7, 'name' => 'Daquq', 'created_at' => now(), 'updated_at' => now()],
// Diyala
['province_id' => 8, 'name' => 'Baqubah', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 8, 'name' => 'Khanaqin', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 8, 'name' => 'Muqdadiyah', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 8, 'name' => 'Balad Ruz', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 8, 'name' => 'Jalawla', 'created_at' => now(), 'updated_at' => now()],
// Anbar
['province_id' => 9, 'name' => 'Ramadi', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 9, 'name' => 'Fallujah', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 9, 'name' => 'Haditha', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 9, 'name' => 'Hit', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 9, 'name' => 'Al-Qaim', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 9, 'name' => 'Rutba', 'created_at' => now(), 'updated_at' => now()],
// Salah al-Din
['province_id' => 10, 'name' => 'Tikrit', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 10, 'name' => 'Samarra', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 10, 'name' => 'Balad', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 10, 'name' => 'Baiji', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 10, 'name' => 'Tuz Khurmatu', 'created_at' => now(), 'updated_at' => now()],
// Karbala
['province_id' => 11, 'name' => 'Karbala', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 11, 'name' => 'Al-Hindiya', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 11, 'name' => 'Ain Al-Tamur', 'created_at' => now(), 'updated_at' => now()],
// Najaf
['province_id' => 12, 'name' => 'Najaf', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 12, 'name' => 'Kufa', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 12, 'name' => 'Al-Manathera', 'created_at' => now(), 'updated_at' => now()],
// Babil
['province_id' => 13, 'name' => 'Hillah', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 13, 'name' => 'Al-Mahawil', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 13, 'name' => 'Al-Musayyib', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 13, 'name' => 'Hashimiya', 'created_at' => now(), 'updated_at' => now()],
// Wasit
['province_id' => 14, 'name' => 'Kut', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 14, 'name' => 'Al-Hayy', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 14, 'name' => 'Al-Numaniyah', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 14, 'name' => 'Badra', 'created_at' => now(), 'updated_at' => now()],
// Maysan
['province_id' => 15, 'name' => 'Amarah', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 15, 'name' => 'Ali Al-Sharqi', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 15, 'name' => 'Al-Majarr Al-Kabir', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 15, 'name' => 'Qalat Saleh', 'created_at' => now(), 'updated_at' => now()],
// Dhi Qar
['province_id' => 16, 'name' => 'Nasiriyah', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 16, 'name' => 'Al-Shatrah', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 16, 'name' => 'Suq Al-Shuyukh', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 16, 'name' => 'Rifai', 'created_at' => now(), 'updated_at' => now()],
// Muthanna
['province_id' => 17, 'name' => 'Samawah', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 17, 'name' => 'Rumaitha', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 17, 'name' => 'Al-Khidhir', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 17, 'name' => 'Salman', 'created_at' => now(), 'updated_at' => now()],
// Al-Qadisiyyah
['province_id' => 18, 'name' => 'Diwaniyah', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 18, 'name' => 'Afak', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 18, 'name' => 'Al-Shamiya', 'created_at' => now(), 'updated_at' => now()],
['province_id' => 18, 'name' => 'Hamza', 'created_at' => now(), 'updated_at' => now()],
]);
}
}

View File

@@ -22,5 +22,9 @@ class DatabaseSeeder extends Seeder
'email' => 'test@example.com',
'password' => 'password123@',
]);
$this->call([
ProvinceSeeder::class,
CitySeeder::class,
]);
}
}

View File

@@ -4,7 +4,6 @@ namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class FibTransactionStatusSeeder extends Seeder
{
@@ -13,12 +12,6 @@ class FibTransactionStatusSeeder extends Seeder
*/
public function run(): void
{
DB::table('fib_transaction_statuses')->insert([
['id' => 0, 'name' => 'unpaid', 'created_at' => now(), 'updated_at' => now(),],
['id' => 1, 'name' => 'cancelled', 'created_at' => now(), 'updated_at' => now(),],
['id' => 2, 'name' => 'expired', 'created_at' => now(), 'updated_at' => now(),],
['id' => 3, 'name' => 'paid', 'created_at' => now(), 'updated_at' => now(),],
['id' => 4, 'name' => 'refunded', 'created_at' => now(), 'updated_at' => now(),],
]);
//
}
}

View File

@@ -4,6 +4,7 @@ namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class ProvinceSeeder extends Seeder
{
@@ -12,6 +13,25 @@ class ProvinceSeeder extends Seeder
*/
public function run(): void
{
//
DB::table('provinces')->insert([
['id' => 1, 'name' => 'Baghdad', 'created_at' => now(), 'updated_at' => now()],
['id' => 2, 'name' => 'Basra', 'created_at' => now(), 'updated_at' => now()],
['id' => 3, 'name' => 'Nineveh', 'created_at' => now(), 'updated_at' => now()],
['id' => 4, 'name' => 'Erbil', 'created_at' => now(), 'updated_at' => now()],
['id' => 5, 'name' => 'Sulaymaniyah', 'created_at' => now(), 'updated_at' => now()],
['id' => 6, 'name' => 'Duhok', 'created_at' => now(), 'updated_at' => now()],
['id' => 7, 'name' => 'Kirkuk', 'created_at' => now(), 'updated_at' => now()],
['id' => 8, 'name' => 'Diyala', 'created_at' => now(), 'updated_at' => now()],
['id' => 9, 'name' => 'Anbar', 'created_at' => now(), 'updated_at' => now()],
['id' => 10, 'name' => 'Salah al-Din', 'created_at' => now(), 'updated_at' => now()],
['id' => 11, 'name' => 'Karbala', 'created_at' => now(), 'updated_at' => now()],
['id' => 12, 'name' => 'Najaf', 'created_at' => now(), 'updated_at' => now()],
['id' => 13, 'name' => 'Babil', 'created_at' => now(), 'updated_at' => now()],
['id' => 14, 'name' => 'Wasit', 'created_at' => now(), 'updated_at' => now()],
['id' => 15, 'name' => 'Maysan', 'created_at' => now(), 'updated_at' => now()],
['id' => 16, 'name' => 'Dhi Qar', 'created_at' => now(), 'updated_at' => now()],
['id' => 17, 'name' => 'Muthanna', 'created_at' => now(), 'updated_at' => now()],
['id' => 18, 'name' => 'Al-Qadisiyyah', 'created_at' => now(), 'updated_at' => now()],
]);
}
}

View File

@@ -1,19 +1,8 @@
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use \App\User\Controllers\Payment\PaymentController;
Route::get('/user', function (Request $request) {
return $request->user();
})->middleware('auth:api');
Route::prefix('v1')->group(function () {
Route::prefix('payment')
// ->middleware('auth:api')
->group(function () {
Route::post('/create_payment', [PaymentController::class, 'createPayment'])->name('create_payment');
});
});

View File

@@ -6,7 +6,9 @@ use App\Admin\Controllers\RoleManagementController;
use App\Admin\Controllers\UserManagementController;
use App\User\Controllers\AuthController;
use App\User\Controllers\GatewayManagementController;
use App\User\Controllers\CityController;
use App\User\Controllers\ProfileController;
use App\User\Controllers\ProvinceController;
use Illuminate\Support\Facades\Route;
Route::prefix('auth')
@@ -39,3 +41,17 @@ Route::prefix('user_gateway')
Route::post('/{gateway}', 'update')->name('update');
Route::delete('/{gateway}', 'destroy')->name('destroy');
});
Route::prefix('province')
->name('province.')
->controller(ProvinceController::class)
->group(function () {
Route::get('list', 'list')->name('list');
});
Route::prefix('city')
->name('city.')
->controller(CityController::class)
->group(function () {
Route::get('list', 'list')->name('list');
});

View File

@@ -40,7 +40,9 @@ services:
- payment
backend:
image: payment-backend:latest
build:
context: ${BACKEND_PATH}
dockerfile: Dockerfile
container_name: laravel
tty: true
restart: unless-stopped
@@ -52,8 +54,6 @@ services:
- postgres
networks:
- payment
command: ["php", "artisan", "serve", "--host=0.0.0.0", "--port=9000"]
# Prints "Overridden command!"
# logging:
# driver: "syslog"
# options: