Compare commits

...

10 Commits

Author SHA1 Message Date
Djery-Tom 2438e94261 Remove phone validation 2023-03-10 11:36:52 +01:00
Djery-Tom 856d6027a2 Update noreply mail password 2022-06-24 09:42:07 +01:00
Djery-Tom bdb7446c33 Add network open wallet at mobile login in data while agent login 2022-05-16 13:26:21 +01:00
Djery-Tom b20141fa09 Add mutuelle sante logo 2022-03-18 15:43:47 +01:00
Djery-Tom a648ef0577 Fix registration of agent 2022-03-17 21:12:10 +01:00
Djery-Tom 49ec8bc581 Disable phone verification 2022-03-08 15:29:11 +01:00
Djery-Tom 566e7eb81b Fix user registration 2022-03-08 15:24:33 +01:00
Djery-Tom c1e38b9590 Fix user registration 2022-03-08 14:53:41 +01:00
Djery-Tom df8188d50f Add cnamgs fond 4 and ilink worl sante logos 2022-02-28 08:49:43 +01:00
Djery-Tom 19bd44b003 + Send QR code to email when new simple user register 2022-01-24 11:58:10 +01:00
7 changed files with 55 additions and 37 deletions

View File

@ -178,6 +178,7 @@ class DataBaseConnector
* @return bool * @return bool
*/ */
public function checknumberValidity($phone){ public function checknumberValidity($phone){
return true;
try { try {
return $this->messenger->checkPhoneExist($phone); return $this->messenger->checkPhoneExist($phone);
} catch(\Throwable $ex){ } catch(\Throwable $ex){
@ -391,7 +392,7 @@ na.validation_code as validation_code,ag.id as agentId,na.solde AS balance,na.et
$etat=1; $etat=1;
$si=1; $si=1;
$category="geolocated"; $category="geolocated";
if($result= mysqli_prepare($this->con,"SELECT * FROM agent_plus WHERE code_dial=? AND etat=? AND category=? AND (longitude!=0 AND latitude!=0)")) { if($result= mysqli_prepare($this->con,"SELECT id , firstname, lastname, adresse , email , longitude , latitude , phone , transactionNumber , openHours , closeHours , solde , network, country FROM agent_plus WHERE code_dial=? AND etat=? AND category=? AND (longitude!=0 AND latitude!=0)")) {
mysqli_stmt_bind_param($result, 'sis', $country, $etat, $category); mysqli_stmt_bind_param($result, 'sis', $country, $etat, $category);
mysqli_stmt_execute($result); mysqli_stmt_execute($result);
$r = mysqli_stmt_get_result($result); $r = mysqli_stmt_get_result($result);
@ -683,7 +684,7 @@ ag.email AS email,ag.longitude as longitude,ag.latitude AS latitude,ag.active as
na.validation_code as validation_code,ag.id as agentId,na.solde AS balance,na.etat AS etat na.validation_code as validation_code,ag.id as agentId,na.solde AS balance,na.etat AS etat
,cg.code_parrain AS code_parrain,cg.code_membre AS code_membre,na.phone as phone,na.transactionNumber as phoneTransaction, ,cg.code_parrain AS code_parrain,cg.code_membre AS code_membre,na.phone as phone,na.transactionNumber as phoneTransaction,
ne.id as network_id,ag.date_created as date_created,cg.category as category, ne.id as network_id,ag.date_created as date_created,cg.category as category,
ag.salt as salt,ag.encrypted_password as encrypted_password,ne.name as network,ct.name as country ag.salt as salt,ag.encrypted_password as encrypted_password,ne.name as network,ne.open_wallet_at_mobile_login,ct.name as country
,ag.number_super as nbre_reseau,ag.number_geoBysuper as nbre_sous_reseau ,ag.number_super as nbre_reseau,ag.number_geoBysuper as nbre_sous_reseau
FROM agents ag INNER JOIN networks_agents na ON ag.id=na.agent_id FROM agents ag INNER JOIN networks_agents na ON ag.id=na.agent_id
INNER JOIN codeGenerer cg ON cg.id=na.codeGenerer_id INNER JOIN networks as ne ON na.network_id=ne.id INNER JOIN countries ct ON ct.id=ne.country_id WHERE na.phone='$phone' or na.transactionNumber='$phone'"); INNER JOIN codeGenerer cg ON cg.id=na.codeGenerer_id INNER JOIN networks as ne ON na.network_id=ne.id INNER JOIN countries ct ON ct.id=ne.country_id WHERE na.phone='$phone' or na.transactionNumber='$phone'");
@ -982,11 +983,11 @@ salt,validation_code, active,network_id , date_created , date_modified) VALUES
if ($result) { if ($result) {
// get user details // get user details
$uid = mysqli_insert_id($this->con); // last inserted id $uid = mysqli_insert_id($this->con); // last inserted id
$result = mysqli_query($this->con,"SELECT ne.name as reseau,ct.name as country,usr.firstname as firstname $result = mysqli_query($this->con,"SELECT usr.id , ne.name as reseau,ct.name as country,usr.firstname as firstname
,usr.lastname as lastname,usr.phone as phone,usr.email as email,usr.validation_code as validation_code , usr.user_code FROM users usr INNER JOIN networks ne ON ne.id=usr.network_id INNER JOIN countries ct ON ct.id=ne.country_id WHERE usr.id = '$uid'"); ,usr.lastname as lastname,usr.phone as phone,usr.email as email,usr.validation_code as validation_code , usr.user_code FROM users usr INNER JOIN networks ne ON ne.id=usr.network_id INNER JOIN countries ct ON ct.id=ne.country_id WHERE usr.id = '$uid'");
// return user details // return user details
if($result){ if($result){
return mysqli_fetch_array($result); return mysqli_fetch_array($result,MYSQLI_ASSOC);
}else return ['error'=>'error geting information','sql'=>mysqli_error($this->con)]; }else return ['error'=>'error geting information','sql'=>mysqli_error($this->con)];
} else { } else {
@ -1023,7 +1024,7 @@ salt,validation_code, active,network_id , date_created , date_modified) VALUES
$codevalide=mysqli_num_rows($se)>0; $codevalide=mysqli_num_rows($se)>0;
}while($codevalide); }while($codevalide);
$agentPhone=$agent['phone']; $agentPhone=$agent['phone'];
$result = mysqli_query($this->con, "INSERT INTO networks_agents(network_id,solde,etat,codeGenerer_id,transactionNumber,phone,validation_code,nh_provider_class_id)VALUES('$networkId','0','0','$codeGenererId','$phone','$agentPhone','$validation_code','$providerClassId')"); $result = mysqli_query($this->con, "INSERT INTO networks_agents(network_id,solde,etat,codeGenerer_id,transactionNumber,phone,validation_code,nh_provider_class_id)VALUES('$networkId','0','0','$codeGenererId','$phone','$agentPhone','$validation_code',$providerClassId)");
if ($result) { if ($result) {
$geoId=mysqli_insert_id($this->con); $geoId=mysqli_insert_id($this->con);
if (mysqli_query($this->con, "UPDATE codeGenerer SET etat='1' WHERE code_membre='$code'")) if (mysqli_query($this->con, "UPDATE codeGenerer SET etat='1' WHERE code_membre='$code'"))
@ -1334,7 +1335,7 @@ ag.adresse,
while ($row=mysqli_fetch_array($result,MYSQLI_ASSOC)){ while ($row=mysqli_fetch_array($result,MYSQLI_ASSOC)){
$rows[]=$row; $rows[]=$row;
} }
return $rows; return $rows ?? [];
} }
return []; return [];
} }

View File

@ -106,6 +106,7 @@ class DataBaseConnector
} }
public function checknumberValidity($phone){ public function checknumberValidity($phone){
return true;
try { try {
return true;//$this->messenger->checkPhoneExist($phone); return true;//$this->messenger->checkPhoneExist($phone);
} catch(\Throwable $ex){ } catch(\Throwable $ex){

View File

@ -8,7 +8,6 @@
include 'DataBaseConnector.php'; include 'DataBaseConnector.php';
/** /**
* Cette classe matérialise la resource qui execute une requete * Cette classe matérialise la resource qui execute une requete
*/ */
@ -443,7 +442,7 @@ class Requester
//Envoyez le mail de bienvenue //Envoyez le mail de bienvenue
try{ try{
/* API URL */ /* API URL */
$url = WALLET_SERVICE_URL.'/notify-new-agent'; $url = WALLET_SERVICE_URL.'/notify-new-user';
/* Init cURL resource */ /* Init cURL resource */
$ch = curl_init($url); $ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
@ -461,7 +460,8 @@ class Requester
$body->email = $user['email']; $body->email = $user['email'];
$body->message = $user['category'] == 'super' ? $message2 : $message1; $body->message = $user['category'] == 'super' ? $message2 : $message1;
$body->category = $user['category']; $body->category = $user['category'];
$body->agent_id = $user['agentId']; $body->user_id = $user['agentId'];
$body->user_type = 'agent';
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
/* execute request */ /* execute request */
curl_exec($ch); curl_exec($ch);
@ -968,7 +968,7 @@ na.id as agent_id,ds.id,cg.code_membre as code_membre ,ds.id as demande_id FROM
// user is already existed - error response // user is already existed - error response
$response["error"] = 1; $response["error"] = 1;
$response["error_msg"] = "numero existe deja"; $response["error_msg"] = "numero existe deja";
echo json_encode($response); return json_encode($response);
} else { } else {
if ($this->db->checknumberValidity($request->phone)) { if ($this->db->checknumberValidity($request->phone)) {
$user = $this->db->storeUserSimple($request->address, $request->lastname, $request->email, $user = $this->db->storeUserSimple($request->address, $request->lastname, $request->email,
@ -985,23 +985,39 @@ na.id as agent_id,ds.id,cg.code_membre as code_membre ,ds.id as demande_id FROM
$validation_code=$user['validation_code']; $validation_code=$user['validation_code'];
$ct=$this->messageText['USER_']; $ct=$this->messageText['USER_'];
$message1 =sprintf($this->messageText['MESSAGE_1_USER'],$username,$ct,$phone,$request->password,$validation_code); $message1 =sprintf($this->messageText['MESSAGE_1_USER'],$username,$ct,$phone,$request->password,$validation_code);
$message2 = sprintf($this->messageText['MESSAGE_2'],$username,$ct,$phone,$request->password,""); // $message2 = sprintf($this->messageText['MESSAGE_2'],$username,$ct,$phone,$request->password,"");
//Envoyez le mail de bienvenue
$from = "noreply@ilink-app.com";
$headers = "From:" . $from;
$name = "ilink";
$this->messenger->setReceiverMail($user['email']);
$this->messenger->setContact($user['phone']);
$this->messenger->setMessage($message1);
$this->messenger->setSubject($subject);
$this->messenger->setHeader($headers);
try{ try{
$this->messenger->sendMail(); /* API URL */
}catch (\Throwable $e){ $url = WALLET_SERVICE_URL.'/notify-new-user';
$this->write_log($e->getMessage().'\n'.$e->getTraceAsString());; /* Init cURL resource */
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
/* set the content type json */
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
'Authorization:'.WALLET_SERVICE_TOKEN,
));
/* set return type json */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
$body = new \stdClass();
$body->subject = $subject;
$body->email = $user['email'];
$body->message = $message1;
$body->user_id = $user['id'];
$body->user_type = 'user';
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
/* execute request */
curl_exec($ch);
/* close cURL resource */
curl_close($ch);
}catch (Throwable $e){
$this->write_log("Error Notify New Simple user ".$request->lastname." : ".$e->getMessage()."\n");
} }
$this->messenger->setContact($user['phone']);
$sms = $this->messenger->sendSms(); $sms = $this->messenger->sendSms();
} else { } else {

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -56,7 +56,7 @@ class Messenger
$this->mail->Host = 'mail.ilink-app.com'; // Set the SMTP server to send through $this->mail->Host = 'mail.ilink-app.com'; // Set the SMTP server to send through
$this->mail->SMTPAuth = true; // Enable SMTP authentication $this->mail->SMTPAuth = true; // Enable SMTP authentication
$this->mail->Username = 'noreply@ilink-app.com'; // SMTP username $this->mail->Username = 'noreply@ilink-app.com'; // SMTP username
$this->mail->Password = 'ilink2017GA'; // SMTP password $this->mail->Password = 'Reply@iLink2022@@@'; // SMTP password
$this->mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged $this->mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
$this->mail->Port = 587; $this->mail->Port = 587;
$this->mail->CharSet = 'UTF-8'; $this->mail->CharSet = 'UTF-8';