src/Controller/PersonCivilController.php line 49

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\PersonCivil;
  4. use App\Entity\Application;
  5. use App\Entity\CheckQr;
  6. use App\Entity\Device;
  7. use App\Entity\PersonAppIdentity;
  8. use App\Entity\PersonAuthHistory;
  9. use App\Form\PersonCivilType;
  10. use App\Repository\ApplicationRepository;
  11. use App\Repository\PersonAuthHistoryRepository;
  12. use App\Repository\PersonRepository;
  13. use App\Repository\PersonCivilRepository;
  14. use App\Repository\CheckQrRepository;
  15. use App\Repository\PersonAppIdentityRepository;
  16. use App\Repository\DeviceRepository;
  17. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  18. use Symfony\Component\HttpFoundation\Request;
  19. use Symfony\Component\HttpFoundation\Response;
  20. use Symfony\Component\HttpFoundation\JsonResponse;
  21. use Symfony\Component\Routing\Annotation\Route;
  22. use Symfony\Component\String\Slugger\SluggerInterface;
  23. use Psr\Container\ContainerInterface;
  24. use Symfony\Component\Filesystem\Filesystem;
  25. use App\API\SqrApi as SqrApi;
  26. use Google\Auth\Credentials\ServiceAccountCredentials;
  27. Use Google\Auth\HttpHandler\HttpHandlerFactory;
  28. /**
  29.  * @Route("/person/civil")
  30.  */
  31. class PersonCivilController extends AbstractController
  32. {
  33.     /**
  34.      * @Route("/", name="app_person_civil_index", methods={"GET"})
  35.      */
  36.     public function index(PersonCivilRepository $personCivilRepository): Response
  37.     {
  38.         return $this->render('person_civil/index.html.twig', [
  39.             'person_civils' => $personCivilRepository->findAll(),
  40.         ]);
  41.     }
  42.     
  43.     /**
  44.      * @Route("/get/IDO/info", name="app_person_civil_ido_get_json", methods={"GET", "POST"})
  45.      */
  46.     public function indexJson(Request $requestPersonCivilRepository $personCivilRepository): Response
  47.     {
  48.         $referenceUser $request->get('referenceUser'); 
  49.         $action = empty($request->get('action'))? "IDO" $request->get('action'); // IDO, EMAIL, PHONE default IDO
  50.         
  51.         if(!empty($referenceUser))
  52.         {
  53.             switch ($action)
  54.             {
  55.                 case 'IDO':
  56.                     $personCivil $personCivilRepository->findOneBySqr($referenceUser); //OK
  57.                     break;
  58.                 case 'EMAIL':
  59.                     $personCivil $personCivilRepository->findOneBy(['email'=>$referenceUser]); //OK
  60.                     break;
  61.                 case 'PHONE':
  62.                     $personCivil $personCivilRepository->findOneBy(['phone'=>$referenceUser]); //OK
  63.                     break;
  64.                 case 'NOMS':
  65.                     $personCivil $personCivilRepository->findOneBy(['firstName'=>$referenceUser]); // OK
  66.                     break;
  67.                 /*case 'IDA':
  68.                     $personCivil = $personCivilRepository->findOneBy(['phone'=>$referenceUser]); // NOK
  69.                     break;
  70.                 case 'PSEUDO':
  71.                     $personCivil = $personCivilRepository->findOneBy(['phone'=>$referenceUser]); // NOK
  72.                     break;*/
  73.                 default:
  74.                     # code...
  75.                     break;
  76.             }
  77.             if($personCivil)
  78.             {
  79.                 $userDta [] =  
  80.                 [
  81.                     'civility'=>$personCivil->getCivility(),
  82.                     'abisIdentificationJson'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->getAbisIdentificationJson(),
  83.                     'firstName'=>$personCivil->getFirstName(),
  84.                     'lastName'=>$personCivil->getLastName(),
  85.                     'dateOfBirth'=>$personCivil->getDateOfBirth()->format("d/m/Y"),
  86.                     'placeOfBirth'=>$personCivil->getPlaceOfBirth(),
  87.                     'email'=>$personCivil->getEmail(),
  88.                     'phone'=>$personCivil->getPhone(),
  89.                     'typeOfIdentificationDocument'=>$personCivil->getTypeOfIdentificationDocument(),
  90.                     'identificationDocumentNumber'=>$personCivil->getIdentificationDocumentNumber(),
  91.                     'dateOfIssue'=>$personCivil->getDateOfIssue(),
  92.                     'dateOfExpirationIssue'=>$personCivil->getDateOfExpirationIssue(),
  93.                     'dateOfProrogation'=>$personCivil->getDateOfProrogation(),
  94.                     'dateOfExpirationProrogation'=>$personCivil->getDateOfExpirationProrogation(),
  95.                     'dateCreated'=>$personCivil->getDateCreated()->format("d/m/Y H:i:s"),
  96.                     'selfie_link'=>"uploads/kyvala/enrolment/".$personCivil->getCheckQr()->getPersonBiometrics()[0]->getFace(),
  97.                     'signature_link'=>"uploads/kyvala/enrolment/".$personCivil->getSignature(),
  98.                     'officeStamp_link'=>"uploads/kyvala/enrolment/".$personCivil->getOfficeStamp(),
  99.                     'nominativeStamp_link'=>"uploads/kyvala/enrolment/".$personCivil->getNominativeStamp(),
  100.                     'officeStampAndSignature_link'=>"uploads/kyvala/enrolment/".$personCivil->getOfficeStampAndSignature(),
  101.                     'nominativeStampAndSignature_link'=>"uploads/kyvala/enrolment/".$personCivil->getNominativeStampAndSignature(),
  102.                     'initials_link'=>"uploads/kyvala/enrolment/".$personCivil->getInitials(),
  103.                     'IDO'=>$personCivil->getCheckQr()->getNumero(),
  104.                     'isEnrolled'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->isIsEnrolled(),
  105.                     'isDoublon'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->isIsDoublon(),
  106.                     'abisEncounterId'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->getAbisEncounterId(),
  107.                     'isPouceGauche'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->isPouceGauche(),
  108.                     'isPouceDroit'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->isPouceDroit(),
  109.                     'isIndexDroit'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->isIndexDroit(),
  110.                     'isIndexGauche'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->isIndexGauche(),
  111.                     'isMajeurDroit'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->isMajeurDroit(),
  112.                     'isMajeurGauche'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->isMajeurGauche(),
  113.                     'isAnnulaireDroit'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->isAnnulaireDroit(),
  114.                     'isAnnulaireGauche'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->isAnnulaireGauche(),
  115.                     'isAuriculaireGauche'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->isAuriculaireGauche(),
  116.                     'isAuriculaireDroit'=>$personCivil->getCheckQr()->getPersonBiometrics()[0]->isAuriculaireDroit(),
  117.                 ];
  118.                 $return = array(
  119.                     'Etat' =>'SUCCESS' 
  120.                     'Message' =>"Utilisateur retrouvé avec succès"
  121.                     'userData'=>$userDta
  122.                 );
  123.             }else
  124.             {
  125.                 $return = array(
  126.                     'Etat' =>'FAILED' 
  127.                     'Message' =>"L'identifiant ne correspond à aucun utilisateur..."
  128.                 );
  129.             }
  130.             /*
  131.             $person = $personRepository->findOneBySqr($referenceUser);
  132.             if($person)
  133.             {
  134.                 $personCivils = $personCivilRepository->findBy(['person'=>$person]);
  135.                 if ($personCivils) 
  136.                 {
  137.                     $tabEnrol = [];
  138.                     foreach ($personCivils as $key) 
  139.                     {
  140.                         $tabEnrol [] = 
  141.                         [
  142.                             'civility'=>$key->getCivility(),
  143.                             'firstName'=>$key->getFirstName(),
  144.                             'lastName'=>$key->getLastName(),
  145.                             'dateOfBirth'=>$key->getDateOfBirth()->format("d/m/Y"),
  146.                             'placeOfBirth'=>$key->getPlaceOfBirth(),
  147.                             'email'=>$key->getEmail(),
  148.                             'phone'=>$key->getPhone(),                                                                                                                                                                                                                                                                                                                                                                
  149.                             'typeOfIdentificationDocument'=>$key->getTypeOfIdentificationDocument(),
  150.                             'identificationDocumentNumber'=>$key->getIdentificationDocumentNumber(),
  151.                             'dateOfIssue'=>$key->getDateOfIssue(),
  152.                             'dateOfExpirationIssue'=>$key->getDateOfExpirationIssue(),
  153.                             'dateOfProrogation'=>$key->getDateOfProrogation(),
  154.                             'dateOfExpirationProrogation'=>$key->getDateOfExpirationProrogation(),
  155.                             'dateCreated'=>$key->getDateCreated()->format("d/m/Y H:i:s"),
  156.                             'referenceKyvala'=>$key->getCheckQr()->getNumero()
  157.                         ];
  158.                     }
  159.                     $return = array(
  160.                         'Etat' =>'SUCCESS' , 
  161.                         'Message' =>count($personCivils). " enregistrement recupérés avec succès...", 
  162.                         'enrolement'=>$tabEnrol
  163.                     );
  164.                     
  165.                 }else
  166.                 {
  167.                     $return = array(
  168.                         'Etat' =>'FAILED' , 
  169.                         'Message' =>"Aucun enregistrement disponible pour cet utilisateur...", 
  170.                     );
  171.                 }
  172.                 
  173.             }else
  174.             {
  175.                 $return = array(
  176.                     'Etat' =>'FAILED' , 
  177.                     'Message' =>"Aucun utilisateur retrouvé avec cet identifiant...", 
  178.                 );
  179.             }*/
  180.         }else
  181.         {
  182.             $return = array(
  183.                 'Etat' =>'FAILED' 
  184.                 'Message' =>"Paramètres requis manquants.."
  185.             );
  186.         }  
  187.         
  188.        return new JsonResponse($return);
  189.     }
  190.     /*Fonction permettant de vérifier l'existance d'utilisateur dans la table personAppIdentity avec la clé d'un projet et l'email et le num tel */
  191.     /**
  192.      * @Route("/user/person/app/identity/check", name="app_person_civil_check_user_identity", methods={"GET", "POST"})
  193.      */
  194.     public function checkUserIdentityJson(Request $requestPersonAppIdentityRepository $personAppIdentityRepositoryApplicationRepository $applicationRepository): Response
  195.     {
  196.         if($_POST)
  197.         {
  198.             $appKey $request->get("app_key");
  199.             $email $request->get("email");
  200.             $telephone $request->get("telephone");
  201.             //$pivot = $request->get("pivot");//TOKEN TELEPHONE EMAIL
  202.             if(!empty($email) && !empty($appKey) && !empty($telephone)) 
  203.             {
  204.                 $application $applicationRepository->findOneBy(['applicationPass'=>$appKey]);
  205.                 if($application)
  206.                 {
  207.                     $personAppIdTelephone $personAppIdentityRepository->findOneBy(['telephone'=>$telephone'application'=>$application]);
  208.                     $personAppIdEmail $personAppIdentityRepository->findOneBy(['email'=>$email'application'=>$application]);
  209.                     
  210.                     if(!empty($personAppIdTelephone) || !empty($personAppIdEmail))
  211.                     {
  212.                         $return = array(
  213.                             'Etat' =>'SUCCESS',
  214.                             'Message' =>'Utilisateur retrouvé avec succès',
  215.                         );
  216.                     }else
  217.                     {
  218.                         $return = array(
  219.                             'Etat' =>'CORRECT'
  220.                             'Message' =>"Utilisateur introuvable. Veuillez procéder à l'enrôlement..."
  221.                         );
  222.                     }
  223.                 }else
  224.                 {
  225.                     $return = array(
  226.                         'Etat' =>'FAILED' 
  227.                         'Message' =>"Vous n'avez pas l'autorisation pour cette requette"
  228.                     );
  229.                 }
  230.             }else
  231.             {
  232.                 $return = array(
  233.                     'Etat' =>'FAILED' 
  234.                     'Message' =>"Paramètres requis manquants"
  235.                 );
  236.             }
  237.         }else
  238.         {
  239.             $return = array(
  240.                 'Etat' =>'FAILED' 
  241.                 'Message' =>"La méthode d'envoie ne correspond pas aux attentes"
  242.             );
  243.         }
  244.         
  245.        return new JsonResponse($return);
  246.     }
  247.     /*Fonction permettant à un utilisateur de s'authentifier par le biais de son telephone, email ou son token*/
  248.     /**
  249.      * @Route("/check/user/token/json", name="app_person_civil_check_user_token", methods={"GET", "POST"})
  250.      */
  251.     public function checkUserTokenJson(Request $requestPersonAppIdentityRepository $personAppIdentityRepositoryDeviceRepository $deviceRepositoryContainerInterface $container,CheckQrRepository $checkQrRepositoryPersonAuthHistoryRepository $personAuthHistoryRepositoryApplicationRepository $applicationRepository): Response
  252.     {
  253.         if($_POST)
  254.         {
  255.             $appKey $request->get("app_key");
  256.             $login $request->get("login");
  257.             $pivot $request->get("pivot");//TOKEN TELEPHONE EMAIL IDO
  258.             $pin $request->get("pin");
  259.             $deviceId $request->get("deviceId");
  260.             $token $request->get("deviceToken");
  261.             $batteryState $request->get("batteryState");
  262.             $isBatteryPlugIn $request->get("isBatteryPlugIn");
  263.             $package $request->get("packageName");
  264.             $version $request->get("appVersion");
  265.             $appLongitude $request->get("appLongitude");
  266.             $appLatitude $request->get("appLatitude");
  267.             $source $request->get("source");
  268.             $fs = new Filesystem();
  269.             //$fs->appendToFile('EventLogFiles.txt', "\r\n ".json_encode($error));
  270.             $fs->appendToFile('identyLog.txt'"\r\n ".date("d-m-Y H:i:s").' : '.json_encode($_POST));
  271.             
  272.             if(!empty($login) && !empty($appKey) && !empty($pivot)) 
  273.             {
  274.                 $application $applicationRepository->findOneBy(['applicationPass'=>$appKey]);
  275.                 if($application)
  276.                 {
  277.                     $fs = new Filesystem();
  278.                     //$fs->appendToFile('EventLogFiles.txt', "\r\n ".json_encode($error));
  279.                     $fs->appendToFile('EventLogFilesConnect.txt'"\r\n ".date("d-m-Y H:i:s").' : '.json_encode($_POST));
  280.                     switch ($pivot)
  281.                     {
  282.                         case 'TOKEN':                           
  283.                             $personAppId $personAppIdentityRepository->findOneBy(['token'=>$login'application'=>$application]);
  284.                             break;
  285.                         case 'TELEPHONE':
  286.                             $personAppId $personAppIdentityRepository->findOneBy(['telephone'=>$login'application'=>$application]);
  287.                             break;
  288.                         case 'EMAIL':
  289.                             $personAppId $personAppIdentityRepository->findOneBy(['email'=>$login'application'=>$application]);
  290.                             break;                        
  291.                         case 'IDO':
  292.                             // working here
  293.                             $qr $checkQrRepository->findOneBy(['numero'=>$login]);
  294.                             if($qr)
  295.                             {
  296.                                 $personAppId $personAppIdentityRepository->findOneBy(['userReference'=>$qr'application'=>$application]);
  297.                                 // si l'utilisateur n'est pas encore enregistré dans la table de connexion AppPersonIdentity, on le crée
  298.                                 if(empty($personAppId))
  299.                                 {
  300.                                     if($source != "WEB")
  301.                                     {
  302.                                         // device infos persist   
  303.                                         $device = new Device();
  304.                                         $device->setDeviceInfo($deviceId);
  305.                                         $device->setDeviceToken($token);
  306.                                         $device->setGpsLatitude($appLatitude);
  307.                                         $device->setGpsLongitude($appLongitude);
  308.                                         $device->setBatteryState($batteryState);
  309.                                         $device->setIsBatteryPlugIn($isBatteryPlugIn);
  310.                                         $device->setPackage($package);
  311.                                         $device->setAppVersion($version);
  312.                                         $deviceRepository->add($devicefalse);
  313.                                     }
  314.                                     
  315.                                     $personAppId = new PersonAppIdentity();
  316.                                     $personAppId->setApplication($application);
  317.                                     $personAppId->setTelephone($qr->getPersonCivil()[0]->getPhone());
  318.                                     $personAppId->setEmail($qr->getPersonCivil()[0]->getEmail());
  319.                                     $personAppId->setPin($pin);
  320.                                     $personAppId->setUserReference($qr);
  321.                                     if($source != "WEB")
  322.                                     {   
  323.                                         $personAppId->setToken($token);       
  324.                                         $personAppId->setDevice($device);
  325.                                     }
  326.                                     
  327.                                     // method to flush
  328.                                     $personAppIdentityRepository->add($personAppIdfalse);
  329.                                 }
  330.                                 
  331.                             }else
  332.                             {
  333.                                 $return = array(
  334.                                     'Etat' =>'FAILED' 
  335.                                     'Message' =>"L'IDO ne correspond à aucun utilisateur..."
  336.                                 );
  337.                             }
  338.                             
  339.                             break;  
  340.                         default:
  341.                             $return = array(
  342.                                 'Etat' =>'FAILED' 
  343.                                 'Message' =>"Le PIVOT ne correspond à aucune option disponible..."
  344.                             );
  345.                             return new JsonResponse($return);
  346.                             break;
  347.                     }
  348.                     
  349.                     if(!empty($personAppId))
  350.                     {
  351.                         $cle $this->getParameter('api_key');
  352.                         $piece 'User login';
  353.                         $proprietaire $personAppId->getUserReference()->getPersonCivil()[0]->fullName();
  354.                     
  355.                         $post = array(
  356.                             'cle' => $cle,
  357.                             'pieceqr'=> $piece
  358.                             'proprietaire' => $proprietaire
  359.                         );
  360.                         
  361.                         $api = new SqrApi($container);
  362.                         $res $api->callAPI($post);
  363.                         //dump($res);die;
  364.                         if($res[0])
  365.                         {
  366.                             $qr $res[0]->qr;
  367.                             $num $res[0]->niu;
  368.                             
  369.                             $checkqr = new CheckQr();
  370.                             $checkqr->setLibelle($qr);
  371.                             $checkqr->setNumero($num);
  372.                             //$checkqr->setChemin($newname);
  373.                     
  374.                             // method to flush
  375.                             $checkQrRepository ->add($checkqrfalse);
  376.                             //$personRepository->add($person, true);
  377.                         
  378.                             //////////////////////////////////////////////////////////////
  379.                             try 
  380.                             {
  381.                                 if($source != "WEB")
  382.                                 {   
  383.                                     // device infos persist   
  384.                                     $device = new Device();
  385.                                     $device->setDeviceInfo($deviceId);
  386.                                     $device->setDeviceToken($token);
  387.                                     $device->setGpsLatitude($appLatitude);
  388.                                     $device->setGpsLongitude($appLongitude);
  389.                                     $device->setBatteryState($batteryState);
  390.                                     $device->setIsBatteryPlugIn($isBatteryPlugIn);
  391.                                     $device->setPackage($package);
  392.                                     $device->setAppVersion($version);
  393.                                     $deviceRepository->add($devicefalse);
  394.                                 
  395.                                     //on met à jour le token.
  396.                                     $personAppId->setToken($token);
  397.                                 } 
  398.                                 $personAppIdentityRepository->add($personAppIdfalse);
  399.                                 $personAuthHistory = new PersonAuthHistory();
  400.                                 
  401.                                 $personAuthHistory->setPersonAppIdentity($personAppId);
  402.                                 $personAuthHistory->setCheckQr($checkqr);
  403.                                 if($source != "WEB")
  404.                                 {   
  405.                                     $personAuthHistory->setDevice($device);
  406.                                 }
  407.                                 $personAuthHistory->setPivot($pivot);
  408.                                 $personAuthHistory->setLogin($login);
  409.                                 $personAuthHistoryRepository->add($personAuthHistorytrue);
  410.                                 
  411.                                 $return = array(
  412.                                     'Etat' =>'SUCCESS',
  413.                                     'Message' =>'Utilisateur retrouvé avec succès',
  414.                                     'nom'=>$personAppId->getUserReference()->getPersonCivil()[0]->getFirstName(),
  415.                                     'prenom'=>$personAppId->getUserReference()->getPersonCivil()[0]->getLastName(),
  416.                                     'selfie_link'=>"uploads/kyvala/enrolment/".$personAppId->getUserReference()->getPersonBiometrics()[0]->getFace(),
  417.                                     'signature_link'=>"uploads/kyvala/enrolment/".$personAppId->getUserReference()->getPersonCivil()[0]->getSignature(),
  418.                                     'IDO'=>$personAppId->getUserReference()->getNumero(),
  419.                                     'isPouceGauche'=>$personAppId->getUserReference()->getPersonBiometrics()[0]->isPouceGauche(),
  420.                                     'isPouceDroit'=>$personAppId->getUserReference()->getPersonBiometrics()[0]->isPouceDroit(),
  421.                                     'isIndexDroit'=>$personAppId->getUserReference()->getPersonBiometrics()[0]->isIndexDroit(),
  422.                                     'isIndexGauche'=>$personAppId->getUserReference()->getPersonBiometrics()[0]->isIndexGauche(),
  423.                                     'isMajeurDroit'=>$personAppId->getUserReference()->getPersonBiometrics()[0]->isMajeurDroit(),
  424.                                     'isMajeurGauche'=>$personAppId->getUserReference()->getPersonBiometrics()[0]->isMajeurGauche(),
  425.                                     'isAnnulaireDroit'=>$personAppId->getUserReference()->getPersonBiometrics()[0]->isAnnulaireDroit(),
  426.                                     'isAnnulaireGauche'=>$personAppId->getUserReference()->getPersonBiometrics()[0]->isAnnulaireGauche(),
  427.                                     'isAuriculaireGauche'=>$personAppId->getUserReference()->getPersonBiometrics()[0]->isAuriculaireGauche(),
  428.                                     'isAuriculaireDroit'=>$personAppId->getUserReference()->getPersonBiometrics()[0]->isAuriculaireDroit(),
  429.                                     'sqr'=>$num,
  430.                                     'pin'=>$personAppId->getPin(),
  431.                                     //'gsDateGenerationCrypto'=>$person->getDateCreated()->format("d/m/Y h:i:s")
  432.                                     'gsDateGenerationCrypto'=>$personAppId->getUserReference()->getPersonCivil()[0]->getDateCreated()->format("d/m/Y h:i:s")
  433.                                 );
  434.                             } catch (\Throwable $error
  435.                             {
  436.                                 //not actions
  437.                                 $fs = new Filesystem();
  438.                                 //$fs->appendToFile('EventLogFiles.txt', "\r\n ".json_encode($error));
  439.                                 $fs->appendToFile('log/Connection/Exceptions/'.date("Y")."/".date("d-m-Y").'/EventLogFiles.txt'"\r\n ".date("d-m-Y H:i:s").' : '.$error);
  440.                                 $return = array(
  441.                                     'Etat' =>'FAILED' 
  442.                                     'Message' =>"Une erreur est survenue lors de l'opération. Veuillez essayer ultérieurement SVP"
  443.                                     'error'=>$error,
  444.                                 );
  445.                             }
  446.                             //////////////////////////////////////////////////////////////
  447.                             
  448.                         }else
  449.                         {
  450.                             $return = array(
  451.                                 'Etat' =>'FAILED' 
  452.                                 'Message' =>"L'API SQR n'a pas repondu. Veuillez essayer à nouveau"
  453.                             );
  454.                         }
  455.                     }else
  456.                     {
  457.                         $return = array(
  458.                             'Etat' =>'FAILED' 
  459.                             'Message' =>"Utilisateur introuvable. Veuillez vérifier votre identifiant..."
  460.                         );
  461.                     }
  462.                 }else
  463.                 {
  464.                     $return = array(
  465.                         'Etat' =>'FAILED' 
  466.                         'Message' =>"Vous n'avez pas l'autorisation pour cette requette"
  467.                     );
  468.                 }
  469.             }else
  470.             {
  471.                 $return = array(
  472.                     'Etat' =>'FAILED' 
  473.                     'Message' =>"Paramètres requis manquants ici.."
  474.                 );
  475.             }
  476.         }else
  477.         {
  478.             $return = array(
  479.                 'Etat' =>'FAILED' 
  480.                 'Message' =>"La méthode d'envoie ne correspond pas aux attentes"
  481.             );
  482.         }
  483.         
  484.        return new JsonResponse($return);
  485.     }
  486.     
  487.     /**
  488.      * @Route("/new", name="app_person_civil_new", methods={"GET", "POST"})
  489.      */
  490.     public function new(Request $requestPersonCivilRepository $personCivilRepository): Response
  491.     {
  492.         $personCivil = new PersonCivil();
  493.         $form $this->createForm(PersonCivilType::class, $personCivil);
  494.         $form->handleRequest($request);
  495.         if ($form->isSubmitted() && $form->isValid()) {
  496.             $personCivilRepository->add($personCiviltrue);
  497.             return $this->redirectToRoute('app_person_civil_index', [], Response::HTTP_SEE_OTHER);
  498.         }
  499.         return $this->renderForm('person_civil/new.html.twig', [
  500.             'person_civil' => $personCivil,
  501.             'form' => $form,
  502.         ]);
  503.     }
  504.     
  505.     /** ///save/etat/civil/data/json
  506.      * @Route("/new/json", name="app_person_civil_new_json", methods={"GET", "POST"})
  507.      */
  508.     public function newJson(Request $requestPersonCivilRepository $personCivilRepositorySluggerInterface $sluggerContainerInterface $containerCheckQrRepository $checkQrRepositoryPersonRepository $personRepositoryApplicationRepository $applicationRepositoryPersonAppIdentityRepository $personAppIdentityRepositoryDeviceRepository $deviceRepository ): Response
  509.     {        
  510.         if($_POST)
  511.         {
  512.             // device info
  513.             $deviceId $request->get("deviceId");
  514.             $token $request->get("deviceToken");
  515.             $batteryState $request->get("batteryState");
  516.             $isBatteryPlugIn $request->get("isBatteryPlugIn");
  517.             $package $request->get("packageName");
  518.             $version $request->get("appVersion");
  519.             $appLongitude $request->get("appLongitude");
  520.             $appLatitude $request->get("appLatitude");
  521.             
  522.             $personCivil = new PersonCivil();           
  523.             
  524.             $sqrRef $request->get("sqr");//référence sqr
  525.             $referenceUser $request->get("referenceUser");//référence de l'utilisateur            
  526.             
  527.             $appKey $request->get("app_key");
  528.             $pin $request->get("pin");
  529.             $civilite $request->get("civilite");
  530.             $nom $request->get("nom");
  531.             $prenom $request->get("prenom");
  532.             $dateNaissance = new \DateTime($request->get("dateNaissance"));
  533.             $lieuNaissance $request->get("lieuNaissance");
  534.             $nationalite $request->get("nationalite");
  535.             $numeroTelephone $request->get("numeroTelephone");
  536.             $adresseEmail $request->get("adresseEmail");
  537.             $typeDocumentIdentite $request->get("typeDocumentIdentite");
  538.             $numeroDocumentIdentite $request->get("numeroDocumentIdentite");
  539.             if(!empty($request->get("dateDelivrancedocument"))){
  540.                 $dateDelivrancedocument = new \DateTime($request->get("dateDelivrancedocument"));
  541.             }else{
  542.                 $dateDelivrancedocument=null;
  543.             }
  544.             if(!empty($request->get("dateExpirationDelivranceDocument"))){
  545.                 $dateExpirationDelivranceDocument = new \DateTime($request->get("dateExpirationDelivranceDocument"));
  546.             }else{
  547.                 $dateExpirationDelivranceDocument=null;
  548.             }
  549.             if(!empty($request->get("dateProrogationDocument"))){
  550.                 $dateProrogationDocument = new \DateTime($request->get("dateProrogationDocument"));
  551.             }else{
  552.                 $dateProrogationDocument=null;
  553.             }
  554.             if(!empty($request->get("dateExpirationProrogationDocument"))){
  555.                 $dateExpirationProrogationDocument = new \DateTime($request->get("dateExpirationProrogationDocument"));
  556.             }else{
  557.                 $dateExpirationProrogationDocument null;
  558.             }
  559.             
  560.             $enrolmentToken $request->get("enrolmentToken");
  561.             $enrolmentUid $request->get("enrolmentUid");
  562.             $enrolmentId $request->get("enrolmentId");
  563.             $enrolmentSource $request->get("enrolmentSource");
  564.             
  565.             $checkQr $checkQrRepository->findOneBy(['numero'=>$sqrRef]);
  566.             if($checkQr)
  567.             {
  568.                 $qrDoublon $personCivilRepository->findOneBy(['checkQr'=>$checkQr]);
  569.                 if(!$qrDoublon)
  570.                 {
  571.                     
  572.                     /** @var UploadedFile $documentIdentiteRecto */            
  573.                     $documentIdentiteRecto $request->files->get('documentIdentiteRecto');
  574.                     // this condition is needed because the 'brochure' field is not required
  575.                     // so the PDF file must be processed only when a file is uploaded
  576.                     if ($documentIdentiteRecto
  577.                     {
  578.                         $originalFilename pathinfo($documentIdentiteRecto->getClientOriginalName(), PATHINFO_FILENAME);
  579.                         // this is needed to safely include the file name as part of the URL
  580.                         $safeFilename $slugger->slug($originalFilename);
  581.                         $newFilename $safeFilename.'-'.uniqid().'.'.$documentIdentiteRecto->guessExtension();
  582.                         // Move the file to the directory where brochures are stored
  583.                         try {
  584.                             $documentIdentiteRecto->move(
  585.                                 $this->getParameter('kyvala_directory').'/'.$sqrRef,
  586.                                 $newFilename
  587.                             );
  588.                         } catch (FileException $e) {
  589.                             // ... handle exception if something happens during file upload
  590.                         }
  591.                         $personCivil->setPictureFrontOfIdentificationDocument($sqrRef.'/'.$newFilename);
  592.                     }
  593.                     /** @var UploadedFile $documentIdentiteVerso */            
  594.                     $documentIdentiteVerso $request->files->get('documentIdentiteVerso');
  595.                     // this condition is needed because the 'brochure' field is not required
  596.                     // so the PDF file must be processed only when a file is uploaded
  597.                     if ($documentIdentiteVerso
  598.                     {
  599.                         $originalFilename pathinfo($documentIdentiteVerso->getClientOriginalName(), PATHINFO_FILENAME);
  600.                         // this is needed to safely include the file name as part of the URL
  601.                         $safeFilename $slugger->slug($originalFilename);
  602.                         $newFilename $safeFilename.'-'.uniqid().'.'.$documentIdentiteVerso->guessExtension();
  603.                         // Move the file to the directory where brochures are stored
  604.                         try {
  605.                             $documentIdentiteVerso->move(
  606.                                 $this->getParameter('kyvala_directory').'/'.$sqrRef,
  607.                                 $newFilename
  608.                             );
  609.                         } catch (FileException $e) {
  610.                             // ... handle exception if something happens during file upload
  611.                         }
  612.                         $personCivil->setPictureBackOfIdentificationDocument($sqrRef.'/'.$newFilename);
  613.                     }
  614.                     
  615.                     /** @var UploadedFile $officeStampAndSignature */            
  616.                     $planLocalisation $request->files->get('planLocalisation');
  617.                     
  618.                     // this condition is needed because the 'brochure' field is not required
  619.                     // so the PDF file must be processed only when a file is uploaded
  620.                     if ($planLocalisation
  621.                     {
  622.                         $originalFilename pathinfo($planLocalisation->getClientOriginalName(), PATHINFO_FILENAME);
  623.                         // this is needed to safely include the file name as part of the URL
  624.                         $safeFilename $slugger->slug($originalFilename);
  625.                         $newFilename $safeFilename.'-'.uniqid().'.'.$planLocalisation->guessExtension();
  626.                         // Move the file to the directory where brochures are stored
  627.                         try {
  628.                             $planLocalisation->move(
  629.                                 $this->getParameter('kyvala_directory').'/'.$sqrRef,
  630.                                 $newFilename
  631.                             );
  632.                         } catch (FileException $e) {
  633.                             // ... handle exception if something happens during file upload
  634.                         }
  635.                         $personCivil->setPictureOfLocalisation($sqrRef.'/'.$newFilename);
  636.                     }
  637.                     
  638.                     /** @var UploadedFile $signature */            
  639.                     $signature $request->files->get('signature');
  640.                     // this condition is needed because the 'brochure' field is not required
  641.                     // so the PDF file must be processed only when a file is uploaded
  642.                     if ($signature)
  643.                     {
  644.                         $originalFilename pathinfo($signature->getClientOriginalName(), PATHINFO_FILENAME);
  645.                         // this is needed to safely include the file name as part of the URL
  646.                         $safeFilename $slugger->slug($originalFilename);
  647.                         $newFilename $safeFilename.'-'.uniqid().'.'.$signature->guessExtension();
  648.                         // Move the file to the directory where they must be stored
  649.                         try {
  650.                             $signature->move(
  651.                                 $this->getParameter('kyvala_directory').'/'.$sqrRef,
  652.                                 $newFilename
  653.                             );
  654.                         } catch (FileException $e
  655.                         {
  656.                             // ... handle exception if something happens during file upload
  657.                         }
  658.                         $personCivil->setSignature($sqrRef.'/'.$newFilename);
  659.                     }
  660.                     
  661.                     try
  662.                     {
  663.                         if (!empty($nom))
  664.                         {
  665.                             if(!empty($referenceUser))
  666.                             {
  667.                                 $person $personRepository->findOneBySqr($referenceUser);
  668.                                 if($person)
  669.                                 {
  670.                                     $personCivil->setPerson($person);
  671.                                 }
  672.                             }
  673.                             // On enregistre les paramètres de connexion de l'utilisateur dans la table personappidentity pour de futur connexion
  674.                             if(!empty($appKey))
  675.                             {
  676.                                 $application $applicationRepository->findOneBy(['applicationPass'=>$appKey]);
  677.                                 if($application)
  678.                                 {
  679.                                     // device infos persist   
  680.                                     $device = new Device();
  681.                                     $device->setDeviceInfo($deviceId);
  682.                                     $device->setDeviceToken($token);
  683.                                     $device->setGpsLatitude($appLatitude);
  684.                                     $device->setGpsLongitude($appLongitude);
  685.                                     $device->setBatteryState($batteryState);
  686.                                     $device->setIsBatteryPlugIn($isBatteryPlugIn);
  687.                                     $device->setPackage($package);
  688.                                     $device->setAppVersion($version);
  689.                                     $deviceRepository->add($devicefalse);
  690.                                     
  691.                                     $personAppIdentity = new PersonAppIdentity();
  692.                                     $personAppIdentity->setApplication($application);
  693.                                     $personAppIdentity->setTelephone($numeroTelephone);
  694.                                     $personAppIdentity->setEmail($adresseEmail);
  695.                                     $personAppIdentity->setPin($pin);
  696.                                     $personAppIdentity->setUserReference($checkQr);
  697.                                     $personAppIdentity->setToken($token);
  698.                                     $personAppIdentity->setDevice($device);
  699.                                     
  700.                                     // method to flush
  701.                                     $personAppIdentityRepository->add($personAppIdentityfalse);
  702.                                     
  703.                                 }else
  704.                                 {
  705.                                     $otherMsg "La clé envoyé ne correspond à aucun message";                            
  706.                                 }                      
  707.                             }
  708.                             
  709.                             $personCivil->setCivility($civilite);
  710.                             $personCivil->setFirstName($nom);
  711.                             $personCivil->setLastName($prenom);
  712.                             $personCivil->setDateOfBirth($dateNaissance);
  713.                             $personCivil->setPlaceOfBirth($lieuNaissance);
  714.                             $personCivil->setNationality($nationalite);
  715.                             $personCivil->setPhone($numeroTelephone);
  716.                             $personCivil->setEmail($adresseEmail);
  717.                             $personCivil->setTypeOfIdentificationDocument($typeDocumentIdentite);
  718.                             $personCivil->setIdentificationDocumentNumber($numeroDocumentIdentite);
  719.                             $personCivil->setDateOfIssue($dateDelivrancedocument);
  720.                             $personCivil->setDateOfExpirationIssue($dateExpirationDelivranceDocument);
  721.                             $personCivil->setDateOfProrogation($dateProrogationDocument);
  722.                             $personCivil->setDateOfExpirationProrogation($dateExpirationProrogationDocument);
  723.                             
  724.                             $personCivil->setEnrolmentUid($enrolmentUid);
  725.                             $personCivil->setEnrolmentId($enrolmentId);
  726.                             $personCivil->setEnrolmentSource($enrolmentSource);
  727.                             $personCivil->setFirebaseToken($enrolmentToken);
  728.                             $personCivil->setFirebasePlateform("MOBILE");
  729.                             $personCivil->setAdresse("");
  730.                                 
  731.                             // spécifier qu'il s'agit d'un enrolement complet
  732.                             $personCivil->setStatus(1);
  733.                             $personCivil->setCheckQr($checkQr);
  734.                                 
  735.                             // method to flush
  736.                             $personCivilRepository->add($personCiviltrue);
  737.                             $return = array(
  738.                                 'Etat' =>'SUCCESS' 
  739.                                 'Message' =>"Votre enregistrement a été effectué avec succès"
  740.                                 'transaction_id'=> $enrolmentId,
  741.                                 'transaction_uid'=> $enrolmentUid,
  742.                                 'transaction_source'=>$enrolmentSource,
  743.                                 'sqr'=>$sqrRef,
  744.                             );
  745.                             /*
  746.                             // send notification to Firebase
  747.                             if(!empty($personCivil->getFirebaseToken()))
  748.                             {
  749.                                 $this->ParamsWithSendPushNotification($personCivil->getFirebaseToken(),"Votre enrôlement",$civilite." ".$prenom." ".$nom.", Bienvenu(e) sur KYVALA ! Votre enrôlement a été effectué avec succès sous la référence SQR : ".$sqrRef.", Merci de conserver cette référence pour la suite de vos opérations");
  750.                             }
  751.                             */
  752.                         }else
  753.                         {
  754.                             $return = array(
  755.                                 'Etat' =>'FAILED' 
  756.                                 'Message' =>"Paramètres requis manquants"
  757.                             );
  758.                         }
  759.                     } catch (\Throwable $error
  760.                     {
  761.                         //not actions
  762.                         $fs = new Filesystem();
  763.                         //$fs->appendToFile('EventLogFiles.txt', "\r\n ".json_encode($error));
  764.                         $fs->appendToFile('log/Enrôlement/Exceptions/'.date("Y")."/".date("d-m-Y").'/EventLogFilesBio.txt'"\r\n ".date("d-m-Y H:i:s")." Enrollement exception : ".$error);
  765.                         $return = array(
  766.                             'Etat' =>'FAILED' 
  767.                             'Message' =>"Une erreur est survenue lors de l'opération. Veuillez essayer ultérieurement SVP"
  768.                             'error'=>$error,
  769.                         );
  770.                     }
  771.                     //////////////////////////////////////////////////////////////
  772.                 }else
  773.                 {
  774.                     $return = array(
  775.                         'Etat' =>'FAILED',
  776.                         'Message' =>"Ces informations sont déjà enregistrées dans la base de donnée sous la référence ".$sqrRef
  777.                     );
  778.                 }
  779.             }else
  780.             {
  781.                 $return = array(
  782.                     'Etat' =>'FAILED',
  783.                     'Message' =>$sqrRef"Une erreur est survenue lors de l'enregistrement, aucun enregistrement ne correspond à la référence..."
  784.                 );
  785.             }            
  786.         }else
  787.         {
  788.             $return = array(
  789.                 'Etat' =>'FAILED',
  790.                 'Message' =>"La méthode d'envoie ne correspond pas aux attentes",
  791.             );
  792.         }
  793.         
  794.         //$fs1 = new Filesystem();
  795.         //$fs1->appendToFile('log/Enrôlement/'.date("Y")."/".date("d-m-Y").'/BiometricsFiles.txt', "\r\n ".json_encode($return));
  796.        return new JsonResponse($return);
  797.     }
  798.     
  799.     /** 
  800.      * @Route("/update/signatures/files", name="app_person_civil_update_signatures", methods={"GET", "POST"})
  801.      */
  802.     public function updateSignatures(Request $requestPersonCivilRepository $personCivilRepositorySluggerInterface $slugger ): Response
  803.     {        
  804.         if($_POST)
  805.         {
  806.             // device info
  807.             $userIdo $request->get("userIdo");                   
  808.             $personIdentified $personCivilRepository->findOneBySqr($userIdo);
  809.             if($personIdentified)
  810.             {
  811.                 /** @var UploadedFile $signature */            
  812.                 $signature $request->files->get('signature');
  813.                 // this condition is needed because the 'brochure' field is not required
  814.                 // so the PDF file must be processed only when a file is uploaded
  815.                 if ($signature)
  816.                 {
  817.                     $originalFilename pathinfo($signature->getClientOriginalName(), PATHINFO_FILENAME);
  818.                     // this is needed to safely include the file name as part of the URL
  819.                     $safeFilename $slugger->slug($originalFilename);
  820.                     $newFilename $safeFilename.'-'.uniqid().'.'.$signature->guessExtension();
  821.                     // Move the file to the directory where they must be stored
  822.                     try {
  823.                         $signature->move(
  824.                             $this->getParameter('kyvala_directory').'/'.$userIdo,
  825.                             $newFilename
  826.                         );
  827.                     } catch (FileException $e
  828.                     {
  829.                         // ... handle exception if something happens during file upload
  830.                     }
  831.                     $personIdentified->setSignature($userIdo.'/'.$newFilename);
  832.                 }
  833.                 /** @var UploadedFile $officeStamp */            
  834.                 $officeStamp $request->files->get('officeStamp');
  835.                 // this condition is needed because the 'brochure' field is not required
  836.                 // so the PDF file must be processed only when a file is uploaded
  837.                 if ($officeStamp
  838.                 {
  839.                     $originalFilename pathinfo($officeStamp->getClientOriginalName(), PATHINFO_FILENAME);
  840.                     // this is needed to safely include the file name as part of the URL
  841.                     $safeFilename $slugger->slug($originalFilename);
  842.                     $newFilename $safeFilename.'-'.uniqid().'.'.$officeStamp->guessExtension();
  843.                     // Move the file to the directory where brochures are stored
  844.                     try {
  845.                         $officeStamp->move(
  846.                             $this->getParameter('kyvala_directory').'/'.$userIdo,
  847.                             $newFilename
  848.                         );
  849.                     } catch (FileException $e) {
  850.                         // ... handle exception if something happens during file upload
  851.                     }
  852.                     $personIdentified->setOfficeStamp($userIdo.'/'.$newFilename);
  853.                 }
  854.                 /** @var UploadedFile $nominativeStamp */            
  855.                 $nominativeStamp $request->files->get('nominativeStamp');
  856.                 // this condition is needed because the 'brochure' field is not required
  857.                 // so the PDF file must be processed only when a file is uploaded
  858.                 if ($nominativeStamp
  859.                 {
  860.                     $originalFilename pathinfo($nominativeStamp->getClientOriginalName(), PATHINFO_FILENAME);
  861.                     // this is needed to safely include the file name as part of the URL
  862.                     $safeFilename $slugger->slug($originalFilename);
  863.                     $newFilename $safeFilename.'-'.uniqid().'.'.$nominativeStamp->guessExtension();
  864.                     // Move the file to the directory where brochures are stored
  865.                     try {
  866.                         $nominativeStamp->move(
  867.                             $this->getParameter('kyvala_directory').'/'.$userIdo,
  868.                             $newFilename
  869.                         );
  870.                     } catch (FileException $e) {
  871.                         // ... handle exception if something happens during file upload
  872.                     }
  873.                     $personIdentified->setNominativeStamp($userIdo.'/'.$newFilename);
  874.                 }
  875.                 
  876.                 /** @var UploadedFile $officeStampAndSignature */            
  877.                 $officeStampAndSignature $request->files->get('officeStampAndSignature');
  878.                 
  879.                 // this condition is needed because the 'brochure' field is not required
  880.                 // so the PDF file must be processed only when a file is uploaded
  881.                 if ($officeStampAndSignature
  882.                 {
  883.                     $originalFilename pathinfo($officeStampAndSignature->getClientOriginalName(), PATHINFO_FILENAME);
  884.                     // this is needed to safely include the file name as part of the URL
  885.                     $safeFilename $slugger->slug($originalFilename);
  886.                     $newFilename $safeFilename.'-'.uniqid().'.'.$officeStampAndSignature->guessExtension();
  887.                     // Move the file to the directory where brochures are stored
  888.                     try {
  889.                         $officeStampAndSignature->move(
  890.                             $this->getParameter('kyvala_directory').'/'.$userIdo,
  891.                             $newFilename
  892.                         );
  893.                     } catch (FileException $e) {
  894.                         // ... handle exception if something happens during file upload
  895.                     }
  896.                     $personIdentified->setOfficeStampAndSignature($userIdo.'/'.$newFilename);
  897.                 }
  898.                 
  899.                 /** @var UploadedFile $nominativeStampAndSignature */            
  900.                 $nominativeStampAndSignature $request->files->get('nominativeStampAndSignature');
  901.                 
  902.                 // this condition is needed because the 'brochure' field is not required
  903.                 // so the PDF file must be processed only when a file is uploaded
  904.                 if ($nominativeStampAndSignature
  905.                 {
  906.                     $originalFilename pathinfo($nominativeStampAndSignature->getClientOriginalName(), PATHINFO_FILENAME);
  907.                     // this is needed to safely include the file name as part of the URL
  908.                     $safeFilename $slugger->slug($originalFilename);
  909.                     $newFilename $safeFilename.'-'.uniqid().'.'.$nominativeStampAndSignature->guessExtension();
  910.                     // Move the file to the directory where brochures are stored
  911.                     try {
  912.                         $nominativeStampAndSignature->move(
  913.                             $this->getParameter('kyvala_directory').'/'.$userIdo,
  914.                             $newFilename
  915.                         );
  916.                     } catch (FileException $e) {
  917.                         // ... handle exception if something happens during file upload
  918.                     }
  919.                     $personIdentified->setNominativeStampAndSignature($userIdo.'/'.$newFilename);
  920.                 }                    
  921.                 
  922.                 /** @var UploadedFile $initials */            
  923.                 $initials $request->files->get('initials');
  924.                 
  925.                 // this condition is needed because the 'brochure' field is not required
  926.                 // so the PDF file must be processed only when a file is uploaded
  927.                 if ($initials
  928.                 {
  929.                     $originalFilename pathinfo($initials->getClientOriginalName(), PATHINFO_FILENAME);
  930.                     // this is needed to safely include the file name as part of the URL
  931.                     $safeFilename $slugger->slug($originalFilename);
  932.                     $newFilename $safeFilename.'-'.uniqid().'.'.$initials->guessExtension();
  933.                     // Move the file to the directory where brochures are stored
  934.                     try {
  935.                         $initials->move(
  936.                             $this->getParameter('kyvala_directory').'/'.$userIdo,
  937.                             $newFilename
  938.                         );
  939.                     } catch (FileException $e) {
  940.                         // ... handle exception if something happens during file upload
  941.                     }
  942.                     $personIdentified->setInitials($userIdo.'/'.$newFilename);
  943.                 }
  944.                  // method to flush
  945.                 $personCivilRepository->add($personIdentifiedtrue);
  946.                 $return = array(
  947.                     'Etat' =>'SUCCESS' 
  948.                     'Message' =>"Vos informations ont été modifié avec succès"
  949.                     'ido'=>$userIdo,
  950.                     'signature_link'=>empty($personIdentified->getSignature()) ? null "uploads/kyvala/enrolment/".$personIdentified->getSignature() ,
  951.                     'officeStamp_link'=>empty($personIdentified->getOfficeStamp()) ? null  "uploads/kyvala/enrolment/".$personIdentified->getOfficeStamp(),
  952.                     'nominativeStamp_link'=>empty($personIdentified->getNominativeStamp()) ? null "uploads/kyvala/enrolment/".$personIdentified->getNominativeStamp(),
  953.                     'officeStampAndSignature_link'=>empty($personIdentified->getOfficeStampAndSignature()) ? null "uploads/kyvala/enrolment/".$personIdentified->getOfficeStampAndSignature(),
  954.                     'nominativeStampAndSignature_link'=>empty($personIdentified->getNominativeStampAndSignature()) ? null "uploads/kyvala/enrolment/".$personIdentified->getNominativeStampAndSignature(),
  955.                     'initials_link'=>empty($personIdentified->getInitials()) ? null "uploads/kyvala/enrolment/".$personIdentified->getInitials(),
  956.                 );
  957.                     
  958.             /*
  959.                 } catch (\Throwable $error) 
  960.                 {
  961.                     //not actions
  962.                     $fs = new Filesystem();
  963.                     //$fs->appendToFile('EventLogFiles.txt', "\r\n ".json_encode($error));
  964.                     $fs->appendToFile('log/Enrôlement/Exceptions/'.date("Y")."/".date("d-m-Y").'/EventLogFilesBio.txt', "\r\n ".date("d-m-Y H:i:s")." Enrollement exception : ".$error);
  965.                     $return = array(
  966.                         'Etat' =>'FAILED' , 
  967.                         'Message' =>"Une erreur est survenue lors de l'opération. Veuillez essayer ultérieurement SVP", 
  968.                         'error'=>$error,
  969.                     );
  970.                 }*/
  971.                 
  972.             }else
  973.             {
  974.                 $return = array(
  975.                     'Etat' =>'FAILED' 
  976.                     'Message' =>"Cet IDO n'est associé à aucun individu enrolé. Veuillez vérifier et essayer à nouveau"
  977.                 );
  978.             }     
  979.         }else
  980.         {
  981.             $return = array(
  982.                 'Etat' =>'FAILED',
  983.                 'Message' =>"La méthode d'envoie ne correspond pas aux attentes",
  984.             );
  985.         }
  986.         
  987.         //$fs1 = new Filesystem();
  988.         //$fs1->appendToFile('log/Enrôlement/'.date("Y")."/".date("d-m-Y").'/BiometricsFiles.txt', "\r\n ".json_encode($return));
  989.        return new JsonResponse($return);
  990.     }
  991.     /**
  992.      * @Route("/save/user/from/ido/json", name="app_person_civil_save_from_ido", methods={"GET", "POST"})
  993.      */
  994.     public function newUserFromIDOJson(Request $requestPersonCivilRepository $personCivilRepositorySluggerInterface $sluggerContainerInterface $containerCheckQrRepository $checkQrRepositoryPersonRepository $personRepositoryApplicationRepository $applicationRepositoryPersonAppIdentityRepository $personAppIdentityRepositoryDeviceRepository $deviceRepository ): Response
  995.     {        
  996.         if($_POST)
  997.         {
  998.             // device info
  999.             $deviceId $request->get("deviceId");
  1000.             $token $request->get("deviceToken");
  1001.             $batteryState $request->get("batteryState");
  1002.             $isBatteryPlugIn $request->get("isBatteryPlugIn");
  1003.             $package $request->get("packageName");
  1004.             $version $request->get("appVersion");
  1005.             $appLongitude $request->get("appLongitude");
  1006.             $appLatitude $request->get("appLatitude");
  1007.             //user info
  1008.             $appKey $request->get("app_key");
  1009.             $telephone $request->get("telephone");
  1010.             $email $request->get("email");
  1011.             $pin $request->get("pin");
  1012.             $ido $request->get("ido");
  1013.             
  1014.             $checkQr $checkQrRepository->findOneBy(['numero'=>$ido]);
  1015.             if($checkQr)
  1016.             {
  1017.                 if (!empty($appKey) &&  !empty($telephone) && !empty($pin)  && !empty($email))
  1018.                 {
  1019.                     // On enregistre les paramètres de connexion de l'utilisateur dans la table personappidentity pour de futur connexion
  1020.                     if(!empty($appKey))
  1021.                     {
  1022.                         $application $applicationRepository->findOneBy(['applicationPass'=>$appKey]);
  1023.                         if($application)
  1024.                         {
  1025.                             $personAppI $personAppIdentityRepository->findOneBy(['application'=>$application'telephone'=>$telephone'email'=>$email'userReference'=>$checkQr]);
  1026.                            
  1027.                             if(empty($personAppI))
  1028.                             {
  1029.                                   // device infos persist  
  1030.                                 $device = new Device();
  1031.                                 $device->setDeviceInfo($deviceId);
  1032.                                 $device->setDeviceToken($token);
  1033.                                 $device->setGpsLatitude($appLatitude);
  1034.                                 $device->setGpsLongitude($appLongitude);
  1035.                                 $device->setBatteryState($batteryState);
  1036.                                 $device->setIsBatteryPlugIn($isBatteryPlugIn);
  1037.                                 $device->setPackage($package);
  1038.                                 $device->setAppVersion($version);
  1039.                                 $deviceRepository->add($devicefalse);
  1040.                                 
  1041.                                 $personAppIdentity = new PersonAppIdentity();
  1042.                                 $personAppIdentity->setApplication($application);
  1043.                                 $personAppIdentity->setTelephone($telephone);
  1044.                                 $personAppIdentity->setEmail($email);
  1045.                                 $personAppIdentity->setPin($pin);
  1046.                                 $personAppIdentity->setUserReference($checkQr);
  1047.                                 $personAppIdentity->setToken($token);
  1048.                                 $personAppIdentity->setDevice($device);
  1049.                                 
  1050.                                 // method to flush
  1051.                                 $personAppIdentityRepository->add($personAppIdentitytrue);
  1052.                                 $return = array(
  1053.                                     'Etat' =>'SUCCESS' 
  1054.                                     'Message' =>"Votre compte as été crée avec succès !!!"
  1055.                                     'IDO'=>$ido,
  1056.                                 );
  1057.                             }else{
  1058.                                 
  1059.                                 $return = array(
  1060.                                     'Etat' =>'FAILED' 
  1061.                                     'Message' =>"Un compte existe déjà avec les informations relatif à cet application, ce numéro de téléphone et cet email. !!!"
  1062.                                     'IDO'=>$ido,
  1063.                                 );
  1064.                             }
  1065.                             
  1066.                             
  1067.                         }else
  1068.                         {
  1069.                             $otherMsg "La clé d'application envoyé ne correspond à aucun projet";                            
  1070.                         }                      
  1071.                     }
  1072.                     /*
  1073.                     $return = array(
  1074.                         'Etat' =>'SUCCESS' , 
  1075.                         'Message' =>"Votre compte as été crée avec succès !!!", 
  1076.                         'IDO'=>$ido,
  1077.                     );*/
  1078.                 }else
  1079.                 {
  1080.                     $return = array(
  1081.                         'Etat' =>'FAILED' 
  1082.                         'Message' =>"Paramètres requis manquants"
  1083.                     );
  1084.                 }
  1085.             }else
  1086.             {
  1087.                 $return = array(
  1088.                     'Etat' =>'FAILED' 
  1089.                     'Message' =>$sqrRef"Une erreur est survenue lors de l'enregistrement, aucun enregistrement ne correspond à la référence IDO..."
  1090.                 );
  1091.             }
  1092.             
  1093.         }else
  1094.         {
  1095.             $return = array(
  1096.                 'Etat' =>'FAILED' 
  1097.                 'Message' =>"La méthode d'envoie ne correspond pas aux attentes"
  1098.             );
  1099.         }
  1100.         
  1101.        return new JsonResponse($return);
  1102.     }
  1103.     /**
  1104.      * @Route("/{id}", name="app_person_civil_show", methods={"GET"})
  1105.      */
  1106.     public function show(PersonCivil $personCivil): Response
  1107.     {
  1108.         return $this->render('person_civil/show.html.twig', [
  1109.             'person_civil' => $personCivil,
  1110.         ]);
  1111.     }
  1112.     /**
  1113.      * @Route("/{id}/edit", name="app_person_civil_edit", methods={"GET", "POST"})
  1114.      */
  1115.     public function edit(Request $requestPersonCivil $personCivilPersonCivilRepository $personCivilRepository): Response
  1116.     {
  1117.         $form $this->createForm(PersonCivilType::class, $personCivil);
  1118.         $form->handleRequest($request);
  1119.         if ($form->isSubmitted() && $form->isValid()) {
  1120.             $personCivilRepository->add($personCiviltrue);
  1121.             return $this->redirectToRoute('app_person_civil_index', [], Response::HTTP_SEE_OTHER);
  1122.         }
  1123.         return $this->renderForm('person_civil/edit.html.twig', [
  1124.             'person_civil' => $personCivil,
  1125.             'form' => $form,
  1126.         ]);
  1127.     }
  1128.     /**
  1129.      * @Route("/{id}", name="app_person_civil_delete", methods={"POST"})
  1130.      */
  1131.     public function delete(Request $requestPersonCivil $personCivilPersonCivilRepository $personCivilRepository): Response
  1132.     {
  1133.         if ($this->isCsrfTokenValid('delete'.$personCivil->getId(), $request->request->get('_token'))) {
  1134.             $personCivilRepository->remove($personCiviltrue);
  1135.         }
  1136.         return $this->redirectToRoute('app_person_civil_index', [], Response::HTTP_SEE_OTHER);
  1137.     }
  1138.     //notifications push avec paramètres
  1139.     public function ParamsWithSendPushNotification($user_notification_token,$title,$message)
  1140.     {
  1141.         //https://www.youtube.com/watch?v=YHniUsrmX9Y
  1142.         $fs = new Filesystem();
  1143.         $credential = new ServiceAccountCredentials(
  1144.             "https://www.googleapis.com/auth/firebase.messaging",
  1145.             json_decode(file_get_contents
  1146.             ("kyvala-45525-firebase-adminsdk-cxpp5-cf78b66d72.json"),true)
  1147.         );
  1148.         $token $credential->fetchAuthToken(HttpHandlerFactory::build());
  1149.         $accessToken $token['access_token'];
  1150.         $ch curl_init("https://fcm.googleapis.com/v1/projects/kyvala-45525/messages:send");
  1151.         curl_setopt($chCURLOPT_HTTPHEADER,[
  1152.             'Content-Type: application/json',
  1153.             'Authorization: ' 'Bearer ' .$accessToken
  1154.         ]);
  1155.         curl_setopt($chCURLOPT_POSTFIELDS'{
  1156.             "message": {
  1157.                 "token":"'.$user_notification_token.'",
  1158.                 "notification": {
  1159.                     "title":"'.$title.'",
  1160.                     "body":"'.$message.'",
  1161.                     "image":"http://poc.kyvala.com/uploads/TOKEN/Token-logo-avec-fond.png"
  1162.                 }
  1163.             }
  1164.         }');
  1165.         curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
  1166.         curl_setopt($chCURLOPT_VERBOSEtrue);
  1167.         $response curl_exec($ch);
  1168.         
  1169.         if (curl_errno($ch)) 
  1170.         {
  1171.             print "Error: " curl_error($ch);
  1172.             $fs->appendToFile('EventLogNotification.txt'"\r\n ".date("d-m-Y H:i:s")." : deviceToken :".$user_notification_token.", Title: ".$title.", Notification: ".$message.", Error:  ".json_encode(curl_error($ch)));
  1173.             exit();
  1174.         }else
  1175.         {
  1176.             $json json_decode($responsetrue);
  1177.         }
  1178.         // Show me the result
  1179.         curl_close($ch);
  1180.         //dump($season_data);
  1181.         
  1182.         $fs->appendToFile('EventLogNotification.txt'"\r\n ".date("d-m-Y H:i:s")." : DeviceToken :".$user_notification_token.", Title: ".$title.", Notification: ".$message.", Retours: ".json_encode($response));
  1183.         // return a JSON object to caller
  1184.         return $json;
  1185.     }
  1186.     public function createCryptographe(Request $requestSluggerInterface $slugger)
  1187.     {
  1188.         $sqrRef $request->get('ref');
  1189.         $nom $request->get('nom');
  1190.         $prenom $request->get('prenom');
  1191.         $telephone $request->get('telephone');
  1192.         $nationalite $request->get('nationalite');
  1193.         $dateNaiss $request->get('dateNaiss');
  1194.         $lieuNaiss $request->get('lieuNaiss');
  1195.         $email $request->get('email');
  1196.         $demog $nom.','.$prenom.','.$telephone.','.$nationalite.','.$dateNaiss.','.$lieuNaiss.','.$email;
  1197.         
  1198.         $fs = new Filesystem();
  1199.         $fs->appendToFile($this->getParameter('kyvala_directory').'/'.$sqrRef.'/demog.txt'"\r\n ".$demog);
  1200.         /** @var UploadedFile $pos1 */            
  1201.         $pos1 $request->files->get('fpr1');
  1202.         // this condition is needed because the 'brochure' field is not required
  1203.         // so the PDF file must be processed only when a file is uploaded
  1204.         if ($pos1
  1205.         {
  1206.             $originalFilename pathinfo($pos1->getClientOriginalName(), PATHINFO_FILENAME);
  1207.             // this is needed to safely include the file name as part of the URL
  1208.             $safeFilename $slugger->slug($originalFilename);
  1209.             $newFilename $safeFilename.'-'.uniqid().'.'.$pos1->guessExtension();
  1210.             //dump($newFilename);die;
  1211.             // Move the file to the directory where they must be stored
  1212.             try {
  1213.                 $pos1->move(
  1214.                     $this->getParameter('kyvala_directory').'/'.$sqrRef,
  1215.                     $newFilename
  1216.                 );
  1217.             } catch (FileException $e
  1218.             {
  1219.                 // ... handle exception if something happens during file upload
  1220.             }
  1221.             //dump($newFilename);die;
  1222.             //$img = \file_get_contents("http://my.kyvala.com/uploads/kyvala/enrolment/".$newFilename);
  1223.             $fpr1 $this->getParameter('kyvala_directory')."/".$newFilename;
  1224.         }
  1225.  
  1226.          /** @var UploadedFile $pos2 */            
  1227.          $pos2 $request->files->get('fpr2');
  1228.  
  1229.          // this condition is needed because the 'brochure' field is not required
  1230.          // so the PDF file must be processed only when a file is uploaded
  1231.          if ($pos2
  1232.          {
  1233.              $originalFilename pathinfo($pos2->getClientOriginalName(), PATHINFO_FILENAME);
  1234.              // this is needed to safely include the file name as part of the URL
  1235.              $safeFilename $slugger->slug($originalFilename);
  1236.              $newFilename $safeFilename.'-'.uniqid().'.'.$pos2->guessExtension();
  1237.  
  1238.              // Move the file to the directory where they must be stored
  1239.              try {
  1240.                  $pos2->move(
  1241.                     $this->getParameter('kyvala_directory').'/'.$sqrRef,
  1242.                      $newFilename
  1243.                  );
  1244.              } catch (FileException $e
  1245.              {
  1246.                  // ... handle exception if something happens during file upload
  1247.              }
  1248.              
  1249.             $fpr2 $this->getParameter('kyvala_directory').'/'.$sqrRef.'/'.$newFilename;
  1250.         
  1251.          }      
  1252.  
  1253.          /** @var UploadedFile $pos3 */            
  1254.          $pos3 $request->files->get('fpr3');
  1255.  
  1256.          // this condition is needed because the 'brochure' field is not required
  1257.          // so the PDF file must be processed only when a file is uploaded
  1258.          if ($pos3
  1259.          {
  1260.              $originalFilename pathinfo($pos3->getClientOriginalName(), PATHINFO_FILENAME);
  1261.              // this is needed to safely include the file name as part of the URL
  1262.              $safeFilename $slugger->slug($originalFilename);
  1263.              $newFilename $safeFilename.'-'.uniqid().'.'.$pos3->guessExtension();
  1264.  
  1265.              // Move the file to the directory where they must be stored
  1266.              try {
  1267.                  $pos3->move(
  1268.                      $this->getParameter('kyvala_directory').'/'.$sqrRef,
  1269.                      $newFilename
  1270.                  );
  1271.              } catch (FileException $e
  1272.              {
  1273.                  // ... handle exception if something happens during file upload
  1274.              }
  1275.             
  1276.             $fpr3 $this->getParameter('kyvala_directory').'/'.$sqrRef.'/'.$newFilename;
  1277.         
  1278.          }   
  1279.  
  1280.          /** @var UploadedFile $pos4 */            
  1281.          $pos4 $request->files->get('fpr4');
  1282.  
  1283.          // this condition is needed because the 'brochure' field is not required
  1284.          // so the PDF file must be processed only when a file is uploaded
  1285.          if ($pos4
  1286.          {
  1287.              $originalFilename pathinfo($pos4->getClientOriginalName(), PATHINFO_FILENAME);
  1288.              // this is needed to safely include the file name as part of the URL
  1289.              $safeFilename $slugger->slug($originalFilename);
  1290.              $newFilename $safeFilename.'-'.uniqid().'.'.$pos4->guessExtension();
  1291.  
  1292.              // Move the file to the directory where they must be stored
  1293.              try {
  1294.                  $pos4->move(
  1295.                      $this->getParameter('kyvala_directory').'/'.$sqrRef,
  1296.                      $newFilename
  1297.                  );
  1298.              } catch (FileException $e
  1299.              {
  1300.                  // ... handle exception if something happens during file upload
  1301.              }
  1302.              
  1303.             $fpr4 $this->getParameter('kyvala_directory').'/'.$sqrRef.'/'.$newFilename;
  1304.         
  1305.          }       
  1306.  
  1307.          /** @var UploadedFile $pos5 */            
  1308.          $pos5 $request->files->get('fpr5');
  1309.  
  1310.          // this condition is needed because the 'brochure' field is not required
  1311.          // so the PDF file must be processed only when a file is uploaded
  1312.          if ($pos5
  1313.          {
  1314.              $originalFilename pathinfo($pos5->getClientOriginalName(), PATHINFO_FILENAME);
  1315.              // this is needed to safely include the file name as part of the URL
  1316.              $safeFilename $slugger->slug($originalFilename);
  1317.              $newFilename $safeFilename.'-'.uniqid().'.'.$pos5->guessExtension();
  1318.  
  1319.              // Move the file to the directory where they must be stored
  1320.              try {
  1321.                  $pos5->move(
  1322.                      $this->getParameter('kyvala_directory').'/'.$sqrRef,
  1323.                      $newFilename
  1324.                  );
  1325.              } catch (FileException $e
  1326.              {
  1327.                  // ... handle exception if something happens during file upload
  1328.              }
  1329.             $fpr5 $this->getParameter('kyvala_directory').'/'.$sqrRef.'/'.$newFilename;
  1330.          }   
  1331.  
  1332.          /** @var UploadedFile $pos6 */            
  1333.          $pos6 $request->files->get('fpl1');
  1334.  
  1335.          // this condition is needed because the 'brochure' field is not required
  1336.          // so the PDF file must be processed only when a file is uploaded
  1337.          if ($pos6
  1338.          {
  1339.              $originalFilename pathinfo($pos6->getClientOriginalName(), PATHINFO_FILENAME);
  1340.              // this is needed to safely include the file name as part of the URL
  1341.              $safeFilename $slugger->slug($originalFilename);
  1342.              $newFilename $safeFilename.'-'.uniqid().'.'.$pos6->guessExtension();
  1343.  
  1344.              // Move the file to the directory where they must be stored
  1345.              try {
  1346.                  $pos6->move(
  1347.                      $this->getParameter('kyvala_directory').'/'.$sqrRef,
  1348.                      $newFilename
  1349.                  );
  1350.              } catch (FileException $e
  1351.              {
  1352.                  // ... handle exception if something happens during file upload
  1353.              }
  1354.             $fpl1 $this->getParameter('kyvala_directory').'/'.$sqrRef.'/'.$newFilename;
  1355.         
  1356.          }
  1357.  
  1358.          /** @var UploadedFile $pos7 */            
  1359.          $pos7 $request->files->get('fpl2');
  1360.  
  1361.          // this condition is needed because the 'brochure' field is not required
  1362.          // so the PDF file must be processed only when a file is uploaded
  1363.          if ($pos7
  1364.          {
  1365.              $originalFilename pathinfo($pos7->getClientOriginalName(), PATHINFO_FILENAME);
  1366.              // this is needed to safely include the file name as part of the URL
  1367.              $safeFilename $slugger->slug($originalFilename);
  1368.              $newFilename $safeFilename.'-'.uniqid().'.'.$pos7->guessExtension();
  1369.  
  1370.              // Move the file to the directory where they must be stored
  1371.              try {
  1372.                  $pos7->move(
  1373.                      $this->getParameter('kyvala_directory').'/'.$sqrRef,
  1374.                      $newFilename
  1375.                  );
  1376.              } catch (FileException $e
  1377.              {
  1378.                  // ... handle exception if something happens during file upload
  1379.              }
  1380.             
  1381.              $fpl2 $this->getParameter('kyvala_directory').'/'.$sqrRef.'/'.$newFilename;
  1382.         
  1383.          }
  1384.  
  1385.          /** @var UploadedFile $pos8 */            
  1386.          $pos8 $request->files->get('fpl3');
  1387.  
  1388.          // this condition is needed because the 'brochure' field is not required
  1389.          // so the PDF file must be processed only when a file is uploaded
  1390.          if ($pos8
  1391.          {
  1392.              $originalFilename pathinfo($pos8->getClientOriginalName(), PATHINFO_FILENAME);
  1393.              // this is needed to safely include the file name as part of the URL
  1394.              $safeFilename $slugger->slug($originalFilename);
  1395.              $newFilename $safeFilename.'-'.uniqid().'.'.$pos8->guessExtension();
  1396.  
  1397.              // Move the file to the directory where they must be stored
  1398.             try {
  1399.                  $pos8->move(
  1400.                      $this->getParameter('kyvala_directory').'/'.$sqrRef,
  1401.                      $newFilename
  1402.                  );
  1403.             } catch (FileException $e
  1404.             {
  1405.                 // ... handle exception if something happens during file upload
  1406.             }
  1407.             
  1408.             $fpl3 $this->getParameter('kyvala_directory').'/'.$sqrRef.'/'.$newFilename;
  1409.          }
  1410.  
  1411.          /** @var UploadedFile $pos9 */            
  1412.          $pos9 $request->files->get('fpl4');
  1413.  
  1414.          // this condition is needed because the 'brochure' field is not required
  1415.          // so the PDF file must be processed only when a file is uploaded
  1416.          if ($pos9
  1417.          {
  1418.              $originalFilename pathinfo($pos9->getClientOriginalName(), PATHINFO_FILENAME);
  1419.              // this is needed to safely include the file name as part of the URL
  1420.              $safeFilename $slugger->slug($originalFilename);
  1421.              $newFilename $safeFilename.'-'.uniqid().'.'.$pos9->guessExtension();
  1422.  
  1423.              // Move the file to the directory where they must be stored
  1424.             try {
  1425.                  $pos9->move(
  1426.                      $this->getParameter('kyvala_directory').'/'.$sqrRef,
  1427.                      $newFilename
  1428.                  );
  1429.             } catch (FileException $e
  1430.             {
  1431.                 // ... handle exception if something happens during file upload
  1432.             }
  1433.             $fpl4 $this->getParameter('kyvala_directory').'/'.$sqrRef.'/'.$newFilename;
  1434.          }
  1435.  
  1436.          /** @var UploadedFile $pos10 */            
  1437.          $pos10 $request->files->get('fpl5');
  1438.  
  1439.          // this condition is needed because the 'brochure' field is not required
  1440.          // so the PDF file must be processed only when a file is uploaded
  1441.          if ($pos10
  1442.          {
  1443.             $originalFilename pathinfo($pos10->getClientOriginalName(), PATHINFO_FILENAME);
  1444.             // this is needed to safely include the file name as part of the URL
  1445.             $safeFilename $slugger->slug($originalFilename);
  1446.             $newFilename $safeFilename.'-'.uniqid().'.'.$pos10->guessExtension();
  1447.             
  1448.             // Move the file to the directory where they must be stored
  1449.             try {
  1450.                  $pos10->move(
  1451.                      $this->getParameter('kyvala_directory').'/'.$sqrRef,
  1452.                      $newFilename
  1453.                  );
  1454.             } catch (FileException $e
  1455.             {
  1456.                 // ... handle exception if something happens during file upload
  1457.             }
  1458.             $fpl5 $this->getParameter('kyvala_directory').'/'.$sqrRef.'/'.$newFilename;
  1459.         }
  1460.          /** @var UploadedFile $face */            
  1461.          $face $request->files->get('face');
  1462.  
  1463.          // this condition is needed because the 'brochure' field is not required
  1464.          // so the PDF file must be processed only when a file is uploaded
  1465.         if ($face
  1466.         { 
  1467.             $originalFilename pathinfo($face->getClientOriginalName(), PATHINFO_FILENAME);
  1468.             // this is needed to safely include the file name as part of the URL
  1469.             $safeFilename $slugger->slug($originalFilename);
  1470.             $newFilename $safeFilename.'-'.uniqid().'.'.$face->guessExtension();
  1471.             
  1472.             // Move the file to the directory where they must be stored
  1473.             try {
  1474.                  $face->move(
  1475.                      $this->getParameter('kyvala_directory').'/'.$sqrRef,
  1476.                      $newFilename
  1477.                  );
  1478.             }catch (FileException $e
  1479.             {
  1480.                 //... handle exception if something happens during file upload
  1481.             }
  1482.             $face $this->getParameter('kyvala_directory').'/'.$sqrRef.'/'.$newFilename;
  1483.         }
  1484.         
  1485.         $curl curl_init();
  1486.         curl_setopt_array($curl, array(
  1487.             CURLOPT_URL => 'https://eval-idencode.tech5.tech/v1/enroll',
  1488.             CURLOPT_RETURNTRANSFER => true,
  1489.             CURLOPT_ENCODING => '',
  1490.             CURLOPT_MAXREDIRS => 10,
  1491.             CURLOPT_TIMEOUT => 0,
  1492.             CURLOPT_FOLLOWLOCATION => true,
  1493.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  1494.             CURLOPT_CUSTOMREQUEST => 'POST',
  1495.             CURLOPT_POSTFIELDS => array('face_image'=> new \CURLFILE($face),'pipeline'=> new \CURLFILE($this->getParameter('kyvala_directory').'/pipeline-with-fp-CR.txt'),'demog'=> new \CURLFILE($this->getParameter('kyvala_directory').'/'.$sqrRef.'/demog.txt'),'finger_image_r1'=> new \CURLFILE($fpr1),'finger_image_r2'=> new \CURLFILE($fpr2),'finger_image_r3'=> new \CURLFILE($fpr3),'finger_image_r4'=> new \CURLFILE($fpr4),'finger_image_r5'=> new \CURLFILE($fpr5),'finger_image_l1'=> new \CURLFILE($fpl1),'finger_image_l2'=> new \CURLFILE($fpl2),'finger_image_l3'=> new \CURLFILE($fpl3),'finger_image_l4'=> new \CURLFILE($fpl4),'finger_image_l5'=> new \CURLFILE($fpl5)),
  1496.         ));
  1497.         $response curl_exec($curl);
  1498.         //On écris le retours de la fonction dans le log
  1499.         $fs->appendToFile($this->getParameter('kyvala_directory').'/'.$sqrRef.'/cryptoGenerationLog.txt'"\r\n ".$response);
  1500.         $response json_decode($response,true);
  1501.         curl_close($curl);
  1502.         //echo $response;
  1503.         return $response;
  1504.     }
  1505. }