Compare commits
3 Commits
feature/Fi
...
feature/Cr
| Author | SHA1 | Date | |
|---|---|---|---|
| 85d3baa2c4 | |||
| 81401060b0 | |||
| c994a3cbd0 |
0
backend/.dockerignore
Executable file → Normal file
0
backend/.dockerignore
Executable file → Normal file
0
backend/.editorconfig
Executable file → Normal file
0
backend/.editorconfig
Executable file → Normal file
0
backend/.env.example
Executable file → Normal file
0
backend/.env.example
Executable file → Normal file
0
backend/.gitattributes
vendored
Executable file → Normal file
0
backend/.gitattributes
vendored
Executable file → Normal file
0
backend/.gitignore
vendored
Executable file → Normal file
0
backend/.gitignore
vendored
Executable file → Normal file
0
backend/.npmrc
Executable file → Normal file
0
backend/.npmrc
Executable file → Normal file
0
backend/Dockerfile
Executable file → Normal file
0
backend/Dockerfile
Executable file → Normal file
0
backend/Dockerfile.production
Executable file → Normal file
0
backend/Dockerfile.production
Executable file → Normal file
0
backend/README.md
Executable file → Normal file
0
backend/README.md
Executable file → Normal file
16
backend/app/Admin/Controllers/AuthController.php
Executable file → Normal file
16
backend/app/Admin/Controllers/AuthController.php
Executable file → Normal file
@@ -16,6 +16,19 @@ class AuthController extends Controller
|
|||||||
{
|
{
|
||||||
use ApiResponse;
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function register(RegisterRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
Expert::query()->create([
|
||||||
|
'username' => $request->username,
|
||||||
|
'email' => $request->email,
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$request->session()->regenerate();
|
||||||
|
|
||||||
|
return $this->successResponse();
|
||||||
|
}
|
||||||
|
|
||||||
public function login(LoginRequest $request): JsonResponse
|
public function login(LoginRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$credentials = ['password' => $request->password];
|
$credentials = ['password' => $request->password];
|
||||||
@@ -26,7 +39,8 @@ class AuthController extends Controller
|
|||||||
$credentials['username'] = $request->login;
|
$credentials['username'] = $request->login;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Auth::guard('expert')->attempt($credentials)) {
|
if (Auth::attempt($credentials))
|
||||||
|
{
|
||||||
$request->session()->regenerate();
|
$request->session()->regenerate();
|
||||||
|
|
||||||
return $this->successResponse();
|
return $this->successResponse();
|
||||||
|
|||||||
0
backend/app/Admin/Controllers/DocumentationController.php
Executable file → Normal file
0
backend/app/Admin/Controllers/DocumentationController.php
Executable file → Normal file
1
backend/app/Admin/Controllers/ExpertManagementController.php
Executable file → Normal file
1
backend/app/Admin/Controllers/ExpertManagementController.php
Executable file → Normal file
@@ -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;
|
||||||
|
|||||||
0
backend/app/Admin/Controllers/PermissionManagementController.php
Executable file → Normal file
0
backend/app/Admin/Controllers/PermissionManagementController.php
Executable file → Normal file
1
backend/app/Admin/Controllers/ProfileController.php
Executable file → Normal file
1
backend/app/Admin/Controllers/ProfileController.php
Executable file → Normal file
@@ -53,4 +53,5 @@ class ProfileController extends Controller
|
|||||||
|
|
||||||
return $this->successResponse();
|
return $this->successResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
0
backend/app/Admin/Controllers/UserManagementController.php
Executable file → Normal file
0
backend/app/Admin/Controllers/UserManagementController.php
Executable file → Normal file
0
backend/app/Admin/Requests/Auth/LoginRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/Auth/LoginRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/Auth/RegisterRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/Auth/RegisterRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/Documentation/RejectRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/Documentation/RejectRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/ExpertManagement/StoreRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/ExpertManagement/StoreRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/ExpertManagement/UpdateRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/ExpertManagement/UpdateRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/PermissionManagement/StoreRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/PermissionManagement/StoreRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/PermissionManagement/UpdateRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/PermissionManagement/UpdateRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/Profile/ChangePasswordRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/Profile/ChangePasswordRequest.php
Executable file → Normal file
8
backend/app/Admin/Requests/Profile/EditRequest.php
Executable file → Normal file
8
backend/app/Admin/Requests/Profile/EditRequest.php
Executable file → Normal file
@@ -4,8 +4,6 @@ namespace App\Admin\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
|
||||||
{
|
{
|
||||||
@@ -26,10 +24,10 @@ class EditRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'username' => 'string|max:255',
|
'username' => 'string|max:255',
|
||||||
'first_name' => 'required|string',
|
'first_name' => 'string',
|
||||||
'last_name' => 'required|string',
|
'last_name' => 'string',
|
||||||
'national_id' => 'required',
|
|
||||||
'email' => 'string|email|max:255',
|
'email' => 'string|email|max:255',
|
||||||
|
'national_id' => 'string',
|
||||||
'phone_number' => 'string',
|
'phone_number' => 'string',
|
||||||
'province_id' => 'string',
|
'province_id' => 'string',
|
||||||
'city_id' => 'string',
|
'city_id' => 'string',
|
||||||
|
|||||||
0
backend/app/Admin/Requests/RoleManagement/StoreRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/RoleManagement/StoreRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/RoleManagement/UpdateRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/RoleManagement/UpdateRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/UserManagement/StoreRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/UserManagement/StoreRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/UserManagement/UpdateRequest.php
Executable file → Normal file
0
backend/app/Admin/Requests/UserManagement/UpdateRequest.php
Executable file → Normal file
0
backend/app/Admin/Resources/ExpertResource.php
Executable file → Normal file
0
backend/app/Admin/Resources/ExpertResource.php
Executable file → Normal file
@@ -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 static 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',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
0
backend/app/Facades/DataTable/DataTable.php
Executable file → Normal file
0
backend/app/Facades/DataTable/DataTable.php
Executable file → Normal file
0
backend/app/Facades/DataTable/DataTableFacade.php
Executable file → Normal file
0
backend/app/Facades/DataTable/DataTableFacade.php
Executable file → Normal file
0
backend/app/Facades/File/File.php
Executable file → Normal file
0
backend/app/Facades/File/File.php
Executable file → Normal file
0
backend/app/Facades/File/FileFacade.php
Executable file → Normal file
0
backend/app/Facades/File/FileFacade.php
Executable file → Normal file
0
backend/app/Http/Controllers/Controller.php
Executable file → Normal file
0
backend/app/Http/Controllers/Controller.php
Executable file → Normal file
0
backend/app/Mail/LoginNotificationMail.php
Executable file → Normal file
0
backend/app/Mail/LoginNotificationMail.php
Executable file → Normal file
@@ -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'];
|
|
||||||
}
|
|
||||||
0
backend/app/Models/City.php
Executable file → Normal file
0
backend/app/Models/City.php
Executable file → Normal file
0
backend/app/Models/Document.php
Executable file → Normal file
0
backend/app/Models/Document.php
Executable file → Normal file
8
backend/app/Models/Expert.php
Executable file → Normal file
8
backend/app/Models/Expert.php
Executable file → Normal file
@@ -5,19 +5,17 @@ namespace App\Models;
|
|||||||
use Database\Factories\ExpertFactory;
|
use Database\Factories\ExpertFactory;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Notifications\Notifiable;
|
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
||||||
use Spatie\Permission\Traits\HasRoles;
|
use Spatie\Permission\Traits\HasRoles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method roles()
|
* @method roles()
|
||||||
* @method permissions()
|
* @method permissions()
|
||||||
*/
|
*/
|
||||||
class Expert extends Authenticatable
|
class Expert extends Model
|
||||||
{
|
{
|
||||||
/** @use HasFactory<ExpertFactory> */
|
/** @use HasFactory<ExpertFactory> */
|
||||||
|
use HasFactory;
|
||||||
use Notifiable,HasFactory,HasRoles;
|
use HasRoles;
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
protected string $guard_name = 'web';
|
protected string $guard_name = 'web';
|
||||||
|
|||||||
@@ -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,12 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
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 FibTransaction extends Model
|
class Gateway extends Model
|
||||||
{
|
{
|
||||||
/** @use HasFactory<\Database\Factories\FibTransactionFactory> */
|
/** @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\UserGatewayFactory;
|
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 UserGateway extends Model
|
class GatewayCategory extends Model
|
||||||
{
|
{
|
||||||
/** @use HasFactory<UserGatewayFactory> */
|
/** @use HasFactory<GatewayCategoryFactory> */
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
0
backend/app/Models/Province.php
Executable file → Normal file
0
backend/app/Models/Province.php
Executable file → Normal file
@@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Database\Factories\TransactionFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class Transaction extends Model
|
|
||||||
{
|
|
||||||
/** @use HasFactory<TransactionFactory> */
|
|
||||||
use HasFactory;
|
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
|
||||||
}
|
|
||||||
@@ -10,8 +10,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|||||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Illuminate\Support\Facades\Hash;
|
|
||||||
use Laravel\Passport\Bridge\Client;
|
|
||||||
use Laravel\Passport\HasApiTokens;
|
use Laravel\Passport\HasApiTokens;
|
||||||
|
|
||||||
#[Guarded(['id'])]
|
#[Guarded(['id'])]
|
||||||
@@ -26,14 +24,4 @@ class User extends Authenticatable
|
|||||||
{
|
{
|
||||||
return $this->morphToMany(Document::class, 'documentable');
|
return $this->morphToMany(Document::class, 'documentable');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateForPassportPasswordGrant(string $password): bool
|
|
||||||
{
|
|
||||||
return Hash::check($password, $this->password);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findForPassport(string $username, Client $client): User
|
|
||||||
{
|
|
||||||
return $this->where('username', $username)->first();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
Passport::enablePasswordGrant();
|
Passport::enablePasswordGrant();
|
||||||
Passport::tokensExpireIn(CarbonInterval::minutes(1));
|
|
||||||
Passport::refreshTokensExpireIn(CarbonInterval::minutes(5));
|
|
||||||
Passport::personalAccessTokensExpireIn(CarbonInterval::minutes(1));
|
Passport::personalAccessTokensExpireIn(CarbonInterval::minutes(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
0
backend/app/Providers/DataTableServiceProvider.php
Executable file → Normal file
0
backend/app/Providers/DataTableServiceProvider.php
Executable file → Normal file
0
backend/app/Providers/FileServiceProvider.php
Executable file → Normal file
0
backend/app/Providers/FileServiceProvider.php
Executable file → Normal file
0
backend/app/Services/DataTable/DataTableInput.php
Executable file → Normal file
0
backend/app/Services/DataTable/DataTableInput.php
Executable file → Normal file
0
backend/app/Services/DataTable/DataTableService.php
Executable file → Normal file
0
backend/app/Services/DataTable/DataTableService.php
Executable file → Normal file
0
backend/app/Services/DataTable/Enums/DataType.php
Executable file → Normal file
0
backend/app/Services/DataTable/Enums/DataType.php
Executable file → Normal file
0
backend/app/Services/DataTable/Enums/SearchType.php
Executable file → Normal file
0
backend/app/Services/DataTable/Enums/SearchType.php
Executable file → Normal file
0
backend/app/Services/DataTable/Exceptions/InvalidFilterException.php
Executable file → Normal file
0
backend/app/Services/DataTable/Exceptions/InvalidFilterException.php
Executable file → Normal file
0
backend/app/Services/DataTable/Exceptions/InvalidParameterInterface.php
Executable file → Normal file
0
backend/app/Services/DataTable/Exceptions/InvalidParameterInterface.php
Executable file → Normal file
0
backend/app/Services/DataTable/Exceptions/InvalidRelationException.php
Executable file → Normal file
0
backend/app/Services/DataTable/Exceptions/InvalidRelationException.php
Executable file → Normal file
0
backend/app/Services/DataTable/Exceptions/InvalidSortingException.php
Executable file → Normal file
0
backend/app/Services/DataTable/Exceptions/InvalidSortingException.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/ApplyFilter.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/ApplyFilter.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/Filter.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/Filter.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterBetween.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterBetween.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterContains.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterContains.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterEquals.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterEquals.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterGreaterThan.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterGreaterThan.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterGreaterThanOrEqual.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterGreaterThanOrEqual.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterLessThan.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterLessThan.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterLessThanOrEqual.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterLessThanOrEqual.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterNotEquals.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/FilterNotEquals.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/SearchFilter.php
Executable file → Normal file
0
backend/app/Services/DataTable/Filter/SearchFunctions/SearchFilter.php
Executable file → Normal file
0
backend/app/Services/DataTable/Sort/ApplySort.php
Executable file → Normal file
0
backend/app/Services/DataTable/Sort/ApplySort.php
Executable file → Normal file
0
backend/app/Services/DataTable/Sort/Sort.php
Executable file → Normal file
0
backend/app/Services/DataTable/Sort/Sort.php
Executable file → Normal file
0
backend/app/Services/DataTable/Validators/FilterValidator.php
Executable file → Normal file
0
backend/app/Services/DataTable/Validators/FilterValidator.php
Executable file → Normal file
0
backend/app/Services/DataTable/Validators/RelationValidator.php
Executable file → Normal file
0
backend/app/Services/DataTable/Validators/RelationValidator.php
Executable file → Normal file
0
backend/app/Services/DataTable/Validators/SortingValidator.php
Executable file → Normal file
0
backend/app/Services/DataTable/Validators/SortingValidator.php
Executable file → Normal file
@@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Services\FIB\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,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,79 +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\CreatePaymentService;
|
|
||||||
use App\Services\FIB\DTO\FIBPaymentCreateDTO;
|
|
||||||
use App\Services\Payments\DTO\PaymentCreateDTO;
|
|
||||||
use Exception;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class PaymentService
|
|
||||||
{
|
|
||||||
protected CreatePaymentService $create_payment_service;
|
|
||||||
|
|
||||||
public function __construct(CreatePaymentService $create_payment_service)
|
|
||||||
{
|
|
||||||
$this->create_payment_service = $create_payment_service;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Exception
|
|
||||||
* @throws Throwable
|
|
||||||
*/
|
|
||||||
public function createPayment(PaymentCreateDTO $dto)
|
|
||||||
{
|
|
||||||
return DB::transaction(function () use ($dto) {
|
|
||||||
|
|
||||||
$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->create_payment_service->run();
|
|
||||||
$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' => '',
|
|
||||||
]);
|
|
||||||
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
0
backend/app/User/Controllers/AuthController.php
Executable file → Normal file
0
backend/app/User/Controllers/AuthController.php
Executable file → Normal file
@@ -1,24 +0,0 @@
|
|||||||
<?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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
14
backend/app/User/Controllers/Dashboard/ConfirmController.php
Executable file
14
backend/app/User/Controllers/Dashboard/ConfirmController.php
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Controllers\Dashboard;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ConfirmController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
24
backend/app/User/Controllers/Dashboard/DocumentationController.php
Executable file
24
backend/app/User/Controllers/Dashboard/DocumentationController.php
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\User\Controller\Dashboard;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Traits\ApiResponse;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class DocumentationController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponse;
|
||||||
|
|
||||||
|
public function store(StoreRequest $request): jsonResponse
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(UpdateRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,97 +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;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class GatewayManagementController extends Controller
|
|
||||||
{
|
|
||||||
use ApiResponse;
|
|
||||||
|
|
||||||
public function index(Request $request)
|
|
||||||
{
|
|
||||||
return DataTableFacade::run(
|
|
||||||
UserGateway::query()->where('user_id', '=', Auth::guard('web')->user()->id),
|
|
||||||
$request,
|
|
||||||
allowedFilters: ['*'],
|
|
||||||
allowedSortings: ['*'],
|
|
||||||
allowedSelects: ['id', 'name', 'domain', 'tax_id', 'bank_name', 'account_holder', 'iban', 'business_type_id', 'business_type_name'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Throwable
|
|
||||||
*/
|
|
||||||
public function store(StoreRequest $request): JsonResponse
|
|
||||||
{
|
|
||||||
$user = Auth::guard('web')->user();
|
|
||||||
|
|
||||||
$logo = $request->has('logo') ? FileFacade::save($request->file('logo'), "{$user->id}") : null;
|
|
||||||
|
|
||||||
DB::transaction(function () use ($user, $logo, $request) {
|
|
||||||
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,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$user->update(['authority_level' => 1]);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
32
backend/app/User/Controllers/ProfileController.php
Executable file → Normal file
32
backend/app/User/Controllers/ProfileController.php
Executable file → Normal file
@@ -2,19 +2,14 @@
|
|||||||
|
|
||||||
namespace App\User\Controllers;
|
namespace App\User\Controllers;
|
||||||
|
|
||||||
use App\Facades\File\FileFacade;
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\City;
|
|
||||||
use App\Models\Province;
|
|
||||||
use App\Traits\ApiResponse;
|
use App\Traits\ApiResponse;
|
||||||
use App\User\Requests\Profile\ChangePasswordRequest;
|
use App\User\Requests\Profile\ChangePasswordRequest;
|
||||||
use App\User\Requests\Profile\EditRequest;
|
use App\User\Requests\Profile\EditRequest;
|
||||||
use App\User\Resources\UserResource;
|
use App\User\Resources\UserResource;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class ProfileController extends Controller
|
class ProfileController extends Controller
|
||||||
{
|
{
|
||||||
@@ -25,40 +20,21 @@ class ProfileController extends Controller
|
|||||||
return $this->successResponse(new UserResource(Auth::user()));
|
return $this->successResponse(new UserResource(Auth::user()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Throwable
|
|
||||||
*/
|
|
||||||
public function edit(EditRequest $request): JsonResponse
|
public function edit(EditRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$province = Province::query()->find($request->province_id);
|
|
||||||
$city = City::query()->find($request->city_id);
|
|
||||||
|
|
||||||
DB::transaction(function () use ($user, $province, $city, $request) {
|
|
||||||
if ($user->kyc_status == 0)
|
|
||||||
{
|
|
||||||
$user->documents()->create([
|
|
||||||
'title' => 'id_card',
|
|
||||||
'url' => FileFacade::save($request->file('id_card'), "{$user->id}/"),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$user->update([
|
$user->update([
|
||||||
'first_name' => $request->first_name,
|
'first_name' => $request->first_name,
|
||||||
'last_name' => $request->last_name,
|
'last_name' => $request->last_name,
|
||||||
'national_id' => $user->kyc_status == 0 ? $request->national_id : $user->national_id,
|
'national_id' => $request->national_id,
|
||||||
'address' => $request->address,
|
'address' => $request->address,
|
||||||
'postal_code' => $request->postal_code,
|
'postal_code' => $request->postal_code,
|
||||||
'phone_number' => $request->phone_number,
|
'phone_number' => $request->phone_number,
|
||||||
'province_id' => $province->id,
|
'province_id' => $request->province_id,
|
||||||
'province_name' => $province->name,
|
'city_id' => $request->city_id,
|
||||||
'city_id' => $city->id,
|
'status' => 1
|
||||||
'city_name' => $city->name,
|
|
||||||
'birth_date' => $request->birth_date,
|
|
||||||
'email' => $request->email,
|
|
||||||
'kyc_status' => 1,
|
|
||||||
]);
|
]);
|
||||||
});
|
|
||||||
|
|
||||||
return $this->successResponse();
|
return $this->successResponse();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
<?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']));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
0
backend/app/User/Requests/Auth/LoginRequest.php
Executable file → Normal file
0
backend/app/User/Requests/Auth/LoginRequest.php
Executable file → Normal file
0
backend/app/User/Requests/Auth/RegisterRequest.php
Executable file → Normal file
0
backend/app/User/Requests/Auth/RegisterRequest.php
Executable file → Normal file
@@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\User\Requests\Gateway;
|
|
||||||
|
|
||||||
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 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 [
|
|
||||||
'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,33 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\User\Requests\Gateway;
|
|
||||||
|
|
||||||
use Illuminate\Contracts\Validation\ValidationRule;
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
class UpdateRequest extends FormRequest
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Determine if the user is authorized to make this request.
|
|
||||||
*/
|
|
||||||
public function authorize(): bool
|
|
||||||
{
|
|
||||||
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 [
|
|
||||||
'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',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
0
backend/app/User/Requests/Profile/ChangePasswordRequest.php
Executable file → Normal file
0
backend/app/User/Requests/Profile/ChangePasswordRequest.php
Executable file → Normal file
24
backend/app/User/Requests/Profile/EditRequest.php
Executable file → Normal file
24
backend/app/User/Requests/Profile/EditRequest.php
Executable file → Normal file
@@ -4,9 +4,6 @@ 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\Support\Facades\Auth;
|
|
||||||
use Illuminate\Validation\Rule;
|
|
||||||
use Illuminate\Validation\Validator;
|
|
||||||
|
|
||||||
class EditRequest extends FormRequest
|
class EditRequest extends FormRequest
|
||||||
{
|
{
|
||||||
@@ -25,20 +22,15 @@ class EditRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
$user = Auth::guard('web')->user();
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'first_name' => 'required|string|max:255',
|
'first_name' => 'required|string',
|
||||||
'last_name' => 'required|string|max:255',
|
'last_name' => 'required|string',
|
||||||
'national_id' => [Rule::prohibitedIf($user->kyc_status == 1), 'string',],
|
'national_id' => 'required',
|
||||||
'email' => 'required|email|max:255',
|
'address' => 'required',
|
||||||
'address' => 'required|string',
|
'postal_code' => 'required',
|
||||||
'postal_code' => 'required|string',
|
'phone_number' => 'required',
|
||||||
'phone_number' => 'required|string',
|
'province_id' => 'required',
|
||||||
'province_id' => 'required|exists:provinces,id',
|
'city_id' => 'required',
|
||||||
'city_id' => 'required|exists:cities,id',
|
|
||||||
'birth_date' => 'required|date',
|
|
||||||
'id_card' => [Rule::prohibitedIf($user->kyc_status == 1), 'image', 'mimes:jpeg,png,jpg,gif,svg', 'max:2048']
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
backend/app/User/Resources/UserResource.php
Executable file → Normal file
13
backend/app/User/Resources/UserResource.php
Executable file → Normal file
@@ -18,19 +18,6 @@ class UserResource extends JsonResource
|
|||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'username' => $this->username,
|
'username' => $this->username,
|
||||||
'email' => $this->email,
|
'email' => $this->email,
|
||||||
'first_name' => $this->first_name,
|
|
||||||
'last_name' => $this->last_name,
|
|
||||||
'national_id' => $this->national_id,
|
|
||||||
'address' => $this->address,
|
|
||||||
'postal_code' => $this->postal_code,
|
|
||||||
'phone_number' => $this->phone_number,
|
|
||||||
'province_id' => $this->province_id,
|
|
||||||
'province_name' => $this->province_name,
|
|
||||||
'city_id' => $this->city_id,
|
|
||||||
'city_name' => $this->city_name,
|
|
||||||
'birth_date' => $this->birth_date,
|
|
||||||
'kyc_status' => $this->kyc_status,
|
|
||||||
'authority_level' => $this->authority_level,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
backend/app/Services/FIB/AuthorizationService.php → backend/app/User/Services/FIB/AuthorizationService.php
Executable file → Normal file
5
backend/app/Services/FIB/AuthorizationService.php → backend/app/User/Services/FIB/AuthorizationService.php
Executable file → Normal file
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\FIB;
|
namespace App\User\Services\FIB;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Client\ConnectionException;
|
use Illuminate\Http\Client\ConnectionException;
|
||||||
@@ -16,7 +16,7 @@ class AuthorizationService
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->url = config('fib.authorization.url');
|
$this->url = config('fib.authorization.url');
|
||||||
$this->channelName = 'fib_authorization';
|
$this->channelName = '';
|
||||||
$this->inputParameters = [
|
$this->inputParameters = [
|
||||||
'client_id' => config('fib.authorization.client_id'),
|
'client_id' => config('fib.authorization.client_id'),
|
||||||
'client_secret' => config('fib.authorization.client_secret'),
|
'client_secret' => config('fib.authorization.client_secret'),
|
||||||
@@ -51,6 +51,7 @@ class AuthorizationService
|
|||||||
{
|
{
|
||||||
return Http::asForm()
|
return Http::asForm()
|
||||||
->throw()
|
->throw()
|
||||||
|
->withoutVerifying()
|
||||||
->post($this->url, $this->inputParameters)
|
->post($this->url, $this->inputParameters)
|
||||||
->json();
|
->json();
|
||||||
}
|
}
|
||||||
31
backend/app/Services/FIB/CancelPaymentService.php → backend/app/User/Services/FIB/CancelPaymentService.php
Executable file → Normal file
31
backend/app/Services/FIB/CancelPaymentService.php → backend/app/User/Services/FIB/CancelPaymentService.php
Executable file → Normal file
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\FIB;
|
namespace App\User\Services\FIB;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Client\ConnectionException;
|
use Illuminate\Http\Client\ConnectionException;
|
||||||
@@ -11,13 +11,21 @@ class CancelPaymentService
|
|||||||
{
|
{
|
||||||
protected string $url;
|
protected string $url;
|
||||||
protected string $channelName;
|
protected string $channelName;
|
||||||
protected AuthorizationService $authorizationService;
|
protected string $accessToken;
|
||||||
|
protected array $headers;
|
||||||
|
|
||||||
public function __construct(AuthorizationService $authorizationService)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->url = config('fib.cancelPayment.url');
|
$this->url = config('fib.cancelPayment.url');
|
||||||
$this->channelName = '';
|
$this->channelName = '';
|
||||||
$this->authorizationService = $authorizationService;
|
}
|
||||||
|
|
||||||
|
public function setHeaders(): void
|
||||||
|
{
|
||||||
|
$this->headers = [
|
||||||
|
'Authorization' => 'Bearer ' . $this->accessToken,
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,26 +50,13 @@ class CancelPaymentService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws ConnectionException
|
* @throws ConnectionException
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function sendRequest(): array
|
public function sendRequest(): array
|
||||||
{
|
{
|
||||||
return Http::withHeaders([
|
return Http::withHeaders($this->headers)
|
||||||
'Authorization' => 'Bearer ' . $this->getToken(),
|
|
||||||
'Content-Type' => 'application/json',
|
|
||||||
])
|
|
||||||
->throw()
|
->throw()
|
||||||
->withoutVerifying()
|
->withoutVerifying()
|
||||||
->post($this->url)
|
->post($this->url)
|
||||||
->json();
|
->json();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function getToken(): string
|
|
||||||
{
|
|
||||||
$data = $this->authorizationService->run();
|
|
||||||
return $data['access_token'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
24
backend/app/Services/FIB/CheckPaymentStatusService.php → backend/app/User/Services/FIB/CheckPaymentStatusService.php
Executable file → Normal file
24
backend/app/Services/FIB/CheckPaymentStatusService.php → backend/app/User/Services/FIB/CheckPaymentStatusService.php
Executable file → Normal file
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\FIB;
|
namespace App\User\Services\FIB;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Client\ConnectionException;
|
use Illuminate\Http\Client\ConnectionException;
|
||||||
@@ -11,13 +11,11 @@ class CheckPaymentStatusService
|
|||||||
{
|
{
|
||||||
protected string $url;
|
protected string $url;
|
||||||
protected string $channelName;
|
protected string $channelName;
|
||||||
protected AuthorizationService $authorizationService;
|
|
||||||
|
|
||||||
public function __construct(AuthorizationService $authorizationService)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->url = config('fib.checkPaymentStatus.url');
|
$this->url = config('fib.checkPaymentStatus.url');
|
||||||
$this->channelName = 'fib_status';
|
$this->channelName = '';
|
||||||
$this->authorizationService = $authorizationService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,26 +40,12 @@ class CheckPaymentStatusService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws ConnectionException
|
* @throws ConnectionException
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function sendRequest(): array
|
public function sendRequest(): array
|
||||||
{
|
{
|
||||||
return Http::withHeaders([
|
return Http::throw()
|
||||||
'Authorization' => 'Bearer ' . $this->getToken(),
|
|
||||||
'Content-Type' => 'application/json',
|
|
||||||
])
|
|
||||||
->throw()
|
|
||||||
->withoutVerifying()
|
->withoutVerifying()
|
||||||
->post($this->url)
|
->post($this->url)
|
||||||
->json();
|
->json();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function getToken(): string
|
|
||||||
{
|
|
||||||
$data = $this->authorizationService->run();
|
|
||||||
return $data['access_token'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
38
backend/app/Services/FIB/CreatePaymentService.php → backend/app/User/Services/FIB/CreatePaymentService.php
Executable file → Normal file
38
backend/app/Services/FIB/CreatePaymentService.php → backend/app/User/Services/FIB/CreatePaymentService.php
Executable file → Normal file
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\FIB;
|
namespace App\User\Services\FIB;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Client\ConnectionException;
|
use Illuminate\Http\Client\ConnectionException;
|
||||||
@@ -11,14 +11,27 @@ class CreatePaymentService
|
|||||||
{
|
{
|
||||||
protected string $url;
|
protected string $url;
|
||||||
protected string $channelName;
|
protected string $channelName;
|
||||||
|
protected string $accessToken;
|
||||||
|
protected array $headers;
|
||||||
protected array $inputParameters;
|
protected array $inputParameters;
|
||||||
protected AuthorizationService $authorizationService;
|
|
||||||
|
|
||||||
public function __construct(AuthorizationService $authorizationService)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->url = config('fib.createPayment.url');
|
$this->url = config('fib.createPayment.url');
|
||||||
$this->channelName = 'fib_create_payment';
|
$this->channelName = '';
|
||||||
$this->authorizationService = $authorizationService;
|
}
|
||||||
|
|
||||||
|
public function setAccessToken(string $accessToken): void
|
||||||
|
{
|
||||||
|
$this->accessToken = $accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setHeaders(): void
|
||||||
|
{
|
||||||
|
$this->headers = [
|
||||||
|
'Authorization' => 'Bearer ' . $this->accessToken,
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setInputParameters(array $inputParameters): void
|
public function setInputParameters(array $inputParameters): void
|
||||||
@@ -48,26 +61,13 @@ class CreatePaymentService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws ConnectionException
|
* @throws ConnectionException
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function sendRequest(): array
|
public function sendRequest(): array
|
||||||
{
|
{
|
||||||
return Http::withHeaders([
|
return Http::withHeaders($this->headers)
|
||||||
'Authorization' => 'Bearer ' . $this->getToken(),
|
|
||||||
'Content-Type' => 'application/json',
|
|
||||||
])
|
|
||||||
->throw()
|
->throw()
|
||||||
->withoutVerifying()
|
->withoutVerifying()
|
||||||
->post($this->url, $this->inputParameters)
|
->post($this->url, $this->inputParameters)
|
||||||
->json();
|
->json();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function getToken(): string
|
|
||||||
{
|
|
||||||
$data = $this->authorizationService->run();
|
|
||||||
return $data['access_token'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
33
backend/app/Services/FIB/RefundService.php → backend/app/User/Services/FIB/RefundService.php
Executable file → Normal file
33
backend/app/Services/FIB/RefundService.php → backend/app/User/Services/FIB/RefundService.php
Executable file → Normal file
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\FIB;
|
namespace App\User\Services\FIB;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Client\ConnectionException;
|
use Illuminate\Http\Client\ConnectionException;
|
||||||
@@ -11,13 +11,21 @@ class RefundService
|
|||||||
{
|
{
|
||||||
protected string $url;
|
protected string $url;
|
||||||
protected string $channelName;
|
protected string $channelName;
|
||||||
protected AuthorizationService $authorizationService;
|
protected string $accessToken;
|
||||||
|
protected array $headers;
|
||||||
|
|
||||||
public function __construct(AuthorizationService $authorizationService)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->url = config('fib.refund.url');
|
$this->url = config('fib.refund.url');
|
||||||
$this->channelName = 'fib_refund';
|
$this->channelName = '';
|
||||||
$this->authorizationService = $authorizationService;
|
}
|
||||||
|
|
||||||
|
public function setHeaders(): void
|
||||||
|
{
|
||||||
|
$this->headers = [
|
||||||
|
'Authorization' => 'Bearer ' . $this->accessToken,
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,26 +50,13 @@ class RefundService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws ConnectionException
|
* @throws ConnectionException
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function sendRequest(): array
|
public function sendRequest(): array
|
||||||
{
|
{
|
||||||
return Http::withHeaders([
|
return Http::withHeaders($this->headers)
|
||||||
'Authorization' => 'Bearer ' . $this->getToken(),
|
|
||||||
'Content-Type' => 'application/json',
|
|
||||||
])
|
|
||||||
->throw()
|
->throw()
|
||||||
->withoutVerifying()
|
->withoutVerifying()
|
||||||
->post($this->url)
|
->post($this->url)
|
||||||
->json();
|
->json();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function getToken(): string
|
|
||||||
{
|
|
||||||
$data = $this->authorizationService->run();
|
|
||||||
return $data['access_token'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user