Intial project with activated wallets
This commit is contained in:
commit
bfc53164e8
|
@ -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,21 @@
|
||||||
|
APP_NAME=WalletService
|
||||||
|
APP_ENV=production
|
||||||
|
APP_KEY=NhSitM0Iv4HmNTRVJRiQPm0x20tgz7zE
|
||||||
|
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_test2
|
||||||
|
DB_USERNAME=root
|
||||||
|
DB_PASSWORD=vps@2017GA
|
||||||
|
|
||||||
|
CACHE_DRIVER=file
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
|
||||||
|
ACCEPTED_KEYS=yhSTSSqIO1uSE1icu09edPOeSFGxIDjo
|
|
@ -0,0 +1,6 @@
|
||||||
|
/vendor
|
||||||
|
/.idea
|
||||||
|
Homestead.json
|
||||||
|
Homestead.yaml
|
||||||
|
.env
|
||||||
|
.phpunit.result.cache
|
|
@ -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,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,100 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exceptions;
|
||||||
|
|
||||||
|
use App\Traits\ApiResponser;
|
||||||
|
use Illuminate\Auth\Access\AuthorizationException;
|
||||||
|
use Illuminate\Auth\AuthenticationException;
|
||||||
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
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("Does not exist any instance of {$model} with given id",
|
||||||
|
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();
|
||||||
|
|
||||||
|
return $this->errorResponse($errors, Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($exception instanceof AuthenticationException)
|
||||||
|
{
|
||||||
|
return $this->errorResponse($exception->getMessage(),Response::HTTP_UNAUTHORIZED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( env('APP_DEBUG', false))
|
||||||
|
{
|
||||||
|
return parent::render($request,$exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->errorResponse('Unexcepted error. Try later',
|
||||||
|
Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\ConfigWallet;
|
||||||
|
use App\Models\Network;
|
||||||
|
use App\Models\NetworksAgent;
|
||||||
|
use App\Models\Wallet;
|
||||||
|
use App\Models\WalletTransaction;
|
||||||
|
use App\Traits\ApiResponser;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
class CommissionController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponser;
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function virement(Request $request)
|
||||||
|
{
|
||||||
|
$rules = [
|
||||||
|
"id_agent" => 'required|integer|min:0'
|
||||||
|
];
|
||||||
|
$this->validate($request,$rules);
|
||||||
|
$wallet = Wallet::where('id_networkAgent',$request->get('id_agent'))->firstOrFail();
|
||||||
|
|
||||||
|
$wallet->balance_princ += $wallet->balance_com;
|
||||||
|
$wallet->balance_com = 0;
|
||||||
|
|
||||||
|
return $this->successResponse('Virement de commission reussie');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Laravel\Lumen\Routing\Controller as BaseController;
|
||||||
|
|
||||||
|
class Controller extends BaseController
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
|
@ -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,123 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\AgentsPlus;
|
||||||
|
use App\Models\CodeGenerer;
|
||||||
|
use App\Models\ConfigWallet;
|
||||||
|
use App\Models\Network;
|
||||||
|
use App\Models\NetworksAgent;
|
||||||
|
use App\Models\Wallet;
|
||||||
|
use App\Models\WalletAgent;
|
||||||
|
use App\Models\WalletTransaction;
|
||||||
|
use App\Traits\ApiResponser;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
class TransactionController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponser;
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add(Request $request)
|
||||||
|
{
|
||||||
|
$transaction = new WalletTransaction ;
|
||||||
|
$this->validate($request,$transaction->rules());
|
||||||
|
|
||||||
|
$walletAgent = Wallet::findOrFail($request->get('id_wallet'));
|
||||||
|
$network_agent = NetworksAgent::findOrFail( $walletAgent->id_networkAgent);
|
||||||
|
// Configuratrion du wallet
|
||||||
|
$config = ConfigWallet::where('id_network',$network_agent->network_id)->firstOrFail();
|
||||||
|
|
||||||
|
// Recuperation des wallets hyperviseur et superviseur
|
||||||
|
$codeGenerer = CodeGenerer::findOrFail($network_agent->codeGenerer_id);
|
||||||
|
$superviseur = AgentsPlus::where('code_membre',$codeGenerer->code_parrain)->firstOrFail();
|
||||||
|
$hyperviseur = AgentsPlus::where('code_membre',$superviseur->code_parrain)->firstOrFail();
|
||||||
|
|
||||||
|
$wallet_agent_sup = WalletAgent::where('agent_id', $superviseur->id)->firstOrFail();
|
||||||
|
$wallet_agent_hyp = WalletAgent::where('agent_id', $hyperviseur->id)->firstOrFail();
|
||||||
|
$walletSuperviseur = Wallet::findOrFail($wallet_agent_sup->wallet_id);;
|
||||||
|
$walletHyperviseur = Wallet::findOrFail($wallet_agent_hyp->wallet_id);;;
|
||||||
|
|
||||||
|
$transaction->fill($request->all());
|
||||||
|
|
||||||
|
$client = new \GuzzleHttp\Client();
|
||||||
|
// Procedure de depot d'argent
|
||||||
|
if($transaction->type == 'credit')
|
||||||
|
{
|
||||||
|
$frais = $transaction->montant * $config->taux_com_client_depot;
|
||||||
|
|
||||||
|
if($walletAgent->balance_princ >= ($transaction->montant + $config->taux_com_client_depot + $config->part_banque_depot)){
|
||||||
|
//Requete vers la banque
|
||||||
|
// 1 ---> Emmètre via API sécurisé SSL une requête de débit de notre
|
||||||
|
//compte marchand la valeur égale au $montantDepot( montant de la
|
||||||
|
//transaction – la frais calculé en % - frais minimum fixe du
|
||||||
|
//dépôt client) et créditer sa carte visa de cette valeur
|
||||||
|
|
||||||
|
$banqueCommission = floatval($config->frais_min_banque_depot * $config->part_banque_depot);
|
||||||
|
// 2---> Emmètre via API sécurisé SSL une requête de débit de notre
|
||||||
|
//compte marchand du (Part de la banque partenaire en %
|
||||||
|
//pour le dépôtqui s’applique sur les frais minimum) et créditer
|
||||||
|
//le compte des opérations défini avec notre banque
|
||||||
|
//partenaire
|
||||||
|
|
||||||
|
$walletAgent->balance_princ -= $transaction->montant;
|
||||||
|
|
||||||
|
$agentCommission = floatval($config->frais_min_banque_depot * $config->taux_com_ag_depot);
|
||||||
|
$superviseurCommission = floatval($config->frais_min_banque_depot * $config->taux_com_sup_depot);
|
||||||
|
$hyperviseurCommission = $frais + $config->frais_min_banque_depot - $superviseurCommission - $agentCommission - $banqueCommission;
|
||||||
|
|
||||||
|
$walletAgent->balance_com += $agentCommission;
|
||||||
|
$walletSuperviseur->balance_com += $superviseurCommission;
|
||||||
|
$walletHyperviseur->balance_com += $hyperviseurCommission;
|
||||||
|
}else{
|
||||||
|
return $this->errorResponse('Solde agent inferieur au montant de depot + frais + frais minimun de depot de la banque', Response::HTTP_BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Procedure de retrait d'argent
|
||||||
|
}elseif ($transaction->type == 'debit')
|
||||||
|
{
|
||||||
|
|
||||||
|
$frais = $transaction->montant * $config->taux_com_client_retrait;
|
||||||
|
|
||||||
|
//Requete vers la banque
|
||||||
|
// 1 ---> Emmètre via API sécurisé SSL une requête de retrait du
|
||||||
|
//(montant de la transaction + frais de transaction) pour débiter
|
||||||
|
//sa carte et créditer notre compte marchand
|
||||||
|
|
||||||
|
$banqueCommission = floatval($transaction->montant * $config->part_banque_retrait);
|
||||||
|
// 2---> Emmètre via API sécurisé SSL une requête de débit de notre
|
||||||
|
//compte marchand du (montant de la transaction multiplié
|
||||||
|
//par la Part de la banque partenaire en % ) et créditer le
|
||||||
|
//compte des opérations défini avec notre banque partenaire
|
||||||
|
|
||||||
|
$walletAgent->balance_princ += $transaction->montant;
|
||||||
|
|
||||||
|
$agentCommission=floatval($transaction->montant*$config->taux_com_ag_retrait);
|
||||||
|
$superviseurCommission=floatval($transaction->montant*$config->taux_com_sup_retrait);
|
||||||
|
$hyperviseurCommission = $frais + $config->frais_min_banque_depot - $superviseurCommission - $agentCommission - $banqueCommission;
|
||||||
|
|
||||||
|
$walletAgent->balance_com += $agentCommission;
|
||||||
|
$walletSuperviseur->balance_com += $superviseurCommission;
|
||||||
|
$walletHyperviseur->balance_com += $hyperviseurCommission;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction->date = new \DateTime();
|
||||||
|
$transaction->statut = 1;
|
||||||
|
$walletAgent->save();
|
||||||
|
$walletSuperviseur->save();
|
||||||
|
$walletHyperviseur->save();
|
||||||
|
$transaction->save();
|
||||||
|
return $this->successResponse($transaction);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Traits\ApiResponser;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class WalletController extends Controller
|
||||||
|
{
|
||||||
|
use ApiResponser;
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function activated(){
|
||||||
|
$networks = DB::select('SELECT networks.name AS network,networks.status AS status,networks.id,countries.name AS country,networks.country_id , configWallet.id_network FROM `networks`
|
||||||
|
INNER JOIN countries ON networks.country_id=countries.id LEFT JOIN configWallet ON configWallet.id_network = networks.id WHERE status = 1 AND id_network IS NOT NULL');
|
||||||
|
|
||||||
|
return $this->successResponse($networks);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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,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,80 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Reliese Model.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AgentsPlus
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $uid
|
||||||
|
* @property string $firstname
|
||||||
|
* @property string $lastname
|
||||||
|
* @property string $email
|
||||||
|
* @property float $userlongitude
|
||||||
|
* @property float $userlatitude
|
||||||
|
* @property int $active
|
||||||
|
* @property Carbon $created
|
||||||
|
* @property Carbon $openHours
|
||||||
|
* @property Carbon $closeHours
|
||||||
|
* @property float $solde
|
||||||
|
* @property int $etat
|
||||||
|
* @property string $network
|
||||||
|
* @property string $country
|
||||||
|
* @property string $code_parrain
|
||||||
|
* @property string $category
|
||||||
|
* @property string $code_membre
|
||||||
|
* @property int $number_geoBysuper
|
||||||
|
*
|
||||||
|
* @package App\Models
|
||||||
|
*/
|
||||||
|
class AgentsPlus extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'agents_plus';
|
||||||
|
public $incrementing = false;
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'id' => 'int',
|
||||||
|
'userlongitude' => 'float',
|
||||||
|
'userlatitude' => 'float',
|
||||||
|
'active' => 'int',
|
||||||
|
'solde' => 'float',
|
||||||
|
'etat' => 'int',
|
||||||
|
'number_geoBysuper' => 'int'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'created',
|
||||||
|
'openHours',
|
||||||
|
'closeHours'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'id',
|
||||||
|
'uid',
|
||||||
|
'firstname',
|
||||||
|
'lastname',
|
||||||
|
'email',
|
||||||
|
'userlongitude',
|
||||||
|
'userlatitude',
|
||||||
|
'active',
|
||||||
|
'created',
|
||||||
|
'openHours',
|
||||||
|
'closeHours',
|
||||||
|
'solde',
|
||||||
|
'etat',
|
||||||
|
'network',
|
||||||
|
'country',
|
||||||
|
'code_parrain',
|
||||||
|
'category',
|
||||||
|
'code_membre',
|
||||||
|
'number_geoBysuper'
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Reliese Model.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CodeGenerer
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $code_parrain
|
||||||
|
* @property string $code_membre
|
||||||
|
* @property Carbon $date_creation
|
||||||
|
* @property Carbon $date_modifcation
|
||||||
|
* @property string $category
|
||||||
|
* @property int $etat
|
||||||
|
*
|
||||||
|
* @package App\Models
|
||||||
|
*/
|
||||||
|
class CodeGenerer extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'codeGenerer';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'etat' => 'int'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'date_creation',
|
||||||
|
'date_modifcation'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'code_parrain',
|
||||||
|
'code_membre',
|
||||||
|
'date_creation',
|
||||||
|
'date_modifcation',
|
||||||
|
'category',
|
||||||
|
'etat'
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Reliese Model.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ConfigWallet
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property float $taux_com_client_retrait
|
||||||
|
* @property float $taux_com_client_depot
|
||||||
|
* @property float $taux_com_ag_retrait
|
||||||
|
* @property float $taux_com_ag_depot
|
||||||
|
* @property float $taux_com_sup_retrait
|
||||||
|
* @property float $taux_com_sup_depot
|
||||||
|
* @property float $part_banque_retrait
|
||||||
|
* @property float $part_banque_depot
|
||||||
|
* @property float $frais_min_banque_depot
|
||||||
|
* @property int $id_network
|
||||||
|
*
|
||||||
|
* @property Network $network
|
||||||
|
*
|
||||||
|
* @package App\Models
|
||||||
|
*/
|
||||||
|
class ConfigWallet extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'configWallet';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'taux_com_client_retrait' => 'float',
|
||||||
|
'taux_com_client_depot' => 'float',
|
||||||
|
'taux_com_ag_retrait' => 'float',
|
||||||
|
'taux_com_ag_depot' => 'float',
|
||||||
|
'taux_com_sup_retrait' => 'float',
|
||||||
|
'taux_com_sup_depot' => 'float',
|
||||||
|
'part_banque_retrait' => 'float',
|
||||||
|
'part_banque_depot' => 'float',
|
||||||
|
'frais_min_banque_depot' => 'float',
|
||||||
|
'id_network' => 'int'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'taux_com_retrait',
|
||||||
|
'taux_com_ag_retrait',
|
||||||
|
'com_depot',
|
||||||
|
'taux_com_ag_depot',
|
||||||
|
'id_network'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function network()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Network::class, 'id_network');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Reliese Model.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class NetworksAgent
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int $network_id
|
||||||
|
* @property int $agent_id
|
||||||
|
* @property float $solde
|
||||||
|
* @property int $etat
|
||||||
|
* @property int $codeGenerer_id
|
||||||
|
* @property string $phone
|
||||||
|
* @property string $transactionNumber
|
||||||
|
* @property string $validation_code
|
||||||
|
*
|
||||||
|
* @property Collection|Wallet[] $wallets
|
||||||
|
*
|
||||||
|
* @package App\Models
|
||||||
|
*/
|
||||||
|
class NetworksAgent extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'networks_agents';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'network_id' => 'int',
|
||||||
|
'agent_id' => 'int',
|
||||||
|
'solde' => 'float',
|
||||||
|
'etat' => 'int',
|
||||||
|
'codeGenerer_id' => 'int'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'network_id',
|
||||||
|
'agent_id',
|
||||||
|
'solde',
|
||||||
|
'etat',
|
||||||
|
'codeGenerer_id',
|
||||||
|
'phone',
|
||||||
|
'transactionNumber',
|
||||||
|
'validation_code'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function wallets()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Wallet::class, 'id_networkAgent');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Reliese Model.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Wallet
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property float $balance_princ
|
||||||
|
* @property float $balance_com
|
||||||
|
* @property int $id_networkAgent
|
||||||
|
* @property Carbon $created_date
|
||||||
|
*
|
||||||
|
* @property NetworksAgent $networks_agent
|
||||||
|
* @property Collection|WalletTransaction[] $wallet_transactions
|
||||||
|
*
|
||||||
|
* @package App\Models
|
||||||
|
*/
|
||||||
|
class Wallet extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'wallets';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'balance_princ' => 'float',
|
||||||
|
'balance_com' => 'float',
|
||||||
|
'id_networkAgent' => 'int'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'created_date'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'balance_princ',
|
||||||
|
'balance_com',
|
||||||
|
'id_networkAgent',
|
||||||
|
'created_date'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function networks_agent()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(NetworksAgent::class, 'id_networkAgent');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function wallet_transactions()
|
||||||
|
{
|
||||||
|
return $this->hasMany(WalletTransaction::class, 'id_wallet');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Reliese Model.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class WalletAgent
|
||||||
|
*
|
||||||
|
* @property int $wallet_id
|
||||||
|
* @property float $balance_princ
|
||||||
|
* @property float $balance_com
|
||||||
|
* @property Carbon $created_date
|
||||||
|
* @property int $agent_id
|
||||||
|
* @property string $lastname
|
||||||
|
* @property int $network_id
|
||||||
|
* @property string $network
|
||||||
|
*
|
||||||
|
* @package App\Models
|
||||||
|
*/
|
||||||
|
class WalletAgent extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'wallet_agent';
|
||||||
|
public $incrementing = false;
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'wallet_id' => 'int',
|
||||||
|
'balance_princ' => 'float',
|
||||||
|
'balance_com' => 'float',
|
||||||
|
'agent_id' => 'int',
|
||||||
|
'network_id' => 'int'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'created_date'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'wallet_id',
|
||||||
|
'balance_princ',
|
||||||
|
'balance_com',
|
||||||
|
'created_date',
|
||||||
|
'agent_id',
|
||||||
|
'lastname',
|
||||||
|
'network_id',
|
||||||
|
'network'
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Reliese Model.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use phpDocumentor\Reflection\Types\Integer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class WalletTransaction
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property float $montant
|
||||||
|
* @property string $numCarte
|
||||||
|
* @property Carbon expiration_date
|
||||||
|
* @property int cvv
|
||||||
|
* @property string $type
|
||||||
|
* @property Carbon $date
|
||||||
|
* @property string $statut
|
||||||
|
* @property string $result
|
||||||
|
* @property int $id_wallet
|
||||||
|
*
|
||||||
|
* @property Wallet $wallet
|
||||||
|
*
|
||||||
|
* @package App\Models
|
||||||
|
*/
|
||||||
|
class WalletTransaction extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'wallet_transaction';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'montant' => 'float',
|
||||||
|
'cvv' => 'int',
|
||||||
|
'id_wallet' => 'int'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'date',
|
||||||
|
'expiration_date'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'montant',
|
||||||
|
'numCarte',
|
||||||
|
'expiration_date',
|
||||||
|
'cvv',
|
||||||
|
'type',
|
||||||
|
'date',
|
||||||
|
'statut',
|
||||||
|
'result',
|
||||||
|
'id_wallet'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function wallet()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Wallet::class, 'id_wallet');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTaxeAttribute($value)
|
||||||
|
{
|
||||||
|
return ucfirst($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTaxeAttribute($value)
|
||||||
|
{
|
||||||
|
$this->attributes['taxe'] = (int) $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'montant'=> 'required|numeric|min:1',
|
||||||
|
'numCarte'=>'required|integer',
|
||||||
|
'cvv'=>'required|integer|min:3|max:4',
|
||||||
|
'expiration_date'=>'required|date_format:m/Y|after_or_equal:today',
|
||||||
|
'type' =>'required|in:credit,debit',
|
||||||
|
'id_wallet' => 'required|integer|min:0'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -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\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,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
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,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Traits;
|
||||||
|
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
trait ApiResponser
|
||||||
|
{
|
||||||
|
public function successResponse($data , $code = Response::HTTP_OK)
|
||||||
|
{
|
||||||
|
return response($data , $code)->header('Content-Type', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function errorResponse($message , $code)
|
||||||
|
{
|
||||||
|
return response()->json(['error' => $message , 'code'=> $code], $code);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function errorMessage($message , $code)
|
||||||
|
{
|
||||||
|
return response($message ,$code)->header('Content-Type', 'application/json');
|
||||||
|
}
|
||||||
|
}
|
|
@ -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,115 @@
|
||||||
|
<?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');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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\AuthenticateAccess::class
|
||||||
|
]);
|
||||||
|
|
||||||
|
// $app->routeMiddleware([
|
||||||
|
// 'auth' => App\Http\Middleware\Authenticate::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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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,42 @@
|
||||||
|
{
|
||||||
|
"name": "laravel/lumen",
|
||||||
|
"description": "The Laravel Lumen Framework.",
|
||||||
|
"keywords": ["framework", "laravel", "lumen"],
|
||||||
|
"license": "MIT",
|
||||||
|
"type": "project",
|
||||||
|
"require": {
|
||||||
|
"php": "^7.2.5",
|
||||||
|
"laravel/lumen-framework": "^7.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"fzaninotto/faker": "^1.9.1",
|
||||||
|
"mockery/mockery": "^1.3.1",
|
||||||
|
"phpunit/phpunit": "^8.5"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"database/seeds",
|
||||||
|
"database/factories"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"App\\": "app/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"classmap": [
|
||||||
|
"tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"preferred-install": "dist",
|
||||||
|
"sort-packages": true,
|
||||||
|
"optimize-autoloader": true
|
||||||
|
},
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"prefer-stable": true,
|
||||||
|
"scripts": {
|
||||||
|
"post-root-package-install": [
|
||||||
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||||
|
|
||||||
|
use App\User;
|
||||||
|
use Faker\Generator as Faker;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Model Factories
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This directory should contain each of the model factory definitions for
|
||||||
|
| your application. Factories provide a convenient way to generate new
|
||||||
|
| model instances for testing / seeding your application's database.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$factory->define(User::class, function (Faker $faker) {
|
||||||
|
return [
|
||||||
|
'name' => $faker->name,
|
||||||
|
'email' => $faker->email,
|
||||||
|
];
|
||||||
|
});
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class DatabaseSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
// $this->call('UsersTableSeeder');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?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>
|
||||||
|
<filter>
|
||||||
|
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||||
|
<directory suffix=".php">./app</directory>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
<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,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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->get('/', function () use ($router) {
|
||||||
|
// return $router->app->version();
|
||||||
|
//});
|
||||||
|
|
||||||
|
$router->post('/transactions','TransactionController@add');
|
||||||
|
$router->post('/virement','CommissionController@virement');
|
||||||
|
|
||||||
|
// Wallets routes
|
||||||
|
$router->group(['prefix' => '/wallets'] , function () use ($router){
|
||||||
|
$router->get('activated', 'WalletController@activated');
|
||||||
|
});
|
|
@ -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,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Laravel\Lumen\Testing\DatabaseMigrations;
|
||||||
|
use Laravel\Lumen\Testing\DatabaseTransactions;
|
||||||
|
|
||||||
|
class ExampleTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic test example.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testExample()
|
||||||
|
{
|
||||||
|
$this->get('/');
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
$this->app->version(), $this->response->getContent()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
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