Init commit
Customers account opening request implemented
This commit is contained in:
commit
8ba0a973a5
|
@ -0,0 +1,15 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
|
@ -0,0 +1,27 @@
|
|||
APP_NAME=UserService
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=false
|
||||
APP_URL=https://test.ilink-app.com
|
||||
APP_TIMEZONE=UTC
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_SLACK_WEBHOOK_URL=
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=iLink_preprod
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=vps@2017GA
|
||||
|
||||
CACHE_DRIVER=file
|
||||
QUEUE_CONNECTION=sync
|
||||
|
||||
ACCEPTED_KEYS=T3J0c9lQXPBs6UWebvPWWdnzqmqWOQM6,2z3I6LwTAEbOJpTpFyWv6WGqPAgJ6be3
|
||||
|
||||
NOTIFICATION_SERVICE_URL=localhost:8083
|
||||
NOTIFICATION_SERVICE_KEY=RfXvPQzQRgwpzQYPnLfWpZzgx4QseHlg
|
||||
|
||||
SWAGGER_GENERATE_ALWAYS=true
|
||||
SWAGGER_DOCS_TOKEN=Zh7KRQyZGAMNXdTWq0d2f4X8qrMBaHN2
|
|
@ -0,0 +1,12 @@
|
|||
/vendor
|
||||
/.idea
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
.env
|
||||
.phpunit.result.cache
|
||||
/resources/views/vendor
|
||||
/storage/api-docs
|
||||
/public/swagger-ui-assets
|
||||
/public/documents
|
||||
/public/qrcodes
|
||||
/public/requests-docs
|
|
@ -0,0 +1,6 @@
|
|||
php:
|
||||
preset: laravel
|
||||
disabled:
|
||||
- unused_use
|
||||
js: true
|
||||
css: true
|
|
@ -0,0 +1,24 @@
|
|||
# Lumen PHP Framework
|
||||
|
||||
[](https://travis-ci.org/laravel/lumen-framework)
|
||||
[](https://packagist.org/packages/laravel/lumen-framework)
|
||||
[](https://packagist.org/packages/laravel/lumen-framework)
|
||||
[](https://packagist.org/packages/laravel/lumen-framework)
|
||||
|
||||
Laravel Lumen is a stunningly fast PHP micro-framework for building web applications with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Lumen attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as routing, database abstraction, queueing, and caching.
|
||||
|
||||
## Official Documentation
|
||||
|
||||
Documentation for the framework can be found on the [Lumen website](https://lumen.laravel.com/docs).
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to Lumen! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Lumen, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Lumen framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
abstract class CreditCardType
|
||||
{
|
||||
const MASTER_CARD_CLASSIC = 'MASTER_CARD_CLASSIC';
|
||||
const MASTER_CARD_GOLD = 'MASTER_CARD_GOLD';
|
||||
const MASTER_CARD_PLATINUM = 'MASTER_CARD_PLATINUM';
|
||||
|
||||
const VISA_CARD_CLASSIC = 'VISA_CARD_CLASSIC';
|
||||
const VISA_CARD_GOLD = 'VISA_CARD_GOLD';
|
||||
const VISA_CARD_PLATINUM = 'VISA_CARD_PLATINUM';
|
||||
|
||||
public static function all()
|
||||
{
|
||||
return [
|
||||
self::MASTER_CARD_CLASSIC => __('states.MASTER_CARD_CLASSIC'),
|
||||
self::MASTER_CARD_GOLD => __('states.MASTER_CARD_GOLD'),
|
||||
self::MASTER_CARD_PLATINUM => __('states.MASTER_CARD_PLATINUM'),
|
||||
self::VISA_CARD_CLASSIC => __('states.VISA_CARD_CLASSIC'),
|
||||
self::VISA_CARD_GOLD => __('states.VISA_CARD_GOLD'),
|
||||
self::VISA_CARD_PLATINUM => __('states.VISA_CARD_PLATINUM'),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
abstract class DocumentType
|
||||
{
|
||||
const LOCALISATION_PLAN = 'LOCALISATION_PLAN';
|
||||
const UTILITY_BILL = 'UTILITY_BILL';
|
||||
|
||||
public static function all()
|
||||
{
|
||||
return [
|
||||
self::LOCALISATION_PLAN => __('states.LOCALISATION_PLAN'),
|
||||
self::UTILITY_BILL => __('states.UTILITY_BILL'),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
abstract class Frequency
|
||||
{
|
||||
const DAILY = 'DAILY';
|
||||
const WEEKLY = 'WEEKLY';
|
||||
const MONTHLY = 'MONTHLY';
|
||||
|
||||
public static function all()
|
||||
{
|
||||
return [
|
||||
self::DAILY => __('states.DAILY'),
|
||||
self::WEEKLY => __('states.WEEKLY'),
|
||||
self::MONTHLY => __('states.MONTHLY'),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
abstract class MaritalStatus
|
||||
{
|
||||
const SINGLE = 'SINGLE';
|
||||
const MARRIED = 'MARRIED';
|
||||
const WIDOW = 'WIDOW';
|
||||
const DIVORCED = 'DIVORCED';
|
||||
|
||||
public static function all()
|
||||
{
|
||||
return [
|
||||
self::SINGLE => __('states.SINGLE'),
|
||||
self::MARRIED => __('states.MARRIED'),
|
||||
self::WIDOW => __('states.WIDOW'),
|
||||
self::DIVORCED => __('states.DIVORCED')
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
abstract class ResidentialStatus
|
||||
{
|
||||
const RESIDENT = 'RESIDENT';
|
||||
const NOT_RESIDENT = 'NOT_RESIDENT';
|
||||
|
||||
public static function all()
|
||||
{
|
||||
return [
|
||||
self::RESIDENT => __('states.RESIDENT'),
|
||||
self::NOT_RESIDENT => __('states.NOT_RESIDENT'),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\NhInsurancesSubscription;
|
||||
use App\Traits\Helper;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CustomerAccountRequestEvent extends Event
|
||||
{
|
||||
use Helper;
|
||||
|
||||
public $request;
|
||||
public $mailTitle;
|
||||
public $mailMessage;
|
||||
public $notification;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($request, string $mailTitle, string $mailMessage,
|
||||
string $notification = null)
|
||||
{
|
||||
//
|
||||
$this->request = $request;
|
||||
$this->mailTitle = $mailTitle;
|
||||
$this->mailMessage = $mailMessage;
|
||||
$this->notification = $notification;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
abstract class Event
|
||||
{
|
||||
use SerializesModels;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
class ExampleEvent extends Event
|
||||
{
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Throwable;
|
||||
|
||||
class AppException extends Exception
|
||||
{
|
||||
// Redéfinissez l'exception ainsi le message n'est pas facultatif
|
||||
public function __construct($message, $code = 400, Throwable $previous = null)
|
||||
{
|
||||
// traitement personnalisé que vous voulez réaliser ...
|
||||
|
||||
// assurez-vous que tout a été assigné proprement
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
// chaîne personnalisée représentant l'objet
|
||||
public function __toString()
|
||||
{
|
||||
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use App\Traits\ApiResponser;
|
||||
use ErrorException;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use GuzzleHttp\Exception\ServerException;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
use ApiResponser;
|
||||
|
||||
/**
|
||||
* A list of the exception types that should not be reported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
AuthorizationException::class,
|
||||
HttpException::class,
|
||||
ModelNotFoundException::class,
|
||||
ValidationException::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||
*
|
||||
* @param \Throwable $exception
|
||||
* @return void
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function report(Throwable $exception)
|
||||
{
|
||||
parent::report($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Throwable $exception
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function render($request, Throwable $exception)
|
||||
{
|
||||
// return parent::render($request, $exception);
|
||||
if ($exception instanceof HttpException) {
|
||||
$code = $exception->getStatusCode();
|
||||
$message = Response::$statusTexts[$code];
|
||||
|
||||
return $this->errorResponse($message, $code);
|
||||
}
|
||||
|
||||
if ($exception instanceof ModelNotFoundException) {
|
||||
$model = strtolower(class_basename($exception->getModel()));
|
||||
|
||||
return $this->errorResponse(trans('errors.model_not_found', ['model' => $model]),
|
||||
Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
if ($exception instanceof AuthorizationException) {
|
||||
return $this->errorResponse($exception->getMessage(), Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
if ($exception instanceof ValidationException) {
|
||||
$errors = $exception->validator->errors()->getMessages();
|
||||
$message = '';
|
||||
foreach ($errors as $val) {
|
||||
foreach ($val as $validation) {
|
||||
$message .= $validation . "\n";
|
||||
}
|
||||
$message .= "\n";
|
||||
}
|
||||
return $this->errorResponse($message, Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
|
||||
|
||||
if ($exception instanceof AuthenticationException) {
|
||||
return $this->errorResponse($exception->getMessage(), Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
if ($exception instanceof QueryException) {
|
||||
return $this->errorResponse($exception->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
if ($exception instanceof ServerException) {
|
||||
return $this->errorResponse($exception->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
if ($exception instanceof ErrorException) {
|
||||
return $this->errorResponse($exception->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
if ($exception instanceof ClientException) {
|
||||
$message = $exception->getResponse()->getBody()->getContents();
|
||||
$error = json_decode($message);
|
||||
$code = $exception->getCode();
|
||||
|
||||
if ($error) {
|
||||
if (isset($error->message)) {
|
||||
$message = json_decode($error->message);
|
||||
if (isset($message->errorMessage))
|
||||
return $this->errorResponse($message->errorMessage, $code);
|
||||
return $this->errorResponse($error->message, $code);
|
||||
}
|
||||
if (isset($error->error)) {
|
||||
try {
|
||||
$message = json_decode($error->error);
|
||||
if (isset($message->message))
|
||||
return $this->errorResponse($message->message, $code);
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
return $this->errorResponse(json_encode($error->error), $code);
|
||||
}
|
||||
}
|
||||
return $this->errorResponse($message, $code);
|
||||
}
|
||||
|
||||
if ($exception instanceof AppException) {
|
||||
return $this->errorResponse($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
if (config('services.app_debug', false)) {
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
|
||||
return $this->errorResponse(trans('errors.unexpected_error'),
|
||||
Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Traits\ApiResponser;
|
||||
use App\Traits\Helper;
|
||||
use Laravel\Lumen\Routing\Controller as BaseController;
|
||||
|
||||
/**
|
||||
* @OA\Info(
|
||||
* title="User Service API",
|
||||
* version="1.0.0",
|
||||
* @OA\Contact(
|
||||
* email="administrateur@ilink-app.com",
|
||||
* url = "https://ilink-app.com/",
|
||||
* name="Developer Team"
|
||||
* )
|
||||
* )
|
||||
*
|
||||
*/
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use ApiResponser, Helper;
|
||||
}
|
|
@ -0,0 +1,707 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\CreditCardType;
|
||||
use App\Enums\DocumentType;
|
||||
use App\Enums\Frequency;
|
||||
use App\Enums\MaritalStatus;
|
||||
use App\Enums\ResidentialStatus;
|
||||
use App\Events\CustomerAccountRequestEvent;
|
||||
use App\Exceptions\AppException;
|
||||
use App\Models\CustomerAccountRequest;
|
||||
use App\Models\CustomerAccountRequestDocument;
|
||||
use App\Models\CustomerAccountType;
|
||||
use App\Models\Identification;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
use Throwable;
|
||||
|
||||
class CustomerAccountOpeningController extends Controller
|
||||
{
|
||||
//
|
||||
|
||||
/**
|
||||
* @OA\Post(
|
||||
* path="/customers_accounts_requests",
|
||||
* summary="Soumettre le formulaire d'ouverture de comptele",
|
||||
* tags={"Agency Banking"},
|
||||
* security={{"api_key":{}}},
|
||||
* @OA\RequestBody(
|
||||
* description="Corps de la requete",
|
||||
* required=true,
|
||||
* @OA\MediaType(
|
||||
* mediaType="multipart/form-data",
|
||||
* @OA\Schema(
|
||||
* @OA\Property(property="user_id",
|
||||
* type="integer",
|
||||
* example=308,
|
||||
* description="ID de l'utilisateur enregistré dans la base de données"
|
||||
* ),
|
||||
* @OA\Property(property="network_id",
|
||||
* type="integer",
|
||||
* example=4,
|
||||
* description="ID du réseau auquel appartient il souhaitre faire sa demande"
|
||||
* ),
|
||||
* @OA\Property(property="customer_account_type_id",
|
||||
* type="integer",
|
||||
* example=101,
|
||||
* description="ID du type de compte"
|
||||
* ),
|
||||
* @OA\Property(property="title",
|
||||
* type="string",
|
||||
* example = "Mr",
|
||||
* description="Title"
|
||||
* ),
|
||||
* @OA\Property(property="lastname",
|
||||
* type="string",
|
||||
* example = "John",
|
||||
* description="Noms"
|
||||
* ),
|
||||
* @OA\Property(property="firstname",
|
||||
* type="string",
|
||||
* example = "Doe",
|
||||
* description="Prenoms"
|
||||
* ),
|
||||
* @OA\Property(property="spouse_name",
|
||||
* type="string",
|
||||
* example = "Bill",
|
||||
* description="Nom Marital"
|
||||
* ),
|
||||
* @OA\Property(property="nationality",
|
||||
* type="string",
|
||||
* example = "Camerounaise",
|
||||
* description="Nationalité"
|
||||
* ),
|
||||
* @OA\Property(property="birth_date",
|
||||
* type="date",
|
||||
* example = "1990-06-15",
|
||||
* description=" Date de naissance"
|
||||
* ),
|
||||
* @OA\Property(property="birth_city",
|
||||
* type="string",
|
||||
* example = "Douala",
|
||||
* description="Ville de naissance"
|
||||
* ),
|
||||
* @OA\Property(property="birth_country",
|
||||
* type="string",
|
||||
* example = "Cameroun",
|
||||
* description="Pays de naissance"
|
||||
* ),
|
||||
* @OA\Property(property="birth_locality",
|
||||
* type="string",
|
||||
* example = "Akwa",
|
||||
* description="Lieu exact de naissance"
|
||||
* ),
|
||||
* @OA\Property(property="father_lastname",
|
||||
* type="string",
|
||||
* example = "Doe",
|
||||
* description="Nom du père"
|
||||
* ),
|
||||
* @OA\Property(property="father_firstname",
|
||||
* type="string",
|
||||
* example = "Doe",
|
||||
* description="Prénom du père"
|
||||
* ),
|
||||
* @OA\Property(property="mother_birth_lastname",
|
||||
* type="string",
|
||||
* example = "Elize",
|
||||
* description="Nom de naissance de la mère"
|
||||
* ),
|
||||
* @OA\Property(property="mother_firstname",
|
||||
* type="string",
|
||||
* example = "marie",
|
||||
* description="Prénom de la mère"
|
||||
* ),
|
||||
* @OA\Property(property="marital_status",
|
||||
* type="string",
|
||||
* example = "SINGLE",
|
||||
* description="Situation matrimoniale"
|
||||
* ),
|
||||
* @OA\Property(property="spouse_lastname",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Nom du conjoint"
|
||||
* ),
|
||||
* @OA\Property(property="spouse_firstname",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Prénom du conjoint"
|
||||
* ),
|
||||
* @OA\Property(property="profession",
|
||||
* type="string",
|
||||
* example = "Student",
|
||||
* description="Profession"
|
||||
* ),
|
||||
* @OA\Property(property="business_activity",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Secteur d'activité économique"
|
||||
* ),
|
||||
* @OA\Property(property="sub_sector_business_activity",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Sous secteur d'activité"
|
||||
* ),
|
||||
* @OA\Property(property="tax_number",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Numéro Fiscal"
|
||||
* ),
|
||||
* @OA\Property(property="security_number",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Numéro de sécurité sociale"
|
||||
* ),
|
||||
* @OA\Property(property="employee_number",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Numéro de l'employeur"
|
||||
* ),
|
||||
* @OA\Property(property="function",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Fonction"
|
||||
* ),
|
||||
* @OA\Property(property="employee_name",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Nom de l'employeur"
|
||||
* ),
|
||||
* @OA\Property(property="employee_address",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Addresse de l'employeur"
|
||||
* ),
|
||||
* @OA\Property(property="residential_status",
|
||||
* type="string",
|
||||
* example = "RESIDENT",
|
||||
* description="Status de résident"
|
||||
* ),
|
||||
* @OA\Property(property="residential_country",
|
||||
* type="string",
|
||||
* example = "Cameroun",
|
||||
* description="Pays de résidence"
|
||||
* ),
|
||||
* @OA\Property(property="residence_permit_number",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Numéro de permis de séjour"
|
||||
* ),
|
||||
* @OA\Property(property="residence_permit_issued_date",
|
||||
* type="date",
|
||||
* example = "",
|
||||
* description="Date de délivrance du permis"
|
||||
* ),
|
||||
* @OA\Property(property="residence_permit_expiry_date",
|
||||
* type="date",
|
||||
* example = "",
|
||||
* description="Date d'expiration du permis"
|
||||
* ),
|
||||
* @OA\Property(property="address_justification_doc",
|
||||
* type="string",
|
||||
* example = "LOCALISATION_PLAN",
|
||||
* description="Justificatif d'adresse"
|
||||
* ),
|
||||
* @OA\Property(property="address",
|
||||
* type="string",
|
||||
* example = "Douala",
|
||||
* description="Adresse géographique"
|
||||
* ),
|
||||
* @OA\Property(property="po_box",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Adresse postale"
|
||||
* ),
|
||||
* @OA\Property(property="phone_number",
|
||||
* type="string",
|
||||
* example = "+237690716639",
|
||||
* description="Numéro de téléphone"
|
||||
* ),
|
||||
* @OA\Property(property="email_1",
|
||||
* type="string",
|
||||
* example = "ddietchi@ilink-app.com",
|
||||
* description="Email 1"
|
||||
* ),
|
||||
* @OA\Property(property="email_2",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Email 2"
|
||||
* ),
|
||||
* @OA\Property(property="person_to_contact_in_case_of_needs_name",
|
||||
* type="string",
|
||||
* example = "Romeo Doe",
|
||||
* description="Personne à contacter en cas de besoin"
|
||||
* ),
|
||||
* @OA\Property(property="person_to_contact_in_case_of_needs_phone_number",
|
||||
* type="string",
|
||||
* example = "+237699000102",
|
||||
* description="Numéro de téléphone de la personne à contacter en cas de besoin"
|
||||
* ),
|
||||
* @OA\Property(property="identification_document_type",
|
||||
* type="string",
|
||||
* example = "CNI",
|
||||
* description="Type de pièce"
|
||||
* ),
|
||||
* @OA\Property(property="identification_document_number",
|
||||
* type="string",
|
||||
* example = "0987654321",
|
||||
* description="Numéro d'identification"
|
||||
* ),
|
||||
* @OA\Property(property="identification_document_issued_date",
|
||||
* type="date",
|
||||
* example = "2019-08-03",
|
||||
* description="Date de délivrance du document"
|
||||
* ),
|
||||
* @OA\Property(property="identification_document_expiry_date",
|
||||
* type="date",
|
||||
* example = "2029-08-03",
|
||||
* description="Date d'expiration du document"
|
||||
* ),
|
||||
* @OA\Property(property="identification_document_issuance_city",
|
||||
* type="string",
|
||||
* example = "Douala",
|
||||
* description="Ville d'émission du document"
|
||||
* ),
|
||||
* @OA\Property(property="identification_document_issuance_country",
|
||||
* type="string",
|
||||
* example = "Cameroun",
|
||||
* description="Pays d'émission du document"
|
||||
* ),
|
||||
* @OA\Property(property="customer_under_guardianship",
|
||||
* type="boolean",
|
||||
* example = "1",
|
||||
* description="Client sous tutelle ?"
|
||||
* ),
|
||||
* @OA\Property(property="guardian_fullname",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Nom(s) et Prénom(s) du tuteur"
|
||||
* ),
|
||||
* @OA\Property(property="guardian_phone_number",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Numéro de téléphone du tuteur"
|
||||
* ),
|
||||
* @OA\Property(property="how_did_you_know_company",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Comment avez vous connu l'entreprise ?"
|
||||
* ),
|
||||
* @OA\Property(property="introducer_fullname",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Nom(s) et Prénom(s) de l'introducteur"
|
||||
* ),
|
||||
* @OA\Property(property="introducer_address",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Adresse de l'introducteur"
|
||||
* ),
|
||||
* @OA\Property(property="expected_service",
|
||||
* type="string",
|
||||
* example = "Services bancaires",
|
||||
* description="Service attendu"
|
||||
* ),
|
||||
* @OA\Property(property="income_sources_and_frequency",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Fréquence de revenus et Plafond des transactions"
|
||||
* ),
|
||||
* @OA\Property(property="business_partners",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Relation d'affaires"
|
||||
* ),
|
||||
* @OA\Property(property="bank_references",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Référence bancaires"
|
||||
* ),
|
||||
* @OA\Property(property="has_account_with_other_bank",
|
||||
* type="boolean",
|
||||
* example = "1",
|
||||
* description="Avez vous des comptes avec d'autres banques ?"
|
||||
* ),
|
||||
* @OA\Property(property="has_operative_other_bank_account",
|
||||
* type="boolean",
|
||||
* example = "1",
|
||||
* description="Si oui, le compte est-il opérationnel ?"
|
||||
* ),
|
||||
* @OA\Property(property="has_engagement_with_other_banks",
|
||||
* type="boolean",
|
||||
* example = "0",
|
||||
* description="Avez vous des engagements avec d'autres banques ?"
|
||||
* ),
|
||||
* @OA\Property(property="is_politically_exposed_person",
|
||||
* type="boolean",
|
||||
* example = "0",
|
||||
* description="Le demandeur est-il une personne politiquement exposée ?"
|
||||
* ),
|
||||
* @OA\Property(property="is_politically_exposed_person_in_service",
|
||||
* type="boolean",
|
||||
* example = "0",
|
||||
* description="En service ?"
|
||||
* ),
|
||||
* @OA\Property(property="has_relationship_with_politically_exposed_person",
|
||||
* type="boolean",
|
||||
* example = "0",
|
||||
* description="Le demandeur est-il une relation avec des personnes politiquement exposées ?"
|
||||
* ),
|
||||
* @OA\Property(property="relationship_with_politically_exposed_person",
|
||||
* type="string",
|
||||
* example = "",
|
||||
* description="Si oui, indiquez leurs noms et la nature de la relation"
|
||||
* ),
|
||||
* @OA\Property(property="email_alerts",
|
||||
* type="boolean",
|
||||
* example = "1",
|
||||
* description="Alertes Email"
|
||||
* ),
|
||||
* @OA\Property(property="e_statement_frequency",
|
||||
* type="string",
|
||||
* example = "MONTHLY",
|
||||
* description="Frequence Relevé bancaire"
|
||||
* ),
|
||||
* @OA\Property(property="e_package",
|
||||
* type="boolean",
|
||||
* example = "1",
|
||||
* description="E Package"
|
||||
* ),
|
||||
* @OA\Property(property="debit_card_type",
|
||||
* type="string",
|
||||
* example = "VISA_CLASSIC",
|
||||
* description="Type de carte de débit"
|
||||
* ),
|
||||
* @OA\Property(property="document1",
|
||||
* type="file",
|
||||
* description="Document 1"
|
||||
* ),
|
||||
* @OA\Property(property="document2",
|
||||
* type="file",
|
||||
* description="Document 2"
|
||||
* ),
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="OK",
|
||||
* @OA\JsonContent(
|
||||
* ref="#/components/schemas/ApiResponse",
|
||||
* example = {
|
||||
* "status" : 200,
|
||||
* "response" : "Demande d'ouverture de compte client soumise",
|
||||
* "error":null
|
||||
* }
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* @throws AppException
|
||||
*/
|
||||
|
||||
public function submit(Request $request)
|
||||
{
|
||||
$this->validate($request,[
|
||||
'user_id' => 'required|integer|exists:users,id',
|
||||
'network_id' => 'required|integer|exists:networks,id',
|
||||
'customer_account_type_id' => 'required|integer|exists:customer_account_types,id',
|
||||
'title' => 'required|string',
|
||||
'lastname' => 'required|string',
|
||||
'firstname' => 'nullable|string',
|
||||
'spouse_name' => 'nullable|string',
|
||||
'nationality' => 'required|string',
|
||||
'birth_date' => 'required|date_format:Y-m-d|before:today',
|
||||
'birth_country' => 'required|string',
|
||||
'birth_city' => 'required|string',
|
||||
'birth_locality' => 'nullable|string',
|
||||
'father_lastname' => 'required|string',
|
||||
'father_firstname' => 'nullable|string',
|
||||
'mother_birth_lastname' => 'required|string',
|
||||
'mother_firstname' => 'nullable|string',
|
||||
'marital_status' => 'required|string',
|
||||
'spouse_lastname' => 'nullable|string',
|
||||
'spouse_firstname' => 'nullable|string',
|
||||
'profession' => 'nullable|string',
|
||||
'business_activity' => 'nullable|string',
|
||||
'sub_sector_business_activity' => 'nullable|string',
|
||||
'tax_number' => 'nullable|string',
|
||||
'security_number' => 'nullable|string',
|
||||
'employee_number' => 'nullable|string',
|
||||
'function' => 'nullable|string',
|
||||
'employee_name' => 'nullable|string',
|
||||
'employee_address' => 'nullable|string',
|
||||
'residential_status' => 'required|string',
|
||||
'residential_country' => 'required|string',
|
||||
'residence_permit_number' => 'nullable|string',
|
||||
'residence_permit_issued_date' => 'nullable|date_format:Y-m-d|before:today',
|
||||
'residence_permit_expiry_date' => 'nullable|date_format:Y-m-d|after:residence_permit_issued_date',
|
||||
'address_justification_doc' => 'required|string',
|
||||
'address' => 'required|string',
|
||||
'po_box' => 'nullable|string',
|
||||
'phone_number' => 'required|string',
|
||||
'email_1' => 'required|string',
|
||||
'email_2' => 'nullable|string',
|
||||
'person_to_contact_in_case_of_needs_name' => 'required|string',
|
||||
'person_to_contact_in_case_of_needs_phone_number' => 'required|string',
|
||||
'identification_document_type' => 'required|string',
|
||||
'identification_document_number' => 'required|string',
|
||||
'identification_document_issued_date' => 'required|date_format:Y-m-d|before:today',
|
||||
'identification_document_expiry_date' => 'required|date_format:Y-m-d|after:identification_document_issued_date',
|
||||
'identification_document_issuance_city' => 'required|string',
|
||||
'identification_document_issuance_country' => 'required|string',
|
||||
'customer_under_guardianship' => 'required|bool',
|
||||
'guardian_fullname' => 'nullable|string',
|
||||
'guardian_phone_number' => 'nullable|string',
|
||||
'how_did_you_know_company' => 'required|string',
|
||||
'introducer_fullname' => 'nullable|string',
|
||||
'introducer_address' => 'nullable|string',
|
||||
'expected_service' => 'required|string',
|
||||
'income_sources_and_frequency' => 'nullable|string',
|
||||
'business_partners' => 'nullable|string',
|
||||
'bank_references' => 'nullable|string',
|
||||
'has_account_with_other_bank' => 'required|bool',
|
||||
'has_operative_other_bank_account' => 'required|bool',
|
||||
'has_engagement_with_other_banks' => 'required|bool',
|
||||
'is_politically_exposed_person' => 'required|bool',
|
||||
'is_politically_exposed_person_in_service' => 'required|bool',
|
||||
'has_relationship_with_politically_exposed_person' => 'required|bool',
|
||||
'relationship_with_politically_exposed_person' => 'nullable|string',
|
||||
'email_alerts' => 'required|bool',
|
||||
'e_statement_frequency' => 'required|string',
|
||||
'e_package' => 'nullable|bool',
|
||||
'debit_card_type' => 'required|string',
|
||||
]);
|
||||
|
||||
$accountType = CustomerAccountType::with('documents')->find($request->input('customer_account_type_id'));
|
||||
$documents = [];
|
||||
if(!empty($accountType->documents)){
|
||||
|
||||
$rules[] = [];
|
||||
foreach ($accountType->documents as $document){
|
||||
$rules[$document->name] = 'required|image|mimes:jpeg,png,jpg,jpeg|max:1024';
|
||||
}
|
||||
|
||||
$this->validate($request, $rules);
|
||||
|
||||
foreach ($accountType->documents as $document){
|
||||
$doc = [];
|
||||
$doc['name'] = $document->name;
|
||||
$doc['description'] = $document->description;
|
||||
$doc['url'] = $this->uploadImage($request,$document->name, 'CRD', 'requests-docs');
|
||||
|
||||
$documents[] = $doc;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(CustomerAccountRequest::where('user_id', $request->input('user_id'))->where('network_id', $request->input('network_id'))
|
||||
->where('status', CustomerAccountRequest::UNDER_VALIDATION)->exists()){
|
||||
return $this->errorResponse(__('messages.customer_account_opening_request_pending'));
|
||||
}
|
||||
|
||||
try{
|
||||
DB::beginTransaction();
|
||||
|
||||
$accountRequest = CustomerAccountRequest::create(array_merge($request->all(),[
|
||||
'unique_id' => strtoupper(Str::random(12))
|
||||
]));
|
||||
|
||||
$documents = array_map(function ($row) use ($accountRequest) {
|
||||
$row['request_id'] = $accountRequest->id;
|
||||
$row['created_at'] = Carbon::now();
|
||||
$row['updated_at'] = Carbon::now();
|
||||
return $row;
|
||||
}, $documents);
|
||||
|
||||
CustomerAccountRequestDocument::insert($documents);
|
||||
|
||||
DB::commit();
|
||||
}catch (Throwable $exception){
|
||||
Log::error($exception->getMessage());
|
||||
DB::rollBack();
|
||||
return $this->errorResponse(trans('errors.unexpected_error'), 500);
|
||||
}
|
||||
|
||||
$mailParams = ['name' => $accountRequest->user->lastname, 'request_id' => $accountRequest->unique_id, 'gender' => $accountRequest->title, 'account_type' => $accountRequest->account_type->name,
|
||||
'opening_amount' => $this->toMoneyWithNetwork($accountRequest->account_type->opening_amount, $accountRequest->network_id)
|
||||
];
|
||||
|
||||
Event::dispatch(new CustomerAccountRequestEvent($accountRequest, __('messages.customer_account_opening_request'), __('messages.customer_account_opening_request_mail',$mailParams)));
|
||||
|
||||
return $this->successResponse(__('messages.customer_account_opening_request_submitted'));
|
||||
}
|
||||
|
||||
public function getCustomerRequests($user_id)
|
||||
{
|
||||
$requests = CustomerAccountRequest::where('user_id', $user_id)->get();
|
||||
|
||||
return $this->successResponse($requests);
|
||||
}
|
||||
|
||||
public function treatRequest($id, Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'nh_validating_agent_id' => 'required_without:agent_id|nullable|integer|exists:nh_validating_agents,id',
|
||||
'agent_id' => 'required_without:nh_validating_agent_id|nullable|integer|exists:agents,id',
|
||||
'type' => 'required|in:ACCEPT,REJECT,MORE_INFORMATION',
|
||||
'reason' => 'nullable|string'
|
||||
]);
|
||||
|
||||
$accountRequest = CustomerAccountRequest::findOrFail($id);
|
||||
if(!in_array($accountRequest->status,[CustomerAccountRequest::UNDER_VALIDATION, CustomerAccountRequest::AWAITING_FURTHER_INFORMATION])){
|
||||
return $this->errorResponse(__('errors.request_already_processed'));
|
||||
}
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$datetime = $this->getCurrentTimeByCountryCode($accountRequest->user->network->country->code_country);
|
||||
|
||||
$type = $request->input('type');
|
||||
$mailParams = ['name' => $accountRequest->user->lastname, 'request_id' => $accountRequest->unique_id, 'reason' => $request->input('reason'),
|
||||
'gender' => $accountRequest->title, 'account_type' => $accountRequest->account_type->name,
|
||||
'opening_amount' => $this->toMoneyWithNetwork($accountRequest->account_type->opening_amount, $accountRequest->network_id)
|
||||
];
|
||||
$notificationParams = ['request_id' => $accountRequest->unique_id];
|
||||
|
||||
switch ($type){
|
||||
case 'REJECT':
|
||||
$accountRequest->status = CustomerAccountRequest::REJECTED;
|
||||
$mailTitle = trans('messages.customer_account_opening_request_rejected');
|
||||
$mailMessage = trans('messages.customer_account_opening_request_rejected_mail', $mailParams);
|
||||
$notification = trans('messages.customer_account_opening_request_rejected_notification', $notificationParams);
|
||||
break;
|
||||
case 'ACCEPT':
|
||||
$accountRequest->status = CustomerAccountRequest::ACCEPTED;
|
||||
$mailTitle = trans('messages.customer_account_opening_request_accepted');
|
||||
$mailMessage = trans('messages.customer_account_opening_request_accepted_mail', $mailParams);
|
||||
$notification = trans('messages.customer_account_opening_request_accepted_notification', $notificationParams);
|
||||
break;
|
||||
default:
|
||||
$accountRequest->status = CustomerAccountRequest::AWAITING_FURTHER_INFORMATION;
|
||||
$mailTitle = trans('messages.customer_account_opening_request_awaiting_more_information');
|
||||
$mailMessage = trans('messages.customer_account_opening_request_awaiting_more_information_mail', $mailParams);
|
||||
$notification = trans('messages.customer_account_opening_request_awaiting_more_information_notification', $notificationParams);
|
||||
}
|
||||
$accountRequest->validating_agent_id = $request->input('nh_validating_agent_id') ?? $request->input('agent_id');
|
||||
$accountRequest->reject_reason = $request->input('reason');
|
||||
$accountRequest->updated_at = $datetime;
|
||||
$accountRequest->save();
|
||||
|
||||
Event::dispatch(new CustomerAccountRequestEvent($accountRequest, $mailTitle, $mailMessage, $notification));
|
||||
DB::commit();
|
||||
return $this->successResponse(trans('messages.successful_transaction'));
|
||||
} catch (Throwable $e) {
|
||||
Log::error($e->getMessage() . '\n' . $e->getTraceAsString());
|
||||
DB::rollBack();
|
||||
return $this->errorResponse(trans('errors.unexpected_error'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/customers_accounts_requests/formData",
|
||||
* summary="Recuperer les informations necessaires avant la soumission du formulaire",
|
||||
* tags={"Agency Banking"},
|
||||
* security={{"api_key":{}}},
|
||||
* @OA\Parameter(
|
||||
* parameter="user_id",
|
||||
* name="user_id",
|
||||
* description="ID de l'utilisateur",
|
||||
* @OA\Schema(
|
||||
* type="integer"
|
||||
* ),
|
||||
* in="query",
|
||||
* required=true
|
||||
* ),
|
||||
* @OA\Parameter(
|
||||
* parameter="network_id",
|
||||
* name="network_id",
|
||||
* description="ID du reseau",
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* ),
|
||||
* in="query",
|
||||
* required=true
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="OK",
|
||||
* @OA\JsonContent(
|
||||
* ref="#/components/schemas/ApiResponse",
|
||||
* example = {
|
||||
* "status" : 200,
|
||||
* "response" : {"identification": { "id": 15, "firstname": "", "lastname": " John doe", "birth_date": "2020-07-28T00:00:00.000000Z", "gender": "M", "town": "Libreville", "country": "Gabon", "identity_document": "Carte d'identité",
|
||||
* "id_identity_document": "1234567890", "expiry_date_document": "2020-07-28T00:00:00.000000Z", "id_user": 321, "status": 1, "createdAt": "2020-07-28T17:01:26.000000Z", "user_image": null, "document_image_front": null, "document_image_back": null,
|
||||
* "idNetwork": 239, "country_id": null }, "customer_account_types": {{ "id": 1, "name": "Compte courant", "description": null, "children": {{ "id": 4, "name": "Compte courant regulier salarie", "description": "Compte courant regulier", "parent_id": 1,
|
||||
* "documents": { { "name": "photo", "description": "photo", "account_type_id": 4 } } } } } }, "marital_status": { { "title": "Single", "value": "SINGLE" } }, "residential_status": { { "title": "Résident", "value": "RESIDENT" } },
|
||||
* "address_justification_docs": { { "title": "Plan de localisation", "value": "LOCALISATION_PLAN" } }, "e_statement_frequencies": { { "title": "Daily", "value": "DAILY" } }, "debit_card_types": { { "title": "MASTER Card Classic",
|
||||
* "value": "MASTER_CARD_CLASSIC" } }},
|
||||
* "error":null
|
||||
* }
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
// Fetch mandatory form data before submit request
|
||||
public function getFormData(Request $request)
|
||||
{
|
||||
$this->validate($request,[
|
||||
'user_id' => 'required|integer|exists:users,id',
|
||||
'network_id' => 'required|integer|exists:networks,id',
|
||||
]);
|
||||
|
||||
if(CustomerAccountRequest::where('user_id', $request->input('user_id'))->where('network_id', $request->input('network_id'))
|
||||
->where('status', CustomerAccountRequest::UNDER_VALIDATION)->exists()){
|
||||
return $this->errorResponse(__('messages.customer_account_opening_request_pending'));
|
||||
}
|
||||
|
||||
$data['identification'] = Identification::where('id_user',$request->input('user_id'))->first();
|
||||
|
||||
$data['customer_account_types'] = CustomerAccountType::has('children')->with(['children:id,name,description,parent_id','children.documents:name,description,account_type_id'])
|
||||
->where('network_id',$request->input('network_id'))->select(['id','name','description'])->get();
|
||||
|
||||
|
||||
foreach (MaritalStatus::all() as $key => $value){
|
||||
$data['marital_status'][] = [
|
||||
'title' => $value,
|
||||
'value' => $key
|
||||
];
|
||||
}
|
||||
|
||||
foreach (ResidentialStatus::all() as $key => $value){
|
||||
$data['residential_status'][] = [
|
||||
'title' => $value,
|
||||
'value' => $key
|
||||
];
|
||||
}
|
||||
|
||||
foreach (DocumentType::all() as $key => $value){
|
||||
$data['address_justification_docs'][] = [
|
||||
'title' => $value,
|
||||
'value' => $key
|
||||
];
|
||||
}
|
||||
|
||||
foreach (Frequency::all() as $key => $value){
|
||||
$data['e_statement_frequencies'][] = [
|
||||
'title' => $value,
|
||||
'value' => $key
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
foreach (CreditCardType::all() as $key => $value){
|
||||
$data['debit_card_types'][] = [
|
||||
'title' => $value,
|
||||
'value' => $key
|
||||
];
|
||||
}
|
||||
|
||||
return $this->successResponse($data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class ExampleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Auth\Factory as Auth;
|
||||
|
||||
class Authenticate
|
||||
{
|
||||
/**
|
||||
* The authentication guard factory instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Auth\Factory
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* Create a new middleware instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Factory $auth
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Auth $auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
{
|
||||
if ($this->auth->guard($guard)->guest()) {
|
||||
return response('Unauthorized.', 401);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AuthenticateAccess
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$validKeys = explode(',' ,env('ACCEPTED_KEYS'));
|
||||
if(in_array($request->header('Authorization') , $validKeys)){
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
abort(Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class ExampleMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
return $next($request);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class Localization
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$enLangs=["en","en-US","en_US","ca","in","gb","GB","us","en-029","en-AU","en-BZ","en-CA","en-GB","en-IE","en-IN","en-JM","en-MY","en-NZ","en-PH","en-SG","en-TT","en-US","en-ZA","en-ZW","au","bz","ie","in","jm","my","nz","ph","sg","tt","za"];
|
||||
|
||||
// Check header request and determine localizaton
|
||||
if ($request->hasHeader('X-localization')){
|
||||
$local = $request->header('X-localization');
|
||||
$pos=strpos($local,"-");
|
||||
if($pos!=false){
|
||||
$local=strtolower(explode("-",$local)[0]);
|
||||
}
|
||||
$local= in_array($local, $enLangs) ? 'en' : 'fr';
|
||||
}else{
|
||||
$local ='fr';
|
||||
}
|
||||
// set laravel localization
|
||||
app()->setLocale($local);
|
||||
// continue request
|
||||
return $next($request);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class SecureApiDocs
|
||||
{
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
// for local, dont add any authentication
|
||||
if (env('APP_ENV') === 'local') {
|
||||
return $next($request);
|
||||
}
|
||||
$token = $request->get('token');
|
||||
if (!$token) {
|
||||
// try to load the token from referer
|
||||
$query = array();
|
||||
parse_str(
|
||||
parse_url($request->header('referer'), PHP_URL_QUERY),
|
||||
$query
|
||||
);
|
||||
if (isset($query['token'])) {
|
||||
$token = $query['token'];
|
||||
}
|
||||
}
|
||||
// we will match it against the `SWAGGER_DOCS_TOKEN` environment variable
|
||||
if ($token === env('SWAGGER_DOCS_TOKEN')) {
|
||||
return $next($request);
|
||||
} else {
|
||||
return abort(403);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
class ExampleJob extends Job
|
||||
{
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
abstract class Job implements ShouldQueue
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queueable Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This job base class provides a central location to place any logic that
|
||||
| is shared across all of your jobs. The trait included with the class
|
||||
| provides access to the "queueOn" and "delay" queue helper methods.
|
||||
|
|
||||
*/
|
||||
|
||||
use InteractsWithQueue, Queueable, SerializesModels;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Events\ExampleEvent;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class ExampleListener
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param \App\Events\ExampleEvent $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(ExampleEvent $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Events\ExampleEvent;
|
||||
use App\Events\CustomerAccountRequestEvent;
|
||||
use App\Traits\Helper;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use stdClass;
|
||||
use Throwable;
|
||||
|
||||
class NotifyUser
|
||||
{
|
||||
use Helper;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param CustomerAccountRequestEvent $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(CustomerAccountRequestEvent $event)
|
||||
{
|
||||
//
|
||||
$request = $event->request;
|
||||
$user = $request->user;
|
||||
try {
|
||||
$client = new Client([
|
||||
'base_uri' => config('services.notification_service.base_uri'),
|
||||
]);
|
||||
$headers = [
|
||||
'Authorization' => config('services.notification_service.key'),
|
||||
];
|
||||
|
||||
$body = new stdClass();
|
||||
$body->title = $event->mailTitle;
|
||||
$body->message = $event->mailMessage;
|
||||
$body->email = $user->email;
|
||||
|
||||
$client->request('POST', '/send-mail', ['json' => $body, 'headers' => $headers]);
|
||||
|
||||
if (isset($event->notification)) {
|
||||
$body = new stdClass();
|
||||
$body->user_code = $user->user_code;
|
||||
$body->message = $event->notification;
|
||||
$body->date = $request->created_at->format('Y-m-d H:i:s') ?? date('Y-m-d H:i:s');
|
||||
|
||||
$data = new stdClass();
|
||||
$data->screen = "notificationview";
|
||||
$data->data = new stdClass();
|
||||
$data->data->type = 'customer_account_opening_request';
|
||||
$data->data->request_id = $data->data->id = $request->id;
|
||||
$body->data = $data;
|
||||
|
||||
$client->request('POST', '/onesignal/pushToUser', ['json' => $body, 'headers' => $headers]);
|
||||
}
|
||||
} catch (Throwable $t) {
|
||||
Log::error('-------- User notification not sent-----------');
|
||||
Log::error($t->getMessage() . '\n' . $t->getTraceAsString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class CountriesCurrency
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $code_dial
|
||||
* @property string $name
|
||||
* @property string $code_country
|
||||
* @property float $longitude
|
||||
* @property float $latitude
|
||||
* @property int $idCurrency
|
||||
* @property string $currency_code
|
||||
* @property string $currency_name_en
|
||||
* @property string $currency_name_fr
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class CountriesCurrency extends Model
|
||||
{
|
||||
protected $table = 'countries_currencies';
|
||||
public $incrementing = false;
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'id' => 'int',
|
||||
'longitude' => 'float',
|
||||
'latitude' => 'float',
|
||||
'idCurrency' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'code_dial',
|
||||
'name',
|
||||
'code_country',
|
||||
'longitude',
|
||||
'latitude',
|
||||
'idCurrency',
|
||||
'currency_code',
|
||||
'currency_name_en',
|
||||
'currency_name_fr'
|
||||
];
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Country
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $code_dial
|
||||
* @property string $name
|
||||
* @property string $code_country
|
||||
* @property float $longitude
|
||||
* @property float $latitude
|
||||
* @property int $idCurrency
|
||||
*
|
||||
* @property Currency $currency
|
||||
* @property Collection|Admin[] $admins
|
||||
* @property Collection|ConfigGame[] $config_games
|
||||
* @property Collection|Identification[] $identifications
|
||||
* @property Collection|WalletIlinkTransaction[] $wallet_ilink_transactions
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class Country extends Model
|
||||
{
|
||||
protected $table = 'countries';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'longitude' => 'float',
|
||||
'latitude' => 'float',
|
||||
'idCurrency' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'code_dial',
|
||||
'name',
|
||||
'code_country',
|
||||
'longitude',
|
||||
'latitude',
|
||||
'idCurrency'
|
||||
];
|
||||
|
||||
public function currency()
|
||||
{
|
||||
return $this->belongsTo(Currency::class, 'idCurrency');
|
||||
}
|
||||
|
||||
public function admins()
|
||||
{
|
||||
return $this->hasMany(Admin::class, 'country');
|
||||
}
|
||||
|
||||
public function config_games()
|
||||
{
|
||||
return $this->hasMany(ConfigGame::class, 'id_pays');
|
||||
}
|
||||
|
||||
public function identifications()
|
||||
{
|
||||
return $this->hasMany(Identification::class);
|
||||
}
|
||||
|
||||
public function wallet_ilink_transactions()
|
||||
{
|
||||
return $this->hasMany(WalletIlinkTransaction::class, 'final_country');
|
||||
}
|
||||
|
||||
public function regulation()
|
||||
{
|
||||
return $this->belongsTo(Regulation::class, 'id_country');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CustomerAccountRequest extends Model
|
||||
{
|
||||
protected $table = 'customer_account_opening_requests';
|
||||
protected $guarded = ['id'];
|
||||
|
||||
const UNDER_VALIDATION = 'UNDER_VALIDATION';
|
||||
const AWAITING_FURTHER_INFORMATION = 'AWAITING_FURTHER_INFORMATION';
|
||||
const ACCEPTED = 'ACCEPTED';
|
||||
const REJECTED = 'REJECTED';
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function account_type()
|
||||
{
|
||||
return $this->belongsTo(CustomerAccountType::class, 'customer_account_type_id');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CustomerAccountRequestDocument extends Model
|
||||
{
|
||||
//
|
||||
protected $table = 'customer_account_request_documents';
|
||||
|
||||
public function request(){
|
||||
return $this->belongsTo(CustomerAccountRequest::class,'request_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CustomerAccountType extends Model
|
||||
{
|
||||
protected $table = 'customer_account_types';
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public function documents(){
|
||||
return $this->hasMany(CustomerAccountTypeDocument::class,'account_type_id');
|
||||
}
|
||||
|
||||
public function children(){
|
||||
return $this->hasMany(CustomerAccountType::class,'parent_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CustomerAccountTypeDocument extends Model
|
||||
{
|
||||
protected $table = 'customer_account_type_documents';
|
||||
protected $guarded = ['id'];
|
||||
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Identification
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $firstname
|
||||
* @property string $lastname
|
||||
* @property Carbon $birth_date
|
||||
* @property string $gender
|
||||
* @property string $town
|
||||
* @property string $country
|
||||
* @property string $identity_document
|
||||
* @property string $id_identity_document
|
||||
* @property Carbon $expiry_date_document
|
||||
* @property int $id_user
|
||||
* @property int $status
|
||||
* @property Carbon $createdAt
|
||||
* @property string $user_image
|
||||
* @property string $document_image_front
|
||||
* @property string $document_image_back
|
||||
* @property int $idNetwork
|
||||
* @property int $country_id
|
||||
*
|
||||
* @property User $user
|
||||
* @property Network $network
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class Identification extends Model
|
||||
{
|
||||
protected $table = 'identifications';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'id_user' => 'int',
|
||||
'status' => 'int',
|
||||
'idNetwork' => 'int',
|
||||
'country_id' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'birth_date',
|
||||
'expiry_date_document',
|
||||
'createdAt'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'firstname',
|
||||
'lastname',
|
||||
'birth_date',
|
||||
'gender',
|
||||
'town',
|
||||
'country',
|
||||
'identity_document',
|
||||
'id_identity_document',
|
||||
'expiry_date_document',
|
||||
'id_user',
|
||||
'status',
|
||||
'createdAt',
|
||||
'user_image',
|
||||
'document_image_front',
|
||||
'document_image_back',
|
||||
'idNetwork',
|
||||
'country_id'
|
||||
];
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(Country::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'id_user');
|
||||
}
|
||||
|
||||
public function network()
|
||||
{
|
||||
return $this->belongsTo(Network::class, 'idNetwork');
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'lastname' => 'required',
|
||||
'birth_date' => 'required|date|before_or_equal:today',
|
||||
'gender' => 'required|in:M,F',
|
||||
'town' => 'required',
|
||||
'country' => 'required',
|
||||
'identity_document' => 'required',
|
||||
'id_identity_document' => 'required',
|
||||
'expiry_date_document' => 'required|date|after_or_equal:today',
|
||||
'id_user' => 'required_without_all:phone_number|integer|min:0|not_in:0',
|
||||
'phone_number' => 'required_without_all:id_user'
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Network
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $country_id
|
||||
* @property string $name
|
||||
* @property int $id_networkAgent
|
||||
* @property int $status
|
||||
*
|
||||
* @property Collection|ConfigWallet[] $config_wallets
|
||||
* @property Collection|Identification[] $identifications
|
||||
* @property WalletsPassword $wallets_password
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class Network extends Model
|
||||
{
|
||||
protected $table = 'networks';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'country_id' => 'int',
|
||||
'id_networkAgent' => 'int',
|
||||
'status' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'country_id',
|
||||
'name',
|
||||
'id_networkAgent',
|
||||
'status'
|
||||
];
|
||||
|
||||
public function config_wallets()
|
||||
{
|
||||
return $this->hasMany(ConfigWallet::class, 'id_network');
|
||||
}
|
||||
|
||||
public function identifications()
|
||||
{
|
||||
return $this->hasMany(Identification::class, 'idNetwork');
|
||||
}
|
||||
|
||||
public function wallets_password()
|
||||
{
|
||||
return $this->hasOne(WalletsPassword::class);
|
||||
}
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(Country::class, 'country_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class User
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $uid
|
||||
* @property string $firstname
|
||||
* @property string $lastname
|
||||
* @property string $phone
|
||||
* @property string $email
|
||||
* @property string $user_code
|
||||
* @property string $numero_carte
|
||||
* @property Carbon $expiration_date
|
||||
* @property string $adresse
|
||||
* @property float $solde
|
||||
* @property string $encrypted_password
|
||||
* @property string $salt
|
||||
* @property string $validation_code
|
||||
* @property int $active
|
||||
* @property boolean $qr_code
|
||||
* @property Carbon $date_modified
|
||||
* @property Carbon $date_created
|
||||
* @property int $network_id
|
||||
* @property int $group_id
|
||||
* @property float $balance_credit
|
||||
* @property float $balance_epargne
|
||||
* @property Carbon|null $date_adhesion
|
||||
* @property int|null $id_bank_country
|
||||
* @property string|null $iban
|
||||
*
|
||||
* @property Collection|Identification[] $identifications
|
||||
* @property Collection|WalletsUser[] $wallets_users
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class User extends Model
|
||||
{
|
||||
protected $table = 'users';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'solde' => 'float',
|
||||
'active' => 'int',
|
||||
'network_id' => 'int',
|
||||
'group_id' => 'int',
|
||||
'balance_credit' => 'float',
|
||||
'balance_epargne' => 'float',
|
||||
'id_bank_country' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'expiration_date',
|
||||
'date_modified',
|
||||
'date_created',
|
||||
'date_adhesion'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'encrypted_password'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'uid',
|
||||
'firstname',
|
||||
'lastname',
|
||||
'phone',
|
||||
'email',
|
||||
'user_code',
|
||||
'numero_carte',
|
||||
'expiration_date',
|
||||
'adresse',
|
||||
'solde',
|
||||
'encrypted_password',
|
||||
'salt',
|
||||
'validation_code',
|
||||
'active',
|
||||
'qr_code',
|
||||
'date_modified',
|
||||
'date_created',
|
||||
'group_id',
|
||||
'balance_credit',
|
||||
'balance_epargne',
|
||||
'date_adhesion',
|
||||
'id_bank_country',
|
||||
'iban'
|
||||
];
|
||||
|
||||
public function identifications()
|
||||
{
|
||||
return $this->hasMany(Identification::class, 'id_user');
|
||||
}
|
||||
|
||||
public function wallets_users()
|
||||
{
|
||||
return $this->hasMany(WalletsUser::class, 'idUser');
|
||||
}
|
||||
|
||||
public function network()
|
||||
{
|
||||
return $this->belongsTo(Network::class, 'network_id');
|
||||
}
|
||||
|
||||
public function bank()
|
||||
{
|
||||
return $this->belongsTo(NetworksOperator::class, 'id_bank_country', 'id_operator_country');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class WalletsUser
|
||||
*
|
||||
* @property int $id
|
||||
* @property float $balance
|
||||
* @property Carbon $createdAt
|
||||
* @property int $idUser
|
||||
*
|
||||
* @property User $user
|
||||
* @property Collection|WalletIlinkTransaction[] $wallet_ilink_transactions
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class WalletsUser extends Model
|
||||
{
|
||||
protected $table = 'wallets_users';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'balance' => 'float',
|
||||
'idUser' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'createdAt'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'balance',
|
||||
'createdAt',
|
||||
'idUser'
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'idUser');
|
||||
}
|
||||
|
||||
public function wallet_ilink_transactions()
|
||||
{
|
||||
return $this->hasMany(WalletIlinkTransaction::class, 'id_wallet_user');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Boot the authentication services for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// Here you may define how you wish users to be authenticated for your Lumen
|
||||
// application. The callback which receives the incoming request instance
|
||||
// should return either a User instance or null. You're free to obtain
|
||||
// the User instance via an API token or any other method necessary.
|
||||
|
||||
$this->app['auth']->viaRequest('api', function ($request) {
|
||||
if ($request->input('api_token')) {
|
||||
return User::where('api_token', $request->input('api_token'))->first();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Events\CustomerAccountRequestEvent;
|
||||
use App\Listeners\NotifyUser;
|
||||
use Laravel\Lumen\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
\App\Events\ExampleEvent::class => [
|
||||
\App\Listeners\ExampleListener::class,
|
||||
],
|
||||
CustomerAccountRequestEvent::class => [
|
||||
NotifyUser::class
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldDiscoverEvents()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
// Api Response schema
|
||||
|
||||
/**
|
||||
* @OA\Schema(
|
||||
* schema="ApiResponse",
|
||||
* title="API Response",
|
||||
* description="Format d'un message de reponse",
|
||||
* @OA\Property(
|
||||
* property="status", description="Code de la requete",
|
||||
* @OA\Schema(type="number", example=200)
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="response", description="Resultat de la requete si pas d'erreur",
|
||||
* @OA\Schema(type="object", example="{name : 'Djery'}")
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="error", description="Message d'erreur si erreur",
|
||||
* @OA\Schema(type="string", example="There is an error")
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
trait ApiResponser
|
||||
{
|
||||
public function successResponse($data, $code = Response::HTTP_OK)
|
||||
{
|
||||
return response($this->formatResponse($code, $data, null), $code)->header('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
public function errorResponse($message, $code = Response::HTTP_BAD_REQUEST)
|
||||
{
|
||||
if ($code == 0) {
|
||||
$code = Response::HTTP_BAD_REQUEST;
|
||||
}
|
||||
return response()->json($this->formatResponse($code, null, $message), $code);
|
||||
}
|
||||
|
||||
// public function errorMessage($message , $code)
|
||||
// {
|
||||
// return response($message ,$code)->header('Content-Type', 'application/json');
|
||||
// }
|
||||
|
||||
private function formatResponse(int $status, $response = null, $error = null)
|
||||
{
|
||||
return ['status' => $status, 'response' => $response, 'error' => $error];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,464 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
|
||||
use App\Exceptions\AppException;
|
||||
use App\Models\Agent;
|
||||
use App\Models\AgentPlus;
|
||||
use App\Models\CodeGenerer;
|
||||
use App\Models\ConfigWallet;
|
||||
use App\Models\CountriesCurrency;
|
||||
use App\Models\Country;
|
||||
use App\Models\Identification;
|
||||
use App\Models\InfosUsersGroup;
|
||||
use App\Models\Network;
|
||||
use App\Models\NetworksAgent;
|
||||
use App\Models\User;
|
||||
use App\Models\UsersDemandesCredit;
|
||||
use App\Models\Wallet;
|
||||
use App\Models\WalletAgent;
|
||||
use App\Models\WalletIlinkTransaction;
|
||||
use App\Models\WalletsUser;
|
||||
use Barryvdh\DomPDF\Facade as PDF;
|
||||
use Brick\Math\RoundingMode;
|
||||
use Brick\Money\Context\AutoContext;
|
||||
use Brick\Money\CurrencyConverter;
|
||||
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
|
||||
use Brick\Money\ExchangeRateProvider\PDOProvider;
|
||||
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
|
||||
use Brick\Money\Money;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Str;
|
||||
use PDO;
|
||||
use Throwable;
|
||||
|
||||
trait Helper
|
||||
{
|
||||
public function sendMail($email, $title, $messageText)
|
||||
{
|
||||
if (config('variables.send_email')) {
|
||||
try {
|
||||
$recipients = [preg_replace("/\s+/", "", $email)]; // Supprimer les espaces dans le mail
|
||||
Mail::mailer('smtp')->raw($messageText, function ($message) use ($recipients, $title) {
|
||||
$message->subject($title);
|
||||
$message->to($recipients);
|
||||
});
|
||||
} catch (Throwable $t) {
|
||||
Log::error('-------- Mail not sent -----------');
|
||||
Log::error($t->getMessage());
|
||||
}
|
||||
}
|
||||
// return $this->successResponse("mail envoye");
|
||||
}
|
||||
|
||||
public function sendPushNotificationToUser($user_code, $message, $data = null, $date = null)
|
||||
{
|
||||
try {
|
||||
$client = new \GuzzleHttp\Client([
|
||||
'base_uri' => env('NOTIFICATION_SERVICE_URL'),
|
||||
]);
|
||||
$headers = [
|
||||
'Authorization' => env('NOTIFICATION_SERVICE_KEY'),
|
||||
];
|
||||
$body = new \stdClass();
|
||||
$body->user_code = $user_code;
|
||||
$body->message = $message;
|
||||
$body->data = $data;
|
||||
try {
|
||||
$body->date = ($date instanceof \DateTime) ? $date->format('Y-m-d H:i:s') : $date;
|
||||
} catch (Throwable $t) {
|
||||
Log::error($t->getMessage());
|
||||
$body->date = $date;
|
||||
}
|
||||
$promise = $client->requestAsync('POST', '/onesignal/pushToUser', ['json' => $body, 'headers' => $headers])->then();
|
||||
// function (ResponseInterface $res) {
|
||||
// echo $res->getStatusCode() . "\n";
|
||||
// },
|
||||
// function (RequestException $e) {
|
||||
// echo $e->getMessage() . "\n";
|
||||
// echo $e->getRequest()->getMethod();
|
||||
// }
|
||||
// );
|
||||
$promise->wait();
|
||||
// return $response->getBody()->getContents();
|
||||
} catch (Throwable $t) {
|
||||
Log::error('-------- User notification not sent-----------');
|
||||
Log::error($t->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function sendPushNotificationToAgent($agent_code, $message, $data = null, $date = null)
|
||||
{
|
||||
try {
|
||||
$client = new \GuzzleHttp\Client([
|
||||
'base_uri' => env('NOTIFICATION_SERVICE_URL'),
|
||||
]);
|
||||
$headers = [
|
||||
'Authorization' => env('NOTIFICATION_SERVICE_KEY'),
|
||||
];
|
||||
$body = new \stdClass();
|
||||
$body->agent_code = $agent_code;
|
||||
$body->message = $message;
|
||||
$body->data = $data;
|
||||
try {
|
||||
$body->date = ($date instanceof \DateTime) ? $date->format('Y-m-d H:i:s') : $date;
|
||||
} catch (Throwable $t) {
|
||||
Log::error($t->getMessage());
|
||||
$body->date = $date;
|
||||
}
|
||||
$promise = $client->requestAsync('POST', '/onesignal/pushToAgent', ['json' => $body, 'headers' => $headers])->then();
|
||||
$promise->wait();
|
||||
} catch (Throwable $t) {
|
||||
Log::error('-------- Agent notification not sent-----------');
|
||||
Log::error($t->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function checkPassword($password, $encrypted_password, $salt)
|
||||
{
|
||||
$encrypted_password_to_check = base64_encode(sha1($password . $salt, true) . $salt);
|
||||
return $encrypted_password_to_check == $encrypted_password;
|
||||
}
|
||||
|
||||
public function hashSSHA($string)
|
||||
{
|
||||
$salt = sha1(rand());
|
||||
$salt = substr($salt, 0, 10);
|
||||
$encrypted = base64_encode(sha1($string . $salt, true) . $salt);
|
||||
$hash = array("salt" => $salt, "encrypted" => $encrypted);
|
||||
return $hash;
|
||||
}
|
||||
|
||||
public function getCountryName($id_country)
|
||||
{
|
||||
return Country::findOrFail($id_country)->name;
|
||||
}
|
||||
|
||||
public function getNetworkName($id_network)
|
||||
{
|
||||
return Network::findOrFail($id_network)->name;
|
||||
}
|
||||
|
||||
public function toMoneyWithNetwork($amount, $id_network)
|
||||
{
|
||||
$currency = collect(DB::select('SELECT cu.code FROM networks n INNER JOIN countries c ON c.id = n.country_id INNER JOIN currencies cu ON cu.id = c.idCurrency
|
||||
WHERE n.id = :id', ['id' => $id_network]))->first();
|
||||
|
||||
$money = Money::of(round($amount, 2), $currency ? $currency->code : 'XAF', new AutoContext());
|
||||
return $money->formatTo(app()->getLocale());
|
||||
}
|
||||
|
||||
public function toMoney($amount, $id_country)
|
||||
{
|
||||
$country = Country::findOrFail($id_country);
|
||||
$money = Money::of(round($amount, 2), $country->currency->code, new AutoContext());
|
||||
return $money->formatTo(app()->getLocale());
|
||||
}
|
||||
|
||||
public function toMoneyWithCurrencyCode($amount, $currency_code)
|
||||
{
|
||||
$money = Money::of(round($amount, 2), $currency_code, new AutoContext());
|
||||
return $money->formatTo(app()->getLocale());
|
||||
}
|
||||
|
||||
private function convertMoney($amount, $init_country, $final_country)
|
||||
{
|
||||
// set to whatever your rates are relative to
|
||||
$baseCurrency = 'USD';
|
||||
|
||||
// use your own credentials, or re-use your existing PDO connection
|
||||
$pdo = new PDO('mysql:host=' . env('DB_HOST') . ';dbname=' . env('DB_DATABASE'), env('DB_USERNAME'), env('DB_PASSWORD'));
|
||||
|
||||
$configuration = new PDOProviderConfiguration();
|
||||
|
||||
$configuration->tableName = 'exchange_rate';
|
||||
$configuration->exchangeRateColumnName = 'exchange_rate';
|
||||
$configuration->targetCurrencyColumnName = 'target_currency';
|
||||
$configuration->sourceCurrencyCode = $baseCurrency;
|
||||
|
||||
// this provider loads exchange rates from your database
|
||||
$provider = new PDOProvider($pdo, $configuration);
|
||||
|
||||
// this provider calculates exchange rates relative to the base currency
|
||||
$provider = new BaseCurrencyProvider($provider, $baseCurrency);
|
||||
|
||||
// this currency converter can now handle any currency pair
|
||||
$converter = new CurrencyConverter($provider);
|
||||
$init_country = Country::findOrFail($init_country);
|
||||
$final_country = Country::findOrFail($final_country);
|
||||
$init_money = Money::of(round($amount, 2), $init_country->currency->code, new AutoContext());
|
||||
return $converter->convert($init_money, $final_country->currency->code, RoundingMode::DOWN);
|
||||
}
|
||||
|
||||
public function toMoneyWithCurrency($amount, $init_country, $final_country)
|
||||
{
|
||||
return $this->convertMoney($amount, $init_country, $final_country)->formatTo(app()->getLocale());
|
||||
}
|
||||
|
||||
public function toMoneyAmount($amount, $init_country, $final_country)
|
||||
{
|
||||
return $this->convertMoney($amount, $init_country, $final_country)->getAmount()->toFloat();
|
||||
}
|
||||
|
||||
public function toUSDAmount($amount, $init_country, $final_currency_code = 'USD')
|
||||
{
|
||||
// set to whatever your rates are relative to
|
||||
$baseCurrency = 'USD';
|
||||
|
||||
// use your own credentials, or re-use your existing PDO connection
|
||||
$pdo = new PDO('mysql:host=' . env('DB_HOST') . ';dbname=' . env('DB_DATABASE'), env('DB_USERNAME'), env('DB_PASSWORD'));
|
||||
|
||||
$configuration = new PDOProviderConfiguration();
|
||||
|
||||
$configuration->tableName = 'exchange_rate';
|
||||
$configuration->exchangeRateColumnName = 'exchange_rate';
|
||||
$configuration->targetCurrencyColumnName = 'target_currency';
|
||||
$configuration->sourceCurrencyCode = $baseCurrency;
|
||||
|
||||
// this provider loads exchange rates from your database
|
||||
$provider = new PDOProvider($pdo, $configuration);
|
||||
|
||||
// this provider calculates exchange rates relative to the base currency
|
||||
$provider = new BaseCurrencyProvider($provider, $baseCurrency);
|
||||
|
||||
// this currency converter can now handle any currency pair
|
||||
$converter = new CurrencyConverter($provider);
|
||||
$init_country = Country::findOrFail($init_country);
|
||||
$init_money = Money::of(round($amount, 2), $init_country->currency->code, new AutoContext());
|
||||
return $converter->convert($init_money, $final_currency_code, RoundingMode::DOWN)->getAmount()->toFloat();
|
||||
}
|
||||
|
||||
|
||||
// public function getTransactionID(){
|
||||
// $d = new DateTime();
|
||||
// $first = str_replace(['-',':'], '',$d->format("y-m-d H:i:s.u"));
|
||||
// return str_replace(' ' ,'.',$first);
|
||||
// }
|
||||
|
||||
public function getCurrency($id_country)
|
||||
{
|
||||
$cc = CountriesCurrency::findOrFail($id_country);
|
||||
return $cc->currency_code;
|
||||
}
|
||||
|
||||
public function arrayPaginator($array, Request $request)
|
||||
{
|
||||
$page = $request->query('page', 1);
|
||||
$perPage = 10;
|
||||
$offset = ($page * $perPage) - $perPage;
|
||||
|
||||
return new LengthAwarePaginator(array_slice($array, $offset, $perPage, true), count($array), $perPage, $page,
|
||||
['path' => $request->url(), 'query' => $request->query()]);
|
||||
}
|
||||
|
||||
public function array_has_dupes($array)
|
||||
{
|
||||
// streamline per @Felix
|
||||
return count($array) !== count(array_unique($array));
|
||||
}
|
||||
|
||||
|
||||
public function checkMyIdentification($id)
|
||||
{
|
||||
$identification = Identification::where('id_user', $id)->first();
|
||||
if (isset($identification)) {
|
||||
if ($identification->status == 0)
|
||||
return $this->errorResponse(trans('errors.validation_identification_required'));
|
||||
else
|
||||
return $identification;
|
||||
} else {
|
||||
return $this->errorResponse(trans('errors.identification_required'));
|
||||
}
|
||||
}
|
||||
|
||||
public function generateGroupCode($length = 8)
|
||||
{
|
||||
$characters = '23456789ABCDEFGHJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
public function generateTransactionCode($length = 12)
|
||||
{
|
||||
$characters = '23456789ABCDEFGHJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
// Fonction de tri par date
|
||||
public function sortFunction($a, $b)
|
||||
{
|
||||
return strtotime($b->date_creation) - strtotime($a->date_creation);
|
||||
}
|
||||
|
||||
// Obtenir l'heure en fonction du pays de l'utilisateur
|
||||
public function getCurrentTime($id_country)
|
||||
{
|
||||
$country = Country::find($id_country);
|
||||
$country_code = isset($country) ? $country->code_country : 'GA';
|
||||
$timezone = \DateTimeZone::listIdentifiers(\DateTimeZone::PER_COUNTRY, $country_code);
|
||||
$date = (sizeof($timezone) > 0) ? new \DateTime('now', new \DateTimeZone($timezone[0])) : new \DateTime();
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
// Obtenir l'heure en fonction du code du pays de l'utilisateur
|
||||
public function getCurrentTimeByCountryCode($country_code = 'GA')
|
||||
{
|
||||
$timezone = \DateTimeZone::listIdentifiers(\DateTimeZone::PER_COUNTRY, $country_code);
|
||||
$date = (sizeof($timezone) > 0) ? new \DateTime('now', new \DateTimeZone($timezone[0])) : new \DateTime();
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
// Verifier l'identification d'un utilisateur à partir de son id
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function checkUserIdentification($id_user)
|
||||
{
|
||||
$identification = Identification::where('id_user', $id_user)->first();
|
||||
if (isset($identification)) {
|
||||
if ($identification->status == 0)
|
||||
throw new AppException(trans('errors.validation_user_identification_required'), 422);
|
||||
else
|
||||
return $identification;
|
||||
} else {
|
||||
throw new AppException(trans('errors.user_identification_required'), 422);
|
||||
}
|
||||
}
|
||||
|
||||
public function generateQRCode($user_id, $user_type)
|
||||
{
|
||||
if ($user_type == 'user') {
|
||||
$user = User::findOrFail($user_id);
|
||||
} else {
|
||||
$user = Agent::findOrFail($user_id);
|
||||
}
|
||||
|
||||
//Check if the directory already exists.
|
||||
$directoryName = '/qrcodes/' . $user_type . 's/';
|
||||
if (!is_dir(public_path() . $directoryName)) {
|
||||
File::makeDirectory(public_path() . $directoryName, 0777, true);
|
||||
}
|
||||
|
||||
$path = $directoryName . $user->id . '.pdf';
|
||||
$pdf = PDF::loadView('emails.qr_code', ['lastname' => $user->lastname, 'data' => 'type=' . $user_type . '&user_id=' . $user->id])
|
||||
->setPaper('a4', 'portrait')->setWarnings(false)->save(public_path($path));
|
||||
|
||||
$user->qr_code = config('app.url') . $path;
|
||||
$user->save();
|
||||
|
||||
return $pdf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function validatePassword($password, $encrypted_password, $salt)
|
||||
{
|
||||
if (!$this->checkPassword($password, $encrypted_password, $salt)) {
|
||||
throw new AppException(trans('messages.incorrect_user_password'), 422);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws AppException
|
||||
*/
|
||||
public function uploadImage(Request $request, $key, $imageCode, $folderName)
|
||||
{
|
||||
|
||||
// if ($request->hasFile('image')) {
|
||||
$original_filename = $request->file($key)->getClientOriginalName();
|
||||
$original_filename_arr = explode('.', $original_filename);
|
||||
$file_ext = end($original_filename_arr);
|
||||
$image = $imageCode . '-' . Str::uuid() . '.' . $file_ext;
|
||||
|
||||
//Check if the directory already exists.
|
||||
$directoryName = './' . $folderName;
|
||||
if (!is_dir($directoryName)) {
|
||||
//Directory does not exist, so lets create it.
|
||||
mkdir($directoryName, 0755);
|
||||
}
|
||||
|
||||
// Allow certain file formats
|
||||
// $allowTypes = array('jpg', 'png', 'jpeg', 'gif');
|
||||
// if (in_array(strtolower($file_ext), $allowTypes)) {
|
||||
|
||||
$compressedImage = $this->compressImage($request->file($key), './' . $folderName . '/' . $image, 70);
|
||||
if ($compressedImage) {
|
||||
return url($folderName . '/' . $image);
|
||||
} else {
|
||||
throw new AppException(trans('errors.compression_failed'));
|
||||
}
|
||||
// } else {
|
||||
// return $this->errorResponse('Sorry, only JPG, JPEG, PNG, & GIF files are allowed to upload.');
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// return $this->errorResponse('File not found');
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function deleteImageFile($filename, $folderName)
|
||||
{
|
||||
// unlink(storage_path('./'.$folderName.'/' . $filename));
|
||||
$path = './' . $folderName . '/' . $filename;
|
||||
if (File::exists($path))
|
||||
File::delete($path);
|
||||
}
|
||||
|
||||
/*
|
||||
* Custom function to compress image size and
|
||||
* upload to the server using PHP
|
||||
*/
|
||||
public function compressImage($source, $destination, $quality)
|
||||
{
|
||||
// Get image info
|
||||
$imgInfo = getimagesize($source);
|
||||
$mime = $imgInfo['mime'];
|
||||
|
||||
// Create a new image from file
|
||||
switch ($mime) {
|
||||
case 'image/jpeg':
|
||||
$image = imagecreatefromjpeg($source);
|
||||
break;
|
||||
case 'image/png':
|
||||
$image = imagecreatefrompng($source);
|
||||
break;
|
||||
case 'image/gif':
|
||||
$image = imagecreatefromgif($source);
|
||||
break;
|
||||
default:
|
||||
$image = imagecreatefromjpeg($source);
|
||||
}
|
||||
|
||||
// Save image
|
||||
imagejpeg($image, $destination, $quality);
|
||||
|
||||
// Return compressed image
|
||||
return $destination;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Create The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| First we need to get an application instance. This creates an instance
|
||||
| of the application / container and bootstraps the application so it
|
||||
| is ready to receive HTTP / Console requests from the environment.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = require __DIR__.'/bootstrap/app.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Artisan Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When we run the console application, the current CLI command will be
|
||||
| executed in this console and the response sent back to a terminal
|
||||
| or another output device for the developers. Here goes nothing!
|
||||
|
|
||||
*/
|
||||
|
||||
$kernel = $app->make(
|
||||
'Illuminate\Contracts\Console\Kernel'
|
||||
);
|
||||
|
||||
exit($kernel->handle(new ArgvInput, new ConsoleOutput));
|
|
@ -0,0 +1,122 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
(new Laravel\Lumen\Bootstrap\LoadEnvironmentVariables(
|
||||
dirname(__DIR__)
|
||||
))->bootstrap();
|
||||
|
||||
date_default_timezone_set(env('APP_TIMEZONE', 'UTC'));
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Create The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we will load the environment and create the application instance
|
||||
| that serves as the central piece of this framework. We'll use this
|
||||
| application as an "IoC" container and router for this framework.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = new Laravel\Lumen\Application(
|
||||
dirname(__DIR__)
|
||||
);
|
||||
|
||||
$app->withFacades();
|
||||
|
||||
$app->withEloquent();
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Container Bindings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Now we will register a few bindings in the service container. We will
|
||||
| register the exception handler and the console kernel. You may add
|
||||
| your own bindings here if you like or you can make another file.
|
||||
|
|
||||
*/
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
||||
App\Exceptions\Handler::class
|
||||
);
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Console\Kernel::class,
|
||||
App\Console\Kernel::class
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Config Files
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Now we will register the "app" configuration file. If the file exists in
|
||||
| your configuration directory it will be loaded; otherwise, we'll load
|
||||
| the default version. You may register other files below as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
$app->configure('app');
|
||||
$app->configure('swagger-lume');
|
||||
$app->configure('queue');
|
||||
$app->configure('variables');
|
||||
$app->configure('services');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, we will register the middleware with the application. These can
|
||||
| be global middleware that run before and after each request into a
|
||||
| route or middleware that'll be assigned to some specific routes.
|
||||
|
|
||||
*/
|
||||
|
||||
$app->middleware([
|
||||
App\Http\Middleware\Localization::class,
|
||||
]);
|
||||
|
||||
$app->routeMiddleware([
|
||||
// 'auth' => App\Http\Middleware\Authenticate::class,
|
||||
'docs' => App\Http\Middleware\SecureApiDocs::class,
|
||||
'auth' => App\Http\Middleware\AuthenticateAccess::class
|
||||
]);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Service Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we will register all of the application's service providers which
|
||||
| are used to bind services into the container. Service providers are
|
||||
| totally optional, so you are not required to uncomment this line.
|
||||
|
|
||||
*/
|
||||
|
||||
// $app->register(App\Providers\AppServiceProvider::class);
|
||||
// $app->register(App\Providers\AuthServiceProvider::class);
|
||||
$app->register(App\Providers\EventServiceProvider::class);
|
||||
$app->register(\SwaggerLume\ServiceProvider::class);
|
||||
$app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class);
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Load The Application Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next we will include the routes file so that they can all be added to
|
||||
| the application. This will provide all of the URLs the application
|
||||
| can respond to, as well as the controllers that may handle them.
|
||||
|
|
||||
*/
|
||||
|
||||
$app->router->group([
|
||||
'namespace' => 'App\Http\Controllers',
|
||||
], function ($router) {
|
||||
require __DIR__.'/../routes/web.php';
|
||||
});
|
||||
|
||||
return $app;
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "laravel/lumen",
|
||||
"description": "The Laravel Lumen Framework.",
|
||||
"keywords": ["framework", "laravel", "lumen"],
|
||||
"license": "MIT",
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": "^8.0",
|
||||
"brick/money": "^0.7.0",
|
||||
"darkaonline/swagger-lume": "^9.0",
|
||||
"flipbox/lumen-generator": "^9.1",
|
||||
"guzzlehttp/guzzle": "^7.5",
|
||||
"laravel/lumen-framework": "^9.0",
|
||||
"ext-gd": "*",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"phpunit/phpunit": "^9.5.10"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-install-cmd": [
|
||||
"cp -a vendor/swagger-api/swagger-ui/dist public/swagger-ui-assets"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue API supports an assortment of back-ends via a single
|
||||
| API, giving you convenient access to each back-end using the same
|
||||
| syntax for every one. Here you may define a default connection.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'sync'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection information for each server that
|
||||
| is used by your application. A default configuration has been added
|
||||
| for each back-end shipped with Laravel. You are free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'jobs',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => 'localhost',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
'block_for' => 0,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||
'queue' => env('SQS_QUEUE', 'your-queue-name'),
|
||||
'suffix' => env('SQS_SUFFIX'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => 90,
|
||||
'block_for' => null,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control which database and table are used to store the jobs that
|
||||
| have failed. You may change them to any database / table you wish.
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database'),
|
||||
'database' => env('DB_CONNECTION', 'mysql'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'accepted_keys' => env('ACCEPTED_KEYS'),
|
||||
'notification_service' => [
|
||||
'base_uri' => env('NOTIFICATION_SERVICE_URL'),
|
||||
'key' => env('NOTIFICATION_SERVICE_KEY')
|
||||
],
|
||||
'app_url' => env('APP_URL'),
|
||||
'app_debug' => env('APP_DEBUG', false)
|
||||
];
|
|
@ -0,0 +1,212 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'api' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Edit to set the api's title
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'title' => 'iLink APP API',
|
||||
],
|
||||
|
||||
'routes' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Route for accessing api documentation interface
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'api' => '/api/documentation',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Route for accessing parsed swagger annotations.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'docs' => '/docs',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Route for Oauth2 authentication callback.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'oauth2_callback' => '/api/oauth2-callback',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Route for serving assets
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'assets' => '/swagger-ui-assets',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Middleware allows to prevent unexpected access to API documentation
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'middleware' => [
|
||||
// 'api' => ['docs'],
|
||||
'api' => [],
|
||||
'asset' => [],
|
||||
// 'docs' => ['docs'],
|
||||
'docs' => [],
|
||||
'oauth2_callback' => [],
|
||||
],
|
||||
],
|
||||
|
||||
'paths' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Absolute path to location where parsed swagger annotations will be stored
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'docs' => storage_path('api-docs'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| File name of the generated json documentation file
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'docs_json' => 'api-docs.json',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Absolute path to directory containing the swagger annotations are stored.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'annotations' => base_path('app'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Absolute path to directories that you would like to exclude from swagger generation
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'excludes' => [],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Edit to set the swagger scan base path
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'base' => env('L5_SWAGGER_BASE_PATH', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Absolute path to directory where to export views
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'views' => base_path('resources/views/vendor/swagger-lume'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API security definitions. Will be generated into documentation file.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'security' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Examples of Security definitions
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
'api_key_security_example' => [ // Unique name of security
|
||||
'type' => 'apiKey', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
|
||||
'description' => 'A short description for security scheme',
|
||||
'name' => 'api_key', // The name of the header or query parameter to be used.
|
||||
'in' => 'header', // The location of the API key. Valid values are "query" or "header".
|
||||
],
|
||||
'oauth2_security_example' => [ // Unique name of security
|
||||
'type' => 'oauth2', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
|
||||
'description' => 'A short description for oauth2 security scheme.',
|
||||
'flow' => 'implicit', // The flow used by the OAuth2 security scheme. Valid values are "implicit", "password", "application" or "accessCode".
|
||||
'authorizationUrl' => 'http://example.com/auth', // The authorization URL to be used for (implicit/accessCode)
|
||||
//'tokenUrl' => 'http://example.com/auth' // The authorization URL to be used for (password/application/accessCode)
|
||||
'scopes' => [
|
||||
'read:projects' => 'read your projects',
|
||||
'write:projects' => 'modify projects in your account',
|
||||
]
|
||||
],*/
|
||||
|
||||
/* Open API 3.0 support
|
||||
'passport' => [ // Unique name of security
|
||||
'type' => 'oauth2', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
|
||||
'description' => 'Laravel passport oauth2 security.',
|
||||
'in' => 'header',
|
||||
'scheme' => 'https',
|
||||
'flows' => [
|
||||
"password" => [
|
||||
"authorizationUrl" => config('app.url') . '/oauth/authorize',
|
||||
"tokenUrl" => config('app.url') . '/oauth/token',
|
||||
"refreshUrl" => config('app.url') . '/token/refresh',
|
||||
"scopes" => []
|
||||
],
|
||||
],
|
||||
],
|
||||
*/
|
||||
'api_key' => [ // Unique name of security
|
||||
'type' => 'apiKey', // Valid values are "basic", "apiKey" or "oauth2".
|
||||
'description' => "Api Key",
|
||||
'name' => 'Authorization', // The name of the header or query parameter to be used.
|
||||
'in' => 'header', // The location of the API key. Valid values are "query" or "header".
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Turn this off to remove swagger generation on production
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'generate_always' => env('SWAGGER_GENERATE_ALWAYS', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Edit to set the swagger version number
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'swagger_version' => env('SWAGGER_VERSION', '3.0'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Edit to trust the proxy's ip address - needed for AWS Load Balancer
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'proxy' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Configs plugin allows to fetch external configs instead of passing them to SwaggerUIBundle.
|
||||
| See more at: https://github.com/swagger-api/swagger-ui#configs-plugin
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'additional_config_url' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Apply a sort to the operation list of each API. It can be 'alpha' (sort by paths alphanumerically),
|
||||
| 'method' (sort by HTTP method).
|
||||
| Default is the order returned by the server unchanged.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'operations_sort' => env('L5_SWAGGER_OPERATIONS_SORT', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Uncomment to pass the validatorUrl parameter to SwaggerUi init on the JS
|
||||
| side. A null value here disables validation.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
'validator_url' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Uncomment to add constants which can be used in anotations
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'constants' => [
|
||||
// 'SWAGGER_LUME_CONST_HOST' => env('SWAGGER_LUME_CONST_HOST', 'http://my-default-host.com'),
|
||||
],
|
||||
];
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
return [
|
||||
'send_email' => env('SEND_EMAIL', true)
|
||||
];
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = User::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->name,
|
||||
'email' => $this->faker->unique()->safeEmail,
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCustomerAccountTypesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('customer_account_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('network_id');
|
||||
$table->string('name')->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->double('opening_amount')->nullable();
|
||||
$table->integer('parent_id')->nullable();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('customer_account_types');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCustomerAccountTypeDocumentsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('customer_account_type_documents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('account_type_id');
|
||||
$table->string('name');
|
||||
$table->text('description');
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('customer_account_type_documents');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCustomerAccountOpeningRequestsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('customer_account_opening_requests', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('unique_id')->unique();
|
||||
$table->integer('user_id');
|
||||
$table->integer('network_id');
|
||||
$table->integer('customer_account_type_id');
|
||||
$table->string('title');
|
||||
$table->string('lastname');
|
||||
$table->string('firstname')->nullable();
|
||||
$table->string('spouse_name')->nullable();
|
||||
$table->string('nationality');
|
||||
$table->date('birth_date');
|
||||
$table->string('birth_country');
|
||||
$table->string('birth_city');
|
||||
$table->string('birth_locality')->nullable();
|
||||
$table->string('father_lastname');
|
||||
$table->string('father_firstname')->nullable();
|
||||
$table->string('mother_birth_lastname');
|
||||
$table->string('mother_firstname')->nullable();
|
||||
$table->string('marital_status');
|
||||
$table->string('spouse_lastname')->nullable();
|
||||
$table->string('spouse_firstname')->nullable();
|
||||
$table->string('profession')->nullable();
|
||||
$table->string('business_activity')->nullable();
|
||||
$table->string('sub_sector_business_activity')->nullable();
|
||||
$table->string('tax_number')->nullable();
|
||||
$table->string('security_number')->nullable();
|
||||
$table->string('employee_number')->nullable();
|
||||
$table->string('function')->nullable();
|
||||
$table->string('employee_name')->nullable();
|
||||
$table->string('employee_address')->nullable();
|
||||
$table->string('residential_status');
|
||||
$table->string('residential_country');
|
||||
$table->string('residence_permit_number')->nullable();
|
||||
$table->date('residence_permit_issued_date')->nullable();
|
||||
$table->date('residence_permit_expiry_date')->nullable();
|
||||
$table->string('address_justification_doc');
|
||||
$table->string('address');
|
||||
$table->string('po_box')->nullable();
|
||||
$table->string('phone_number');
|
||||
$table->string('email_1');
|
||||
$table->string('email_2')->nullable();
|
||||
$table->string('person_to_contact_in_case_of_needs_name');
|
||||
$table->string('person_to_contact_in_case_of_needs_phone_number');
|
||||
$table->string('identification_document_type');
|
||||
$table->string('identification_document_number');
|
||||
$table->date('identification_document_issued_date');
|
||||
$table->date('identification_document_expiry_date');
|
||||
$table->string('identification_document_issuance_city');
|
||||
$table->string('identification_document_issuance_country');
|
||||
$table->boolean('customer_under_guardianship')->default(false);
|
||||
$table->string('guardian_fullname')->nullable();
|
||||
$table->string('guardian_phone_number')->nullable();
|
||||
$table->string('how_did_you_know_company');
|
||||
$table->string('introducer_fullname')->nullable();
|
||||
$table->string('introducer_address')->nullable();
|
||||
$table->string('expected_service');
|
||||
$table->string('income_sources_and_frequency')->nullable();
|
||||
$table->string('business_partners')->nullable();
|
||||
$table->string('bank_references')->nullable();
|
||||
$table->boolean('has_account_with_other_bank')->default(false);
|
||||
$table->boolean('has_operative_other_bank_account')->default(false);
|
||||
$table->boolean('has_engagement_with_other_banks')->default(false);
|
||||
$table->boolean('is_politically_exposed_person')->default(false);
|
||||
$table->boolean('is_politically_exposed_person_in_service')->default(false);
|
||||
$table->boolean('has_relationship_with_politically_exposed_person')->default(false);
|
||||
$table->text('relationship_with_politically_exposed_person')->nullable();
|
||||
$table->boolean('email_alerts')->default(false);
|
||||
$table->string('e_statement_frequency')->nullable();
|
||||
$table->boolean('e_package')->default(false);
|
||||
$table->string('debit_card_type');
|
||||
$table->string('status')->default('UNDER_VALIDATION');
|
||||
$table->text('reject_reason')->nullable();
|
||||
$table->integer('validating_agent_id')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('customer_account_opening_requests');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateInfosCustomerAccountOpeningRequestsView extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::statement("CREATE OR REPLACE VIEW `infos_customer_account_opening_requests` AS
|
||||
SELECT cr.*, ct.name as customer_account_type_name ,
|
||||
ct.description as customer_account_type_description,
|
||||
ct.opening_amount as customer_account_type_opening_amount,
|
||||
`nva`.`lastname` AS `validating_agent_lastname`,
|
||||
`nva`.`firstname` AS `validating_agent_firstname`,
|
||||
`nva`.`phone` AS `validating_agent_phone`,
|
||||
`nva`.`email` AS `validating_agent_email`
|
||||
FROM customer_account_opening_requests cr
|
||||
JOIN customer_account_types ct ON ct.id = cr.customer_account_type_id
|
||||
LEFT JOIN nh_validating_agents nva ON cr.validating_agent_id = nva.id
|
||||
");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('infos_customer_account_opening_requests');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCustomerAccountRequestDocumentsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('customer_account_request_documents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('request_id');
|
||||
$table->string('name');
|
||||
$table->string('description');
|
||||
$table->string('url');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('customer_account_request_documents');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// $this->call('UsersTableSeeder');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Application Test Suite">
|
||||
<directory suffix="Test.php">./tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
</php>
|
||||
</phpunit>
|
|
@ -0,0 +1,21 @@
|
|||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Handle Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Create The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| First we need to get an application instance. This creates an instance
|
||||
| of the application / container and bootstraps the application so it
|
||||
| is ready to receive HTTP / Console requests from the environment.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = require __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Once we have the application, we can handle the incoming request
|
||||
| through the kernel, and send the associated response back to
|
||||
| the client's browser allowing them to enjoy the creative
|
||||
| and wonderful application we have prepared for them.
|
||||
|
|
||||
*/
|
||||
|
||||
$app->run();
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
return [
|
||||
'model_not_found' => 'Does not exist any instance of :model with given id',
|
||||
'unexpected_error' => 'Unexpected error. Try later',
|
||||
'validation_error' => 'The field :field has :validation',
|
||||
'service_unavailable' => 'Service unavailable',
|
||||
"amount_not_allowed" => "This amount is not allowed. It must be between :min and :max"
|
||||
];
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
return [
|
||||
'empty_com_balance' => 'Commission balance is empty',
|
||||
'treated_demand' => 'Credit request already processed',
|
||||
'canceled_demand' => 'Canceled credit request',
|
||||
'princ_balance_inf_to_demand_amount' => 'Your main balance is less than the amount of the request, do you want to change the amount ?',
|
||||
'new_wallet_added' => 'New wallet added',
|
||||
'success_treated_demand' => 'Request successfully processed',
|
||||
'canceled_credit_request' => 'Canceled credit request',
|
||||
'canceled_transaction' => 'Canceled transaction',
|
||||
'successful_transaction' => 'Successful transaction',
|
||||
'incorrect_user_password' => 'Incorrect user password',
|
||||
'successful_identification'=>'User :name has been successfully identified.',
|
||||
'user_identificated' => 'User already identificated',
|
||||
'user_not_identificated' => 'User is not identificated',
|
||||
'validated_identification'=>'Validated identification',
|
||||
'identification_already_validated'=>'Identification already validated',
|
||||
'successful_bank_account_attachment_taken' => 'Your request to link your bank account has been taken into account, you will receive a confirmation email as soon as the bank has validated your IBAN code',
|
||||
'customer_account_opening_request_submitted' => "Customer account opening request submitted",
|
||||
'customer_account_opening_request_pending' => "You already have a customer account opening request pending",
|
||||
'customer_account_opening_request' => "Customer account opening request",
|
||||
'customer_account_opening_request_mail' => ":gender :name ,
|
||||
|
||||
Your customer account opening request is being validated.
|
||||
Request information:
|
||||
- ID: :request_id
|
||||
- Account type: :account_type
|
||||
- Opening amount: :opening_amount
|
||||
",
|
||||
'customer_account_opening_request_accepted' => "Customer account opening request accepted",
|
||||
'customer_account_opening_request_accepted_mail' => ":gender :name,
|
||||
|
||||
Your customer account opening request has been accepted.
|
||||
Request information:
|
||||
- ID: :request_id
|
||||
- Account type: :account_type
|
||||
- Opening amount: :opening_amount
|
||||
|
||||
Go to the nearest branch to complete the process
|
||||
",
|
||||
'customer_account_opening_request_accepted_notification' => "Your customer account opening request :request_id has been accepted.
|
||||
Please ensure that your wallet has sufficient credit to activate your insurance.",
|
||||
'customer_account_opening_request_rejected' => "Customer account opening request rejected",
|
||||
'customer_account_opening_request_rejected_mail' => ":gender :name,
|
||||
|
||||
Your customer account opening request has been rejected.
|
||||
Request information:
|
||||
- ID: :request_id
|
||||
- Account type: :account_type
|
||||
|
||||
Reason for rejection: :reason ",
|
||||
'customer_account_opening_request_rejected_notification' => "Your customer account opening request :request_id has been rejected.",
|
||||
'customer_account_opening_request_awaiting_more_information' => "Customer account opening request awaiting more information.",
|
||||
'customer_account_opening_request_awaiting_more_information_mail' => ":gender :name,
|
||||
|
||||
Your customer account opening request is waiting for more information.
|
||||
Request information:
|
||||
- ID: :subscription_id
|
||||
- Account type: :account_type
|
||||
- Opening amount: :opening_amount
|
||||
|
||||
Message: :reason",
|
||||
'customer_account_opening_request_awaiting_more_information_notification' => "Your customer account opening request :subscription_id is awaiting more information."
|
||||
];
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
return [
|
||||
|
||||
];
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
return [
|
||||
'PENDING' => "IN PROGRESS",
|
||||
'ACCEPTED' => "ACCEPTED",
|
||||
'REJECTED' => "REJECTED",
|
||||
'SINGLE' => 'Single',
|
||||
'MARRIED' => 'Married',
|
||||
'WIDOW' => 'Widow',
|
||||
'DIVORCED' => 'Divorced',
|
||||
'RESIDENT' => 'Resident',
|
||||
'NOT_RESIDENT' => 'Not Resident',
|
||||
'LOCALISATION_PLAN' => 'Localisation Plan',
|
||||
'UTILITY_BILL' => 'Utility Bill',
|
||||
'DAILY' => 'Daily',
|
||||
'WEEKLY' => 'Weekly',
|
||||
'MONTHLY' => 'Monthly',
|
||||
'MASTER_CARD_CLASSIC' => 'MASTER Card Classic',
|
||||
'MASTER_CARD_GOLD' => 'MASTER Card Gold',
|
||||
'MASTER_CARD_PLATINUM' => 'MASTER Card Platinum',
|
||||
'VISA_CARD_CLASSIC' => 'VISA Card Classic',
|
||||
'VISA_CARD_GOLD' => 'VISA Card Gold',
|
||||
'VISA_CARD_PLATINUM' => 'VISA Card Platinum',
|
||||
];
|
|
@ -0,0 +1,151 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines contain the default error messages used by
|
||||
| the validator class. Some of these rules have multiple versions such
|
||||
| as the size rules. Feel free to tweak each of these messages here.
|
||||
|
|
||||
*/
|
||||
|
||||
'accepted' => 'The :attribute must be accepted.',
|
||||
'active_url' => 'The :attribute is not a valid URL.',
|
||||
'after' => 'The :attribute must be a date after :date.',
|
||||
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
|
||||
'alpha' => 'The :attribute may only contain letters.',
|
||||
'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.',
|
||||
'alpha_num' => 'The :attribute may only contain letters and numbers.',
|
||||
'array' => 'The :attribute must be an array.',
|
||||
'before' => 'The :attribute must be a date before :date.',
|
||||
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
|
||||
'between' => [
|
||||
'numeric' => 'The :attribute must be between :min and :max.',
|
||||
'file' => 'The :attribute must be between :min and :max kilobytes.',
|
||||
'string' => 'The :attribute must be between :min and :max characters.',
|
||||
'array' => 'The :attribute must have between :min and :max items.',
|
||||
],
|
||||
'boolean' => 'The :attribute field must be true or false.',
|
||||
'confirmed' => 'The :attribute confirmation does not match.',
|
||||
'date' => 'The :attribute is not a valid date.',
|
||||
'date_equals' => 'The :attribute must be a date equal to :date.',
|
||||
'date_format' => 'The :attribute does not match the format :format.',
|
||||
'different' => 'The :attribute and :other must be different.',
|
||||
'digits' => 'The :attribute must be :digits digits.',
|
||||
'digits_between' => 'The :attribute must be between :min and :max digits.',
|
||||
'dimensions' => 'The :attribute has invalid image dimensions.',
|
||||
'distinct' => 'The :attribute field has a duplicate value.',
|
||||
'email' => 'The :attribute must be a valid email address.',
|
||||
'ends_with' => 'The :attribute must end with one of the following: :values',
|
||||
'exists' => 'The selected :attribute is invalid.',
|
||||
'file' => 'The :attribute must be a file.',
|
||||
'filled' => 'The :attribute field must have a value.',
|
||||
'gt' => [
|
||||
'numeric' => 'The :attribute must be greater than :value.',
|
||||
'file' => 'The :attribute must be greater than :value kilobytes.',
|
||||
'string' => 'The :attribute must be greater than :value characters.',
|
||||
'array' => 'The :attribute must have more than :value items.',
|
||||
],
|
||||
'gte' => [
|
||||
'numeric' => 'The :attribute must be greater than or equal :value.',
|
||||
'file' => 'The :attribute must be greater than or equal :value kilobytes.',
|
||||
'string' => 'The :attribute must be greater than or equal :value characters.',
|
||||
'array' => 'The :attribute must have :value items or more.',
|
||||
],
|
||||
'image' => 'The :attribute must be an image.',
|
||||
'in' => 'The selected :attribute is invalid.',
|
||||
'in_array' => 'The :attribute field does not exist in :other.',
|
||||
'integer' => 'The :attribute must be an integer.',
|
||||
'ip' => 'The :attribute must be a valid IP address.',
|
||||
'ipv4' => 'The :attribute must be a valid IPv4 address.',
|
||||
'ipv6' => 'The :attribute must be a valid IPv6 address.',
|
||||
'json' => 'The :attribute must be a valid JSON string.',
|
||||
'lt' => [
|
||||
'numeric' => 'The :attribute must be less than :value.',
|
||||
'file' => 'The :attribute must be less than :value kilobytes.',
|
||||
'string' => 'The :attribute must be less than :value characters.',
|
||||
'array' => 'The :attribute must have less than :value items.',
|
||||
],
|
||||
'lte' => [
|
||||
'numeric' => 'The :attribute must be less than or equal :value.',
|
||||
'file' => 'The :attribute must be less than or equal :value kilobytes.',
|
||||
'string' => 'The :attribute must be less than or equal :value characters.',
|
||||
'array' => 'The :attribute must not have more than :value items.',
|
||||
],
|
||||
'max' => [
|
||||
'numeric' => 'The :attribute may not be greater than :max.',
|
||||
'file' => 'The :attribute may not be greater than :max kilobytes.',
|
||||
'string' => 'The :attribute may not be greater than :max characters.',
|
||||
'array' => 'The :attribute may not have more than :max items.',
|
||||
],
|
||||
'mimes' => 'The :attribute must be a file of type: :values.',
|
||||
'mimetypes' => 'The :attribute must be a file of type: :values.',
|
||||
'min' => [
|
||||
'numeric' => 'The :attribute must be at least :min.',
|
||||
'file' => 'The :attribute must be at least :min kilobytes.',
|
||||
'string' => 'The :attribute must be at least :min characters.',
|
||||
'array' => 'The :attribute must have at least :min items.',
|
||||
],
|
||||
'not_in' => 'The selected :attribute is invalid.',
|
||||
'not_regex' => 'The :attribute format is invalid.',
|
||||
'numeric' => 'The :attribute must be a number.',
|
||||
'password' => 'The password is incorrect.',
|
||||
'present' => 'The :attribute field must be present.',
|
||||
'regex' => 'The :attribute format is invalid.',
|
||||
'required' => 'The :attribute field is required.',
|
||||
'required_if' => 'The :attribute field is required when :other is :value.',
|
||||
'required_unless' => 'The :attribute field is required unless :other is in :values.',
|
||||
'required_with' => 'The :attribute field is required when :values is present.',
|
||||
'required_with_all' => 'The :attribute field is required when :values are present.',
|
||||
'required_without' => 'The :attribute field is required when :values is not present.',
|
||||
'required_without_all' => 'The :attribute field is required when none of :values are present.',
|
||||
'same' => 'The :attribute and :other must match.',
|
||||
'size' => [
|
||||
'numeric' => 'The :attribute must be :size.',
|
||||
'file' => 'The :attribute must be :size kilobytes.',
|
||||
'string' => 'The :attribute must be :size characters.',
|
||||
'array' => 'The :attribute must contain :size items.',
|
||||
],
|
||||
'starts_with' => 'The :attribute must start with one of the following: :values',
|
||||
'string' => 'The :attribute must be a string.',
|
||||
'timezone' => 'The :attribute must be a valid zone.',
|
||||
'unique' => 'The :attribute has already been taken.',
|
||||
'uploaded' => 'The :attribute failed to upload.',
|
||||
'url' => 'The :attribute format is invalid.',
|
||||
'uuid' => 'The :attribute must be a valid UUID.',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify custom validation messages for attributes using the
|
||||
| convention "attribute.rule" to name the lines. This makes it quick to
|
||||
| specify a specific custom language line for a given attribute rule.
|
||||
|
|
||||
*/
|
||||
|
||||
'custom' => [
|
||||
'attribute-name' => [
|
||||
'rule-name' => 'custom-message',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Attributes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used to swap our attribute placeholder
|
||||
| with something more reader friendly such as "E-Mail Address" instead
|
||||
| of "email". This simply helps us make our message more expressive.
|
||||
|
|
||||
*/
|
||||
|
||||
'attributes' => [],
|
||||
|
||||
];
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
return [
|
||||
'model_not_found' => 'Il n\'existe aucune instance de :model avec l\'id donné',
|
||||
'unexpected_error' => 'Erreur inattendue. Essayer plus tard',
|
||||
'validation_error' => 'Le champ :field a :validation',
|
||||
'service_unavailable' => 'Service non disponible',
|
||||
"amount_not_allowed" => "Ce montant n'est pas autorisé. Il doit être compris entre :min et :max"
|
||||
];
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
return [
|
||||
'empty_com_balance' => 'Solde de commission est vide',
|
||||
'treated_demand' => 'Demande de crédit deja traitée',
|
||||
'canceled_demand' => 'Demande de credit annulée',
|
||||
'princ_balance_inf_to_demand_amount' => 'Votre solde principal est inférieur au montant de la demande, voulez vous modifier le montant ?',
|
||||
'new_wallet_added' => 'Nouveau wallet ajouté',
|
||||
'success_treated_demand' => 'Demande traitée avec succès',
|
||||
'canceled_credit_request' => 'Demande de crédit annulée',
|
||||
'canceled_transaction' => 'Transaction annulée',
|
||||
'successful_transaction' => 'Transaction réussie',
|
||||
'incorrect_user_password' => 'Mot de passe utilisateur incorrect',
|
||||
'successful_identification' => 'L\'utilisateur :name a été identifié avec succes',
|
||||
'validated_identification' => 'Identification validée',
|
||||
'user_identificated' => 'Utilisateur déjà identifié',
|
||||
'user_not_identificated' => 'Utilisateur non identifié',
|
||||
'identification_already_validated' => 'Identification deja validée',
|
||||
'successful_bank_account_attachment_taken' => 'Votre requête de rattachement de votre compte bancaire a été prise en compte, vous recevrez un mail de confirmation dès lors que la banque aura validé votre code IBAN.',
|
||||
'customer_account_opening_request_submitted' => "Demande d'ouverture de compte client soumise",
|
||||
'customer_account_opening_request_pending' => "Vous avez deja une demande d'ouverture de compte client en cours de validation",
|
||||
'customer_account_opening_request' => "Demande d'ouverture de compte client",
|
||||
'customer_account_opening_request_mail' => ":gender :name ,
|
||||
|
||||
Votre demande d'ouverture de compte client est en cours de validation.
|
||||
Informations de la demande :
|
||||
- ID : :request_id
|
||||
- Type de compte : :account_type
|
||||
- Montant d'ouverture : :opening_amount
|
||||
",
|
||||
'customer_account_opening_request_accepted' => "Demande d'ouverture de compte client acceptée",
|
||||
'customer_account_opening_request_accepted_mail' => ":gender :name ,
|
||||
|
||||
Votre demande d'ouverture de compte client a été acceptée.
|
||||
Informations de la demande :
|
||||
- ID : :request_id
|
||||
- Type de compte : :account_type
|
||||
- Montant d'ouverture: :opening_amount
|
||||
|
||||
Rendez-vous à l'agence la plus proche pour terminer le processus
|
||||
",
|
||||
'customer_account_opening_request_accepted_notification' => "Votre demande d'ouverture de compte client :request_id a été acceptée.
|
||||
Assurer-vous que votre wallet a le crédit suffisant pour activer votre assurance",
|
||||
'customer_account_opening_request_rejected' => "Demande d'ouverture de compte client rejetée",
|
||||
'customer_account_opening_request_rejected_mail' => ":gender :name ,
|
||||
|
||||
Votre demande d'ouverture de compte client a été rejetée.
|
||||
Informations de la demande :
|
||||
- ID : :request_id
|
||||
- Type de compte : :account_type
|
||||
|
||||
Motif du rejet : :reason ",
|
||||
'customer_account_opening_request_rejected_notification' => "Votre demande d'ouverture de compte client :request_id a été rejetée.",
|
||||
'customer_account_opening_request_awaiting_more_information' => "Demande d'ouverture de compte client en attente de plus d'informations",
|
||||
'customer_account_opening_request_awaiting_more_information_mail' => ":gender :name ,
|
||||
|
||||
Votre demande d'ouverture de compte client est en attente de plus d'informations.
|
||||
Informations de la demande :
|
||||
- ID : :subscription_id
|
||||
- Type de compte : :account_type
|
||||
- Montant d'ouverture: :opening_amount
|
||||
|
||||
Message : :reason",
|
||||
'customer_account_opening_request_awaiting_more_information_notification' => "Votre demande d'ouverture de compte client :subscription_id est en attente de plus d'informations.",
|
||||
];
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
return [
|
||||
|
||||
];
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
return [
|
||||
'PENDING' => 'EN COURS',
|
||||
'ACCEPTED' => 'ACCEPTÉE',
|
||||
'REJECTED' => 'REJETÉE',
|
||||
'MARRIED' => 'Marié',
|
||||
'WIDOW' => 'Widow',
|
||||
'DIVORCED' => 'Divorcé',
|
||||
'RESIDENT' => 'Résident',
|
||||
'NOT_RESIDENT' => 'Non résident',
|
||||
'LOCALISATION_PLAN' => 'Plan de localisation',
|
||||
'UTILITY_BILL' => 'Facture de services publics',
|
||||
'DAILY' => 'Daily',
|
||||
'WEEKLY' => 'Weekly',
|
||||
'MONTHLY' => 'Mensuel',
|
||||
'MASTER_CARD_CLASSIC' => 'MASTER Card Classic',
|
||||
'MASTER_CARD_GOLD' => 'MASTER Card Gold',
|
||||
'MASTER_CARD_PLATINUM' => 'MASTER Card Platinum',
|
||||
'VISA_CARD_CLASSIC' => 'VISA Card Classic',
|
||||
'VISA_CARD_GOLD' => 'VISA Card Gold',
|
||||
'VISA_CARD_PLATINUM' => 'VISA Card Platinum',
|
||||
];
|
|
@ -0,0 +1,168 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines contain the default error messages used by
|
||||
| the validator class. Some of these rules have multiple versions such
|
||||
| as the size rules. Feel free to tweak each of these messages here.
|
||||
|
|
||||
*/
|
||||
|
||||
return [
|
||||
'accepted' => 'Le champ :attribute doit être accepté.',
|
||||
'accepted_if' => 'Le champ :attribute doit être accepté quand :other a la valeur :value.',
|
||||
'active_url' => 'Le champ :attribute n\'est pas une URL valide.',
|
||||
'after' => 'Le champ :attribute doit être une date postérieure au :date.',
|
||||
'after_or_equal' => 'Le champ :attribute doit être une date postérieure ou égale au :date.',
|
||||
'alpha' => 'Le champ :attribute doit contenir uniquement des lettres.',
|
||||
'alpha_dash' => 'Le champ :attribute doit contenir uniquement des lettres, des chiffres et des tirets.',
|
||||
'alpha_num' => 'Le champ :attribute doit contenir uniquement des chiffres et des lettres.',
|
||||
'array' => 'Le champ :attribute doit être un tableau.',
|
||||
'attached' => ':attribute est déjà attaché(e).',
|
||||
'before' => 'Le champ :attribute doit être une date antérieure au :date.',
|
||||
'before_or_equal' => 'Le champ :attribute doit être une date antérieure ou égale au :date.',
|
||||
'between' => [
|
||||
'array' => 'Le tableau :attribute doit contenir entre :min et :max éléments.',
|
||||
'file' => 'La taille du fichier de :attribute doit être comprise entre :min et :max kilo-octets.',
|
||||
'numeric' => 'La valeur de :attribute doit être comprise entre :min et :max.',
|
||||
'string' => 'Le texte :attribute doit contenir entre :min et :max caractères.',
|
||||
],
|
||||
'boolean' => 'Le champ :attribute doit être vrai ou faux.',
|
||||
'confirmed' => 'Le champ de confirmation :attribute ne correspond pas.',
|
||||
'current_password' => 'Le mot de passe est incorrect.',
|
||||
'date' => 'Le champ :attribute n\'est pas une date valide.',
|
||||
'date_equals' => 'Le champ :attribute doit être une date égale à :date.',
|
||||
'date_format' => 'Le champ :attribute ne correspond pas au format :format.',
|
||||
'declined' => 'Le champ :attribute doit être décliné.',
|
||||
'declined_if' => 'Le champ :attribute doit être décliné quand :other a la valeur :value.',
|
||||
'different' => 'Les champs :attribute et :other doivent être différents.',
|
||||
'digits' => 'Le champ :attribute doit contenir :digits chiffres.',
|
||||
'digits_between' => 'Le champ :attribute doit contenir entre :min et :max chiffres.',
|
||||
'dimensions' => 'La taille de l\'image :attribute n\'est pas conforme.',
|
||||
'distinct' => 'Le champ :attribute a une valeur en double.',
|
||||
'email' => 'Le champ :attribute doit être une adresse e-mail valide.',
|
||||
'ends_with' => 'Le champ :attribute doit se terminer par une des valeurs suivantes : :values',
|
||||
'exists' => 'Le champ :attribute sélectionné est invalide.',
|
||||
'file' => 'Le champ :attribute doit être un fichier.',
|
||||
'filled' => 'Le champ :attribute doit avoir une valeur.',
|
||||
'gt' => [
|
||||
'array' => 'Le tableau :attribute doit contenir plus de :value éléments.',
|
||||
'file' => 'La taille du fichier de :attribute doit être supérieure à :value kilo-octets.',
|
||||
'numeric' => 'La valeur de :attribute doit être supérieure à :value.',
|
||||
'string' => 'Le texte :attribute doit contenir plus de :value caractères.',
|
||||
],
|
||||
'gte' => [
|
||||
'array' => 'Le tableau :attribute doit contenir au moins :value éléments.',
|
||||
'file' => 'La taille du fichier de :attribute doit être supérieure ou égale à :value kilo-octets.',
|
||||
'numeric' => 'La valeur de :attribute doit être supérieure ou égale à :value.',
|
||||
'string' => 'Le texte :attribute doit contenir au moins :value caractères.',
|
||||
],
|
||||
'image' => 'Le champ :attribute doit être une image.',
|
||||
'in' => 'Le champ :attribute est invalide.',
|
||||
'in_array' => 'Le champ :attribute n\'existe pas dans :other.',
|
||||
'integer' => 'Le champ :attribute doit être un entier.',
|
||||
'ip' => 'Le champ :attribute doit être une adresse IP valide.',
|
||||
'ipv4' => 'Le champ :attribute doit être une adresse IPv4 valide.',
|
||||
'ipv6' => 'Le champ :attribute doit être une adresse IPv6 valide.',
|
||||
'json' => 'Le champ :attribute doit être un document JSON valide.',
|
||||
'lt' => [
|
||||
'array' => 'Le tableau :attribute doit contenir moins de :value éléments.',
|
||||
'file' => 'La taille du fichier de :attribute doit être inférieure à :value kilo-octets.',
|
||||
'numeric' => 'La valeur de :attribute doit être inférieure à :value.',
|
||||
'string' => 'Le texte :attribute doit contenir moins de :value caractères.',
|
||||
],
|
||||
'lte' => [
|
||||
'array' => 'Le tableau :attribute doit contenir au plus :value éléments.',
|
||||
'file' => 'La taille du fichier de :attribute doit être inférieure ou égale à :value kilo-octets.',
|
||||
'numeric' => 'La valeur de :attribute doit être inférieure ou égale à :value.',
|
||||
'string' => 'Le texte :attribute doit contenir au plus :value caractères.',
|
||||
],
|
||||
'max' => [
|
||||
'array' => 'Le tableau :attribute ne peut contenir plus de :max éléments.',
|
||||
'file' => 'La taille du fichier de :attribute ne peut pas dépasser :max kilo-octets.',
|
||||
'numeric' => 'La valeur de :attribute ne peut être supérieure à :max.',
|
||||
'string' => 'Le texte de :attribute ne peut contenir plus de :max caractères.',
|
||||
],
|
||||
'mimes' => 'Le champ :attribute doit être un fichier de type : :values.',
|
||||
'mimetypes' => 'Le champ :attribute doit être un fichier de type : :values.',
|
||||
'min' => [
|
||||
'array' => 'Le tableau :attribute doit contenir au moins :min éléments.',
|
||||
'file' => 'La taille du fichier de :attribute doit être supérieure à :min kilo-octets.',
|
||||
'numeric' => 'La valeur de :attribute doit être supérieure ou égale à :min.',
|
||||
'string' => 'Le texte :attribute doit contenir au moins :min caractères.',
|
||||
],
|
||||
'multiple_of' => 'La valeur de :attribute doit être un multiple de :value',
|
||||
'not_in' => 'Le champ :attribute sélectionné n\'est pas valide.',
|
||||
'not_regex' => 'Le format du champ :attribute n\'est pas valide.',
|
||||
'numeric' => 'Le champ :attribute doit contenir un nombre.',
|
||||
'password' => 'Le mot de passe est incorrect',
|
||||
'present' => 'Le champ :attribute doit être présent.',
|
||||
'prohibited' => 'Le champ :attribute est interdit.',
|
||||
'prohibited_if' => 'Le champ :attribute est interdit quand :other a la valeur :value.',
|
||||
'prohibited_unless' => 'Le champ :attribute est interdit à moins que :other est l\'une des valeurs :values.',
|
||||
'prohibits' => 'Le champ :attribute interdit :other d\'être présent.',
|
||||
'regex' => 'Le format du champ :attribute est invalide.',
|
||||
'relatable' => ':attribute n\'est sans doute pas associé(e) avec cette donnée.',
|
||||
'required' => 'Le champ :attribute est obligatoire.',
|
||||
'required_if' => 'Le champ :attribute est obligatoire quand la valeur de :other est :value.',
|
||||
'required_unless' => 'Le champ :attribute est obligatoire sauf si :other est :values.',
|
||||
'required_with' => 'Le champ :attribute est obligatoire quand :values est présent.',
|
||||
'required_with_all' => 'Le champ :attribute est obligatoire quand :values sont présents.',
|
||||
'required_without' => 'Le champ :attribute est obligatoire quand :values n\'est pas présent.',
|
||||
'required_without_all' => 'Le champ :attribute est requis quand aucun de :values n\'est présent.',
|
||||
'same' => 'Les champs :attribute et :other doivent être identiques.',
|
||||
'size' => [
|
||||
'array' => 'Le tableau :attribute doit contenir :size éléments.',
|
||||
'file' => 'La taille du fichier de :attribute doit être de :size kilo-octets.',
|
||||
'numeric' => 'La valeur de :attribute doit être :size.',
|
||||
'string' => 'Le texte de :attribute doit contenir :size caractères.',
|
||||
],
|
||||
'starts_with' => 'Le champ :attribute doit commencer avec une des valeurs suivantes : :values',
|
||||
'string' => 'Le champ :attribute doit être une chaîne de caractères.',
|
||||
'timezone' => 'Le champ :attribute doit être un fuseau horaire valide.',
|
||||
'unique' => 'La valeur du champ :attribute est déjà utilisée.',
|
||||
'uploaded' => 'Le fichier du champ :attribute n\'a pu être téléversé.',
|
||||
'url' => 'Le format de l\'URL de :attribute n\'est pas valide.',
|
||||
'uuid' => 'Le champ :attribute doit être un UUID valide',
|
||||
'custom' => [
|
||||
'attribute-name' => [
|
||||
'rule-name' => 'custom-message',
|
||||
],
|
||||
],
|
||||
|
||||
'attributes' => [
|
||||
'address' => 'adresse',
|
||||
'age' => 'âge',
|
||||
'available' => 'disponible',
|
||||
'city' => 'ville',
|
||||
'content' => 'contenu',
|
||||
'country' => 'pays',
|
||||
'current_password' => 'mot de passe actuel',
|
||||
'date' => 'date',
|
||||
'day' => 'jour',
|
||||
'description' => 'description',
|
||||
'email' => 'adresse e-mail',
|
||||
'excerpt' => 'extrait',
|
||||
'first_name' => 'prénom',
|
||||
'gender' => 'genre',
|
||||
'hour' => 'heure',
|
||||
'last_name' => 'nom',
|
||||
'minute' => 'minute',
|
||||
'mobile' => 'portable',
|
||||
'month' => 'mois',
|
||||
'name' => 'nom',
|
||||
'password' => 'mot de passe',
|
||||
'password_confirmation' => 'confirmation du mot de passe',
|
||||
'phone' => 'téléphone',
|
||||
'second' => 'seconde',
|
||||
'sex' => 'sexe',
|
||||
'size' => 'taille',
|
||||
'time' => 'heure',
|
||||
'title' => 'titre',
|
||||
'username' => 'nom d\'utilisateur',
|
||||
'year' => 'année',
|
||||
],
|
||||
];
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
/** @var \Laravel\Lumen\Routing\Router $router */
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register all of the routes for an application.
|
||||
| It is a breeze. Simply tell Lumen the URIs it should respond to
|
||||
| and give it the Closure to call when that URI is requested.
|
||||
|
|
||||
*/
|
||||
|
||||
$router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($router) {
|
||||
// Customers opening account
|
||||
$router->group(['prefix' => '/customers_accounts_requests'], function () use ($router) {
|
||||
$router->get('formData', 'CustomerAccountOpeningController@getFormData');
|
||||
$router->post('', 'CustomerAccountOpeningController@submit');
|
||||
$router->get('{user_id}', 'CustomerAccountOpeningController@getCustomerRequests');
|
||||
$router->put('{id}/treat', 'CustomerAccountOpeningController@treatRequest');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
|
@ -0,0 +1,3 @@
|
|||
*
|
||||
!data/
|
||||
!.gitignore
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use Laravel\Lumen\Testing\DatabaseMigrations;
|
||||
use Laravel\Lumen\Testing\DatabaseTransactions;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_that_base_endpoint_returns_a_successful_response()
|
||||
{
|
||||
$this->get('/');
|
||||
|
||||
$this->assertEquals(
|
||||
$this->app->version(), $this->response->getContent()
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use Laravel\Lumen\Testing\TestCase as BaseTestCase;
|
||||
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* Creates the application.
|
||||
*
|
||||
* @return \Laravel\Lumen\Application
|
||||
*/
|
||||
public function createApplication()
|
||||
{
|
||||
return require __DIR__.'/../bootstrap/app.php';
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue