+ Send QR code to email when new simple user register

This commit is contained in:
Djery-Tom 2022-01-24 11:58:10 +01:00
parent 88616dc4ce
commit 19bd44b003
1 changed files with 33 additions and 16 deletions

View File

@ -443,7 +443,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 +461,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);
@ -985,23 +986,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['agentId'];
$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 {