+ Optimization of requests to the bank ( Validation of IBAN code)

This commit is contained in:
Djery-Tom 2020-11-05 18:12:55 +01:00
parent 29374c8cc4
commit a587c69c51
10 changed files with 339 additions and 124 deletions

View File

@ -350,7 +350,7 @@ class WalletController extends Controller
public function getWalletBanks($id_wallet_network) public function getWalletBanks($id_wallet_network)
{ {
$banks = DB::select("SELECT b.id as id_bank, b.nom as bank_name , bc.adresse as bank_address, c.name as country FROM networks_banks nb INNER JOIN banks_countries bc on bc.id = nb.id_bank_country INNER JOIN banks b ON b.id = bc.id_bank $banks = DB::select("SELECT bc.id as id_bank, b.nom as bank_name , bc.adresse as bank_address, c.name as country FROM networks_banks nb INNER JOIN banks_countries bc on bc.id = nb.id_bank_country INNER JOIN banks b ON b.id = bc.id_bank
INNER JOIN countries c ON bc.id_country = c.id WHERE nb.id_network = :id_network ;", ['id_network' => $id_wallet_network]); INNER JOIN countries c ON bc.id_country = c.id WHERE nb.id_network = :id_network ;", ['id_network' => $id_wallet_network]);
return $this->successResponse($banks); return $this->successResponse($banks);

View File

@ -8,6 +8,7 @@ use App\Models\ConfigWallet;
use App\Models\Country; use App\Models\Country;
use App\Models\Identification; use App\Models\Identification;
use App\Models\NetworksAgent; use App\Models\NetworksAgent;
use App\Models\NetworksBank;
use App\Models\PayingNetwork; use App\Models\PayingNetwork;
use App\Models\Regulation; use App\Models\Regulation;
use App\Models\TypeIlinkTransaction; use App\Models\TypeIlinkTransaction;
@ -396,11 +397,22 @@ class iLinkTransactionController extends Controller
// return $rep; // return $rep;
//Verifier si la banque est associée au reseau //Verifier si la banque est associée au reseau
$result = DB::select("SELECT * FROM networks_banks nb INNER JOIN banks_countries bc ON bc.id = nb.id_bank_country $network_bank = NetworksBank::where('id_network', $request->id_wallet_network)->where('id_bank_country', $request->id_bank)->first();
WHERE nb.id_network = :id_network AND bc.id_bank = :id_bank;", ["id_network" => $request->id_wallet_network, 'id_bank' => $request->id_bank]); if (!$network_bank)
if (sizeof($result) == 0)
return $this->errorResponse(trans('errors.bank_not_associated_with_network')); return $this->errorResponse(trans('errors.bank_not_associated_with_network'));
//Verifier le code IBAN
$country_code = $network_bank->network->country->code_country;
$bank_code = $network_bank->banks_country->code_banque;
switch ($this->checkIBAN($request->iban, $country_code, $bank_code)) {
case 0:
return $this->errorResponse(trans('errors.invalid_iban'));
case 1:
return $this->errorResponse(trans('errors.country_not_match_iban'));
case 2:
return $this->errorResponse(trans('errors.bank_not_match_iban'));
}
$transaction->frais = $frais = 0; $transaction->frais = $frais = 0;
$transaction->taxe = $taxe = 0; $transaction->taxe = $taxe = 0;
// $walletUser->balance -= $transaction->montant; // $walletUser->balance -= $transaction->montant;
@ -412,6 +424,8 @@ class iLinkTransactionController extends Controller
$transaction->id_wallet_hyp = $walletHyperviseur->id; $transaction->id_wallet_hyp = $walletHyperviseur->id;
$transaction->frais = $frais; $transaction->frais = $frais;
$transaction->date = new \DateTime(); $transaction->date = new \DateTime();
$transaction->bank = $network_bank->banks_country->bank->nom;
$transaction->country = $network_bank->network->country->name;
$transaction->id_bank = $request->id_bank; $transaction->id_bank = $request->id_bank;
$transaction->iban = $request->iban; $transaction->iban = $request->iban;
// $walletUser->save(); // $walletUser->save();
@ -426,7 +440,7 @@ class iLinkTransactionController extends Controller
['id_transaction' => $transaction->id_transaction, 'amount' => $this->toMoney($transaction->montant, $init_country), ['id_transaction' => $transaction->id_transaction, 'amount' => $this->toMoney($transaction->montant, $init_country),
'net' => $this->toMoney($transaction->montant, $init_country), 'iban' => $request->iban, 'fees' => $this->toMoney($frais, $init_country), 'net' => $this->toMoney($transaction->montant, $init_country), 'iban' => $request->iban, 'fees' => $this->toMoney($frais, $init_country),
'sender_code' => $user->user_code]); 'sender_code' => $user->user_code]);
// $this->sendMail($user->email, trans('messages.successful_transaction'), $message); $this->sendMail($user->email, trans('messages.successful_transaction'), $message);
return $this->successResponse($message . trans('messages.sent_by_mail')); return $this->successResponse($message . trans('messages.sent_by_mail'));
break; break;
@ -1076,11 +1090,22 @@ class iLinkTransactionController extends Controller
return $this->errorResponse(trans('errors.insufficient_balance')); return $this->errorResponse(trans('errors.insufficient_balance'));
//Verifier si la banque est associée au reseau //Verifier si la banque est associée au reseau
$result = DB::select("SELECT * FROM networks_banks nb INNER JOIN banks_countries bc ON bc.id = nb.id_bank_country $network_bank = NetworksBank::where('id_network', $request->id_wallet_network)->where('id_bank_country', $request->id_bank)->first();
WHERE nb.id_network = :id_network AND bc.id_bank = :id_bank;", ["id_network" => $request->id_wallet_network, 'id_bank' => $request->id_bank]); if (!$network_bank)
if (sizeof($result) == 0)
return $this->errorResponse(trans('errors.bank_not_associated_with_network')); return $this->errorResponse(trans('errors.bank_not_associated_with_network'));
//Verifier le code IBAN
$country_code = $network_bank->network->country->code_country;
$bank_code = $network_bank->banks_country->code_banque;
switch ($this->checkIBAN($request->iban, $country_code, $bank_code)) {
case 0:
return $this->errorResponse(trans('errors.invalid_iban'));
case 1:
return $this->errorResponse(trans('errors.country_not_match_iban'));
case 2:
return $this->errorResponse(trans('errors.bank_not_match_iban'));
}
$transaction->frais = $frais = 0; $transaction->frais = $frais = 0;
$transaction->taxe = $taxe = 0; $transaction->taxe = $taxe = 0;
// $walletUser->balance -= $transaction->montant; // $walletUser->balance -= $transaction->montant;
@ -1094,6 +1119,8 @@ class iLinkTransactionController extends Controller
$transaction->id_wallet_sup = $walletSuperviseur->id; $transaction->id_wallet_sup = $walletSuperviseur->id;
$transaction->frais = $frais; $transaction->frais = $frais;
$transaction->date = new \DateTime(); $transaction->date = new \DateTime();
$transaction->bank = $network_bank->banks_country->bank->nom;
$transaction->country = $network_bank->network->country->name;
$transaction->id_bank = $request->id_bank; $transaction->id_bank = $request->id_bank;
$transaction->iban = $request->iban; $transaction->iban = $request->iban;
// $walletUser->save(); // $walletUser->save();
@ -1108,15 +1135,13 @@ class iLinkTransactionController extends Controller
['id_transaction' => $transaction->id_transaction, 'amount' => $this->toMoney($transaction->montant, $init_country), ['id_transaction' => $transaction->id_transaction, 'amount' => $this->toMoney($transaction->montant, $init_country),
'net' => $this->toMoney($transaction->montant, $init_country), 'iban' => $request->iban, 'fees' => $this->toMoney($frais, $init_country), 'net' => $this->toMoney($transaction->montant, $init_country), 'iban' => $request->iban, 'fees' => $this->toMoney($frais, $init_country),
'sender_code' => $codeGenerer->code_membre]); 'sender_code' => $codeGenerer->code_membre]);
// $this->sendMail($user->email, trans('messages.successful_transaction'), $message); $this->sendMail($agent->email, trans('messages.successful_transaction'), $message);
return $this->successResponse($message . trans('messages.sent_by_mail')); return $this->successResponse($message . trans('messages.sent_by_mail'));
} }
} }
public public function lastUserTransactions($id_user)
function lastUserTransactions($id_user)
{ {
$user = User::findOrFail($id_user); $user = User::findOrFail($id_user);
$wallet_user = WalletsUser::where('idUser', $user->id)->firstOrFail(); $wallet_user = WalletsUser::where('idUser', $user->id)->firstOrFail();
@ -1157,8 +1182,7 @@ class iLinkTransactionController extends Controller
return $this->successResponse($transactions); return $this->successResponse($transactions);
} }
public public function lastAgentTransactions($id_wallet_agent)
function lastAgentTransactions($id_wallet_agent)
{ {
$transactions = DB::select('SELECT wit.id_transaction, tit.nom as operation_fr , tit.name as operation_en, wit.montant ,wit.nom_emetteur, wit.prenom_emetteur, wit.id_wallet_user,wit.frais,wit.taxe,wit.id_destinataire, $transactions = DB::select('SELECT wit.id_transaction, tit.nom as operation_fr , tit.name as operation_en, wit.montant ,wit.nom_emetteur, wit.prenom_emetteur, wit.id_wallet_user,wit.frais,wit.taxe,wit.id_destinataire,
wit.nom_destinataire, wit.prenom_destinataire, wit.type , wit.id_wallet_user, wit.init_country, wit.final_country , wit.network_destinataire , wit.montant_net_final_country , wit.nom_destinataire, wit.prenom_destinataire, wit.type , wit.id_wallet_user, wit.init_country, wit.final_country , wit.network_destinataire , wit.montant_net_final_country ,
@ -1193,8 +1217,7 @@ class iLinkTransactionController extends Controller
return $this->successResponse($transactions); return $this->successResponse($transactions);
} }
public public function calculateCommission(Request $request)
function calculateCommission(Request $request)
{ {
$rules = [ $rules = [
'type' => 'required|integer|min:0|not_in:0', 'type' => 'required|integer|min:0|not_in:0',
@ -1248,13 +1271,19 @@ class iLinkTransactionController extends Controller
case 1: //User - Envoi wallet à wallet case 1: //User - Envoi wallet à wallet
$this->validate($request, [ $this->validate($request, [
'final_country' => 'required|integer|min:0|not_in:0', 'final_country' => 'required|integer|min:0|not_in:0',
'id_destinataire' => 'required_without:phone_destinataire' 'id_destinataire' => 'required_without:phone_destinataire',
'network_destinataire' => 'required|integer|min:0|not_in:0',
]); ]);
$configNetworkDestinataire = ConfigWallet::where('id_network', $request->network_destinataire)->firstOrFail();
$frais = ($init_country != $request->final_country) ? $this->calculateFees($plr_user_wallet_wallet, $request->montant) : $this->calculateFees($plr_user_wallet_wallet_national, $request->montant); $frais = ($init_country != $request->final_country) ? $this->calculateFees($plr_user_wallet_wallet, $request->montant) : $this->calculateFees($plr_user_wallet_wallet_national, $request->montant);
$taxe = ($init_country != $request->final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais); $taxe = ($init_country != $request->final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
$destinataire = User::where('user_code', $request->id_destinataire)->first();
//Verifier si c'est pas un reseau ilink //Verifier si c'est pas un reseau ilink
$data['destinataire'] = $destinataire ? $destinataire->lastname . ' ' . $destinataire->firstname : $request->id_destinataire; if ($configNetworkDestinataire->type != 'ilink') {
$data['destinataire'] = $request->id_destinataire;
} else {
$destinataire = User::where('user_code', $request->id_destinataire)->first();
$data['destinataire'] = $destinataire ? $destinataire->lastname . ' ' . $destinataire->firstname : $request->id_destinataire;
}
$data['frais'] = round($frais + $taxe, 2); $data['frais'] = round($frais + $taxe, 2);
$data['montant_net_init'] = round($request->montant - $data['frais'], 2); $data['montant_net_init'] = round($request->montant - $data['frais'], 2);
$data['montant_net_final'] = $this->toMoneyWithCurrency($data['montant_net_init'], $init_country, $request->final_country); $data['montant_net_final'] = $this->toMoneyWithCurrency($data['montant_net_init'], $init_country, $request->final_country);
@ -1342,8 +1371,7 @@ class iLinkTransactionController extends Controller
return $this->successResponse($data); return $this->successResponse($data);
} }
public public function getTransactionRetrait(Request $request)
function getTransactionRetrait(Request $request)
{ {
$this->validate($request, [ $this->validate($request, [
'id_transaction' => 'required', 'id_transaction' => 'required',
@ -1399,8 +1427,7 @@ class iLinkTransactionController extends Controller
} }
private private function getPaliers(array $paliers, $type)
function getPaliers(array $paliers, $type)
{ {
return array_values(array_filter($paliers, function ($palier) use ($type) { return array_values(array_filter($paliers, function ($palier) use ($type) {
return $palier->type == $type; return $palier->type == $type;
@ -1408,8 +1435,7 @@ class iLinkTransactionController extends Controller
} }
//Calcul des frais internationaux //Calcul des frais internationaux
private private function calculateFees(array $paliers, $montant)
function calculateFees(array $paliers, $montant)
{ {
$size = sizeof($paliers); $size = sizeof($paliers);
if ($size > 0) { if ($size > 0) {
@ -1436,8 +1462,7 @@ class iLinkTransactionController extends Controller
} }
private private function random_string()
function random_string()
{ {
$character_set_array = array(); $character_set_array = array();
$character_set_array[] = array('count' => 12, 'characters' => 'ABCDEFGHJKMNPQRSTUVWXYZ'); $character_set_array[] = array('count' => 12, 'characters' => 'ABCDEFGHJKMNPQRSTUVWXYZ');
@ -1452,8 +1477,7 @@ class iLinkTransactionController extends Controller
return implode('', $temp_array); return implode('', $temp_array);
} }
private private function getTransactionID()
function getTransactionID()
{ {
do { do {
$code = $this->generateTransactionCode(); $code = $this->generateTransactionCode();
@ -1464,8 +1488,7 @@ class iLinkTransactionController extends Controller
} }
private private function checkUserIdentification($id_user)
function checkUserIdentification($id_user)
{ {
$identification = Identification::where('id_user', $id_user)->first(); $identification = Identification::where('id_user', $id_user)->first();
if (isset($identification)) { if (isset($identification)) {
@ -1491,8 +1514,7 @@ class iLinkTransactionController extends Controller
// //
// } // }
public public function cancel($id_transaction)
function cancel($id_transaction)
{ {
$transaction = WalletIlinkTransaction::where('id_transaction', $id_transaction)->firstOrFail(); $transaction = WalletIlinkTransaction::where('id_transaction', $id_transaction)->firstOrFail();
$transactionInverse = $transaction->replicate(); $transactionInverse = $transaction->replicate();
@ -1536,8 +1558,7 @@ class iLinkTransactionController extends Controller
} }
//Verfier les limites reglementaires //Verfier les limites reglementaires
public public function checkReguationsLimits($identifiant, $init_country, $final_country, $montant_transaction, $is_id_document_emetteur = false)
function checkReguationsLimits($identifiant, $init_country, $final_country, $montant_transaction, $is_id_document_emetteur = false)
{ {
$regulation = Regulation::where('id_country', $init_country)->first(); $regulation = Regulation::where('id_country', $init_country)->first();
@ -1582,8 +1603,7 @@ class iLinkTransactionController extends Controller
} }
// Recevoir le traitement d'une transaction venant d'un reseau payeur // Recevoir le traitement d'une transaction venant d'un reseau payeur
public public function receiveRequestProcessingResult(Request $request)
function receiveRequestProcessingResult(Request $request)
{ {
$this->validate($request, [ $this->validate($request, [
'id_transaction' => 'required', 'id_transaction' => 'required',

35
app/Models/Bank.php Normal file
View File

@ -0,0 +1,35 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
/**
* Class Bank
*
* @property int $id
* @property string $nom
*
* @property Collection|BanksCountry[] $banks_countries
*
* @package App\Models
*/
class Bank extends Model
{
protected $table = 'banks';
public $timestamps = false;
protected $fillable = [
'nom'
];
public function banks_countries()
{
return $this->hasMany(BanksCountry::class, 'id_bank');
}
}

View File

@ -0,0 +1,61 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
/**
* Class BanksCountry
*
* @property int $id
* @property int $id_bank
* @property int $id_country
* @property string|null $adresse
* @property string|null $code_banque
* @property bool $status
*
* @property Bank $bank
* @property Country $country
* @property Collection|NetworksBank[] $networks_banks
*
* @package App\Models
*/
class BanksCountry extends Model
{
protected $table = 'banks_countries';
public $timestamps = false;
protected $casts = [
'id_bank' => 'int',
'id_country' => 'int',
'status' => 'bool'
];
protected $fillable = [
'id_bank',
'id_country',
'adresse',
'code_banque',
'status'
];
public function bank()
{
return $this->belongsTo(Bank::class, 'id_bank');
}
public function country()
{
return $this->belongsTo(Country::class, 'id_country');
}
public function networks_banks()
{
return $this->hasMany(NetworksBank::class, 'id_bank_country');
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class NetworksBank
*
* @property int $id
* @property int $id_bank_country
* @property int $id_network
*
* @property BanksCountry $banks_country
* @property Network $network
*
* @package App\Models
*/
class NetworksBank extends Model
{
protected $table = 'networks_banks';
public $timestamps = false;
protected $casts = [
'id_bank_country' => 'int',
'id_network' => 'int'
];
protected $fillable = [
'id_bank_country',
'id_network'
];
public function banks_country()
{
return $this->belongsTo(BanksCountry::class, 'id_bank_country');
}
public function network()
{
return $this->belongsTo(Network::class, 'id_network');
}
}

View File

@ -436,4 +436,46 @@ trait Helper
// return $response->getBody()->getContents(); // return $response->getBody()->getContents();
} }
// Verification du code IBAN
// 0 si code invalide
// 1 si le pays ne correspond pas
// 2 si le code la banque est incorrect
// 3 si tout est ok
public function checkIBAN($iban, $country_code, $bank_code = null)
{
// Normalize input (remove spaces and make upcase)
$iban = strtoupper(str_replace(' ', '', $iban));
if (preg_match('/^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}$/', $iban)) {
$country = substr($iban, 0, 2);
if ($country != $country_code)
return 1;
// $check = intval(substr($iban, 2, 2));
$code_bank = substr($iban, 4, 4);
if ($code_bank != $bank_code)
return 2;
// $account = substr($iban, 4);
// // To numeric representation
// $search = range('A', 'Z');
// foreach (range(10, 35) as $tmp)
// $replace[] = strval($tmp);
// $numstr = str_replace($search, $replace, $account . $country . '00');
//
// // Calculate checksum
// $checksum = intval(substr($numstr, 0, 1));
// for ($pos = 1; $pos < strlen($numstr); $pos++) {
// $checksum *= 10;
// $checksum += intval(substr($numstr, $pos, 1));
// $checksum %= 97;
// }
// return ((98 - $checksum) == $check) ? 3 : 0;
return 3;
} else
return 0;
}
} }

View File

@ -81,12 +81,13 @@ $app->register(\SwaggerLume\ServiceProvider::class);
$app->middleware([ $app->middleware([
App\Http\Middleware\Localization::class, App\Http\Middleware\Localization::class,
App\Http\Middleware\AuthenticateAccess::class
]); ]);
$app->routeMiddleware([ $app->routeMiddleware([
// 'auth' => App\Http\Middleware\Authenticate::class, // 'auth' => App\Http\Middleware\Authenticate::class,
'docs' => App\Http\Middleware\SecureApiDocs::class, 'docs' => App\Http\Middleware\SecureApiDocs::class,
'auth' => App\Http\Middleware\AuthenticateAccess::class
]); ]);
/* /*

View File

@ -75,4 +75,7 @@ Paying network : :network :country',
"transmitter_network_not_configured" => "This transmitter network is not configured in our system", "transmitter_network_not_configured" => "This transmitter network is not configured in our system",
"transmitter_network_not_authorized" => "This sender network is not authorized to receive transactions in our system", "transmitter_network_not_authorized" => "This sender network is not authorized to receive transactions in our system",
"transmitter_network_not_recognized" => 'This network is not recognized as being a sender network of the recipient network', "transmitter_network_not_recognized" => 'This network is not recognized as being a sender network of the recipient network',
"invalid_iban" => "The IBAN code is invalid",
"country_not_match_iban" => "The IBAN code does not correspond to the country of this bank",
"bank_not_match_iban" => "The IBAN code does not correspond to this bank",
]; ];

View File

@ -75,4 +75,7 @@ Réseau payeur : :network :country',
"transmitter_network_not_configured" => "Ce reseau emetteur n'est pas configuré dans notre systeme", "transmitter_network_not_configured" => "Ce reseau emetteur n'est pas configuré dans notre systeme",
"transmitter_network_not_authorized" => "Ce reseau emetteur n'est pas autorisé à recevoir des transactions dans notre systeme", "transmitter_network_not_authorized" => "Ce reseau emetteur n'est pas autorisé à recevoir des transactions dans notre systeme",
"transmitter_network_not_recognized" => "Ce réseau n'est pas reconnu comme etant un réseau emetteur du reseau destinataire", "transmitter_network_not_recognized" => "Ce réseau n'est pas reconnu comme etant un réseau emetteur du reseau destinataire",
"invalid_iban" => "Le code IBAN est invalide",
"country_not_match_iban" => "Le code IBAN ne correspond pas au pays cette banque",
"bank_not_match_iban" => "Le code IBAN ne correspond à cette banque",
]; ];

View File

@ -14,110 +14,113 @@
//$router->get('/', function () use ($router) { //$router->get('/', function () use ($router) {
// return $router->app->version(); // return $router->app->version();
//}); //});
$router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($router) {
// Helper routes // Helper routes
$router->post('receivePayment', 'TransmittingNetworksController@receivePayment'); $router->post('receivePayment', 'TransmittingNetworksController@receivePayment');
$router->post('update_password', 'UserController@updatePassword'); $router->post('update_password', 'UserController@updatePassword');
$router->get('agent_codes/{agent_code}', 'HelperController@agentCodes'); $router->get('agent_codes/{agent_code}', 'HelperController@agentCodes');
$router->get('countries', 'HelperController@countries'); $router->get('countries', 'HelperController@countries');
$router->get('countries/{dial_code}','HelperController@country'); $router->get('countries/{dial_code}', 'HelperController@country');
$router->post('paying_networks','HelperController@paying_networks'); $router->post('paying_networks', 'HelperController@paying_networks');
$router->post('other_paying_networks','HelperController@other_paying_networks'); $router->post('other_paying_networks', 'HelperController@other_paying_networks');
$router->get('init','HelperController@init'); $router->get('init', 'HelperController@init');
// Transactions routes // Transactions routes
$router->group(['prefix' => '/transactions'] , function () use ($router){ $router->group(['prefix' => '/transactions'], function () use ($router) {
$router->post('','TransactionController@add'); $router->post('', 'TransactionController@add');
$router->get('{id_wallet}','TransactionController@lastTransactions'); $router->get('{id_wallet}', 'TransactionController@lastTransactions');
$router->post('commission','TransactionController@calculateCommission'); $router->post('commission', 'TransactionController@calculateCommission');
$router->delete('{id_transaction}','TransactionController@cancel'); $router->delete('{id_transaction}', 'TransactionController@cancel');
// Transactions wallet ilink // Transactions wallet ilink
$router->group(['prefix' => '/ilink'] , function () use ($router){ $router->group(['prefix' => '/ilink'], function () use ($router) {
$router->post('','iLinkTransactionController@add'); $router->post('', 'iLinkTransactionController@add');
$router->post('commission','iLinkTransactionController@calculateCommission'); $router->post('commission', 'iLinkTransactionController@calculateCommission');
$router->get('user/{id_wallet_user}','iLinkTransactionController@lastUserTransactions'); $router->get('user/{id_wallet_user}', 'iLinkTransactionController@lastUserTransactions');
$router->get('agent/{id_wallet_agent}','iLinkTransactionController@lastAgentTransactions'); $router->get('agent/{id_wallet_agent}', 'iLinkTransactionController@lastAgentTransactions');
$router->post('check_retraits','iLinkTransactionController@getTransactionRetrait'); $router->post('check_retraits', 'iLinkTransactionController@getTransactionRetrait');
$router->delete('{id_transaction}', 'iLinkTransactionController@cancel'); $router->delete('{id_transaction}', 'iLinkTransactionController@cancel');
$router->post('receive_request_processing_result', 'iLinkTransactionController@receiveRequestProcessingResult'); $router->post('receive_request_processing_result', 'iLinkTransactionController@receiveRequestProcessingResult');
});
}); });
});
// Credits routes // Credits routes
$router->group(['prefix' => '/credits'] , function () use ($router){ $router->group(['prefix' => '/credits'], function () use ($router) {
$router->put('treatDemand/{id_demand}', 'CreditController@treatDemand'); $router->put('treatDemand/{id_demand}', 'CreditController@treatDemand');
$router->put('cancelDemand/{id_demand}', 'CreditController@cancelDemand'); $router->put('cancelDemand/{id_demand}', 'CreditController@cancelDemand');
}); });
$router->put('/virement/{id_wallet}','CommissionController@virement'); $router->put('/virement/{id_wallet}', 'CommissionController@virement');
// Wallets routes // Wallets routes
$router->group(['prefix' => '/wallets'] , function () use ($router){ $router->group(['prefix' => '/wallets'], function () use ($router) {
$router->get('{id_agent}/activated', 'WalletController@activated'); $router->get('{id_agent}/activated', 'WalletController@activated');
$router->get('{id_wallet}', 'WalletController@show'); $router->get('{id_wallet}', 'WalletController@show');
$router->post('', 'WalletController@create'); $router->post('', 'WalletController@create');
//Les historiques globals des hyperviseur et superviseur //Les historiques globals des hyperviseur et superviseur
$router->get('hyper_history/{id_network}', 'WalletController@hyperHistory'); $router->get('hyper_history/{id_network}', 'WalletController@hyperHistory');
$router->get('super_history/{id_wallet}', 'WalletController@superHistory'); $router->get('super_history/{id_wallet}', 'WalletController@superHistory');
// Routes sans pagination // Routes sans pagination
$router->get('all_hyper_history/{id_network}', 'WalletController@allHyperHistory'); $router->get('all_hyper_history/{id_network}', 'WalletController@allHyperHistory');
$router->get('all_super_history/{id_wallet}', 'WalletController@allSuperHistory'); $router->get('all_super_history/{id_wallet}', 'WalletController@allSuperHistory');
// Wallets users iLink // Wallets users iLink
$router->group(['prefix' => '/users'], function () use ($router) { $router->group(['prefix' => '/users'], function () use ($router) {
$router->get('{id_user}', 'WalletController@showWalletUser'); $router->get('{id_user}', 'WalletController@showWalletUser');
//Liste des banques //Liste des banques
$router->get('banks/{id_wallet_network}', 'WalletController@getWalletBanks'); $router->get('banks/{id_wallet_network}', 'WalletController@getWalletBanks');
});
}); });
});
// Idendification routes // Idendification routes
$router->group(['prefix' => '/identifications'], function () use ($router) { $router->group(['prefix' => '/identifications'], function () use ($router) {
$router->post('', 'UserController@identification'); $router->post('', 'UserController@identification');
$router->put('', 'UserController@updateIdentification'); $router->put('', 'UserController@updateIdentification');
$router->post('{id_identification}', 'UserController@validateIdentification'); $router->post('{id_identification}', 'UserController@validateIdentification');
$router->get('{user_phone}', 'UserController@fetchIdentification'); $router->get('{user_phone}', 'UserController@fetchIdentification');
$router->get('verify/{user_phone}', 'UserController@verifyIdentification'); $router->get('verify/{user_phone}', 'UserController@verifyIdentification');
$router->post('rattach_card/{id_user}', 'UserController@rattachCard'); $router->post('rattach_card/{id_user}', 'UserController@rattachCard');
});
// Users groups routes
$router->group(['prefix' => '/groups'], function () use ($router) {
$router->post('', 'UserGroupController@createGroup');
$router->put('', 'UserGroupController@updateGroup');
$router->post('join', 'UserGroupController@joinGroup');
$router->delete('', 'UserGroupController@deleteGroup');
$router->get('my/{code_user}', 'UserGroupController@myGroup');
$router->get('limits/{code_user}', 'UserGroupController@myGroupLimits');
// Demandes de groupes
$router->group(['prefix' => '/demands'], function () use ($router) {
$router->get('{id_demand}', 'UserGroupController@getGroupDemand');
$router->get('all/{id_user}', 'UserGroupController@getAllGroupDemand');
$router->post('validate', 'UserGroupController@validateGroupDemand');
$router->post('cancel', 'UserGroupController@cancelGroupDemand');
}); });
//Nano credit // Users groups routes
$router->group(['prefix' => '/nanoCredit'], function () use ($router) { $router->group(['prefix' => '/groups'], function () use ($router) {
$router->post('ask', 'NanoCreditController@askNanoCredit'); $router->post('', 'UserGroupController@createGroup');
$router->post('guarantee', 'NanoCreditController@guaranteeCredit'); $router->put('', 'UserGroupController@updateGroup');
$router->post('refund', 'NanoCreditController@refundCredit'); $router->post('join', 'UserGroupController@joinGroup');
$router->post('durations', 'NanoCreditController@getDurations'); $router->delete('', 'UserGroupController@deleteGroup');
$router->get('demands/{id_user}', 'NanoCreditController@getNanoCreditsDemands'); $router->get('my/{code_user}', 'UserGroupController@myGroup');
$router->get('all_demands/{id_user}', 'NanoCreditController@getAllNanoCreditsDemands'); $router->get('limits/{code_user}', 'UserGroupController@myGroupLimits');
$router->get('demands_in_progress/{id_user}', 'NanoCreditController@getNanoCreditsDemandsInProgress');
$router->get('guarantee_demands/{id_wallet_agent}', 'NanoCreditController@getGuaranteeNanoCreditsDemands');
$router->get('details/{id_demand}', 'NanoCreditController@getInfosNanoCredit');
$router->get('accounts/{id_user}', 'NanoCreditController@getNanoCreditAccount');
$router->group(['prefix' => '/savings'], function () use ($router) { // Demandes de groupes
$router->post('make', 'NanoCreditController@makeSavings'); $router->group(['prefix' => '/demands'], function () use ($router) {
$router->post('break', 'NanoCreditController@breakSavings'); $router->get('{id_demand}', 'UserGroupController@getGroupDemand');
$router->get('details/{id_saving}', 'NanoCreditController@getInfosSavings'); $router->get('all/{id_user}', 'UserGroupController@getAllGroupDemand');
$router->get('demands/{id_user}', 'NanoCreditController@getSavingsDemands'); $router->post('validate', 'UserGroupController@validateGroupDemand');
$router->get('demands_in_progress/{id_user}', 'NanoCreditController@getSavingsDemandsInProgress'); $router->post('cancel', 'UserGroupController@cancelGroupDemand');
});
//Nano credit
$router->group(['prefix' => '/nanoCredit'], function () use ($router) {
$router->post('ask', 'NanoCreditController@askNanoCredit');
$router->post('guarantee', 'NanoCreditController@guaranteeCredit');
$router->post('refund', 'NanoCreditController@refundCredit');
$router->post('durations', 'NanoCreditController@getDurations');
$router->get('demands/{id_user}', 'NanoCreditController@getNanoCreditsDemands');
$router->get('all_demands/{id_user}', 'NanoCreditController@getAllNanoCreditsDemands');
$router->get('demands_in_progress/{id_user}', 'NanoCreditController@getNanoCreditsDemandsInProgress');
$router->get('guarantee_demands/{id_wallet_agent}', 'NanoCreditController@getGuaranteeNanoCreditsDemands');
$router->get('details/{id_demand}', 'NanoCreditController@getInfosNanoCredit');
$router->get('accounts/{id_user}', 'NanoCreditController@getNanoCreditAccount');
$router->group(['prefix' => '/savings'], function () use ($router) {
$router->post('make', 'NanoCreditController@makeSavings');
$router->post('break', 'NanoCreditController@breakSavings');
$router->get('details/{id_saving}', 'NanoCreditController@getInfosSavings');
$router->get('demands/{id_user}', 'NanoCreditController@getSavingsDemands');
$router->get('demands_in_progress/{id_user}', 'NanoCreditController@getSavingsDemandsInProgress');
});
}); });
}); });
}); });