src/Controller/ParametrageController.php line 1299

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Doctrine\DBAL\Schema\ForeignKeyConstraint;
  7. use Doctrine\ORM\Query;
  8. use Symfony\Component\HttpFoundation\RequestStack;
  9. use Symfony\Component\HttpFoundation\Request;
  10. use Symfony\Component\HttpFoundation\Response;
  11. use Symfony\Component\HttpClient\HttpClient;
  12. use App\Controller\CommunController;
  13. use App\Entity\UserClient
  14. use App\Services\libMQTT\src\ClientMQTT;
  15. class ParametrageController extends AbstractController
  16. {
  17.    
  18.     protected $requestStack;
  19.     
  20.      public function __construct(RequestStack $requestStack)
  21.     {
  22.         $this->requestStack $requestStack;
  23.     }
  24.     
  25.     public function ParametrageListeTerminaux() {
  26.         
  27.         $idclient=null;
  28.         $request $this->requestStack->getCurrentRequest();
  29.         $clients null;
  30.         $request $this->requestStack->getCurrentRequest();
  31.         $idclient=$request->getSession()->get('idClient');
  32.         if($idclient!=null)
  33.         {
  34.              $token $request->getSession()->get('token');
  35.              $commun= new CommunController($this->requestStack,$token); 
  36.              $terminaux$commun->ListeTerminaux();    
  37.             // return new response(var_dump($terminaux));   
  38.             return $this->render('ParametrageBundle/parametragelisteterminaux.html.twig',    array('terminaux' =>  $terminaux ,'idclient' => $idclient)); 
  39.         }
  40.         else 
  41.         {
  42.             $error 'Fin de session';
  43.             $lastUsername ='';
  44.             return $this->render('LoginBundle/login.html.twig'
  45.                                     array('last_login'=> $lastUsername,
  46.                                         'error'=>$error));
  47.         }
  48.     }
  49.    
  50.  
  51.    ///***************Gestion des services***************** */
  52.     public function ParametrageServices($idTerminal) {
  53.         
  54.         $idclient=null;
  55.         $request $this->requestStack->getCurrentRequest();
  56.         $clients null;
  57.         $request $this->requestStack->getCurrentRequest();
  58.         $idclient=$request->getSession()->get('idClient');
  59.         if($idclient!=null)
  60.             {
  61.             
  62.             $token $request->getSession()->get('token');
  63.         
  64.             $commun= new CommunController($this->requestStack,$token); 
  65.             $borne$commun->TerminalById($idTerminal);  
  66.             
  67.             $services$commun->ServicesTerminal($idTerminal);
  68.             //return new response(var_dump($services)); 
  69.             return $this->render('ParametrageBundle/ParametrageServices.html.twig',    array('terminal' =>  $borne ,'idclient' => $idclient 'services'=>$services)); 
  70.              }
  71.         else 
  72.         {
  73.                  $error 'Fin de session';
  74.                  $lastUsername ='';
  75.                  return $this->render('LoginBundle/login.html.twig'
  76.                                          array('last_login'=> $lastUsername,
  77.                                              'error'=>$error));
  78.         }
  79.     }
  80.     public function UpdateService($identifiant$message='') {
  81.         //return new response(var_dump($identifiant));  
  82.        
  83.         $idclient=null;
  84.         $request $this->requestStack->getCurrentRequest();
  85.         $clients null;
  86.         $request $this->requestStack->getCurrentRequest();
  87.         $idclient=$request->getSession()->get('idClient');
  88.         if($idclient!=null)
  89.             {
  90.                 //$token = $request->getSession()->get('token');
  91.                 $commun= new CommunController($this->requestStack,''); 
  92.                 $tokenvalid$commun-> VerifValiditeToken();   
  93.                 if($tokenvalid==true$token $request->getSession()->get('token');
  94.                 else $token=$commun->getTokenApi($idclient);
  95.         
  96.                 $httpClient HttpClient::create([
  97.                     'auth_bearer' => $token
  98.                 ]);
  99.                      
  100.                 
  101.                 $response $httpClient->request('GET'
  102.                     "http://apiionycar.netbase.fr/api/services/".$identifiant,
  103.                          ['headers' => [
  104.                             'Content-Type' => 'application/json',
  105.                 ]
  106.                          ]);
  107.                 $service=null;
  108.                 if($response->getStatusCode()==200$service=json_decode($response->getContent(),true);
  109.                //return new response(var_dump($service)); 
  110.                $response1 $httpClient->request('GET'
  111.                     "http://apiionycar.netbase.fr/api/service_types.json",
  112.                          ['headers' => [
  113.                             'Content-Type' => 'application/json',
  114.                 ]
  115.                          ]);
  116.                 $typeservices=null;
  117.                 if($response1->getStatusCode()==200$typeservices=json_decode($response1->getContent(),true);
  118.                // return new response(var_dump($typeservices)); 
  119.                $param=explode("_",$identifiant);
  120.                $idTerminal=$param[0];
  121.                $commun= new CommunController($this->requestStack,$token); 
  122.                $services$commun->ServicesTerminal($idTerminal);
  123.               // return new response(var_dump($services)); 
  124.           
  125.                 return $this->render('ParametrageBundle/UpdateService.html.twig',    array('idclient' => $idclient 'service'=>$service 'typeservices'=>$typeservices ,'message'=>$message 'services'=>$services)); 
  126.              }
  127.         else 
  128.         {
  129.                  $error 'Fin de session';
  130.                  $lastUsername ='';
  131.                  return $this->render('LoginBundle/login.html.twig'
  132.                                          array('last_login'=> $lastUsername,
  133.                                              'error'=>$error));
  134.         }
  135.     }
  136.     public function DoUpdateService($identifiant) {
  137.         //return new response(var_dump($identifiant));  
  138.         $message='';
  139.         $idclient=null;
  140.         $request $this->requestStack->getCurrentRequest();
  141.         $clients null;
  142.         $request $this->requestStack->getCurrentRequest();
  143.         $idclient=$request->getSession()->get('idClient');
  144.         if($idclient!=null)
  145.           {  
  146.             $commun= new CommunController($this->requestStack,''); 
  147.             $tokenvalid$commun-> VerifValiditeToken();   
  148.             if($tokenvalid==true$token $request->getSession()->get('token');
  149.             else $token=$commun->getTokenApi($idclient);
  150.             $postData $request->request->all();
  151.             //return new response(var_dump($postData)); 
  152.            /* $idTypeService=$postData['idTypeService'];
  153.             $nom=$postData['nom'];
  154.             $description=$postData['description'];
  155.             $ptDistribution=$postData['ptDistribution'];*/
  156.             $httpClient HttpClient::create([
  157.                 'auth_bearer' => $token
  158.             ]);
  159.     
  160.             $response $httpClient->request('PATCH'
  161.                 "http://apiionycar.netbase.fr/api/services/".$identifiant,
  162.                 ['headers' => [
  163.                     'Content-Type' => 'application/merge-patch+json',
  164.                 ], 
  165.                 'json' => ['idServiceType' => intval($postData['idTypeService']) , 
  166.                            'pointDistribution' => intval($postData['ptDistribution']),
  167.                            'nom'=> $postData['nom'],
  168.                            'description'=>$postData['description'] ],
  169.                 ]);
  170.               //  return new response(var_dump($response)); 
  171.                 if($response->getStatusCode()==200$message='Modification prise en compte ';
  172.                 else $message='Erreur lors de la modification du service'
  173.             
  174.            /* $response = $httpClient->request('GET', 
  175.                 "http://apiionycar.netbase.fr/api/services/".$identifiant,
  176.                      ['headers' => [
  177.                         'Content-Type' => 'application/json',
  178.             ]
  179.                      ]);
  180.             $service=null;
  181.             if($response->getStatusCode()==200) $service=json_decode($response->getContent(),true);*/
  182.            
  183.                return $this->UpdateService($identifiant$message);
  184.           
  185.                // return $this->render('ParametrageBundle/UpdateService.html.twig',    array('idclient' => $idclient , 'service'=>$service , 'typeservices'=>$typeservices , 'message'=>$message)); 
  186.              }
  187.        else 
  188.           {
  189.               return $this->forward('App\Controller\LoginController::index');
  190.           }
  191.     }
  192.     public function AddService($idTerminal) {
  193.         //return new response(var_dump($identifiant));  
  194.        
  195.         $idclient=null;
  196.         $request $this->requestStack->getCurrentRequest();
  197.         $clients null;
  198.         $request $this->requestStack->getCurrentRequest();
  199.         $idclient=$request->getSession()->get('idClient');
  200.         if($idclient!=null)
  201.             {
  202.                 $commun= new CommunController($this->requestStack,''); 
  203.                 $tokenvalid$commun-> VerifValiditeToken();   
  204.                 if($tokenvalid==true$token $request->getSession()->get('token');
  205.                 else $token=$commun->getTokenApi($idclient);
  206.         
  207.                 $httpClient HttpClient::create([
  208.                     'auth_bearer' => $token
  209.                 ]);
  210.                      
  211.                 
  212.                $response1 $httpClient->request('GET'
  213.                     "http://apiionycar.netbase.fr/api/service_types.json",
  214.                          ['headers' => [
  215.                             'Content-Type' => 'application/json',
  216.                 ]
  217.                          ]);
  218.                 $typeservices=null;
  219.                 if($response1->getStatusCode()==200$typeservices=json_decode($response1->getContent(),true);
  220.                // return new response(var_dump($typeservices)); 
  221.                $commun= new CommunController($this->requestStack,$token); 
  222.                $services$commun->ServicesTerminal($idTerminal);
  223.                // return new response(var_dump($services)); 
  224.                 return $this->render('ParametrageBundle/AddService.html.twig',    array('idclient' => $idclient 'idTerminal'=>$idTerminal 'typeservices'=>$typeservices ,'services'=>$services)); 
  225.              }
  226.         else 
  227.         {
  228.                  $error 'Fin de session';
  229.                  $lastUsername ='';
  230.                  return $this->render('LoginBundle/login.html.twig'
  231.                                          array('last_login'=> $lastUsername,
  232.                                              'error'=>$error));
  233.         }
  234.     }
  235.  
  236.     public function DoAddService() {
  237.          
  238.         $idclient=null;
  239.         $request $this->requestStack->getCurrentRequest();
  240.         $clients null;
  241.         $request $this->requestStack->getCurrentRequest();
  242.         $idclient=$request->getSession()->get('idClient');
  243.         if($idclient!=null)
  244.        { 
  245.            $token $request->getSession()->get('token');
  246.            $postData $request->request->all();
  247.         //  return new response(var_dump(intval($postData['idTypeService']))); 
  248.         // return new response(var_dump($postData)); 
  249.             $httpClient HttpClient::create([
  250.                 'auth_bearer' => $token
  251.             ]);
  252.             $response $httpClient->request('POST'
  253.                 "http://apiionycar.netbase.fr/api/services",
  254.                 ['headers' => [
  255.                     'Content-Type' => 'application/json',
  256.                 ], 
  257.                 'json' => ['idSite' => intval($postData['idTerminal']),
  258.                         
  259.                         'pointDistribution' => intval($postData['ptDistribution']),
  260.                         'idServiceType' => intval($postData['idTypeService']) , 
  261.                         'nom'=> $postData['nom'],
  262.                         'description'=>$postData['description'],
  263.                         'disponible'=>], 
  264.                         
  265.                 ]);
  266.                 
  267.                 // if($response->getStatusCode()==201)
  268.             
  269.                 return $this->forward('App\Controller\ParametrageController::ParametrageServices',[
  270.                         'idTerminal'=>$postData['idTerminal']
  271.                     ]);
  272.         }
  273.         else 
  274.         {
  275.             $error 'Fin de session';
  276.             $lastUsername ='';
  277.             return $this->render('LoginBundle/login.html.twig'
  278.                                     array('last_login'=> $lastUsername,
  279.                                         'error'=>$error));
  280.         }
  281.         
  282.      //   return $this->ParametrageServices($postData['idTerminal']);
  283.        
  284.     }
  285. /*
  286.     public function DoDeleteService($identifiant) {
  287.          
  288.         $idclient=null;
  289.         $request = $this->requestStack->getCurrentRequest();
  290.         $clients = null;
  291.         $request = $this->requestStack->getCurrentRequest();
  292.         $idclient=$request->getSession()->get('idClient');
  293.         $token = $request->getSession()->get('token');
  294.       
  295.      //  return new response(var_dump($identifiant)); 
  296.        
  297.         $httpClient = HttpClient::create([
  298.             'auth_bearer' => $token
  299.         ]);
  300.         $response = $httpClient->request('DELETE', 
  301.             "http://apiionycar.netbase.fr/api/services/".$identifiant,
  302.             ['headers' => [
  303.                 'Content-Type' => 'application/json',
  304.             ]
  305.             ]);
  306.         //return new response(var_dump($response)); 
  307.         return $this->ParametrageServices($postData['idTerminal']);
  308.     }*/
  309.     public function DeleteService() {
  310.          
  311.         $idclient=null;
  312.         $request $this->requestStack->getCurrentRequest();
  313.         $clients null;
  314.         $request $this->requestStack->getCurrentRequest();
  315.         $idclient=$request->getSession()->get('idClient');
  316.         $token $request->getSession()->get('token');
  317.         $postData $request->request->all();
  318.         $identifiant=$postData['identifiant'];
  319.        // return new response(var_dump($identifiant)); 
  320.         $param=explode("_",$identifiant);
  321.         $idTerminal=$param[0];
  322.        
  323.         $httpClient HttpClient::create([
  324.             'auth_bearer' => $token
  325.         ]);
  326.         $response $httpClient->request('DELETE'
  327.             "http://apiionycar.netbase.fr/api/services/".$identifiant,
  328.             ['headers' => [
  329.                 'Content-Type' => 'application/json',
  330.             ]
  331.             ]);
  332.         $postData=null;
  333.         if($response->getStatusCode()==204) return new response(true);
  334.         else  return new response(false);
  335.      
  336.     }
  337. /********** Fin gestion services*********/
  338. /****** Gestion des tarifs *************/
  339. public function ParametrageTarifs($idTerminal) {
  340.      
  341.    
  342.     $idclient=null;
  343.     $request $this->requestStack->getCurrentRequest();
  344.    // return new response(var_dump($request->getSession())); 
  345.     $clients null;
  346.     $request $this->requestStack->getCurrentRequest();
  347.     $idclient=$request->getSession()->get('idClient');
  348.     if($idclient!=null)
  349.         {$token $request->getSession()->get('token');
  350.     
  351.         $commun= new CommunController($this->requestStack,$token); 
  352.         $borne$commun->TerminalById($idTerminal);  
  353.         
  354.         $tarifs$commun->TarifsTerminal($idTerminal);
  355.         //return new response(var_dump($tarifs)); 
  356.         return $this->render('ParametrageBundle/ParametrageTarifs.html.twig',    array('terminal' =>  $borne ,'idclient' => $idclient 'tarifs'=>$tarifs)); 
  357.          }
  358.     else 
  359.          {
  360.              $error 'Fin de session';
  361.              $lastUsername ='';
  362.              return $this->render('LoginBundle/login.html.twig'
  363.                                      array('last_login'=> $lastUsername,
  364.                                          'error'=>$error));
  365.          }
  366. }
  367.     public function DeleteTarif() {
  368.             
  369.         $idclient=null;
  370.         $request $this->requestStack->getCurrentRequest();
  371.         $clients null;
  372.         $request $this->requestStack->getCurrentRequest();
  373.         $idclient=$request->getSession()->get('idClient');
  374.         $token $request->getSession()->get('token');
  375.         $postData $request->request->all();
  376.         $idTarif=$postData['idTarif'];
  377.     
  378.         $httpClient HttpClient::create([
  379.             'auth_bearer' => $token
  380.         ]);
  381.         $response $httpClient->request('DELETE'
  382.             "http://apiionycar.netbase.fr/api/tarifs/".$idTarif,
  383.             ['headers' => [
  384.                 'Content-Type' => 'application/json',
  385.             ]
  386.             ]);
  387.     
  388.         if($response->getStatusCode()==204) return new response(true);
  389.         else  return new response(false);
  390.     
  391.     }
  392.     public function AddTarif($idTerminal) {
  393.         //return new response(var_dump($idTerminal));  
  394.        
  395.         $idclient=null;
  396.         $request $this->requestStack->getCurrentRequest();
  397.         $clients null;
  398.         $request $this->requestStack->getCurrentRequest();
  399.         $idclient=$request->getSession()->get('idClient');
  400.         if($idclient!=null)
  401.             {
  402.                 $token $request->getSession()->get('token');
  403.         
  404.                 $httpClient HttpClient::create([
  405.                     'auth_bearer' => $token
  406.                 ]);
  407.                      
  408.                 // service type
  409.                $response1 $httpClient->request('GET'
  410.                     "http://apiionycar.netbase.fr/api/service_types.json",
  411.                          ['headers' => [
  412.                             'Content-Type' => 'application/json',
  413.                 ]
  414.                          ]);
  415.                 $typeservices=null;
  416.                 if($response1->getStatusCode()==200$typeservices=json_decode($response1->getContent(),true);
  417.                 // return new response(var_dump($typeservices)); 
  418.                 //Unite type
  419.                 $response2 $httpClient->request('GET'
  420.                     "http://apiionycar.netbase.fr/api/unite_types.json",
  421.                          ['headers' => [
  422.                             'Content-Type' => 'application/json',
  423.                 ]
  424.                          ]);
  425.                 $typeunites=null;
  426.                 if($response2->getStatusCode()==200$typeunites=json_decode($response2->getContent(),true);
  427.                 // return new response(var_dump($typeunites)); 
  428.                $commun= new CommunController($this->requestStack,$token); 
  429.                $tarifs$commun->TarifsTerminal($idTerminal);
  430.                // return new response(var_dump($tarifs)); 
  431.                 return $this->render('ParametrageBundle/AddTarif.html.twig',    array('idclient' => $idclient 'idTerminal'=>$idTerminal 'typeservices'=>$typeservices ,'tarifs'=>$tarifs 'typeunites'=>$typeunites)); 
  432.              }
  433.         else 
  434.          {
  435.                  $error 'Fin de session';
  436.                  $lastUsername ='';
  437.                  return $this->render('LoginBundle/login.html.twig'
  438.                                          array('last_login'=> $lastUsername,
  439.                                              'error'=>$error));
  440.         }
  441.     }
  442.     public function DoAddTarif()
  443.     {
  444.         $idclient=null;
  445.         $request $this->requestStack->getCurrentRequest();
  446.         $clients null;
  447.         $request $this->requestStack->getCurrentRequest();
  448.         $idclient=$request->getSession()->get('idClient');
  449.         if($idclient!=null)
  450.        { 
  451.            $token $request->getSession()->get('token');
  452.             $postData $request->request->all();
  453.         //  return new response(var_dump(intval($postData['idTypeService']))); 
  454.         
  455.         //return new response(var_dump($postData)); 
  456.             $httpClient HttpClient::create([
  457.                 'auth_bearer' => $token
  458.             ]);
  459.             $response $httpClient->request('POST'
  460.                 "http://apiionycar.netbase.fr/api/tarifs",
  461.                 ['headers' => [
  462.                     'Content-Type' => 'application/json',
  463.                 ], 
  464.                 'json' => ['idSite' => intval($postData['idTerminal']),                      
  465.                         'idServiceType' => intval($postData['idTypeService']) , 
  466.                         'idUniteType' => intval($postData['idTypeUnite']),
  467.                         //'devise'=> 'EUR',//$postData['devise'],
  468.                         //'deviseSymbole'=>$postData['symbole'],
  469.                         'prix'=>floatval($postData['prix']) ], 
  470.                         
  471.                 ]);
  472.             //return new response(var_dump($response)); 
  473.            // if($response->getStatusCode()==201) return new response(true);
  474.            // else return new response(false);
  475.             return $this->forward('App\Controller\ParametrageController::ParametrageTarifs',[
  476.                     'idTerminal'=>$postData['idTerminal']
  477.                 ]);
  478.         }
  479.         else 
  480.         {
  481.             $error 'Fin de session';
  482.             $lastUsername ='';
  483.             return $this->render('LoginBundle/login.html.twig'
  484.                                     array('last_login'=> $lastUsername,
  485.                                         'error'=>$error));
  486.         }
  487.     }
  488.     
  489.     public function UpdateTarif($idTarif $message='')
  490.     {
  491.         $idclient=null;
  492.         $request $this->requestStack->getCurrentRequest();
  493.         $clients null;
  494.         $request $this->requestStack->getCurrentRequest();
  495.         $idclient=$request->getSession()->get('idClient');
  496.         if($idclient!=null)
  497.             {
  498.                 $token $request->getSession()->get('token');
  499.         
  500.                 $httpClient HttpClient::create([
  501.                     'auth_bearer' => $token
  502.                 ]);
  503.                      
  504.                //Tarif  
  505.                 $response $httpClient->request('GET'
  506.                     "http://apiionycar.netbase.fr/api/tarifs/".$idTarif,
  507.                          ['headers' => [
  508.                             'Content-Type' => 'application/json',
  509.                 ]
  510.                          ]);
  511.                 $tarif=null;
  512.                 if($response->getStatusCode()==200$tarif=json_decode($response->getContent(),true);
  513.                //return new response(var_dump($tarif)); 
  514.               //Type servuce
  515.                $response1 $httpClient->request('GET'
  516.                     "http://apiionycar.netbase.fr/api/service_types.json",
  517.                          ['headers' => [
  518.                             'Content-Type' => 'application/json',
  519.                 ]
  520.                          ]);
  521.                 $typeservices=null;
  522.                 if($response1->getStatusCode()==200$typeservices=json_decode($response1->getContent(),true);
  523.                // return new response(var_dump($typeservices)); 
  524.                //Type unite
  525.                $response2 $httpClient->request('GET'
  526.                     "http://apiionycar.netbase.fr/api/unite_types.json",
  527.                          ['headers' => [
  528.                             'Content-Type' => 'application/json',
  529.                 ]
  530.                          ]);
  531.                 $typeunites=null;
  532.                
  533.                 if($response2->getStatusCode()==200$typeunites=json_decode($response2->getContent(),true);
  534.               // return new response(var_dump($typeunites)); 
  535.               //liste tarif
  536.                $idTerminal=0;
  537.                if($tarif!=null$idTerminal=$tarif['idSite'];
  538.                $commun= new CommunController($this->requestStack,$token); 
  539.                $tarifs$commun->TarifsTerminal($idTerminal);
  540.                
  541.               // return new response(var_dump($services)); 
  542.           
  543.                 return $this->render('ParametrageBundle/UpdateTarif.html.twig',    array('idclient' => $idclient 'tarif'=>$tarif 'typeservices'=>$typeservices ,'message'=>$message 'tarifs'=>$tarifs ,'typeunites'=>$typeunites)); 
  544.              }
  545.         else 
  546.         {
  547.                  $error 'Fin de session';
  548.                  $lastUsername ='';
  549.                  return $this->render('LoginBundle/login.html.twig'
  550.                                          array('last_login'=> $lastUsername,
  551.                                              'error'=>$error));
  552.         }
  553.     }
  554.     public function DoUpdateTarif($idTarif)
  555.     {
  556.          
  557.          //return new response(var_dump($identifiant));  
  558.          $message='';
  559.          $idclient=null;
  560.          $request $this->requestStack->getCurrentRequest();
  561.          $idclient=$request->getSession()->get('idClient');
  562.  
  563.          if($idclient!=null)
  564.            {  
  565.              $token $request->getSession()->get('token');
  566.              $postData $request->request->all();
  567.             
  568.              $httpClient HttpClient::create([
  569.                  'auth_bearer' => $token
  570.              ]);
  571.      
  572.              $response $httpClient->request('PATCH'
  573.                  "http://apiionycar.netbase.fr/api/tarifs/".$idTarif,
  574.                  ['headers' => [
  575.                      'Content-Type' => 'application/merge-patch+json',
  576.                  ], 
  577.                  'json' => ['idServiceType' => intval($postData['idTypeService']) , 
  578.                             'idUniteType' => intval($postData['idTypeUnite']),
  579.                             'prix'=> floatval($postData['prix']),
  580.                             'devise'=>$postData['devise'] ],
  581.                  ]);
  582.                  //return new response(var_dump($response->getStatusCode())); 
  583.  
  584.                  if($response->getStatusCode()==200$message='Modification prise en compte ';
  585.                  else $message='Erreur lors de la modification du service'
  586.             
  587.                  return $this->UpdateTarif($idTarif$message);
  588.               }
  589.         else 
  590.            {
  591.                return $this->forward('App\Controller\LoginController::index');
  592.            }
  593.     }
  594. /**********fin Gestion tarifs ***** */
  595. /************Gestion site ***************/
  596.     public function ParametrageSite($idTerminal)
  597.     {
  598.         //return new response(var_dump('Site ='.$idTerminal));  
  599.           //return new response(var_dump($identifiant));  
  600.           $idclient=null;
  601.           $request $this->requestStack->getCurrentRequest();
  602.           $idclient=$request->getSession()->get('idClient');
  603.   
  604.           if($idclient!=null)
  605.             {  
  606.                 $commun= new CommunController($this->requestStack,''); 
  607.                 $tokenvalid$commun-> VerifValiditeToken();   
  608.                 if($tokenvalid==true$token $request->getSession()->get('token');
  609.                 else $token=$commun->getTokenApi($idclient);
  610.                 //$postData = $request->request->all();
  611.              
  612.                 $httpClient HttpClient::create([
  613.                   'auth_bearer' => $token
  614.                 ]);
  615.       
  616.                 $response $httpClient->request('GET'
  617.                   "http://apiionycar.netbase.fr/api/terminal_ionycars/".$idTerminal,
  618.                   ['headers' => [
  619.                       'Content-Type' => 'application/json',
  620.                   ],
  621.                   ]);
  622.                   //return new response(var_dump($response->getStatusCode())); 
  623.   
  624.                   if($response->getStatusCode()==200$terminal=json_decode($response->getContent(),true);
  625.                   else $terminal=null;
  626.                 //SH 2024.03.13  gestion nouvel formulaire payzen iframe
  627.                 $con$this->getDoctrine()->getConnection();
  628.                 $sql $con->prepare("SELECT * FROM boutique_payzen");
  629.                 $sql->execute();
  630.                 $boutiques $sql->fetchAll();
  631.                 //fin SH 
  632.              
  633.                   //return new response(var_dump($terminal)); 
  634.                   return $this->render('ParametrageBundle/EditUpdateSite.html.twig',    array('idclient' => $idclient 'terminal'=>$terminal ,'boutiques'=>$boutiques )); 
  635.                }
  636.             else 
  637.             {
  638.                    $error 'Fin de session';
  639.                    $lastUsername ='';
  640.                    return $this->render('LoginBundle/login.html.twig'
  641.                                            array('last_login'=> $lastUsername,
  642.                                                'error'=>$error));
  643.             }
  644.     }
  645.     public function UpdateSite()
  646.     {
  647.         $idclient=null;
  648.         $request $this->requestStack->getCurrentRequest();
  649.         $idclient=$request->getSession()->get('idClient');
  650.         $postData $request->request->all();
  651.         //return new response(var_dump($postData)); 
  652.         if($idclient!=null)
  653.             {  
  654.                 $commun= new CommunController($this->requestStack,''); 
  655.                 $tokenvalid$commun-> VerifValiditeToken();   
  656.                 if($tokenvalid==true$token $request->getSession()->get('token');
  657.                 else $token=$commun->getTokenApi($idclient);
  658.                 $httpClient HttpClient::create([
  659.                     'auth_bearer' => $token
  660.                 ]);
  661.                 $response $httpClient->request('PATCH'
  662.                     "http://apiionycar.netbase.fr/api/terminal_ionycars/".$postData['idTerminal'],
  663.                     ['headers' => [
  664.                         'Content-Type' => 'application/merge-patch+json',
  665.                     ], 
  666.                     'json' => ['nomTerminal' => $postData['nomTerminal'] , 
  667.                                'gpsTerminal'=>$postData['gpsTerminal'] ],
  668.                     ]);
  669.                 //return new response(var_dump($response));    
  670.                 if($response->getStatusCode()==200) return  new response(true) ;
  671.                 else return  new response(false) ; 
  672.             }
  673.         else return  new response(false) ; 
  674.         //return false;
  675.     }
  676.     public function UpdatePaySite()
  677.     {
  678.         $idclient=null;
  679.         $request $this->requestStack->getCurrentRequest();
  680.         $idclient=$request->getSession()->get('idClient');
  681.         $postData $request->request->all();
  682.         //return new response(var_dump($postData)); 
  683.         if($idclient!=null)
  684.             {  
  685.                 $commun= new CommunController($this->requestStack,''); 
  686.                 $tokenvalid$commun-> VerifValiditeToken();   
  687.                 if($tokenvalid==true$token $request->getSession()->get('token');
  688.                 else $token=$commun->getTokenApi($idclient);
  689.   
  690.                 if($postData['paiementProd']==='0'$bnqKey=$postData['testKey'];
  691.                 else  $bnqKey=$postData['prodKey'];
  692.                 $httpClient HttpClient::create([
  693.                     'auth_bearer' => $token
  694.                 ]);
  695.                 $response $httpClient->request('PATCH'
  696.                     "http://apiionycar.netbase.fr/api/zone_terminals/".$postData['idTerminal']."_1",
  697.                     ['headers' => [
  698.                         'Content-Type' => 'application/merge-patch+json',
  699.                     ], 
  700.                     'json' => ['BnqSiteId' => $postData['BnqSiteId'] , 
  701.                                'BnqKey'=>trim($bnqKey),
  702.                                'paiementProd' => intval($postData['paiementProd']) , 
  703.                                'testKeyPayzen'=>trim($postData['testKey']) ,
  704.                                'prodKeyPayzen'=>trim($postData['prodKey']) ,
  705.                                'testPwdPayzen'=>trim($postData['testPwd']) , //SH 2022.05.30
  706.                                'prodPwdPayzen'=>trim($postData['prodPwd']) , //SH 2022.05.30
  707.                             ],
  708.                     ]);
  709.                // return new response(var_dump($response));    
  710.                 if($response->getStatusCode()==200) return  new response(true) ;
  711.                 else return  new response(false) ; 
  712.             }
  713.         else return  new response(false) ; 
  714.         //return false;
  715.     }
  716.     public function ConfigTPE()
  717.     {
  718.         $idclient=null;
  719.         $request $this->requestStack->getCurrentRequest();
  720.         $idclient=$request->getSession()->get('idClient');
  721.         $postData $request->request->all();
  722.        /// return new response(var_dump($postData)); 
  723.         if($idclient!=null)
  724.             {  
  725.                 $topic=$postData['idTerminal']."/in/SetConfig/TPE";
  726.                // return new response(var_dump($topic)); 
  727.                 $res=$this->MessageMQTT($topic,$postData['action']);
  728.                 //$res=$this->MessageMQTT($topic,1);
  729.                 return new response(var_dump($res)); 
  730.                 
  731.             }
  732.         else return  new response(false) ; 
  733.         //return false;
  734.     }
  735.     //SH 2024.04.29 gesion formulaire payzen iframe
  736.     public function UpdateBoutiqueSite()
  737.     {
  738.         $idclient=null;
  739.         $request $this->requestStack->getCurrentRequest();
  740.         $idclient=$request->getSession()->get('idClient');
  741.         $postData $request->request->all();
  742.         //return new response(var_dump($postData)); 
  743.         if($idclient!=null)
  744.             {  
  745.                 $commun= new CommunController($this->requestStack,''); 
  746.                 $tokenvalid$commun-> VerifValiditeToken();   
  747.                 if($tokenvalid==true$token $request->getSession()->get('token');
  748.                 else $token=$commun->getTokenApi($idclient);
  749.   
  750.                   
  751.                 $con$this->getDoctrine()->getConnection();
  752.                 $sql $con->prepare("SELECT *
  753.                         FROM boutique_payzen where ID_BOUTIQUE=?");
  754.                 $sql->bindValue(1$postData['boutiquePayzen']);
  755.                 $sql->execute();
  756.                 $boutique $sql->fetch();
  757.                 //return new response(var_dump($boutique)); 
  758.                 if($postData['paiementProd']==='0'$bnqKey=$boutique['TEST_KEY'];
  759.                 else  $bnqKey=$boutique['PROD_KEY'];
  760.                 $httpClient HttpClient::create([
  761.                     'auth_bearer' => $token
  762.                 ]);
  763.                 $response $httpClient->request('PATCH'
  764.                    "http://apiionycar.netbase.fr/api/zone_terminals/".$postData['idTerminal']."_1",
  765.                     ['headers' => [
  766.                         'Content-Type' => 'application/merge-patch+json',
  767.                     ], 
  768.                     'json' => ['BnqSiteId' => $postData['boutiquePayzen'] , 
  769.                                'BnqKey'=>trim($bnqKey),
  770.                                'paiementProd' => intval($postData['paiementProd']) , 
  771.                                'testKeyPayzen'=> trim($boutique['TEST_KEY']) ,
  772.                                'prodKeyPayzen'=> trim($boutique['PROD_KEY']) ,
  773.                                'testPwdPayzen'=>' ' 
  774.                                'prodPwdPayzen'=>' ' 
  775.                             ],
  776.                     ]);
  777.                // return new response(var_dump($response));    
  778.                 if($response->getStatusCode()==200) return  new response(true) ;
  779.                 else return  new response(false) ; 
  780.             }
  781.         else return  new response(false) ; 
  782.         //return false;
  783.     }
  784.     //fin SH 
  785. /***************Fin Site**************/
  786.     public function MessageMQTT($sujet,$message) {
  787.         
  788.         //return new Response(var_dump($sujet));
  789.         $server '192.168.1.22';
  790.         $port=1883;
  791.         $clientId='api_isipay';
  792.         $client = new ClientMQTT($server,$port$clientId);
  793.         
  794.         $client->setAuthDetails("urbaflux""BJdYM#t8ucvN?yZMu");
  795.         $client->setParamServer($server,$port$clientId); 
  796.         $result $client->connect();
  797.             
  798.        // return new Response(var_dump($result));
  799.         $result $client->publish($sujet ,$message 0);  
  800.         $client->close();
  801.         return $result;
  802.      
  803.     }
  804.     public function ParametrageBadges($idTerminal)
  805.     {
  806.            //return new response(var_dump('Site ='.$idTerminal));  
  807.           //return new response(var_dump($identifiant));  
  808.           $idclient=null;
  809.           $request $this->requestStack->getCurrentRequest();
  810.           $idclient=$request->getSession()->get('idClient');
  811.           $terminal null;
  812.           if($idclient!=null)
  813.             {  
  814.                 $commun= new CommunController($this->requestStack,''); 
  815.                 $tokenvalid$commun-> VerifValiditeToken();   
  816.                 if($tokenvalid==true$token $request->getSession()->get('token');
  817.                 else $token=$commun->getTokenApi($idclient);
  818.                 //$postData = $request->request->all();
  819.               //  $terminal= $commun->TerminalById($idTerminal);  
  820.                 $httpClient HttpClient::create([
  821.                   'auth_bearer' => $token
  822.                 ]);
  823.       
  824.                 $response $httpClient->request('GET'
  825.                 "http://apiionycar.netbase.fr/api/terminal_ionycars/".$idTerminal,
  826.                 ['headers' => [
  827.                     'Content-Type' => 'application/json',
  828.                 ],
  829.                 ]);
  830.                // return new response(var_dump($response->getStatusCode())); 
  831.                 if($response->getStatusCode()==200
  832.                 {
  833.                     $terminal=json_decode($response->getContent(),true);
  834.                     //return new response(var_dump($terminal)); 
  835.                  }
  836.                 
  837.                 $response $httpClient->request('GET'
  838.                   "http://apiionycar.netbase.fr/api/liste_badges/".$idTerminal,
  839.                   ['headers' => [
  840.                       'Content-Type' => 'application/json',
  841.                   ],
  842.                   ]);
  843.                  // return new response(var_dump($response->getStatusCode())); 
  844.                   $badgesHex null;
  845.                   $badgesHexInv null;
  846.                   if($response->getStatusCode()==200
  847.                   {
  848.                       $listeBadges=json_decode($response->getContent(),true);
  849.                       $badges $listeBadges['listeBadges'];
  850.                       $badges =  explode';'$badges );
  851.                       $j=0;
  852.                       for($i 0$i count($badges); $i++) 
  853.                       {
  854.                         if($badges[$i]!='')
  855.                         {   
  856.                             if(($idTerminal==1198) or ($idTerminal==1154))
  857.                             {
  858.                                 $badgesHex[$j]=strtoupper(dechex($badges[$i]));
  859.                                 $badgesHexInv[$j]['DEC']=$badges[$i];
  860.                                 $badgesHexInv[$j]['HEX']=$badgesHex[$j];
  861.                                 $badgesHexInv[$j]['HEXINV']=substr($badgesHex[$j],4,2).':'.substr($badgesHex[$j],2,2).':'.substr($badgesHex[$j],0,2).':**';
  862.                                 $j++;
  863.                             }
  864.                             else
  865.                             {
  866.                                // $badgesHex[$j]=strtoupper(dechex($badges[$i]));
  867.                                $badgesHex[$j]='';
  868.                                 if(strlen($badges[$i])<=7)
  869.                                 {
  870.                                     $nbChar=8-strlen($badges[$i]);
  871.                                     for($k=0;$k<$nbChar;$k++)  $badgesHex[$j]=$badgesHex[$j].'0';
  872.                                 }
  873.                                 $badgesHex[$j].=strtoupper($badges[$i]);
  874.                                
  875.                                 $badgesHexInv[$j]['DEC']=hexdec($badgesHex[$j]);
  876.                                 $badgesHexInv[$j]['HEX']=$badgesHex[$j];
  877.                                 $badgesHexInv[$j]['HEXINV']= $badgesHexInv[$j]['HEX'];
  878.                                 $j++;
  879.                             }
  880.                            
  881.                         }
  882.                        
  883.                       }
  884.   
  885.                   }
  886.                   else $badges=null;
  887.                  // return new response(var_dump($badgesHex)); 
  888.                 // return new response(var_dump($badgesHexInv)); 
  889.                 //SH 2024.07.10 synchronisation des badges 
  890.                 $synchroBadges =  null;
  891.                 $con $this->getDoctrine()->getConnection('ionycar');    
  892.                 $sql $con->prepare("SELECT * FROM tb_action_badge where synchro=0 and idSite=?");
  893.                 $sql->bindValue(1$idTerminal);
  894.                 $sql->execute();
  895.                 $synchroBadges $sql->fetchAll();
  896.                 //return new response(var_dump($synchroBadges)); 
  897.                 //fin SH 
  898.                
  899.                  
  900.                   return $this->render('ParametrageBundle/ParametrageBadges.html.twig',    array('idclient' => $idclient 'terminal' =>$terminal 'badges'=>$badges ,
  901.                               'badgesHexInv' =>$badgesHexInv 'synchro' => $synchroBadges )); 
  902.                }
  903.             else 
  904.             {
  905.                    $error 'Fin de session';
  906.                    $lastUsername ='';
  907.                    return $this->render('LoginBundle/login.html.twig'
  908.                                            array('last_login'=> $lastUsername,
  909.                                                'error'=>$error));
  910.             }
  911.     }
  912.     public function AddBadge() {
  913.         $idclient=null;
  914.         $request $this->requestStack->getCurrentRequest();
  915.         $clients null;
  916.         $request $this->requestStack->getCurrentRequest();
  917.         $idclient=$request->getSession()->get('idClient');
  918.         $token $request->getSession()->get('token');
  919.         $postData $request->request->all();
  920.         $badge=$postData['badge'];
  921.         $idTerminal $postData['idTerminal'];
  922.         //return new response(var_dump($badge)); 
  923.         $topic=$idTerminal.'/in/AddBadge';
  924.         $res=$this->MessageMQTT($topic,$badge);
  925.         $this->ajoutActionBadge($idTerminal $badge);//SH 2024.07.09 synchro mode offline
  926.         return new response($topic);
  927.     }
  928.     //SH 2024.04.12 ajout d'une liste de badge 
  929.     public function AddListeBadges() {
  930.         $idclient=null;
  931.         $request $this->requestStack->getCurrentRequest();
  932.         $clients null;
  933.         $request $this->requestStack->getCurrentRequest();
  934.         $idclient=$request->getSession()->get('idClient');
  935.         $token $request->getSession()->get('token');
  936.         $postData $request->request->all();
  937.         $badges=$postData['badges'];
  938.         $idTerminal $postData['idTerminal'];
  939.         $badges explode(","$badges);
  940.         // return new response(var_dump($badges));
  941.         $topic=$idTerminal.'/in/AddBadge';
  942.         for($i=0;$i<count($badges);$i++) 
  943.         {      
  944.             $res=$this->MessageMQTT($topic,$badges[$i]);
  945.             $this->ajoutActionBadge($idTerminal $badges[$i]);//SH 2024.07.09 synchro mode offline
  946.         }
  947.        
  948.         return new response($topic);
  949.     }
  950.     //fin SH 
  951.  
  952.     public function DeleteBadge() {
  953.          
  954.         $idclient=null;
  955.         $request $this->requestStack->getCurrentRequest();
  956.         $clients null;
  957.         $request $this->requestStack->getCurrentRequest();
  958.         $idclient=$request->getSession()->get('idClient');
  959.         $token $request->getSession()->get('token');
  960.         $postData $request->request->all();
  961.         $badge=$postData['badge'];
  962.         $idTerminal $postData['idTerminal'];
  963.         //return new response(var_dump($badge)); 
  964.         if($badge =='tout'$topic=$idTerminal.'/in/DeleteAll';
  965.         else $topic=$idTerminal.'/in/DeleteBadge';
  966.         $res=$this->MessageMQTT($topic,$badge);
  967.         return new response($topic);
  968.     }
  969.  
  970.     /*************SH 2024.03.13  gestion nouveau formulaire de paiement payzen forfait GO************/
  971.     function BoutiquesPayzen()
  972.     {
  973.         //return new Response(var_dump('Boutiques Payzen')); 
  974.         $idclient=null;
  975.         $request $this->requestStack->getCurrentRequest();
  976.         $idclient=$request->getSession()->get('idClient');
  977.         $postData $request->request->all();
  978.         if($idclient!=null)
  979.             {  
  980.                 $con$this->getDoctrine()->getConnection();
  981.                 $sql $con->prepare("SELECT * FROM boutique_payzen");
  982.                 $sql->execute();
  983.                 $boutiques $sql->fetchAll();
  984.                // return new Response(var_dump($boutiques)); 
  985.                 return $this->render('ParametrageBundle/ParametrageBoutiques.html.twig',    array('boutiques' =>  $boutiques ,'idclient' => $idclient));        
  986.                 
  987.             }
  988.         else {
  989.                 $error 'Fin de session';
  990.                 $lastUsername ='';
  991.                 return $this->render('LoginBundle/login.html.twig'
  992.                                         array('last_login'=> $lastUsername,
  993.                                             'error'=>$error));
  994.          }
  995.     }
  996.     public function AddBoutique() {
  997.        // return new response(var_dump('AddBoutique'));  
  998.     
  999.         $request $this->requestStack->getCurrentRequest();
  1000.         $postData $request->request->all();
  1001.         //return new response(var_dump($postData)); 
  1002.         try 
  1003.         {
  1004.             $con $this->getDoctrine()->getConnection();    
  1005.             $sql $con->prepare("insert into boutique_payzen (ID_BOUTIQUE, LIB_BOUTIQUE, TEST_KEY, PROD_KEY
  1006.                         ) values (?,?,?,?);");
  1007.             $sql->bindValue(1$postData['idBoutique']);
  1008.             $sql->bindValue(2$postData['libBoutique']);
  1009.             $sql->bindValue(3$postData['cleTest']);
  1010.             $sql->bindValue(4$postData['cleProd']);
  1011.             $sql->execute();
  1012.             return new Response(true);
  1013.             //return true ;
  1014.         }
  1015.         catch (\Exception $e) {
  1016.             return new Response(false);
  1017.         }
  1018.        
  1019.     }
  1020.     public function UpdateBoutique($identifiant$message='') {
  1021.         //return new response(var_dump($identifiant));  
  1022.        
  1023.         $idclient=null;
  1024.         $request $this->requestStack->getCurrentRequest();
  1025.         $idclient=$request->getSession()->get('idClient');
  1026.       
  1027.         if($idclient!=null)
  1028.             {
  1029.                 $con$this->getDoctrine()->getConnection();
  1030.                 $sql $con->prepare("SELECT *
  1031.                         FROM boutique_payzen where ID_BOUTIQUE=?");
  1032.                 $sql->bindValue(1$identifiant);
  1033.                 $sql->execute();
  1034.                 $boutique $sql->fetch();
  1035.                // return new response(var_dump($boutique));
  1036.                 
  1037.                 return $this->render('ParametrageBundle/UpdateBoutique.html.twig',    array('idclient' => $idclient 'boutique'=>$boutique ,'message'=>$message )); 
  1038.              }
  1039.         else 
  1040.         {
  1041.                  $error 'Fin de session';
  1042.                  $lastUsername ='';
  1043.                  return $this->render('LoginBundle/login.html.twig'
  1044.                                          array('last_login'=> $lastUsername,
  1045.                                              'error'=>$error));
  1046.         }
  1047.     }
  1048.     public function DoUpdateBoutique($identifiant) {
  1049.        // return new response(var_dump($identifiant));  
  1050.         $message='';
  1051.         $idclient=null;
  1052.         $request $this->requestStack->getCurrentRequest();
  1053.         $idclient=$request->getSession()->get('idClient');
  1054.         $postData $request->request->all();
  1055.         //return new response(var_dump($postData));
  1056.         if($idclient!=null)
  1057.           {  
  1058.             try
  1059.             {
  1060.                 $con $this->getDoctrine()->getConnection();    
  1061.                 $sql $con->prepare("update  boutique_payzen set  LIB_BOUTIQUE=? , TEST_KEY=? , PROD_KEY=?
  1062.                                         where ID_BOUTIQUE = ? ;");
  1063.                 $sql->bindValue(1$postData['libBoutique']);
  1064.                 $sql->bindValue(2$postData['cleTest']);
  1065.                 $sql->bindValue(3$postData['cleProd']);
  1066.                 $sql->bindValue(4$identifiant);
  1067.                 $sql->execute();
  1068.                 $message='Modification prise en compte '
  1069.             }
  1070.             catch (\Exception $e) {
  1071.                 $message='Erreur lors de la modification du service';
  1072.             }
  1073.               
  1074.              
  1075.                return $this->UpdateBoutique($identifiant$message);
  1076.            
  1077.                 //return $this->render('ParametrageBundle/UpdateBoutique.html.twig',    array('idclient' => $idclient , 'service'=>$service , 'typeservices'=>$typeservices , 'message'=>$message)); 
  1078.             }
  1079.        else 
  1080.           {
  1081.               return $this->forward('App\Controller\LoginController::index');
  1082.           }
  1083.     }
  1084.     
  1085.     /************* FIN SH ********/
  1086.    //SH 2024.07.09 ajout synchronistion badge mode offline
  1087.    public function ajoutActionBadge($idTerminal $badge)
  1088.    {
  1089.         $con $this->getDoctrine()->getConnection('ionycar');    
  1090.         $sql $con->prepare("insert into tb_action_badge ( idSite , badge, synchro) values (?,?,?);");
  1091.         $sql->bindValue(1$idTerminal);
  1092.         $sql->bindValue(2$badge);
  1093.         $sql->bindValue(30);
  1094.         $sql->execute();
  1095.         return new Response(true);
  1096.    }
  1097.    public function VerifBadge()
  1098.    {
  1099.         $request $this->requestStack->getCurrentRequest();
  1100.         $postData $request->request->all();
  1101.         $idTerminal=$postData['idTerminal'];
  1102.         $liste=$postData['listeBadges'];
  1103.         $listeBadgeexplode(";"$liste);
  1104.         //return new response(var_dump($listeBadge));
  1105.         for($i=0;$i<count($listeBadge);$i++)
  1106.         {
  1107.             $con $this->getDoctrine()->getConnection('ionycar');    
  1108.             $sql $con->prepare("update  tb_action_badge set  synchro=1 ,dateSynchro=?
  1109.                                     where LOWER(badge) = ? and synchro=0 ;");
  1110.             $sql->bindValue(1date('Y-m-d H:i:s'));
  1111.             $sql->bindValue(2strtolower($listeBadge[$i]));
  1112.             $sql->execute();
  1113.             $message='Modification prise en compte '
  1114.         }
  1115.         return new response(var_dump($message));
  1116.    }
  1117.    public function SynchroBadges($idTerminal)
  1118.    {
  1119.         $request $this->requestStack->getCurrentRequest();
  1120.         $con $this->getDoctrine()->getConnection('ionycar');    
  1121.         $sql $con->prepare("SELECT * FROM tb_action_badge where synchro=0 and idSite=?");
  1122.         $sql->bindValue(1$idTerminal);
  1123.         $sql->execute();
  1124.         $badges $sql->fetchAll();
  1125.         //return new response(var_dump($badges));
  1126.         if(count($badges)>0)
  1127.         {
  1128.             $topic=strval($idTerminal).'/in/AddBadge';
  1129.             for($i=0;$i<count($badges);$i++) 
  1130.             {      
  1131.                 $res=$this->MessageMQTT($topic,$badges[$i]['badge']);
  1132.             }
  1133.            
  1134.         }
  1135.         return new response(var_dump($badges));
  1136.    }
  1137.    //fin SH
  1138. }