+ Fix fetchIdentification bug
This commit is contained in:
parent
12dc918736
commit
c6ae0cb47a
|
@ -20,7 +20,9 @@ class HelperController extends Controller
|
||||||
|
|
||||||
public function countries()
|
public function countries()
|
||||||
{
|
{
|
||||||
$countries = DB::select('SELECT id , name FROM countries');
|
$countries = DB::select('SELECT id , name , currency_code FROM countries_currencies WHERE id IN (
|
||||||
|
SELECT distinct c.id FROM networks n INNER JOIN countries_currencies c ON n.country_id=c.id INNER JOIN configWallet cw ON cw.id_network = n.id WHERE status = 1
|
||||||
|
)');
|
||||||
return $this->successResponse($countries);
|
return $this->successResponse($countries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,10 +79,11 @@ class UserController extends Controller
|
||||||
return $this->successResponse(trans('messages.validated_identification'));
|
return $this->successResponse(trans('messages.validated_identification'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fetchIdentification($id_user)
|
public function fetchIdentification($user_phone)
|
||||||
{
|
{
|
||||||
// return Identification::where('id_user', $id_user)->firstOrFail();
|
// return Identification::where('id_user', $id_user)->firstOrFail();
|
||||||
$identification = Identification::where('id_user', $id_user)->first();
|
$user = User::where('phone', $user_phone)->firstOrFail();
|
||||||
|
$identification = Identification::where('id_user', $user->id)->first();
|
||||||
$data['isIdentified'] = false;
|
$data['isIdentified'] = false;
|
||||||
$data['isIdentifiedValidated'] = false;
|
$data['isIdentifiedValidated'] = false;
|
||||||
$data['data'] = $identification;
|
$data['data'] = $identification;
|
||||||
|
|
|
@ -143,7 +143,8 @@ class iLinkTransactionController extends Controller
|
||||||
$walletUser->balance += $montantDepot;
|
$walletUser->balance += $montantDepot;
|
||||||
$commisionAgent = floatval($frais * $config->taux_com_ag_envoi_cash / 100);
|
$commisionAgent = floatval($frais * $config->taux_com_ag_envoi_cash / 100);
|
||||||
$commisionSuper = floatval($frais * $config->taux_com_sup_envoi_cash / 100);
|
$commisionSuper = floatval($frais * $config->taux_com_sup_envoi_cash / 100);
|
||||||
$commisionHyper = floatval($frais * $config->taux_com_ag_envoi_cash / 100);
|
$commisionHyper = floatval($frais * $config->taux_com_hyp_envoi_cash / 100);
|
||||||
|
$walletAgent->balance_princ -= $transaction->montant;
|
||||||
$walletAgent->balance_com += $commisionAgent;
|
$walletAgent->balance_com += $commisionAgent;
|
||||||
$transaction->commission_ag = $commisionAgent;
|
$transaction->commission_ag = $commisionAgent;
|
||||||
$walletSuperviseur->balance_com += $commisionSuper;
|
$walletSuperviseur->balance_com += $commisionSuper;
|
||||||
|
@ -215,6 +216,9 @@ 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();
|
||||||
|
$walletAgent->save();
|
||||||
|
$walletSuperviseur->save();
|
||||||
|
$walletHyperviseur->save();
|
||||||
$transaction->save();
|
$transaction->save();
|
||||||
return $this->successResponse(trans('messages.successful_transaction'));
|
return $this->successResponse(trans('messages.successful_transaction'));
|
||||||
|
|
||||||
|
@ -223,7 +227,43 @@ class iLinkTransactionController extends Controller
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 17: // Agent - Envoi de cash vers cash
|
case 17: // Agent - Envoi de cash vers cash
|
||||||
|
$this->validate($request, $transaction->cash_cash_rules());
|
||||||
|
|
||||||
|
$frais = ($request->init_country != $request->final_country)? $this->calculateFees($plr_agent_cash_cash, $request->montant) : $this->calculateFees($plr_agent_cash_cash_national, $request->montant);
|
||||||
|
$taxe = ($request->init_country != $request->final_country) ? $this->calculateTax($taxesInternationales , $frais) : $this->calculateTax($taxesNationales ,$frais);
|
||||||
|
$montantRetrait = $request->montant - $frais - $taxe;
|
||||||
|
$commisionAgent = floatval( $frais * $config->taux_com_ag_envoi_cash / 100) ;
|
||||||
|
$commisionSuper = floatval( $frais * $config->taux_com_sup_envoi_cash / 100) ;
|
||||||
|
$commisionHyper = floatval( $frais * $config->taux_com_hyp_envoi_cash / 100);
|
||||||
|
|
||||||
|
$transaction->montant_retrait = $montantRetrait;
|
||||||
|
$walletAgent->balance_com += $commisionAgent;
|
||||||
|
$transaction->commission_ag = $commisionAgent;
|
||||||
|
$walletSuperviseur->balance_com += $commisionSuper;
|
||||||
|
$transaction->commission_sup = $commisionSuper;
|
||||||
|
$walletHyperviseur->balance_com += $commisionHyper;
|
||||||
|
$transaction->commission_hyp = $commisionHyper;
|
||||||
|
$transaction->id_wallet_ag = $walletAgent->id;
|
||||||
|
$transaction->id_wallet_sup = $walletSuperviseur->id;
|
||||||
|
$transaction->id_wallet_hyp = $walletHyperviseur->id;
|
||||||
|
|
||||||
|
$code_retrait = $this->random_string();
|
||||||
|
$hash = $this->hashSSHA($code_retrait);
|
||||||
|
$transaction->encrypted_code_retrait = $hash['encrypted'];
|
||||||
|
$transaction->code_retrait_salt = $hash['salt'];
|
||||||
|
|
||||||
|
$walletAgent->balance_princ -= $transaction->montant;
|
||||||
|
$transaction->frais = $frais;
|
||||||
|
$transaction->taxe = $taxe;
|
||||||
|
$transaction->date = new \DateTime();
|
||||||
|
$transaction->status_retrait = 0;
|
||||||
|
$walletAgent->save();
|
||||||
|
$walletSuperviseur->save();
|
||||||
|
$walletHyperviseur->save();
|
||||||
|
$transaction->save();
|
||||||
|
$this->sendMail($request->email_emetteur, trans('messages.successful_transaction'), trans('messages.successful_send_cash',['montant'=> $montantRetrait,
|
||||||
|
'code'=> $code_retrait]));
|
||||||
|
return $this->successResponse(trans('messages.successful_transaction'));
|
||||||
break;
|
break;
|
||||||
case 18: // Agent - Envoi de cash vers banque
|
case 18: // Agent - Envoi de cash vers banque
|
||||||
// Indisponible
|
// Indisponible
|
||||||
|
|
|
@ -15,7 +15,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property float $montant
|
* @property float $montant
|
||||||
* @property float $montant_retrait
|
* @property float $montant_retrait
|
||||||
* @property string $code_retrait
|
* @property string $encrypted_code_retrait
|
||||||
|
* @property string $code_retrait_salt
|
||||||
* @property int $status_retrait
|
* @property int $status_retrait
|
||||||
* @property string $id_destinataire
|
* @property string $id_destinataire
|
||||||
* @property string $type_id_destinataire
|
* @property string $type_id_destinataire
|
||||||
|
@ -26,6 +27,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
* @property string $prenom_destinataire
|
* @property string $prenom_destinataire
|
||||||
* @property string $nom_emetteur
|
* @property string $nom_emetteur
|
||||||
* @property string $prenom_emetteur
|
* @property string $prenom_emetteur
|
||||||
|
* @property string $email_emetteur
|
||||||
|
* @property string $type_document_emetteur
|
||||||
|
* @property string $id_type_document_emetteur
|
||||||
* @property float $frais
|
* @property float $frais
|
||||||
* @property float $taxe
|
* @property float $taxe
|
||||||
* @property string $numero_carte
|
* @property string $numero_carte
|
||||||
|
@ -86,7 +90,8 @@ class WalletIlinkTransaction extends Model
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'montant',
|
'montant',
|
||||||
'montant_retrait',
|
'montant_retrait',
|
||||||
'code_retrait',
|
'encrypted_code_retrait',
|
||||||
|
'code_retrait_salt',
|
||||||
'status_retrait',
|
'status_retrait',
|
||||||
'id_destinataire',
|
'id_destinataire',
|
||||||
'type_id_destinataire',
|
'type_id_destinataire',
|
||||||
|
@ -97,6 +102,9 @@ class WalletIlinkTransaction extends Model
|
||||||
'prenom_destinataire',
|
'prenom_destinataire',
|
||||||
'nom_emetteur',
|
'nom_emetteur',
|
||||||
'prenom_emetteur',
|
'prenom_emetteur',
|
||||||
|
'email_emetteur',
|
||||||
|
'type_document_emetteur',
|
||||||
|
'id_type_document_emetteur',
|
||||||
'frais',
|
'frais',
|
||||||
'taxe',
|
'taxe',
|
||||||
'numero_carte',
|
'numero_carte',
|
||||||
|
@ -163,4 +171,22 @@ class WalletIlinkTransaction extends Model
|
||||||
'expiration_date'=>'required_if:facade,front|date_format:m/y|after_or_equal:today',
|
'expiration_date'=>'required_if:facade,front|date_format:m/y|after_or_equal:today',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function cash_cash_rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'init_country' =>'required|integer|min:0|not_in:0',
|
||||||
|
'final_country' =>'required|integer|min:0|not_in:0',
|
||||||
|
'nom_emetteur'=>'required',
|
||||||
|
'prenom_emetteur'=>'required',
|
||||||
|
'email_emetteur'=>'required',
|
||||||
|
'type_document_emetteur'=>'required',
|
||||||
|
'id_document_emetteur'=>'required',
|
||||||
|
'nom_destinataire'=>'required',
|
||||||
|
'prenom_destinataire'=>'required',
|
||||||
|
'type_document_destinataire'=>'required',
|
||||||
|
'id_document_destinataire'=>'required',
|
||||||
|
'montant'=> 'required|numeric|min:0|not_in:0'
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,4 +23,12 @@ trait Helper
|
||||||
$encrypted_password_to_check = base64_encode(sha1($password . $salt, true) . $salt);
|
$encrypted_password_to_check = base64_encode(sha1($password . $salt, true) . $salt);
|
||||||
return $encrypted_password_to_check == $encrypted_password;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,7 @@ Bienvenue dans la famille iLink World !!!
|
||||||
|
|
||||||
Cordialement,
|
Cordialement,
|
||||||
Equipe iLinkWorld.',
|
Equipe iLinkWorld.',
|
||||||
'successful_deposit_ilink' => 'Votre compte ilink a été rechargé d\'un montant de :montant'
|
'successful_deposit_ilink' => 'Votre compte ilink a été rechargé d\'un montant de :montant',
|
||||||
|
'successful_send_cash' => 'Vous avez envoyé une somme de :montant .
|
||||||
|
Code de retrait : :code',
|
||||||
];
|
];
|
||||||
|
|
|
@ -54,7 +54,7 @@ $router->group(['prefix' => '/wallets'] , function () use ($router){
|
||||||
$router->group(['prefix' => '/identifications'] , function () use ($router){
|
$router->group(['prefix' => '/identifications'] , function () use ($router){
|
||||||
$router->post('','UserController@identification');
|
$router->post('','UserController@identification');
|
||||||
$router->post('{id_identification}','UserController@validateIdentification');
|
$router->post('{id_identification}','UserController@validateIdentification');
|
||||||
$router->get('{id_user}','UserController@fetchIdentification');
|
$router->get('{user_phone}','UserController@fetchIdentification');
|
||||||
$router->get('verify/{user_phone}','UserController@verifyIdentification');
|
$router->get('verify/{user_phone}','UserController@verifyIdentification');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue