Compare commits
6 Commits
feature/Ga
...
feature/Ed
| Author | SHA1 | Date | |
|---|---|---|---|
| d04637b1ef | |||
| 3c61e279ec | |||
| e9f6ee71fa | |||
| 60129f5abb | |||
| 2d8f2dbcc5 | |||
| 86e353749a |
@@ -4,6 +4,7 @@ namespace App\Admin\Controllers;
|
|||||||
|
|
||||||
use App\Admin\Requests\ExpertManagement\StoreRequest;
|
use App\Admin\Requests\ExpertManagement\StoreRequest;
|
||||||
use App\Admin\Requests\ExpertManagement\UpdateRequest;
|
use App\Admin\Requests\ExpertManagement\UpdateRequest;
|
||||||
|
use App\Admin\Resources\ExpertManagementResource;
|
||||||
use App\Facades\DataTable\DataTableFacade;
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\City;
|
use App\Models\City;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Admin\Controllers;
|
namespace App\Admin\Controllers;
|
||||||
|
|
||||||
use App\Admin\Requests\Profile\ChangePasswordRequest;
|
use App\Admin\Requests\Profile\ChangePasswordRequest;
|
||||||
|
use App\Admin\Requests\Profile\EditRequest;
|
||||||
use App\Admin\Resources\ExpertResource;
|
use App\Admin\Resources\ExpertResource;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Traits\ApiResponse;
|
use App\Traits\ApiResponse;
|
||||||
@@ -19,6 +20,24 @@ class ProfileController extends Controller
|
|||||||
return $this->successResponse(new ExpertResource(Auth::guard('expert')->user()));
|
return $this->successResponse(new ExpertResource(Auth::guard('expert')->user()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function edit(EditRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$expert = $request->user('expert');
|
||||||
|
|
||||||
|
$expert->update([
|
||||||
|
'username' => $request->username,
|
||||||
|
'first_name' => $request->first_name,
|
||||||
|
'last_name' => $request->last_name,
|
||||||
|
'email' => $expert->email,
|
||||||
|
'national_id' => $request->national_id,
|
||||||
|
'phone_number' => $request->phone_number,
|
||||||
|
'province_id' => $request->province_id,
|
||||||
|
'city_id' => $request->city_id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
public function changePassword(ChangePasswordRequest $request): JsonResponse
|
public function changePassword(ChangePasswordRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$expert = Auth::guard('expert')->user();
|
$expert = Auth::guard('expert')->user();
|
||||||
|
|||||||
39
backend/app/Admin/Requests/Profile/EditRequest.php
Executable file
39
backend/app/Admin/Requests/Profile/EditRequest.php
Executable file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Requests\Profile;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Illuminate\Validation\Validator;
|
||||||
|
|
||||||
|
class EditRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*/
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, ValidationRule|array|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
$user = $this->user();
|
||||||
|
return [
|
||||||
|
'username' => 'string|max:255',
|
||||||
|
'first_name' => 'required|string',
|
||||||
|
'last_name' => 'required|string',
|
||||||
|
'national_id' => 'required',
|
||||||
|
'email' => 'string|email|max:255',
|
||||||
|
'phone_number' => 'string',
|
||||||
|
'province_id' => 'string',
|
||||||
|
'city_id' => 'string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Enums;
|
|
||||||
|
|
||||||
enum BusinessTypeEnum: int
|
|
||||||
{
|
|
||||||
case MEDICAL = 1;
|
|
||||||
case LEGAL = 2;
|
|
||||||
case ENGINEERING = 3;
|
|
||||||
case EDUCATION = 4;
|
|
||||||
case CONSULTING = 5;
|
|
||||||
case BEAUTY = 6;
|
|
||||||
case TECHNICAL_SERVICES = 7;
|
|
||||||
case FINANCIAL = 8;
|
|
||||||
case REAL_ESTATE = 9;
|
|
||||||
case RESTAURANT = 10;
|
|
||||||
case SHOP = 11;
|
|
||||||
case TRANSPORTATION = 12;
|
|
||||||
case ART = 13;
|
|
||||||
case SPORT = 14;
|
|
||||||
case OTHER = 15;
|
|
||||||
|
|
||||||
public function label(): string
|
|
||||||
{
|
|
||||||
return match ($this) {
|
|
||||||
self::MEDICAL => 'medical',
|
|
||||||
self::LEGAL => 'legal',
|
|
||||||
self::ENGINEERING => 'engineering',
|
|
||||||
self::EDUCATION => 'education',
|
|
||||||
self::CONSULTING => 'consulting',
|
|
||||||
self::BEAUTY => 'beauty',
|
|
||||||
self::TECHNICAL_SERVICES => 'technical_services',
|
|
||||||
self::FINANCIAL => 'financial',
|
|
||||||
self::REAL_ESTATE => 'real_estate',
|
|
||||||
self::RESTAURANT => 'restaurant',
|
|
||||||
self::SHOP => 'shop',
|
|
||||||
self::TRANSPORTATION => 'transportation',
|
|
||||||
self::ART => 'art',
|
|
||||||
self::SPORT => 'sport',
|
|
||||||
self::OTHER => 'other',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public function name($id): string
|
|
||||||
{
|
|
||||||
$mapArray = [
|
|
||||||
1 => 'medical',
|
|
||||||
2 => 'legal',
|
|
||||||
3 => 'engineering',
|
|
||||||
4 => 'education',
|
|
||||||
5 => 'consulting',
|
|
||||||
6 => 'beauty',
|
|
||||||
7 => 'technical_services',
|
|
||||||
8 => 'financial',
|
|
||||||
9 => 'real_estate',
|
|
||||||
10 => 'restaurant',
|
|
||||||
11 => 'shop',
|
|
||||||
12 => 'transportation',
|
|
||||||
13 => 'art',
|
|
||||||
14 => 'sport',
|
|
||||||
15 => 'other',
|
|
||||||
];
|
|
||||||
|
|
||||||
return $mapArray[$id];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Enums;
|
|
||||||
|
|
||||||
enum PaymentStatusEnum:int
|
|
||||||
{
|
|
||||||
case Unpaid = 0;
|
|
||||||
case Cancelled = 1;
|
|
||||||
case Expired = 2;
|
|
||||||
case Paid = 3;
|
|
||||||
case Refunded = 4;
|
|
||||||
|
|
||||||
public function label(): string
|
|
||||||
{
|
|
||||||
return match ($this) {
|
|
||||||
self::Unpaid => 'unpaid',
|
|
||||||
self::Cancelled => 'cancelled',
|
|
||||||
self::Expired => 'expired',
|
|
||||||
self::Paid => 'paid',
|
|
||||||
self::Refunded => 'refunded',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Database\Factories\BusinessTypeFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class BusinessType extends Model
|
|
||||||
{
|
|
||||||
/** @use HasFactory<BusinessTypeFactory> */
|
|
||||||
use HasFactory;
|
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class FibTransaction extends Model
|
|
||||||
{
|
|
||||||
/** @use HasFactory<\Database\Factories\FibTransactionFactory> */
|
|
||||||
use HasFactory;
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class FibTransactionStatus extends Model
|
|
||||||
{
|
|
||||||
/** @use HasFactory<\Database\Factories\FibTransactionStatusFactory> */
|
|
||||||
use HasFactory;
|
|
||||||
}
|
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Database\Factories\UserGatewayFactory;
|
use Database\Factories\GatewayFactory;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class UserGateway extends Model
|
class Gateway extends Model
|
||||||
{
|
{
|
||||||
/** @use HasFactory<UserGatewayFactory> */
|
/** @use HasFactory<GatewayFactory> */
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Database\Factories\TransactionFactory;
|
use Database\Factories\GatewayCategoryFactory;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Transaction extends Model
|
class GatewayCategory extends Model
|
||||||
{
|
{
|
||||||
/** @use HasFactory<TransactionFactory> */
|
/** @use HasFactory<GatewayCategoryFactory> */
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\User\Controllers;
|
|
||||||
|
|
||||||
use App\Enums\BusinessTypeEnum;
|
|
||||||
use App\Facades\DataTable\DataTableFacade;
|
|
||||||
use App\Facades\File\FileFacade;
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use App\Models\UserGateway;
|
|
||||||
use App\Traits\ApiResponse;
|
|
||||||
use App\User\Requests\Gateway\StoreRequest;
|
|
||||||
use App\User\Requests\Gateway\UpdateRequest;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
class GatewayManagementController extends Controller
|
|
||||||
{
|
|
||||||
use ApiResponse;
|
|
||||||
|
|
||||||
public function index(Request $request)
|
|
||||||
{
|
|
||||||
return DataTableFacade::run(
|
|
||||||
UserGateway::query()->where('user_id', '=', Auth::guard('web')->id()),
|
|
||||||
$request,
|
|
||||||
allowedFilters: ['*'],
|
|
||||||
allowedSortings: ['*'],
|
|
||||||
allowedSelects: ['id', 'name', 'domain', 'tax_id', 'bank_name', 'account_holder', 'iban', 'business_type_id', 'business_type_name'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function store(StoreRequest $request): JsonResponse
|
|
||||||
{
|
|
||||||
$user = Auth::guard('web')->user();
|
|
||||||
|
|
||||||
$logo = $request->has('logo') ? FileFacade::save($request->file('logo'), "{$user->id}") : null;
|
|
||||||
|
|
||||||
UserGateway::query()->create([
|
|
||||||
'user_id' => $user->id,
|
|
||||||
'username' => $user->username,
|
|
||||||
'name' => $request->name,
|
|
||||||
'domain' => $request->domain,
|
|
||||||
'tax_id' => $request->tax_id,
|
|
||||||
'bank_name' => $request->bank_name,
|
|
||||||
'account_holder' => $request->account_holder,
|
|
||||||
'iban' => $request->iban,
|
|
||||||
'business_type_id' => $request->business_type_id,
|
|
||||||
'business_type_name' => BusinessTypeEnum::name($request->business_type_id),
|
|
||||||
'logo' => $logo,
|
|
||||||
]);
|
|
||||||
|
|
||||||
return $this->successResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function show(UserGateway $gateway): JsonResponse
|
|
||||||
{
|
|
||||||
return $this->successResponse($gateway);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function update(UpdateRequest $request, UserGateway $gateway): JsonResponse
|
|
||||||
{
|
|
||||||
$logo = null;
|
|
||||||
$user = Auth::guard('web')->user();
|
|
||||||
|
|
||||||
if ($request->has('logo'))
|
|
||||||
{
|
|
||||||
FileFacade::delete($gateway->logo, true);
|
|
||||||
$logo = FileFacade::save(request()->file('logo'), "{$user->id}");
|
|
||||||
}
|
|
||||||
|
|
||||||
$gateway->update([
|
|
||||||
'name' => $request->name,
|
|
||||||
'domain' => $request->domain,
|
|
||||||
'business_type_id' => $request->business_type_id,
|
|
||||||
'business_type_name' => BusinessTypeEnum::name($request->business_type_id),
|
|
||||||
'logo' => $logo,
|
|
||||||
]);
|
|
||||||
|
|
||||||
return $this->successResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function destroy(UserGateway $gateway): JsonResponse
|
|
||||||
{
|
|
||||||
$gateway->delete();
|
|
||||||
return $this->successResponse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -24,17 +24,7 @@ class ProfileController extends Controller
|
|||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
$user->update([
|
$user->update($request->validated());
|
||||||
'first_name' => $request->first_name,
|
|
||||||
'last_name' => $request->last_name,
|
|
||||||
'national_id' => $request->national_id,
|
|
||||||
'address' => $request->address,
|
|
||||||
'postal_code' => $request->postal_code,
|
|
||||||
'phone_number' => $request->phone_number,
|
|
||||||
'province_id' => $request->province_id,
|
|
||||||
'city_id' => $request->city_id,
|
|
||||||
'status' => 1
|
|
||||||
]);
|
|
||||||
|
|
||||||
return $this->successResponse();
|
return $this->successResponse();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\User\Requests\Gateway;
|
|
||||||
|
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
|
||||||
|
|
||||||
class StoreRequest extends FormRequest
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Determine if the user is authorized to make this request.
|
|
||||||
*/
|
|
||||||
public function authorize(): bool
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the validation rules that apply to the request.
|
|
||||||
*
|
|
||||||
* @return array<string, ValidationRule|array|string>
|
|
||||||
*/
|
|
||||||
public function rules(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'name' => 'required|string|max:255',
|
|
||||||
'domain' => 'required|string|max:255',
|
|
||||||
'tax_id' => 'required|string',
|
|
||||||
'bank_name' => 'required|string|max:255',
|
|
||||||
'account_holder' => 'required|string',
|
|
||||||
'iban' => 'required|string|max:255',
|
|
||||||
'logo' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
|
||||||
'business_type_id' => 'required|string|exists:business_types,id',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\User\Requests\Gateway;
|
|
||||||
|
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
|
||||||
|
|
||||||
class UpdateRequest extends FormRequest
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Determine if the user is authorized to make this request.
|
|
||||||
*/
|
|
||||||
public function authorize(): bool
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the validation rules that apply to the request.
|
|
||||||
*
|
|
||||||
* @return array<string, ValidationRule|array|string>
|
|
||||||
*/
|
|
||||||
public function rules(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'name' => 'required|string|max:255',
|
|
||||||
'domain' => 'required|string|max:255',
|
|
||||||
'business_type_id' => 'required|string|exists:business_types,id',
|
|
||||||
'logo' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,8 @@ namespace App\User\Requests\Profile;
|
|||||||
|
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Illuminate\Validation\Validator;
|
||||||
|
|
||||||
class EditRequest extends FormRequest
|
class EditRequest extends FormRequest
|
||||||
{
|
{
|
||||||
@@ -22,10 +24,18 @@ class EditRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
$user = $this->user();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'first_name' => 'required|string',
|
'first_name' => [
|
||||||
'last_name' => 'required|string',
|
Rule::prohibitedIf($user->kyc_status == 1), 'string',
|
||||||
'national_id' => 'required',
|
],
|
||||||
|
'last_name' => [
|
||||||
|
Rule::prohibitedIf($user->kyc_status == 1), 'string',
|
||||||
|
],
|
||||||
|
'national_id' => [
|
||||||
|
Rule::prohibitedIf($user->kyc_status == 1), 'string',
|
||||||
|
],
|
||||||
'address' => 'required',
|
'address' => 'required',
|
||||||
'postal_code' => 'required',
|
'postal_code' => 'required',
|
||||||
'phone_number' => 'required',
|
'phone_number' => 'required',
|
||||||
@@ -33,4 +43,28 @@ class EditRequest extends FormRequest
|
|||||||
'city_id' => 'required',
|
'city_id' => 'required',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
public function after(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
function (Validator $validator) {
|
||||||
|
$user = $this->user();
|
||||||
|
if ($user->kyc_status == 1) {
|
||||||
|
$lockedFields = [
|
||||||
|
'first_name',
|
||||||
|
'last_name',
|
||||||
|
'national_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($lockedFields as $field) {
|
||||||
|
if ($this->filled($field)) {
|
||||||
|
$validator->errors()->add(
|
||||||
|
$field,
|
||||||
|
'you cannot change this field.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Database\Factories;
|
|
||||||
|
|
||||||
use App\Models\BusinessType;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @extends Factory<BusinessType>
|
|
||||||
*/
|
|
||||||
class BusinessTypeFactory extends Factory
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Define the model's default state.
|
|
||||||
*
|
|
||||||
* @return array<string, mixed>
|
|
||||||
*/
|
|
||||||
public function definition(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Database\Factories;
|
|
||||||
|
|
||||||
use App\Models\FibTransaction;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @extends Factory<FibTransaction>
|
|
||||||
*/
|
|
||||||
class FibTransactionFactory extends Factory
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Define the model's default state.
|
|
||||||
*
|
|
||||||
* @return array<string, mixed>
|
|
||||||
*/
|
|
||||||
public function definition(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Database\Factories;
|
|
||||||
|
|
||||||
use App\Models\FibTransactionStatus;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @extends Factory<FibTransactionStatus>
|
|
||||||
*/
|
|
||||||
class FibTransactionStatusFactory extends Factory
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Define the model's default state.
|
|
||||||
*
|
|
||||||
* @return array<string, mixed>
|
|
||||||
*/
|
|
||||||
public function definition(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use App\Models\UserGateway;
|
use App\Models\GatewayCategory;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends Factory<UserGateway>
|
* @extends Factory<GatewayCategory>
|
||||||
*/
|
*/
|
||||||
class UserGatewayFactory extends Factory
|
class GatewayCategoryFactory extends Factory
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Define the model's default state.
|
* Define the model's default state.
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use App\Models\Transaction;
|
use App\Models\Gateway;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends Factory<Transaction>
|
* @extends Factory<Gateway>
|
||||||
*/
|
*/
|
||||||
class TransactionFactory extends Factory
|
class GatewayFactory extends Factory
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Define the model's default state.
|
* Define the model's default state.
|
||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('business_types', function (Blueprint $table) {
|
Schema::create('gateway_categories', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
@@ -23,6 +23,6 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('business_types');
|
Schema::dropIfExists('gateway_categories');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('user_gateways', function (Blueprint $table) {
|
Schema::create('gateways', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('user_id')->constrained('users');
|
$table->foreignId('user_id')->constrained('users');
|
||||||
$table->string('username');
|
$table->string('username');
|
||||||
@@ -22,8 +22,8 @@ return new class extends Migration
|
|||||||
$table->string('account_holder');
|
$table->string('account_holder');
|
||||||
$table->string('logo')->nullable();
|
$table->string('logo')->nullable();
|
||||||
$table->string('iban');
|
$table->string('iban');
|
||||||
$table->foreignId('business_type_id')->constrained('business_types');
|
$table->foreignId('category_id')->constrained('gateway_categories');
|
||||||
$table->string('business_type_name');
|
$table->string('category_name');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,6 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('user_gateways');
|
Schema::dropIfExists('gateways');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -23,7 +23,7 @@ return new class extends Migration
|
|||||||
$table->foreignId('status_id')->constrained('payment_statuses');
|
$table->foreignId('status_id')->constrained('payment_statuses');
|
||||||
$table->string('status_name');
|
$table->string('status_name');
|
||||||
$table->ipAddress('ip');
|
$table->ipAddress('ip');
|
||||||
$table->foreignId('user_gateway_id')->constrained('user_gateways');
|
$table->foreignId('gateway_id')->constrained('gateways');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
<?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('transactions', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->foreignId('user_id')->constrained('users');
|
|
||||||
$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');
|
|
||||||
$table->foreignId('gateway_id')->constrained('gateways');
|
|
||||||
$table->integer('status');
|
|
||||||
$table->timestamps();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('transactions');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<?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('fib_transaction_statuses', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->string('name');
|
|
||||||
$table->timestamps();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('fib_transaction_statuses');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
<?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('fib_transactions', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->foreignId('transaction_id')->constrained('transactions');
|
|
||||||
$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');
|
|
||||||
$table->timestamp('paidAt');
|
|
||||||
$table->string('paidAmount');
|
|
||||||
$table->string('paidCurrency');
|
|
||||||
$table->string('decliningReason');
|
|
||||||
$table->timestamp('declinedAt');
|
|
||||||
$table->string('paidByName');
|
|
||||||
$table->string('paidByIban');
|
|
||||||
$table->timestamps();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('fib_transactions');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Database\Seeders;
|
|
||||||
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
|
|
||||||
class BusinessTypeSeeder extends Seeder
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the database seeds.
|
|
||||||
*/
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
DB::table('business_types')->insert([
|
|
||||||
['id' => 1, 'name' => 'medical', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 2, 'name' => 'legal', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 3, 'name' => 'engineering', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 4, 'name' => 'education', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 5, 'name' => 'consulting', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 6, 'name' => 'beauty', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 7, 'name' => 'technical_services', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 8, 'name' => 'financial', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 9, 'name' => 'real_estate', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 10, 'name' => 'restaurant', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 11, 'name' => 'shop', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 12, 'name' => 'transportation', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 13, 'name' => 'art', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 14, 'name' => 'sport', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
['id' => 15, 'name' => 'other', 'created_at' => now(), 'updated_at' => now()],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Database\Seeders;
|
|
||||||
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
|
|
||||||
class FibTransactionStatusSeeder extends Seeder
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the database seeds.
|
|
||||||
*/
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,7 @@ namespace Database\Seeders;
|
|||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class FibTransactionSeeder extends Seeder
|
class GatewayCategorySeeder extends Seeder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the database seeds.
|
* Run the database seeds.
|
||||||
@@ -5,7 +5,7 @@ namespace Database\Seeders;
|
|||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class TransactionSeeder extends Seeder
|
class GatewaySeeder extends Seeder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the database seeds.
|
* Run the database seeds.
|
||||||
@@ -4,7 +4,6 @@ namespace Database\Seeders;
|
|||||||
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
|
|
||||||
class PaymentStatusSeeder extends Seeder
|
class PaymentStatusSeeder extends Seeder
|
||||||
{
|
{
|
||||||
@@ -13,12 +12,6 @@ class PaymentStatusSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
DB::table('payment_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(),],
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Database\Seeders;
|
|
||||||
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
|
|
||||||
class UserGatewaySeeder extends Seeder
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the database seeds.
|
|
||||||
*/
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,7 @@ use App\Admin\Controllers\AuthController;
|
|||||||
use App\Admin\Controllers\DocumentationController;
|
use App\Admin\Controllers\DocumentationController;
|
||||||
use App\Admin\Controllers\ExpertManagementController;
|
use App\Admin\Controllers\ExpertManagementController;
|
||||||
use App\Admin\Controllers\PermissionManagementController;
|
use App\Admin\Controllers\PermissionManagementController;
|
||||||
|
use App\Admin\Controllers\ProfileController;
|
||||||
use App\Admin\Controllers\RoleManagementController;
|
use App\Admin\Controllers\RoleManagementController;
|
||||||
use App\Admin\Controllers\UserManagementController;
|
use App\Admin\Controllers\UserManagementController;
|
||||||
|
|
||||||
@@ -38,7 +39,6 @@ Route::prefix('user_management')
|
|||||||
Route::post('/{user}', 'update')->name('update');
|
Route::post('/{user}', 'update')->name('update');
|
||||||
Route::delete('/{user}', 'destroy')->name('destroy');
|
Route::delete('/{user}', 'destroy')->name('destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::prefix('roles')
|
Route::prefix('roles')
|
||||||
->name('roles.')
|
->name('roles.')
|
||||||
->middleware(['auth:expert', 'permission:role-management'])
|
->middleware(['auth:expert', 'permission:role-management'])
|
||||||
@@ -50,7 +50,6 @@ Route::prefix('roles')
|
|||||||
Route::post('/{role}', 'update')->name('update');
|
Route::post('/{role}', 'update')->name('update');
|
||||||
Route::delete('/{role}', 'destroy')->name('destroy');
|
Route::delete('/{role}', 'destroy')->name('destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::prefix('permissions')
|
Route::prefix('permissions')
|
||||||
->name('permissions.')
|
->name('permissions.')
|
||||||
->middleware(['auth:expert', 'permission:permission-management'])
|
->middleware(['auth:expert', 'permission:permission-management'])
|
||||||
@@ -62,7 +61,6 @@ Route::prefix('permissions')
|
|||||||
Route::post('/{permission}', 'update')->name('update');
|
Route::post('/{permission}', 'update')->name('update');
|
||||||
Route::delete('/{permission}', 'destroy')->name('destroy');
|
Route::delete('/{permission}', 'destroy')->name('destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::prefix('expert')
|
Route::prefix('expert')
|
||||||
->name('expert.')
|
->name('expert.')
|
||||||
->middleware(['auth:expert', 'permission:expert-management'])
|
->middleware(['auth:expert', 'permission:expert-management'])
|
||||||
@@ -74,3 +72,13 @@ Route::prefix('expert')
|
|||||||
Route::post('/{expert}', 'update')->name('update');
|
Route::post('/{expert}', 'update')->name('update');
|
||||||
Route::delete('/{expert}', 'destroy')->name('destroy');
|
Route::delete('/{expert}', 'destroy')->name('destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::prefix('profile')
|
||||||
|
->name('profile.')
|
||||||
|
->middleware('auth')
|
||||||
|
->controller(ProfileController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::get('info', 'info')->name('info');
|
||||||
|
Route::post('edit', 'edit')->name('edit');
|
||||||
|
Route::post('change_password', 'changePassword')->name('changePassword');
|
||||||
|
});
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ use App\Admin\Controllers\PermissionManagementController;
|
|||||||
use App\Admin\Controllers\RoleManagementController;
|
use App\Admin\Controllers\RoleManagementController;
|
||||||
use App\Admin\Controllers\UserManagementController;
|
use App\Admin\Controllers\UserManagementController;
|
||||||
use App\User\Controllers\AuthController;
|
use App\User\Controllers\AuthController;
|
||||||
use App\User\Controllers\GatewayManagementController;
|
|
||||||
use App\User\Controllers\ProfileController;
|
use App\User\Controllers\ProfileController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
@@ -27,15 +26,3 @@ Route::prefix('profile')
|
|||||||
Route::post('edit', 'edit')->name('edit');
|
Route::post('edit', 'edit')->name('edit');
|
||||||
Route::post('change_password', 'changePassword')->name('changePassword');
|
Route::post('change_password', 'changePassword')->name('changePassword');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::prefix('user_gateway')
|
|
||||||
->name('userGateway.')
|
|
||||||
->middleware(['auth'])
|
|
||||||
->controller(GatewayManagementController::class)
|
|
||||||
->group(function () {
|
|
||||||
Route::get('/', 'index')->name('index');
|
|
||||||
Route::post('/', 'store')->name('store');
|
|
||||||
Route::get('/{gateway}', 'show')->name('show');
|
|
||||||
Route::post('/{gateway}', 'update')->name('update');
|
|
||||||
Route::delete('/{gateway}', 'destroy')->name('destroy');
|
|
||||||
});
|
|
||||||
|
|||||||
Reference in New Issue
Block a user