+ Fix bug iLink Transaction : Agent - Envoi de cash vers wallet iLink

This commit is contained in:
Djery-Tom 2020-12-05 16:34:10 +01:00
parent 98545f1319
commit a18565658b
1 changed files with 4 additions and 0 deletions

View File

@ -921,6 +921,9 @@ class iLinkTransactionController extends Controller
$this->validate($request, $transaction->cash_wallet_rules());
$agent = AgentPlus::findOrFail($network_agent->agent_id);
if ($this->checkPassword($request->password, $agent->encrypted_password, $agent->salt)) {
if ($request->montant > $walletAgent->balance_princ)
return $this->errorResponse(trans('errors.insufficient_balance'));
$user = User::where('user_code', $request->user_code)->first();
if (!$user)
return $this->errorResponse(trans('errors.wallet_not_defined'));
@ -944,6 +947,7 @@ class iLinkTransactionController extends Controller
$commisionSuper = floatval($frais * $config->taux_com_sup_envoi_cash / 100);
$commisionHyper = floatval($frais * $config->taux_com_hyp_envoi_cash / 100);
$walletAgent->balance_princ -= $transaction->montant;
$walletAgent->balance_com += $commisionAgent;
$transaction->commission_ag = $commisionAgent;
$walletSuperviseur->balance_com += $commisionSuper;