2020-04-17 15:28:27 +00:00
|
|
|
<?php
|
2020-06-08 18:54:36 +00:00
|
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
2020-06-25 16:57:44 +00:00
|
|
|
|
|
|
|
use Brick\Money\Context\CustomContext;
|
2020-06-25 08:08:10 +00:00
|
|
|
use Brick\Money\CurrencyConverter;
|
|
|
|
use Brick\Money\ExchangeRateProvider\PDOProvider;
|
|
|
|
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
|
|
|
|
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
|
|
|
|
use Brick\Math\RoundingMode;
|
|
|
|
use Brick\Money\Money;
|
2020-06-25 11:05:34 +00:00
|
|
|
use Brick\Money\Context\AutoContext;
|
2020-04-17 15:28:27 +00:00
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: Hanry Nzale
|
|
|
|
* Date: 03/08/2018
|
|
|
|
* Time: 02:03
|
|
|
|
*/
|
|
|
|
class Hyperviseur_dash extends CI_Controller
|
|
|
|
{
|
2020-06-08 18:54:36 +00:00
|
|
|
public function _contruct()
|
|
|
|
{
|
|
|
|
parent::_contruct();
|
|
|
|
$this->load->model('user_model');
|
|
|
|
date_default_timezone_set($this->session->userdata('timezone'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!$this->session->userdata('email')) {
|
|
|
|
$this->session->set_flashdata('error', 'log in first');
|
|
|
|
|
|
|
|
$data['alert'] = "ok";
|
|
|
|
$data['message'] = "Login first!";
|
|
|
|
|
|
|
|
redirect('index.php', $data);
|
|
|
|
} else {
|
|
|
|
$count_d_traite = $this->user_model->getCountDemandeByStatut($this->session->userdata('member_code'), 1);
|
|
|
|
$count_d_no_traite = $this->user_model->getCountDemandeByStatut($this->session->userdata('member_code'), 0);
|
|
|
|
$count_d = $this->user_model->getCountDemande($this->session->userdata('member_code'));
|
|
|
|
|
|
|
|
$data['active'] = "dash";
|
|
|
|
$data['list_geolocated_users'] = $this->user_model->getAllGeolocatedUsersForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['listdem'] = $this->user_model->getDemandes($this->session->userdata('member_code'));
|
|
|
|
$data['allGeo'] = $this->user_model->getAllUserGeoForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['allDem'] = $this->user_model->getDemandes($this->session->userdata('member_code'));
|
|
|
|
$data['token'] = $this->session->userdata('token');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['member_code'] = $this->session->userdata('member_code');
|
|
|
|
$data['phone'] = $this->session->userdata('phone');
|
|
|
|
$data['adresse'] = $this->session->userdata('adresse');
|
|
|
|
$data['category'] = $this->session->userdata('category');
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$data['count_geo'] = $this->user_model->countUserGeoForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['count_sup'] = $this->user_model->countUser("super", 'all', $this->session->userdata('member_code'));
|
|
|
|
$data['count_d_traite'] = $count_d_traite;
|
|
|
|
$data['count_d_no_traite'] = $count_d_no_traite;
|
|
|
|
$data['count_d_users'] = $count_d;
|
|
|
|
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('hyperviseur_dash');
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAllUser_g()
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!$this->session->userdata('email')) {
|
|
|
|
$this->session->set_flashdata('error', 'log in first');
|
|
|
|
|
|
|
|
$data['alert'] = "ok";
|
|
|
|
$data['message'] = "Login first!";
|
|
|
|
|
|
|
|
redirect('index.php', $data);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if ($this->input->post('ville')) {
|
|
|
|
$this->session->set_userdata('current_ville', $this->input->post('ville'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$data['active'] = "geolocated";
|
|
|
|
$data['total_points'] = $this->user_model->getCoutGeolocatedUsersForHyper($this->session->userdata('member_code'), $this->session->userdata('current_ville'));
|
|
|
|
$data['map_title'] = $this->lang->line('utilisateurs géolocalisés à') . " " . $this->session->userdata('current_ville');
|
|
|
|
$data['tab'] = $this->user_model->getUsersGeolocatedByVilleForHyp($this->session->userdata('current_ville'), $this->session->userdata('member_code'));
|
|
|
|
$data['positions'] = $this->user_model->getUsersGeolocatedPositionByVilleForHyp($this->session->userdata('current_ville'), $this->session->userdata('member_code'));
|
|
|
|
$data['latitude'] = $this->session->userdata('latitude');
|
|
|
|
$data['longitude'] = $this->session->userdata('longitude');
|
|
|
|
$data['token'] = $this->session->userdata('token');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['code_parrain'] = $this->session->userdata('code_parrain');
|
|
|
|
$data['phone'] = $this->session->userdata('phone');
|
|
|
|
$data['adresse'] = $this->session->userdata('adresse');
|
|
|
|
$data['category'] = $this->session->userdata('category');
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
|
|
|
$data['alert'] = "";
|
2020-04-17 15:28:27 +00:00
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
|
|
|
$this->load->view('header_hyp', $data);
|
2020-06-08 18:54:36 +00:00
|
|
|
$this->load->view('listeadmin');
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAllSupervisor()
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!$this->session->userdata('email')) {
|
|
|
|
$this->session->set_flashdata('error', 'log in first');
|
|
|
|
|
|
|
|
$data['alert'] = "ok";
|
|
|
|
$data['message'] = "Login first!";
|
|
|
|
|
|
|
|
|
|
|
|
redirect('index.php', $data);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
/*$this->db->select('*');
|
|
|
|
$this->db->from('users');
|
|
|
|
$this->db->where('category','super');
|
|
|
|
$this->db->where('network',$this->session->userdata('network'));
|
|
|
|
$this->db->where('code_parrain',$this->session->userdata('code_parrain'));*/
|
|
|
|
$query = $this->user_model->getSupervisorsForHyp($this->session->userdata('member_code'));
|
|
|
|
|
|
|
|
$network = $this->session->userdata('network');
|
|
|
|
$category = 'super';
|
|
|
|
$position = $this->user_model->getAllpositions($network, $category, $this->session->userdata('member_code'));
|
|
|
|
if ($position != null) {
|
|
|
|
//var_dump($position);
|
|
|
|
//echo json_encode($position);
|
|
|
|
}
|
|
|
|
$data['total_points'] = $this->user_model->getCoutSuperForHyper($this->session->userdata('member_code'));
|
|
|
|
$data['positions'] = $position;
|
|
|
|
$data['active'] = "super";
|
|
|
|
$data['map_title'] = $this->lang->line('Superviseurs');
|
|
|
|
$data['tab'] = $query;
|
|
|
|
$data['latitude'] = $this->session->userdata('latitude');
|
|
|
|
$data['longitude'] = $this->session->userdata('longitude');
|
|
|
|
$data['token'] = $this->session->userdata('token');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['code_parrain'] = $this->session->userdata('code_parrain');
|
|
|
|
$data['phone'] = $this->session->userdata('phone');
|
|
|
|
$data['adresse'] = $this->session->userdata('adresse');
|
|
|
|
$data['category'] = $this->session->userdata('category');
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
|
|
|
$data['alert'] = "";
|
2020-04-17 15:28:27 +00:00
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
|
|
|
$this->load->view('header_hyp', $data);
|
2020-06-08 18:54:36 +00:00
|
|
|
$this->load->view('listeadmin');
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAllSupervisorPositions()
|
|
|
|
{
|
|
|
|
if (!$this->session->userdata('email')) {
|
|
|
|
$this->session->set_flashdata('error', 'log in first');
|
|
|
|
|
|
|
|
$data['alert'] = "ok";
|
|
|
|
$data['message'] = "Login first!";
|
|
|
|
|
|
|
|
|
|
|
|
redirect('index.php', $data);
|
|
|
|
} else {
|
|
|
|
$network = $this->session->userdata('network');
|
|
|
|
$category = 'super';
|
|
|
|
|
|
|
|
$position = $this->user_model->getAllpositions($network, $category, $this->session->userdata('member_code'));
|
|
|
|
if ($position != null) {
|
|
|
|
return $position;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDemandes()
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!$this->session->userdata('email')) {
|
|
|
|
$this->session->set_flashdata('error', 'log in first');
|
|
|
|
$data['alert'] = "ok";
|
|
|
|
$data['message'] = "Login first!";
|
|
|
|
$this->load->view('login', $data);
|
|
|
|
} else {
|
2020-08-04 08:08:30 +00:00
|
|
|
|
|
|
|
$debut = $this->input->get("d");
|
|
|
|
$fin = $this->input->get("f");
|
|
|
|
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
|
|
|
$data['debut'] = $debut ? date($format, strtotime($debut)) : null;
|
|
|
|
$data['fin'] = $fin ? date($format, strtotime($fin)) : null;
|
|
|
|
$fin = Date('Y-m-d', strtotime($fin . "+1 day"));
|
|
|
|
|
|
|
|
$ville = $this->session->userdata('ville');
|
|
|
|
$data['active'] = "demandes";
|
|
|
|
$data['type'] = 'incoming';
|
|
|
|
$data['demand_type'] = 'credit';
|
|
|
|
$data['alert'] = "";
|
|
|
|
$data['token'] = $this->session->userdata('token');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['code_parrain'] = $this->session->userdata('code_parrain');
|
|
|
|
$data['phone'] = $this->session->userdata('phone');
|
|
|
|
$data['adresse'] = $this->session->userdata('adresse');
|
|
|
|
$data['category'] = $this->session->userdata('category');
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['tab_fastDemande'] = $this->user_model->getRangeASCDemandesByNetwork($debut, $fin, $this->session->userdata('member_code'), $this->session->userdata('current_demande_ville'));
|
|
|
|
$data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesByNetwork($debut, $fin, $this->session->userdata('member_code'), $this->session->userdata('current_demande_ville'));
|
|
|
|
$data['list'] = $this->user_model->getDemandesBySuper($debut, $fin, $this->session->userdata('member_code'));
|
|
|
|
$data['temp_moyen'] = $this->user_model->getTempsMoyenByVille($this->session->userdata('member_code'), $this->session->userdata('network'));
|
|
|
|
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('demande_credit');
|
|
|
|
$this->load->view('footer');
|
|
|
|
|
2020-04-24 10:40:34 +00:00
|
|
|
}
|
2020-06-08 18:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function addvilles()
|
|
|
|
{
|
|
|
|
$id = 1;
|
|
|
|
$date = "2018-08-29";
|
|
|
|
for ($i = 1; $i <= 267; $i++) {
|
|
|
|
$newdate = date("Y-m-d", strtotime($date . " + 1 day + 1 hour"));
|
|
|
|
$data = array(
|
|
|
|
'dateAjout' => $date,
|
|
|
|
'dateModif' => $newdate,
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
$newdate = date("Y-m-d", strtotime($date . " + 1 day + 3 hour"));
|
|
|
|
$date = $newdate;
|
|
|
|
|
|
|
|
$this->db->update('demande_superviseur', $data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDemandesAd()
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!$this->session->userdata('email')) {
|
|
|
|
$this->session->set_flashdata('error', 'log in first');
|
|
|
|
$data['alert'] = "ok";
|
|
|
|
$data['message'] = "Login first!";
|
|
|
|
$this->load->view('login', $data);
|
|
|
|
} else {
|
|
|
|
$network = $this->session->userdata('network');
|
2020-04-28 22:23:15 +00:00
|
|
|
$debut = $this->input->get("d");
|
|
|
|
$fin = $this->input->get("f");
|
2020-06-08 18:54:36 +00:00
|
|
|
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
|
|
|
$data['debut'] = $debut ? date($format, strtotime($debut)) : null;
|
|
|
|
$data['fin'] = $fin ? date($format, strtotime($fin)) : null;
|
2020-04-28 22:23:15 +00:00
|
|
|
$data['demand_type'] = 'adhesion';
|
2020-06-08 18:54:36 +00:00
|
|
|
$data['active'] = "demandesAd";
|
|
|
|
$data['alert'] = "";
|
|
|
|
$data['token'] = $this->session->userdata('token');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['code_parrain'] = $this->session->userdata('code_parrain');
|
|
|
|
$data['phone'] = $this->session->userdata('phone');
|
|
|
|
$data['adresse'] = $this->session->userdata('adresse');
|
|
|
|
$data['category'] = $this->session->userdata('category');
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['tab_fastDemande'] = $this->user_model->getRangeASCDemandesAd($debut, $fin, $this->session->userdata('member_code'));
|
|
|
|
$data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesAd($debut, $fin, $this->session->userdata('member_code'));
|
|
|
|
$data['temp_moyen'] = $this->user_model->getTempsMoyenAd($debut, $fin, $this->session->userdata('member_code'));
|
|
|
|
$data['list'] = $this->user_model->getDemandesAdForSuper($debut, $fin, $this->session->userdata('member_code'));
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
|
|
|
$data['type'] = $this->lang->line('Adhésion');
|
2020-04-17 15:28:27 +00:00
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
|
|
|
$this->load->view('header_hyp', $data);
|
2020-06-08 18:54:36 +00:00
|
|
|
$this->load->view('demande_adhesion');
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Wallet
|
|
|
|
public function wallet()
|
|
|
|
{
|
|
|
|
if (!$this->session->userdata('email')) {
|
|
|
|
$this->session->set_flashdata('error', 'log in first');
|
|
|
|
|
|
|
|
$data['alert'] = "ok";
|
|
|
|
$data['message'] = "Login first!";
|
|
|
|
$this->load->view('login', $data);
|
|
|
|
} else {
|
2020-05-05 08:25:12 +00:00
|
|
|
$id_network = $this->session->userdata('network_id');
|
2020-06-01 11:21:06 +00:00
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
|
|
|
if ($data['hasWallet']) {
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
if ($this->input->get('history')) {
|
|
|
|
$this->historique($id_network, $this->input->get('d'), $this->input->get('f'), $this->input->get('history'));
|
2020-06-22 11:39:55 +00:00
|
|
|
} elseif ($this->input->get('config')) {
|
|
|
|
$this->config_wallet($this->input->get('config'), $this->input->get('country'));
|
2020-06-23 15:49:59 +00:00
|
|
|
} elseif ($this->input->get('show')) {
|
|
|
|
$this->show_config_infos($this->input->get('show'));
|
2020-06-22 11:39:55 +00:00
|
|
|
}else {
|
2020-06-25 19:27:43 +00:00
|
|
|
$context = new AutoContext();
|
2020-06-01 11:21:06 +00:00
|
|
|
|
|
|
|
$data["commission"] = "";
|
|
|
|
$data["principal"] = "";
|
|
|
|
$data["transactions"] = "";
|
|
|
|
$agent_id = $this->session->userdata('agent_id');
|
|
|
|
|
2020-04-17 15:28:27 +00:00
|
|
|
|
2020-05-05 08:25:12 +00:00
|
|
|
$taux = $data['hasWallet']->first_row();
|
2020-06-01 11:21:06 +00:00
|
|
|
$data['idConfig'] = $taux->id;
|
2020-06-08 18:54:36 +00:00
|
|
|
if ($data['hasWallet']->first_row()->type == 'visa') {
|
2020-06-01 11:21:06 +00:00
|
|
|
$data['taux_client_r'] = $taux->taux_com_client_retrait;
|
|
|
|
$data['taux_client_d'] = $taux->taux_com_client_depot;
|
|
|
|
$data['taux_ag_r'] = $taux->taux_com_ag_retrait;
|
|
|
|
$data['taux_ag_d'] = $taux->taux_com_ag_depot;
|
|
|
|
$data['taux_sup_r'] = $taux->taux_com_sup_retrait;
|
|
|
|
$data['taux_sup_d'] = $taux->taux_com_sup_depot;
|
|
|
|
$data['taux_bq_d'] = $taux->part_banque_depot;
|
|
|
|
$data['taux_bq_r'] = $taux->part_banque_retrait;
|
|
|
|
$data['frais_d'] = $taux->frais_min_banque_depot;
|
2020-06-24 12:06:52 +00:00
|
|
|
|
|
|
|
$agents_g = $this->user_model->getAllGeolocatedUsersForHyp($this->session->userdata('member_code'));
|
|
|
|
|
|
|
|
//Fetch all transactions of any geolocated agent of the network
|
|
|
|
$data["transactions"] = array();
|
|
|
|
$totalCommissionBanque = 0;
|
|
|
|
if ($agents_g) {
|
|
|
|
foreach ($agents_g->result() as $row) {
|
|
|
|
$wallet = $this->user_model->getWallet($row->agent_id);
|
|
|
|
if ($wallet) {
|
|
|
|
$transactions = $this->user_model->getAgentTransactions($wallet->first_row()->wallet_id);
|
|
|
|
if ($transactions) {
|
|
|
|
foreach ($transactions->result() as $trans) {
|
|
|
|
$totalCommissionBanque += $trans->commission_banque;
|
|
|
|
$trans->code_parrain = $row->code_parrain; // Add code parrain to transaction
|
|
|
|
array_push($data['transactions'], $trans);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$data["totalCommissionBanque"] = $totalCommissionBanque;
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
} elseif ($data['hasWallet']->first_row()->type == 'ilink') {
|
2020-06-13 14:47:09 +00:00
|
|
|
|
2020-06-24 12:06:52 +00:00
|
|
|
$transactions = $this->user_model->getNetworkIlinTransactions($id_network);
|
|
|
|
$data["transactions"] = array();
|
|
|
|
$totalCommissionBanque = 0;
|
|
|
|
if ($transactions) {
|
|
|
|
foreach ($transactions->result() as $trans) {
|
|
|
|
$totalCommissionBanque += $trans->commission_banque;
|
|
|
|
array_push($data['transactions'], $trans);
|
|
|
|
}
|
|
|
|
}
|
2020-06-25 16:57:44 +00:00
|
|
|
$data["totalCommissionBanque"] = Money::of(round($totalCommissionBanque,2), $this->session->userdata('currency_code'), $context )->formatTo('fr_FR');
|
2020-06-24 12:06:52 +00:00
|
|
|
|
2020-06-01 11:21:06 +00:00
|
|
|
}
|
2020-05-05 08:25:12 +00:00
|
|
|
|
|
|
|
//Create wallet if it not exist
|
|
|
|
$res = $this->user_model->getWallet($agent_id);
|
|
|
|
if ($res == false) {
|
|
|
|
$this->user_model->addWallet($agent_id);
|
|
|
|
$res = $this->user_model->getWallet($agent_id);
|
2020-04-19 08:51:28 +00:00
|
|
|
}
|
|
|
|
|
2020-04-17 15:28:27 +00:00
|
|
|
$row = $res->first_row();
|
2020-08-10 18:11:05 +00:00
|
|
|
$data["commission"] = Money::of(round($row->balance_com, 2), $this->session->userdata('currency_code'), $context)->formatTo('fr_FR');
|
|
|
|
$data["principal"] = Money::of(round($row->balance_princ, 2), $this->session->userdata('currency_code'), $context)->formatTo('fr_FR');
|
2020-05-05 08:25:12 +00:00
|
|
|
$data['wallet_id'] = $row->wallet_id;
|
2020-06-25 08:08:10 +00:00
|
|
|
$data['curreny_code'] = $this->session->userdata('currency_code');
|
2020-06-24 12:06:52 +00:00
|
|
|
|
2020-05-05 08:25:12 +00:00
|
|
|
|
2020-06-01 11:21:06 +00:00
|
|
|
$res = $this->user_model->getWalletPassword($id_network);
|
|
|
|
$data['walletPassword'] = $res ? $res->first_row() : null;
|
|
|
|
$data['alert'] = "";
|
2020-08-10 18:11:05 +00:00
|
|
|
$data['active'] = "wallet_wallet";
|
2020-06-01 11:21:06 +00:00
|
|
|
$data['token'] = $this->session->userdata('token');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['code_parrain'] = $this->session->userdata('code_parrain');
|
|
|
|
$data['phone'] = $this->session->userdata('phone');
|
|
|
|
$data['adresse'] = $this->session->userdata('adresse');
|
|
|
|
$data['category'] = $this->session->userdata('category');
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['network_id'] = $id_network;
|
|
|
|
$data['country'] = $this->session->userdata('current_pays');
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['pays'] = $this->user_model->getAllGameCountries();
|
|
|
|
$data['networks'] = $this->user_model->getActiveNetwork();
|
|
|
|
$data['agentWalletInfos'] = $this->user_model->getInfosWalletAgentForHyper($id_network);
|
|
|
|
$this->load->view('header_hyp', $data);
|
2020-06-05 16:53:04 +00:00
|
|
|
if ($data['hasWallet']->first_row()->type == 'visa')
|
2020-06-01 11:21:06 +00:00
|
|
|
$this->load->view('gestion_wallet_hyp');
|
|
|
|
elseif ($data['hasWallet']->first_row()->type == 'ilink')
|
|
|
|
$this->load->view('gestion_wallet_ilink_hyp');
|
|
|
|
$this->load->view('footer');
|
2020-06-08 18:54:36 +00:00
|
|
|
}
|
2020-06-01 11:21:06 +00:00
|
|
|
}
|
2020-06-08 18:54:36 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-05 08:25:12 +00:00
|
|
|
|
|
|
|
private function isLogged()
|
|
|
|
{
|
|
|
|
if (!$this->session->userdata('email')) {
|
|
|
|
$this->session->set_flashdata('error', 'log in first');
|
|
|
|
|
|
|
|
$data['alert'] = "ok";
|
|
|
|
$data['message'] = "Login first!";
|
|
|
|
$this->load->view('login', $data);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
private function historique($network_id, $startDate, $endDate, $type)
|
2020-05-05 08:25:12 +00:00
|
|
|
{
|
2020-08-27 09:37:45 +00:00
|
|
|
// $data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
2020-06-08 18:54:36 +00:00
|
|
|
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
|
|
|
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
|
|
|
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
|
|
|
$endDate = Date('Y-m-d', strtotime($endDate . "+1 day"));
|
|
|
|
if ($type == 'transaction')
|
|
|
|
$data['transactions'] = $this->user_model->getTransactions($startDate, $endDate, $network_id);
|
2020-07-29 17:50:46 +00:00
|
|
|
else if ($type == 'transaction_ilink') {
|
|
|
|
$networkDetails = $this->user_model->getNetworkDetails($network_id);
|
|
|
|
$data['currency_name_fr'] = $networkDetails->first_row()->currency_name_fr;
|
|
|
|
$data['currency_name_en'] = $networkDetails->first_row()->currency_name_en;
|
2020-06-24 12:06:52 +00:00
|
|
|
$data['transactions'] = $this->user_model->getIlinkTransactions($startDate, $endDate, $network_id);
|
2020-07-29 17:50:46 +00:00
|
|
|
} else if ($type == 'commission_transfer')
|
2020-07-10 18:19:15 +00:00
|
|
|
$data['transactions'] = $this->user_model->getCommissionTransfers($startDate, $endDate, $this->session->userdata('member_code'));
|
|
|
|
else if ($type == 'balance_statement')
|
|
|
|
$data['wallets'] = $this->user_model->getInfosWalletAgentForHyper($this->session->userdata('network_id'));
|
2020-07-25 18:09:43 +00:00
|
|
|
else if ($type == 'refund_history')
|
|
|
|
$data['refunds'] = $this->user_model->getRefunds($startDate, $endDate, $network_id);
|
2020-05-05 08:25:12 +00:00
|
|
|
else
|
2020-06-08 18:54:36 +00:00
|
|
|
$data['transactions'] = $this->user_model->getRecharges($startDate, $endDate, $network_id);
|
2020-05-05 08:25:12 +00:00
|
|
|
|
2020-08-27 09:37:45 +00:00
|
|
|
$data['active'] = "wallet_wallet";
|
2020-05-05 08:25:12 +00:00
|
|
|
$data['alert'] = "";
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$data['networks'] = $this->user_model->getActiveNetwork();
|
|
|
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
2020-06-08 18:54:36 +00:00
|
|
|
$data['country'] = $this->session->userdata('current_pays');
|
2020-05-05 08:25:12 +00:00
|
|
|
$data['category'] = $this->session->userdata('category');
|
|
|
|
|
|
|
|
$this->load->view('header_hyp', $data);
|
2020-06-08 18:54:36 +00:00
|
|
|
if ($type == 'transaction')
|
2020-05-05 08:25:12 +00:00
|
|
|
$this->load->view('historique_transactions');
|
2020-06-24 12:06:52 +00:00
|
|
|
else if ($type == 'transaction_ilink')
|
|
|
|
$this->load->view('historique_transactions_ilink');
|
2020-07-10 18:19:15 +00:00
|
|
|
else if ($type == 'commission_transfer')
|
|
|
|
$this->load->view('historique_transferts_commission');
|
|
|
|
else if ($type == 'balance_statement')
|
|
|
|
$this->load->view('config_wallet_ilink_hyp/etat_soldes');
|
2020-07-25 18:09:43 +00:00
|
|
|
else if ($type == 'refund_history')
|
|
|
|
$this->load->view('historique_remboursement');
|
2020-05-05 08:25:12 +00:00
|
|
|
else
|
|
|
|
$this->load->view('historique_recharges');
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
public function walletPassword()
|
|
|
|
{
|
|
|
|
if ($this->isLogged()) {
|
2020-05-05 08:25:12 +00:00
|
|
|
$data['active'] = "wallet_password";
|
|
|
|
$data['alert'] = "";
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$data['networks'] = $this->user_model->getActiveNetwork();
|
|
|
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
2020-06-08 18:54:36 +00:00
|
|
|
$data['country'] = $this->session->userdata('current_pays');
|
2020-05-05 08:25:12 +00:00
|
|
|
$data['network_id'] = $this->session->userdata('network_id');
|
|
|
|
$res = $this->user_model->getWalletPassword($this->session->userdata('network_id'));
|
|
|
|
$data['walletPassword'] = $res ? $res->first_row() : null;
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('wallet_password');
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
public function generate_wallet_password()
|
|
|
|
{
|
|
|
|
if ($this->isLogged()) {
|
2020-05-05 08:25:12 +00:00
|
|
|
if (isset($_POST)) {
|
|
|
|
$network_id = isset($_POST['network_id']) ? $_POST['network_id'] : null;
|
|
|
|
$email = $_POST['email'];
|
|
|
|
// $size = $_POST['size'];
|
2020-06-08 18:54:36 +00:00
|
|
|
$wallet_password_id = isset($_POST['wallet_password_id']) ? $_POST['wallet_password_id'] : null;
|
2020-05-05 08:25:12 +00:00
|
|
|
$network = $_POST['network'];
|
|
|
|
$country = $_POST['country'];
|
|
|
|
|
|
|
|
$password = $this->generate_string();
|
2020-06-08 18:54:36 +00:00
|
|
|
$hash = $this->hashSSHA($password);
|
|
|
|
$encrypted_password = $hash['encrypted'];
|
|
|
|
$salt = $hash['salt'];
|
2020-05-05 08:25:12 +00:00
|
|
|
|
|
|
|
$this->load->library('email');
|
|
|
|
$this->email->from('noreply@ilink-app.com', 'iLink World');
|
|
|
|
$this->email->to($email);
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
$this->email->subject($this->lang->line('wallet_password') . ' ' . $network . ' - ' . $country);
|
|
|
|
$this->email->message($this->lang->line('mot de passe') . ' : ' . $password);
|
2020-05-05 08:25:12 +00:00
|
|
|
|
|
|
|
if ($this->email->send()) {
|
2020-06-08 18:54:36 +00:00
|
|
|
if ($wallet_password_id == null)
|
|
|
|
$this->user_model->addWalletPassword($network_id, $encrypted_password, $salt, $email);
|
2020-05-05 08:25:12 +00:00
|
|
|
else
|
2020-06-08 18:54:36 +00:00
|
|
|
$this->user_model->updateWalletPassword($wallet_password_id, $encrypted_password, $salt, $email);
|
2020-05-05 08:25:12 +00:00
|
|
|
$res = true;
|
|
|
|
} else {
|
|
|
|
// show_error($this->email->print_debugger());
|
|
|
|
$res = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($res) {
|
|
|
|
echo json_encode("200");
|
|
|
|
} else {
|
|
|
|
echo json_encode("500");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
private function generate_string($length = 10)
|
|
|
|
{
|
|
|
|
$chars = 'abcdefghjkmnpqrstuvwxyz' .
|
2020-05-05 08:25:12 +00:00
|
|
|
'23456789';
|
|
|
|
|
|
|
|
$str = '';
|
|
|
|
$max = strlen($chars) - 1;
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
for ($i = 0; $i < $length; $i++)
|
2020-05-05 08:25:12 +00:00
|
|
|
$str .= $chars[mt_rand(0, $max)];
|
|
|
|
|
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
private function hashSSHA($password)
|
|
|
|
{
|
2020-05-05 08:25:12 +00:00
|
|
|
$salt = sha1(rand());
|
|
|
|
$salt = substr($salt, 0, 10);
|
|
|
|
$encrypted = base64_encode(sha1($password . $salt, true) . $salt);
|
|
|
|
$hash = array("salt" => $salt, "encrypted" => $encrypted);
|
|
|
|
return $hash;
|
|
|
|
}
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
public function resetWalletPassword()
|
|
|
|
{
|
|
|
|
if ($this->isLogged()) {
|
2020-05-05 08:25:12 +00:00
|
|
|
if (isset($_POST)) {
|
|
|
|
$email = $_POST['email'];
|
2020-06-08 18:54:36 +00:00
|
|
|
$wallet_password_id = isset($_POST['wallet_password_id']) ? $_POST['wallet_password_id'] : null;
|
2020-05-05 08:25:12 +00:00
|
|
|
$network = $_POST['network'];
|
|
|
|
$country = $_POST['country'];
|
|
|
|
|
|
|
|
$password = $this->generate_string();
|
2020-06-08 18:54:36 +00:00
|
|
|
$hash = $this->hashSSHA($password);
|
|
|
|
$encrypted_password = $hash['encrypted'];
|
|
|
|
$salt = $hash['salt'];
|
2020-05-05 08:25:12 +00:00
|
|
|
|
|
|
|
$this->load->library('email');
|
|
|
|
$this->email->from('noreply@ilink-app.com', 'iLink World');
|
|
|
|
$this->email->to($email);
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
$this->email->subject($this->lang->line('reset_wallet_password') . ' ' . $network . ' - ' . $country);
|
|
|
|
$this->email->message($this->lang->line('mot de passe') . ' : ' . $password);
|
2020-05-05 08:25:12 +00:00
|
|
|
|
|
|
|
if ($this->email->send()) {
|
2020-07-25 18:09:43 +00:00
|
|
|
$this->user_model->updateWalletPassword($wallet_password_id, $encrypted_password, $salt);
|
2020-05-05 08:25:12 +00:00
|
|
|
$res = true;
|
|
|
|
} else {
|
|
|
|
// show_error($this->email->print_debugger());
|
|
|
|
$res = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($res) {
|
|
|
|
echo json_encode("200");
|
|
|
|
} else {
|
|
|
|
echo json_encode("500");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
public function recharge_wallet()
|
|
|
|
{
|
|
|
|
if ($this->isLogged()) {
|
2020-05-05 08:25:12 +00:00
|
|
|
if (isset($_POST)) {
|
|
|
|
$password = $_POST['password'];
|
|
|
|
$wallet_id = $_POST['wallet_id'];
|
2020-06-08 18:54:36 +00:00
|
|
|
$salt = $_POST['salt'];
|
2020-05-05 08:25:12 +00:00
|
|
|
$encrypted_password = $_POST['encrypted_password'];
|
|
|
|
$montant = $_POST['montant'];
|
|
|
|
|
|
|
|
$hash = base64_encode(sha1($password . $salt, true) . $salt);
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
if ($encrypted_password == $hash) {
|
|
|
|
$this->user_model->updateWalletBalance($montant, $wallet_id);
|
|
|
|
$res = $this->user_model->addWalletRecharge($montant, $wallet_id);
|
|
|
|
$code = $res ? '200' : '500';
|
|
|
|
} else {
|
2020-05-05 08:25:12 +00:00
|
|
|
$code = '400';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo json_encode($code);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-25 18:09:43 +00:00
|
|
|
public function rembourser_compensation()
|
|
|
|
{
|
|
|
|
if ($this->isLogged()) {
|
|
|
|
if (isset($_POST)) {
|
|
|
|
$password = $_POST['password'];
|
|
|
|
$id_config = $_POST['id_config'];
|
|
|
|
$id_network = $_POST['id_network'];
|
|
|
|
$salt = $_POST['salt'];
|
|
|
|
$encrypted_password = $_POST['encrypted_password'];
|
|
|
|
$montant = $_POST['montant'];
|
|
|
|
|
|
|
|
$hash = base64_encode(sha1($password . $salt, true) . $salt);
|
|
|
|
|
|
|
|
if ($encrypted_password == $hash) {
|
|
|
|
$res = $this->user_model->insertRembourssementCompensation($montant, $id_network, $id_config);
|
|
|
|
$code = $res ? '200' : '401';
|
|
|
|
} else {
|
|
|
|
$code = '400';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo json_encode($code);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
public function calculator()
|
|
|
|
{
|
|
|
|
if ($this->isLogged()) {
|
2020-08-10 18:11:05 +00:00
|
|
|
$data['active'] = "wallet_calculator";
|
2020-06-05 16:53:04 +00:00
|
|
|
$data['alert'] = "";
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$data['networks'] = $this->user_model->getActiveNetwork();
|
|
|
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
|
|
|
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
2020-06-08 18:54:36 +00:00
|
|
|
$data['country'] = $this->session->userdata('current_pays');
|
2020-06-05 16:53:04 +00:00
|
|
|
$data['network_id'] = $this->session->userdata('network_id');
|
|
|
|
$data['countries'] = $this->user_model->getWalletsCountries();
|
2020-06-18 09:07:18 +00:00
|
|
|
$showResult = false;
|
|
|
|
$frais = 0;
|
|
|
|
$taxe = 0;
|
|
|
|
$config = $data['hasWallet']->first_row();
|
|
|
|
|
|
|
|
//Simulateur
|
|
|
|
$com_ag = $this->session->userdata('com_ag') ? $this->session->userdata('com_ag') : 0 ;
|
|
|
|
$com_sup = $this->session->userdata('com_sup') ? $this->session->userdata('com_sup') : 0 ;
|
|
|
|
$com_hyp = $this->session->userdata('com_hyp') ? $this->session->userdata('com_hyp') : 0 ;
|
|
|
|
$com_bq = $this->session->userdata('com_bq') ? $this->session->userdata('com_bq') : 0 ;
|
|
|
|
// $frais_retrait = $this->session->userdata('frais_retrait') ? $this->session->userdata('frais_retrait') : 0 ;
|
|
|
|
|
|
|
|
if (isset($_POST)) {
|
|
|
|
$operation = $this->input->post('operation');
|
|
|
|
$montant = $this->input->post('montant');
|
|
|
|
$init_country = $this->input->post('init_country');
|
|
|
|
$final_country = $this->input->post('final_country');
|
|
|
|
$save = $this->input->post('save');
|
|
|
|
$code = $this->input->post('code');
|
|
|
|
|
|
|
|
|
|
|
|
$taxes = $this->user_model->getTaxes($data['idConfig']);
|
|
|
|
|
|
|
|
$plr_user_wallet_wallet = $this->user_model->getPalierConfigWallet("user_wallet_wallet_international", $data['idConfig']);
|
|
|
|
$plr_user_wallet_cash = $this->user_model->getPalierConfigWallet("user_wallet_cash_international", $data['idConfig']);
|
|
|
|
$plr_agent_depot_wallet_ilink = $this->user_model->getPalierConfigWallet("agent_depot_wallet_ilink_international" , $data['idConfig']);
|
|
|
|
$plr_agent_depot_autre_wallet = $this->user_model->getPalierConfigWallet("agent_depot_autre_wallet_international" , $data['idConfig']);
|
|
|
|
$plr_agent_cash_cash = $this->user_model->getPalierConfigWallet("agent_cash_cash_international", $data['idConfig']);
|
|
|
|
|
|
|
|
$plr_user_wallet_wallet_national= $this->user_model->getPalierConfigWallet("user_wallet_wallet_national", $data['idConfig']);
|
|
|
|
$plr_user_wallet_cash_national = $this->user_model->getPalierConfigWallet("user_wallet_cash_national", $data['idConfig']);
|
|
|
|
$plr_agent_depot_wallet_ilink_national = $this->user_model->getPalierConfigWallet("agent_depot_wallet_ilink_national" , $data['idConfig']);
|
|
|
|
$plr_agent_depot_autre_wallet_national = $this->user_model->getPalierConfigWallet("agent_depot_autre_wallet_national" , $data['idConfig']);
|
|
|
|
$plr_agent_cash_cash_national = $this->user_model->getPalierConfigWallet("agent_cash_cash_national", $data['idConfig']);
|
|
|
|
|
|
|
|
$plr_user_wallet_wallet = $plr_user_wallet_wallet ? $plr_user_wallet_wallet->result() : [];
|
|
|
|
$plr_user_wallet_cash = $plr_user_wallet_cash ? $plr_user_wallet_cash->result() : [];
|
|
|
|
$plr_agent_depot_wallet_ilink = $plr_agent_depot_wallet_ilink ? $plr_agent_depot_wallet_ilink->result() : [];
|
|
|
|
$plr_agent_depot_autre_wallet = $plr_agent_depot_autre_wallet ? $plr_agent_depot_autre_wallet->result() : [];
|
|
|
|
$plr_agent_cash_cash = $plr_agent_cash_cash ? $plr_agent_cash_cash->result() : [];
|
|
|
|
|
|
|
|
$plr_user_wallet_wallet_national = $plr_user_wallet_wallet_national ? $plr_user_wallet_wallet_national->result() : [];
|
|
|
|
$plr_user_wallet_cash_national = $plr_user_wallet_cash_national ? $plr_user_wallet_cash_national->result() : [];
|
|
|
|
$plr_agent_depot_wallet_ilink_national = $plr_agent_depot_wallet_ilink_national ? $plr_agent_depot_wallet_ilink_national->result() : [];
|
|
|
|
$plr_agent_depot_autre_wallet_national = $plr_agent_depot_autre_wallet_national ? $plr_agent_depot_autre_wallet_national->result() : [];
|
|
|
|
$plr_agent_cash_cash_national = $plr_agent_cash_cash_national ? $plr_agent_cash_cash_national->result() : [];
|
|
|
|
|
|
|
|
$taxes = $taxes ? $taxes->result() : [];
|
|
|
|
$taxesNationales = array_filter($taxes, function ($tax) {
|
|
|
|
return $tax->destination == 'national';
|
|
|
|
});
|
|
|
|
|
|
|
|
$taxesInternationales = array_filter($taxes, function ($tax) {
|
|
|
|
return $tax->destination == 'international';
|
|
|
|
});
|
|
|
|
|
|
|
|
if (isset($save)) {
|
|
|
|
$showResult = true;
|
|
|
|
switch ($operation) {
|
|
|
|
case 1: //Envoi wallet à wallet
|
|
|
|
$frais = ($init_country != $final_country) ? $this->calculateFees1($plr_user_wallet_wallet, $montant) : $this->calculateFees1($plr_user_wallet_wallet_national, $montant);
|
2020-07-25 18:09:43 +00:00
|
|
|
$taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
2020-06-18 09:07:18 +00:00
|
|
|
|
2020-07-25 18:09:43 +00:00
|
|
|
$com_hyp = $frais;
|
|
|
|
$this->session->set_userdata('com_hyp', $com_hyp);
|
2020-06-18 09:07:18 +00:00
|
|
|
break;
|
|
|
|
case 2: //Envoi de wallet à carte
|
|
|
|
$frais = $montant * $config->taux_com_user_wallet_carte / 100;
|
|
|
|
// $taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales , $frais) : $this->calculateTax($taxesNationales ,$frais);
|
2020-07-25 18:09:43 +00:00
|
|
|
$com_hyp = $frais * $config->taux_com_hyp_envoi_wallet_carte_ilink / 100;
|
|
|
|
$com_bq = $frais * $config->taux_com_banque_envoi_wallet_carte_ilink / 100;
|
|
|
|
$this->session->set_userdata('com_hyp', $com_hyp);
|
|
|
|
$this->session->set_userdata('com_bq', $com_bq);
|
2020-06-18 09:07:18 +00:00
|
|
|
break;
|
|
|
|
case 3: //Envoi de wallet à cash
|
|
|
|
$frais = ($init_country != $final_country) ? $this->calculateFees1($plr_user_wallet_cash, $montant) : $this->calculateFees1($plr_user_wallet_cash_national, $montant);
|
2020-07-25 18:09:43 +00:00
|
|
|
$taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
2020-06-18 09:07:18 +00:00
|
|
|
|
2020-07-25 18:09:43 +00:00
|
|
|
$com_hyp = $frais;
|
|
|
|
$this->session->set_userdata('com_hyp', $com_hyp);
|
2020-06-18 09:07:18 +00:00
|
|
|
// $this->session->set_userdata('frais_retrait',$frais);
|
|
|
|
$code = $this->random_string();
|
2020-07-25 18:09:43 +00:00
|
|
|
$data['message_code'] = '' . $code;
|
|
|
|
// $this->user_model->insertSimulateur($frais,$montant-$frais-$taxe,$code,$montant);
|
2020-06-18 09:07:18 +00:00
|
|
|
break;
|
|
|
|
case 4: //Envoi de wallet à banque
|
|
|
|
// Non disponible
|
|
|
|
//Pas de taxes
|
|
|
|
break;
|
|
|
|
// case 5: //Envoi de carte à wallet
|
|
|
|
// $frais =$montant * $config->taux_com_user_carte_wallet / 100;
|
|
|
|
//// $taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales , $frais) : $this->calculateTax($taxesNationales ,$frais);
|
|
|
|
// break;
|
|
|
|
// case 6: //Envoi de carte à cash
|
|
|
|
// $frais =$montant * $config->taux_com_user_carte_cash / 100;
|
|
|
|
//// $taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales , $frais) : $this->calculateTax($taxesNationales ,$frais);
|
|
|
|
// break;
|
|
|
|
case 9: // Retrait de wallet en cash
|
|
|
|
$frais = ($init_country != $final_country) ? $this->calculateFees1($plr_user_wallet_cash, $montant) : $this->calculateFees1($plr_user_wallet_cash_national, $montant);
|
2020-07-25 18:09:43 +00:00
|
|
|
$taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
2020-06-18 09:07:18 +00:00
|
|
|
|
2020-07-25 18:09:43 +00:00
|
|
|
$com_hyp = $frais;
|
|
|
|
$this->session->set_userdata('com_hyp', $com_hyp);
|
2020-06-18 09:07:18 +00:00
|
|
|
$code = $this->random_string();
|
2020-07-25 18:09:43 +00:00
|
|
|
$data['message_code'] = '' . $code;
|
|
|
|
// $this->user_model->insertSimulateur($frais,$montant-$frais-$taxe,$code,$montant);
|
2020-06-18 09:07:18 +00:00
|
|
|
break;
|
|
|
|
case 10: //Retrait de carte vers wallet
|
|
|
|
$frais = $montant * $config->taux_com_user_carte_wallet / 100;
|
|
|
|
|
2020-07-25 18:09:43 +00:00
|
|
|
$com_hyp = $frais * $config->taux_com_hyp_retrait_carte_cash_ilink / 100;
|
|
|
|
$com_bq = $frais * $config->taux_com_banque_retrait_carte_cash_ilink / 100;
|
|
|
|
$this->session->set_userdata('com_hyp', $com_hyp);
|
|
|
|
$this->session->set_userdata('com_bq', $com_bq);
|
2020-06-18 09:07:18 +00:00
|
|
|
break;
|
|
|
|
case 11: // Retrait de carte vers cash
|
2020-07-25 18:09:43 +00:00
|
|
|
$frais = $montant * $config->taux_com_user_carte_cash / 100;
|
2020-06-18 09:07:18 +00:00
|
|
|
|
2020-07-25 18:09:43 +00:00
|
|
|
$com_hyp = $frais * $config->taux_com_hyp_retrait_carte_cash_ilink / 100;
|
|
|
|
$com_bq = $frais * $config->taux_com_banque_retrait_carte_cash_ilink / 100;
|
|
|
|
$this->session->set_userdata('com_hyp', $com_hyp);
|
|
|
|
$this->session->set_userdata('com_bq', $com_bq);
|
2020-06-18 09:07:18 +00:00
|
|
|
$code = $this->random_string();
|
2020-07-25 18:09:43 +00:00
|
|
|
$data['message_code'] = '' . $code;
|
|
|
|
// $this->user_model->insertSimulateur($frais * $config->taux_com_hyp_retrait_carte_cash_ilink / 100,$montant-$frais-$taxe,$code,$montant);
|
2020-06-18 09:07:18 +00:00
|
|
|
break;
|
|
|
|
case 12: // Agent - Retrait en cash
|
|
|
|
// empty
|
|
|
|
//Sauvegarder les frais lors de chaque operation d'envoi
|
|
|
|
if(isset($code)){
|
|
|
|
$simulateur = $this->user_model->getSimulateur($code);
|
2020-07-25 18:09:43 +00:00
|
|
|
if($simulateur) {
|
|
|
|
$part_ag = $simulateur->first_row()->com_hyp * $config->taux_com_ag_retrait_cash / 100;
|
|
|
|
$part_sup = $simulateur->first_row()->com_hyp * $config->taux_com_sup_retrait_cash / 100;
|
|
|
|
$com_ag = $part_ag;
|
|
|
|
$com_sup = $part_sup;
|
2020-06-18 09:07:18 +00:00
|
|
|
$com_hyp -= ($part_ag + $part_sup);
|
2020-06-19 14:10:00 +00:00
|
|
|
$data['montant_retrait'] = $simulateur->first_row()->montant_retrait;
|
|
|
|
$data['frais_retrait'] = $simulateur->first_row()->com_hyp;
|
|
|
|
$data['montant_init'] = $simulateur->first_row()->montant;
|
2020-07-25 18:09:43 +00:00
|
|
|
$this->session->set_userdata('com_ag', $com_ag);
|
|
|
|
$this->session->set_userdata('com_sup', $com_sup);
|
|
|
|
$this->session->set_userdata('com_hyp', $com_hyp);
|
2020-06-18 09:07:18 +00:00
|
|
|
}else{
|
|
|
|
$data['error_simulateur'] = 'Code de retrait incorrect';
|
|
|
|
}
|
2020-06-19 14:10:00 +00:00
|
|
|
}else{
|
|
|
|
$data['error_simulateur'] = 'Code de retrait incorrect';
|
2020-06-18 09:07:18 +00:00
|
|
|
}
|
|
|
|
|
2020-06-19 14:10:00 +00:00
|
|
|
|
2020-06-18 09:07:18 +00:00
|
|
|
break;
|
|
|
|
case 13: // Agent - Retrait de la carte vers cash
|
|
|
|
$frais = $montant * $config->taux_com_wallet_ag_carte_cash / 100;
|
|
|
|
|
2020-07-25 18:09:43 +00:00
|
|
|
$com_ag = $frais * $config->taux_com_ag_retrait_carte_cash / 100;
|
|
|
|
$com_sup = $frais * $config->taux_com_sup_retrait_carte_cash / 100;
|
|
|
|
$com_hyp = $frais * $config->taux_com_hyp_retrait_carte_cash / 100;
|
|
|
|
$com_bq = $frais * $config->taux_com_banque_retrait_carte_cash / 100;
|
|
|
|
$this->session->set_userdata('com_ag', $com_ag);
|
|
|
|
$this->session->set_userdata('com_sup', $com_sup);
|
|
|
|
$this->session->set_userdata('com_hyp', $com_hyp);
|
|
|
|
$this->session->set_userdata('com_bq', $com_bq);
|
2020-06-18 09:07:18 +00:00
|
|
|
break;
|
|
|
|
case 14: // Agent - Envoi de cash vers wallet iLink
|
|
|
|
$frais = ($init_country != $final_country) ? $this->calculateFees1($plr_agent_depot_wallet_ilink, $montant) : $this->calculateFees1($plr_agent_depot_wallet_ilink_national, $montant);
|
2020-07-25 18:09:43 +00:00
|
|
|
$taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
|
|
|
$com_ag = $frais * $config->taux_com_ag_envoi_cash / 100;
|
|
|
|
$com_sup = $frais * $config->taux_com_sup_envoi_cash / 100;
|
|
|
|
$com_hyp = $frais * $config->taux_com_hyp_envoi_cash / 100;
|
|
|
|
$this->session->set_userdata('com_ag', $com_ag);
|
|
|
|
$this->session->set_userdata('com_sup', $com_sup);
|
|
|
|
$this->session->set_userdata('com_hyp', $com_hyp);
|
2020-06-18 09:07:18 +00:00
|
|
|
break;
|
|
|
|
case 15: // Agent - Envoi de cash vers autre wallet
|
|
|
|
$frais = ($init_country != $final_country) ? $this->calculateFees1($plr_agent_depot_autre_wallet, $montant) : $this->calculateFees1($plr_agent_depot_autre_wallet_national, $montant);
|
2020-07-25 18:09:43 +00:00
|
|
|
$taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
|
|
|
$com_ag = $frais * $config->taux_com_ag_envoi_cash / 100;
|
|
|
|
$com_sup = $frais * $config->taux_com_sup_envoi_cash / 100;
|
|
|
|
$com_hyp = $frais * $config->taux_com_hyp_envoi_cash / 100;
|
|
|
|
$this->session->set_userdata('com_ag', $com_ag);
|
|
|
|
$this->session->set_userdata('com_sup', $com_sup);
|
|
|
|
$this->session->set_userdata('com_hyp', $com_hyp);
|
2020-06-18 09:07:18 +00:00
|
|
|
break;
|
|
|
|
case 16: // Agent - Envoi de cash vers une carte visa
|
|
|
|
$frais = $montant * $config->taux_com_wallet_ag_envoi_cash_carte / 100;
|
2020-07-25 18:09:43 +00:00
|
|
|
$com_ag = $frais * $config->taux_com_ag_depot_cash_carte / 100;
|
|
|
|
$com_sup = $frais * $config->taux_com_sup_depot_cash_carte / 100;
|
|
|
|
$com_hyp = $frais * $config->taux_com_hyp_depot_cash_carte / 100;
|
|
|
|
$com_bq = $frais * $config->taux_com_banque_depot_cash_carte / 100;
|
|
|
|
$this->session->set_userdata('com_ag', $com_ag);
|
|
|
|
$this->session->set_userdata('com_sup', $com_sup);
|
|
|
|
$this->session->set_userdata('com_hyp', $com_hyp);
|
|
|
|
$this->session->set_userdata('com_bq', $com_bq);
|
2020-06-18 09:07:18 +00:00
|
|
|
break;
|
|
|
|
case 17: // Agent - Envoi de cash vers cash
|
|
|
|
$frais = ($init_country != $final_country) ? $this->calculateFees1($plr_agent_cash_cash, $montant) : $this->calculateFees1($plr_agent_cash_cash_national, $montant);
|
2020-07-25 18:09:43 +00:00
|
|
|
$taxe = ($init_country != $final_country) ? $this->calculateTax($taxesInternationales, $frais) : $this->calculateTax($taxesNationales, $frais);
|
|
|
|
$com_ag = $frais * $config->taux_com_ag_envoi_cash / 100;
|
|
|
|
$com_sup = $frais * $config->taux_com_sup_envoi_cash / 100;
|
|
|
|
$com_hyp = $frais * $config->taux_com_hyp_envoi_cash / 100;
|
|
|
|
$this->session->set_userdata('com_ag', $com_ag);
|
|
|
|
$this->session->set_userdata('com_sup', $com_sup);
|
|
|
|
$this->session->set_userdata('com_hyp', $com_hyp);
|
2020-06-18 09:07:18 +00:00
|
|
|
$code = $this->random_string();
|
2020-07-25 18:09:43 +00:00
|
|
|
$data['message_code'] = '' . $code;
|
|
|
|
// $this->user_model->insertSimulateur($frais,$montant-$frais-$taxe,$code,$montant);
|
2020-06-18 09:07:18 +00:00
|
|
|
break;
|
|
|
|
case 18: // Agent - Envoi de cash vers banque
|
|
|
|
// Indisponible
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$data['showResult'] = $showResult;
|
|
|
|
$data['frais'] = $frais;
|
|
|
|
$data['taxe'] = $taxe;
|
|
|
|
|
|
|
|
$data['operation'] = $operation;
|
|
|
|
$data['init_country'] = $init_country;
|
|
|
|
$data['final_country'] = $final_country;
|
2020-06-19 14:10:00 +00:00
|
|
|
$data['montant'] = $montant;
|
|
|
|
|
2020-06-18 09:07:18 +00:00
|
|
|
|
|
|
|
$data['com_ag'] = $com_ag;
|
|
|
|
$data['com_sup'] = $com_sup;
|
|
|
|
$data['com_hyp'] = $com_hyp;
|
|
|
|
$data['com_bq'] = $com_bq;
|
|
|
|
|
2020-06-05 16:53:04 +00:00
|
|
|
$operations = [
|
2020-06-08 18:54:36 +00:00
|
|
|
new Operation(1, $this->lang->line('op1')),
|
2020-06-10 14:20:30 +00:00
|
|
|
new Operation(2, $this->lang->line('op2')),
|
|
|
|
new Operation(3, $this->lang->line('op3')),
|
2020-06-13 14:47:09 +00:00
|
|
|
new Operation(4, $this->lang->line('op4')),
|
|
|
|
// new Operation(5, $this->lang->line('op5')),
|
|
|
|
// new Operation(6, $this->lang->line('op6')),
|
2020-06-10 14:20:30 +00:00
|
|
|
// new Operation(7, $this->lang->line('op7')),
|
|
|
|
// new Operation(8, $this->lang->line('op8')),
|
|
|
|
new Operation(9, $this->lang->line('op9')),
|
|
|
|
new Operation(10, $this->lang->line('op10')),
|
|
|
|
new Operation(11, $this->lang->line('op11')),
|
2020-06-13 14:47:09 +00:00
|
|
|
new Operation(12, $this->lang->line('op12')),
|
|
|
|
new Operation(13, $this->lang->line('op13')),
|
|
|
|
new Operation(14, $this->lang->line('op14')),
|
|
|
|
new Operation(15, $this->lang->line('op15')),
|
|
|
|
new Operation(16, $this->lang->line('op16')),
|
|
|
|
new Operation(17, $this->lang->line('op17')),
|
|
|
|
new Operation(18, $this->lang->line('op18')),
|
2020-06-05 16:53:04 +00:00
|
|
|
];
|
|
|
|
$data['operations'] = $operations;
|
|
|
|
// if (isset($_POST)) {
|
|
|
|
// $data['montant'] = isset($_POST['montant']) ? $_POST['montant'] : 0 ;
|
|
|
|
// }
|
2020-06-19 14:10:00 +00:00
|
|
|
|
2020-06-05 16:53:04 +00:00
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('calculator');
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
}
|
2020-06-18 09:07:18 +00:00
|
|
|
|
|
|
|
//Calcul des frais internationaux
|
|
|
|
function calculateFees1(array $paliers, $montant)
|
|
|
|
{
|
|
|
|
$size = sizeof($paliers);
|
2020-06-25 08:08:10 +00:00
|
|
|
if($size > 0){
|
|
|
|
$min = $paliers[0]->min;
|
|
|
|
$max = $size > 0 ? $paliers[$size - 1]->max : 0;
|
|
|
|
$palier = null;
|
|
|
|
foreach ($paliers as $p) {
|
|
|
|
if ($montant >= $p->min && $montant <= $p->max) {
|
|
|
|
$palier = $p;
|
|
|
|
break;
|
|
|
|
}
|
2020-06-18 09:07:18 +00:00
|
|
|
}
|
|
|
|
|
2020-06-25 08:08:10 +00:00
|
|
|
if ($palier) {
|
|
|
|
return (($palier->min + $palier->max) / 2 * $palier->taux / 100);
|
|
|
|
} else {
|
|
|
|
if ($montant < $min)
|
|
|
|
return $min * $paliers[0]->taux / 100;
|
|
|
|
else if ($montant > $max)
|
|
|
|
return $max * $paliers[$size - 1]->taux / 100;
|
|
|
|
}
|
2020-06-18 09:07:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Calcul des frais nationaux
|
|
|
|
function calculateFees2($min, $max, $taux, $montant)
|
|
|
|
{
|
|
|
|
if ($montant < $min)
|
|
|
|
return $min * $taux / 100;
|
|
|
|
else if ($montant > $max)
|
|
|
|
return $max * $taux / 100;
|
|
|
|
else
|
|
|
|
return $montant * $taux / 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Calcul des taxes
|
|
|
|
function calculateTax(array $taxes, $frais)
|
|
|
|
{
|
|
|
|
$sommeTaux = 0;
|
|
|
|
$sommeFixe = 0;
|
|
|
|
foreach ($taxes as $tax) {
|
|
|
|
if ($tax->type == '%')
|
|
|
|
$sommeTaux += $tax->valeur;
|
|
|
|
|
|
|
|
if ($tax->type == 'fixe')
|
|
|
|
$sommeFixe += $tax->valeur;
|
|
|
|
}
|
|
|
|
return ($frais * $sommeTaux / 100) + $sommeFixe;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function random_string()
|
|
|
|
{
|
|
|
|
$character_set_array = array();
|
2020-06-19 14:10:00 +00:00
|
|
|
$character_set_array[] = array('count' => 12, 'characters' => 'abcdefghjkmnpqrstuvwxyz');
|
|
|
|
$character_set_array[] = array('count' => 4, 'characters' => '23456789');
|
2020-06-18 09:07:18 +00:00
|
|
|
$temp_array = array();
|
|
|
|
foreach ($character_set_array as $character_set) {
|
|
|
|
for ($i = 0; $i < $character_set['count']; $i++) {
|
|
|
|
$temp_array[] = $character_set['characters'][rand(0, strlen($character_set['characters']) - 1)];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
shuffle($temp_array);
|
|
|
|
return implode('', $temp_array);
|
|
|
|
}
|
2020-06-22 11:39:55 +00:00
|
|
|
|
|
|
|
private function config_wallet($config , $country)
|
|
|
|
{
|
|
|
|
// $data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
2020-08-27 09:37:45 +00:00
|
|
|
$data['active'] = "wallet_wallet";
|
2020-06-22 11:39:55 +00:00
|
|
|
$data['alert'] = "";
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
|
|
|
$data['country'] = $this->session->userdata('current_pays');
|
|
|
|
$data['category'] = $this->session->userdata('category');
|
|
|
|
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
2020-07-06 15:56:17 +00:00
|
|
|
$data['network_id'] = $this->session->userdata('network_id');
|
2020-06-22 11:39:55 +00:00
|
|
|
if (isset($country)) {
|
|
|
|
$data['country_id'] = $country;
|
|
|
|
$data['country'] = $this->user_model->getCountry($country)->first_row();
|
2020-06-30 11:07:41 +00:00
|
|
|
$res = $this->user_model->getActiveNetworksByCountry($country,$this->session->userdata('network_id'));
|
2020-06-22 11:39:55 +00:00
|
|
|
$data['networks'] = [];
|
|
|
|
if($res){
|
|
|
|
$result = $res->result();
|
|
|
|
foreach ($result as $network){
|
|
|
|
$res = $this->user_model->getSharingRate($network->id , $data['idConfig']);
|
|
|
|
if($res){
|
|
|
|
$network->rate = $res->first_row()->taux_partage;
|
2020-07-10 18:19:15 +00:00
|
|
|
$network->url = $res->first_row()->url;
|
2020-06-22 11:39:55 +00:00
|
|
|
}else{
|
|
|
|
$network->rate = null;
|
2020-07-10 18:19:15 +00:00
|
|
|
$network->url = null;
|
2020-06-22 11:39:55 +00:00
|
|
|
}
|
|
|
|
$data['networks'][] = $network;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('gestion_wallet_ilink_config_paying_network');
|
|
|
|
$this->load->view('footer');
|
|
|
|
return;
|
|
|
|
}
|
2020-06-23 06:41:44 +00:00
|
|
|
$res = $this->user_model->getWalletsCountries();
|
2020-06-22 11:39:55 +00:00
|
|
|
$data['countries'] = [];
|
|
|
|
if($res){
|
|
|
|
$result = $res->result();
|
|
|
|
foreach ($result as $country){
|
|
|
|
$res = $this->user_model->countPayingNetworks($country->id, $data['idConfig']);
|
|
|
|
if($res){
|
|
|
|
$country->total = $res->first_row()->total;
|
|
|
|
}else{
|
|
|
|
$country->total = null;
|
|
|
|
}
|
|
|
|
$data['countries'][] = $country;
|
|
|
|
}
|
|
|
|
}
|
2020-07-06 15:56:17 +00:00
|
|
|
$taux = $data['hasWallet']->first_row();
|
|
|
|
switch($config){
|
|
|
|
case 'paying_networks':
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('gestion_wallet_ilink_config_paying_networks');
|
|
|
|
break;
|
|
|
|
case 'user_wallet_wallet':
|
|
|
|
$data['plr_user_wallet_wallet'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet_international", $data['idConfig']);
|
|
|
|
$data['plr_user_wallet_wallet_national'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet_national", $data['idConfig']);
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('config_wallet_ilink_hyp/user_wallet_wallet');
|
|
|
|
break;
|
|
|
|
case 'user_wallet_carte':
|
|
|
|
$data['taux_u_w_cart'] = $taux->taux_com_user_wallet_carte;
|
|
|
|
$data['taux_hyp_s_wallet_cart_ilink'] = $taux->taux_com_hyp_envoi_wallet_carte_ilink;
|
|
|
|
$data['taux_bq_s_wallet_cart_ilink'] = $taux->taux_com_banque_envoi_wallet_carte_ilink;
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('config_wallet_ilink_hyp/user_wallet_carte');
|
|
|
|
break;
|
|
|
|
case 'user_wallet_cash':
|
|
|
|
$data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash_international", $data['idConfig']);
|
|
|
|
$data['plr_user_wallet_cash_national'] = $this->user_model->getPalierConfigWallet("user_wallet_cash_national", $data['idConfig']);
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('config_wallet_ilink_hyp/user_wallet_cash');
|
|
|
|
break;
|
|
|
|
case 'user_carte_wallet':
|
|
|
|
$data['taux_u_c_w'] = $taux->taux_com_user_carte_wallet;
|
|
|
|
$data['taux_u_c_c'] = $taux->taux_com_user_carte_cash;
|
|
|
|
$data['taux_hyp_r_cart_ilink'] = $taux->taux_com_hyp_retrait_carte_cash_ilink;
|
|
|
|
$data['taux_bq_r_cart_ilink'] = $taux->taux_com_banque_retrait_carte_cash_ilink;
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('config_wallet_ilink_hyp/user_carte_wallet');
|
|
|
|
break;
|
|
|
|
case 'agent_remove_cash':
|
|
|
|
$data['taux_ag_r_c'] = $taux->taux_com_ag_retrait_cash;
|
|
|
|
$data['taux_sup_r_c'] = $taux->taux_com_sup_retrait_cash;
|
|
|
|
$data['taux_hyp_r_c'] = $taux->taux_com_hyp_retrait_cash;
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('config_wallet_ilink_hyp/agent_remove_cash');
|
|
|
|
break;
|
|
|
|
case 'agent_remove_carte_cash':
|
|
|
|
$data['taux_ag_cart_c'] = $taux->taux_com_wallet_ag_carte_cash;
|
|
|
|
$data['taux_ag_r_cart'] = $taux->taux_com_ag_retrait_carte_cash;
|
|
|
|
$data['taux_sup_r_cart'] = $taux->taux_com_sup_retrait_carte_cash;
|
|
|
|
$data['taux_hyp_r_cart'] = $taux->taux_com_hyp_retrait_carte_cash;
|
|
|
|
$data['taux_bq_r_cart'] = $taux->taux_com_banque_retrait_carte_cash;
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('config_wallet_ilink_hyp/agent_remove_carte_cash');
|
|
|
|
break;
|
|
|
|
case 'agent_send_cash_carte':
|
|
|
|
$data['taux_ag_d_c_c'] = $taux->taux_com_wallet_ag_envoi_cash_carte;
|
|
|
|
$data['taux_ag_d_c'] = $taux->taux_com_ag_depot_cash_carte;
|
|
|
|
$data['taux_sup_d_c'] = $taux->taux_com_sup_depot_cash_carte;
|
|
|
|
$data['taux_hyp_d_c'] = $taux->taux_com_hyp_depot_cash_carte;
|
|
|
|
$data['taux_bq_d_c'] = $taux->taux_com_banque_depot_cash_carte;
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('config_wallet_ilink_hyp/agent_send_cash_carte');
|
|
|
|
break;
|
|
|
|
case 'agent_send_cash_canal':
|
|
|
|
$data['taux_ag_s_c'] = $taux->taux_com_ag_envoi_cash;
|
|
|
|
$data['taux_sup_s_c'] = $taux->taux_com_sup_envoi_cash;
|
|
|
|
$data['taux_hyp_s_c'] = $taux->taux_com_hyp_envoi_cash;
|
|
|
|
|
|
|
|
$data['plr_agent_depot_wallet_ilink'] = $this->user_model->getPalierConfigWallet("agent_depot_wallet_ilink_international" , $data['idConfig']);
|
|
|
|
$data['plr_agent_depot_autre_wallet'] = $this->user_model->getPalierConfigWallet("agent_depot_autre_wallet_international" , $data['idConfig']);
|
|
|
|
$data['plr_agent_cash_cash'] = $this->user_model->getPalierConfigWallet("agent_cash_cash_international", $data['idConfig']);
|
|
|
|
|
|
|
|
$data['plr_agent_depot_wallet_ilink_national'] = $this->user_model->getPalierConfigWallet("agent_depot_wallet_ilink_national" , $data['idConfig']);
|
|
|
|
$data['plr_agent_depot_autre_wallet_national'] = $this->user_model->getPalierConfigWallet("agent_depot_autre_wallet_national" , $data['idConfig']);
|
|
|
|
$data['plr_agent_cash_cash_national'] = $this->user_model->getPalierConfigWallet("agent_cash_cash_national", $data['idConfig']);
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('config_wallet_ilink_hyp/agent_send_cash_canal');
|
|
|
|
break;
|
2020-07-10 18:19:15 +00:00
|
|
|
case 'taxes':
|
|
|
|
$data['taxes'] = $this->user_model->getTaxes($data['idConfig']);
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('config_wallet_ilink_hyp/taxes');
|
|
|
|
break;
|
2020-07-06 15:56:17 +00:00
|
|
|
}
|
2020-06-22 11:39:55 +00:00
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
|
2020-06-23 15:49:59 +00:00
|
|
|
private function show_config_infos($type)
|
|
|
|
{
|
|
|
|
|
2020-08-27 09:37:45 +00:00
|
|
|
$data['active'] = "wallet_wallet";
|
2020-06-23 15:49:59 +00:00
|
|
|
$data['alert'] = "";
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
|
|
|
$data['country'] = $this->session->userdata('current_pays');
|
|
|
|
$data['category'] = $this->session->userdata('category');
|
|
|
|
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
2020-07-25 18:09:43 +00:00
|
|
|
$res = $this->user_model->getWalletPassword($this->session->userdata('network_id'));
|
|
|
|
$data['walletPassword'] = $res ? $res->first_row() : null;
|
2020-06-23 15:49:59 +00:00
|
|
|
$data['networks'] = $this->user_model->getPayingNetworksByConfigWallet($data['idConfig']);
|
|
|
|
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('gestion_wallet_ilink_paying_network_account');
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
|
2020-06-22 11:39:55 +00:00
|
|
|
public function config_sharing_rate(){
|
|
|
|
if ($this->isLogged()) {
|
|
|
|
if (isset($_POST)) {
|
|
|
|
$network_id = $_POST['network_id'];
|
|
|
|
$config_id = $_POST['config_id'];
|
|
|
|
$rate = $_POST['rate'];
|
2020-07-10 18:19:15 +00:00
|
|
|
$url = $_POST['url'];
|
2020-08-06 06:26:28 +00:00
|
|
|
$res = $this->user_model->setSharingRate($network_id, $config_id, $rate, $url);
|
2020-06-22 11:39:55 +00:00
|
|
|
|
|
|
|
if ($res) {
|
|
|
|
echo json_encode("200");
|
|
|
|
} else {
|
|
|
|
echo json_encode("500");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-06 06:26:28 +00:00
|
|
|
|
|
|
|
public function nano_credit()
|
|
|
|
{
|
|
|
|
if ($this->isLogged()) {
|
|
|
|
$data['network_id'] = $this->session->userdata('network_id');
|
2020-08-27 09:37:45 +00:00
|
|
|
if ($this->input->get('history')) {
|
|
|
|
$this->historique_nano_credit($data['network_id'], $this->input->get('d'), $this->input->get('f'), $this->input->get('history'));
|
|
|
|
} elseif ($this->input->get('config')) {
|
|
|
|
$this->config_nano_credit($this->input->get('config'));
|
|
|
|
} else {
|
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
|
|
|
$data['groups'] = $this->user_model->getUsersGroups($this->session->userdata('network_id'));
|
|
|
|
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
|
|
|
$data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig']);
|
|
|
|
$data['taxes'] = $this->user_model->getTaxes($data['idConfig'], 'nano_credit');
|
|
|
|
$data['active'] = "nano_credit";
|
|
|
|
$data['alert'] = "";
|
|
|
|
$data['game_pays'] = $this->user_model->getGameCountry();
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['country'] = $this->session->userdata('current_pays');
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['currency_code'] = $this->session->userdata('currency_code');
|
|
|
|
$data['token'] = $this->session->userdata('token');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['configWallet'] = $data['hasWallet']->first_row();
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('nano_credit/gestion_nano_credit_hyp');
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private function config_nano_credit($config)
|
|
|
|
{
|
|
|
|
// $data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
|
|
|
$data['active'] = "nano_credit";
|
|
|
|
$data['alert'] = "";
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
|
|
|
$data['country'] = $this->session->userdata('current_pays');
|
|
|
|
$data['category'] = $this->session->userdata('category');
|
|
|
|
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
|
|
|
$data['network_id'] = $this->session->userdata('network_id');
|
2020-08-06 06:26:28 +00:00
|
|
|
|
2020-08-27 09:37:45 +00:00
|
|
|
switch ($config) {
|
|
|
|
case 'nano_credit':
|
|
|
|
$data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig']);
|
|
|
|
$data['taxes'] = $this->user_model->getTaxes($data['idConfig'], 'nano_credit');
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('nano_credit/config_nano_credit');
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'epargne':
|
|
|
|
$data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig'], 'epargne');
|
|
|
|
$data['taxes'] = $this->user_model->getTaxes($data['idConfig'], 'epargne');
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
$this->load->view('nano_credit/config_savings');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
|
|
|
|
private function historique_nano_credit($network_id, $startDate, $endDate, $type)
|
|
|
|
{
|
|
|
|
$data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
|
|
|
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
|
|
|
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
|
|
|
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
|
|
|
$endDate = Date('Y-m-d', strtotime($endDate . "+1 day"));
|
|
|
|
$data['currency_code'] = $this->session->userdata('currency_code');
|
|
|
|
|
|
|
|
if ($type == 'nano_credit') {
|
|
|
|
$data['transactions'] = $this->user_model->getUserDemandesCredit($startDate, $endDate, $network_id);
|
|
|
|
|
2020-08-31 16:34:03 +00:00
|
|
|
} else if ($type == 'savings') {
|
2020-08-27 09:37:45 +00:00
|
|
|
$data['transactions'] = $this->user_model->getIlinkTransactions($startDate, $endDate, $network_id);
|
2020-08-06 06:26:28 +00:00
|
|
|
}
|
2020-08-27 09:37:45 +00:00
|
|
|
$data['active'] = "nano_credit";
|
|
|
|
$data['alert'] = "";
|
|
|
|
$data['firstname'] = $this->session->userdata('firstname');
|
|
|
|
$data['lastname'] = $this->session->userdata('lastname');
|
|
|
|
$data['email'] = $this->session->userdata('email');
|
|
|
|
$data['network'] = $this->session->userdata('network');
|
|
|
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
|
|
|
$data['networks'] = $this->user_model->getActiveNetwork();
|
|
|
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
|
|
|
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
|
|
|
$data['country'] = $this->session->userdata('current_pays');
|
|
|
|
$data['category'] = $this->session->userdata('category');
|
|
|
|
|
|
|
|
$this->load->view('header_hyp', $data);
|
|
|
|
if ($type == 'epargne')
|
|
|
|
$this->load->view('nano_credit/historique_savings');
|
|
|
|
else
|
|
|
|
$this->load->view('nano_credit/historique_nano_credit');
|
|
|
|
$this->load->view('footer');
|
2020-08-06 06:26:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function saveCreditLimit()
|
|
|
|
{
|
|
|
|
if ($this->isLogged()) {
|
|
|
|
if (isset($_POST)) {
|
|
|
|
$limit_min = $_POST['limit_min'];
|
|
|
|
$limit_max = $_POST['limit_max'];
|
|
|
|
$id_network = $_POST['id_network'];
|
|
|
|
|
|
|
|
$this->user_model->insertCreditLimit($limit_min, $limit_max, '1', $id_network);
|
|
|
|
$res = true;
|
|
|
|
|
|
|
|
if ($res) {
|
|
|
|
echo json_encode("200");
|
|
|
|
} else {
|
|
|
|
echo json_encode("500");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-14 16:21:08 +00:00
|
|
|
|
|
|
|
public function saveNanoCreditRates()
|
|
|
|
{
|
|
|
|
if ($this->isLogged()) {
|
|
|
|
if (isset($_POST)) {
|
|
|
|
$idConfig = $_POST['id_config'];
|
|
|
|
$rates = isset($_POST['rates']) ? $_POST['rates'] : null;
|
2020-08-27 09:37:45 +00:00
|
|
|
$type = isset($_POST['type']) ? $_POST['type'] : 'nano_credit';
|
|
|
|
|
|
|
|
$this->insertNanoCreditRates($rates, $idConfig, $type);
|
2020-08-14 16:21:08 +00:00
|
|
|
$res = true;
|
|
|
|
|
|
|
|
if ($res) {
|
|
|
|
echo json_encode("200");
|
|
|
|
} else {
|
|
|
|
echo json_encode("500");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-27 09:37:45 +00:00
|
|
|
private function insertNanoCreditRates($palier, $idConfig, $type)
|
2020-08-14 16:21:08 +00:00
|
|
|
{
|
|
|
|
|
2020-08-27 09:37:45 +00:00
|
|
|
$exist = $this->user_model->getNanoCreditRates($idConfig, $type);
|
2020-08-14 16:21:08 +00:00
|
|
|
if ($exist) {
|
2020-08-27 09:37:45 +00:00
|
|
|
$this->user_model->deleteNanoCreditRates($idConfig, $type);
|
2020-08-14 16:21:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($palier) {
|
|
|
|
foreach ($palier as $p) {
|
|
|
|
$array = json_decode(json_encode($p), true);
|
|
|
|
$row = [];
|
|
|
|
foreach ($array as $key => $value) {
|
|
|
|
$row[] = $value;
|
|
|
|
}
|
2020-08-27 09:37:45 +00:00
|
|
|
$this->user_model->addNanoCreditRates($idConfig, $row[0], $row[1], $type);
|
2020-08-14 16:21:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-06-05 16:53:04 +00:00
|
|
|
}
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
class Operation
|
|
|
|
{
|
|
|
|
public $name;
|
2020-06-05 16:53:04 +00:00
|
|
|
public $id;
|
|
|
|
|
2020-06-08 18:54:36 +00:00
|
|
|
public function __construct($id, $name)
|
2020-06-05 16:53:04 +00:00
|
|
|
{
|
|
|
|
$this->name = $name;
|
|
|
|
$this->id = $id;
|
|
|
|
}
|
2020-04-17 15:28:27 +00:00
|
|
|
}
|