src/Controller/Front/IndexController.php line 471

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  */
  5. namespace App\Controller\Front;
  6. use App\Entity\AbonnementPay;
  7. use App\Entity\BesoinProductPage;
  8. use App\Entity\BesoinProductPageCategory;
  9. use App\Entity\Cart;
  10. use App\Entity\CartDetail;
  11. use App\Entity\CompteAbonnementPro;
  12. use App\Entity\CompteAbonnementProCommandesFactures;
  13. use App\Entity\CompteAbonnementProFacture;
  14. use App\Entity\Imprimeur;
  15. use App\Entity\LanguageCountry;
  16. use App\Entity\NosCrea;
  17. use App\Entity\NotifB2b;
  18. use App\Entity\NotifB2cCompte;
  19. use App\Entity\OrderDetailVirement;
  20. use App\Entity\Orders;
  21. use App\Entity\Page\Page;
  22. use App\Entity\Product;
  23. use App\Entity\Stats;
  24. use App\Entity\StuartOrder;
  25. use App\Entity\User;
  26. use App\Entity\UserStripe;
  27. use App\Services\AbonnementService;
  28. use App\Services\AvisVerifiesService;
  29. use App\Services\CartService;
  30. use App\Services\CheckoutService;
  31. use App\Services\FactureService;
  32. use App\Services\NbDesigner;
  33. use App\Services\Notifications;
  34. use App\Services\OrderService;
  35. use App\Services\ReferalCandyService;
  36. use App\Services\StripeConnect;
  37. use App\Services\StripeConnectTest;
  38. use Spipu\Html2Pdf\Html2Pdf;
  39. use Stripe\Invoice;
  40. use Stripe\Subscription;
  41. use Symfony\Component\Finder\Finder;
  42. use Symfony\Component\HttpFoundation\RedirectResponse;
  43. use Symfony\Component\Routing\Annotation\Route;
  44. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  45. use Twig\Environment;
  46. use Symfony\Component\HttpFoundation\Response;
  47. use Symfony\Component\HttpFoundation\Request;
  48. use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
  49. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  50. use Doctrine\ORM\EntityManagerInterface;
  51. use Symfony\Contracts\Translation\TranslatorInterface;
  52. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  53. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  54. use JouwWeb\SendCloud\Client;
  55. use JouwWeb\SendCloud\Model\Address;
  56. use JouwWeb\SendCloud\Model\Parcel;
  57. use JouwWeb\SendCloud\Model\WebhookEvent;
  58. use JouwWeb\SendCloud\Exception\SendCloudRequestException;
  59. use App\Services\SendCloudApi;
  60. use App\Services\DelivreeService;
  61. use Stripe\Stripe;
  62. use Stripe\Customer;
  63. use Stripe\PaymentMethod;
  64. use App\Services\Exaprint;
  65. class IndexController extends AbstractController
  66. {
  67.     private $em;
  68.     private $session;
  69.     private $apiCloudSend;
  70.     private $delivreeService;
  71.     private $cartService;
  72.     private $mailer;
  73.     private $router;
  74.     public function __construct(
  75.         SessionInterface $session,
  76.         ParameterBagInterface $params,
  77.         TranslatorInterface $trans,
  78.         EntityManagerInterface $em,
  79.         CheckoutService $checkout_service,
  80.         SendCloudApi $apiCloudSend,
  81.         DelivreeService $delivreeService,
  82.         CartService $cartService,
  83.         AbonnementService $abonnementService,
  84.         StripeConnect $stripeConnect,
  85.         FactureService $facture_service,
  86.         Notifications $notifications,
  87.         AvisVerifiesService $avisVerifiesService,
  88.         ReferalCandyService $candyService,
  89.         OrderService $order_service,
  90.         \Swift_Mailer $mailer,
  91.         Environment $twig,
  92.         UrlGeneratorInterface $router,
  93.         Exaprint $exaprint,
  94.         NbDesigner $nbDesigner
  95.     ) {
  96.         $this->em $em;
  97.         $this->trans $trans;
  98.         $this->session $session;
  99.         $this->params $params;
  100.         $this->checkout_service $checkout_service;
  101.         $this->apiCloudSend $apiCloudSend;
  102.         $this->delivreeService $delivreeService;
  103.         $this->cartService $cartService;
  104.         $this->abonnementService $abonnementService;
  105.         $this->stripeConnectService =  $stripeConnect;
  106.         $this->facture_service $facture_service;
  107.         $this->notifications $notifications;
  108.         $this->avisVerifiesService $avisVerifiesService;
  109.         $this->candyService $candyService;
  110.         $this->order_service $order_service;
  111.         $this->mailer $mailer;
  112.         $this->twig $twig;
  113.         $this->nbDesigner $nbDesigner;
  114.         $this->router $router;
  115.         $this->exaprint $exaprint;
  116.     }
  117.     /**
  118.      * @Route("/", name="accueil",options={"expose"=true})
  119.      */
  120.     public function index(Request $request) : Response
  121.     {
  122.         if($request->get('displayProduct') && $request->get('imprimerRelierEdit') && $request->get('imprimerRelierEdit') == && $request->get('displayProduct') == 1)
  123.             return $this->redirectToRoute('edit_pdf_page');
  124.         $response $this->render('front/accueil/index.html.twig');
  125.         return $response;
  126.     }
  127.     /**
  128.      * @Route("/vcompteur", name="add_visiteur_count",options={"expose"=true})
  129.      */
  130.     public function compteurVisite(Request $request) : Response
  131.     {
  132.         if ($request->isXmlHttpRequest()) {
  133.             $this->checkout_service->addCompteurVisite($request);
  134.         }
  135.         $response = new Response();
  136.         $response->setContent(1);
  137.         return $response;
  138.     }
  139.     /**
  140.      * @Route("/add-cookies", name="add_cookies",options={"expose"=true})
  141.      */
  142.     public function addCookies(Request $request) : Response
  143.     {
  144.         if ($request->isXmlHttpRequest()) {
  145.             $this->cartService->addCookies($request);
  146.         }
  147.         $response = new Response();
  148.         $response->setContent(1);
  149.         return $response;
  150.     }
  151.     /**
  152.      * @Route("/add-cookies-refuse", name="add_cookies_refuse",options={"expose"=true})
  153.      */
  154.     public function addCookiesRefuse(Request $request) : Response
  155.     {
  156.         if ($request->isXmlHttpRequest()) {
  157.             $this->cartService->addCookiesRefuse($request);
  158.         }
  159.         $response = new Response();
  160.         $response->setContent(1);
  161.         return $response;
  162.     }
  163.     /**
  164.      * @Route("/block-livraison-accueil", name="block_livraison_accueil",options={"expose"=true})
  165.      */
  166.     public function blockLivraison(Request $request): Response
  167.     {
  168.         $dataRequest $request->request->all();
  169.         $this->session->set('longiAdresse',$dataRequest['longi']);
  170.         $this->session->set('latAdresse',$dataRequest['lat']);
  171.         $this->session->set('addresseAdresse',$dataRequest['addresseAdresse']);
  172.         $this->session->set('postalcodeAdresse',$dataRequest['postalcode']);
  173.         $this->session->set('cityAdresse',$dataRequest['cityAdresse']);
  174.         $this->session->set('CountryLiv',$dataRequest['CountryLiv']);
  175.         $this->session->set('CountryCodeLiv',$dataRequest['CountryCodeLiv']);
  176.         $dataLivrason $this->checkout_service->getModeLivraisonSansStock($dataRequest);
  177.         $dataLivrason['latLongi'] = ['lat' => $dataRequest['lat'],'longi'=>$dataRequest['longi']];
  178.         return $this->render('front/accueil/block_livraison.html.twig'$dataLivrason);
  179.     }
  180.     /**
  181.      * @Route("/block-livraison-new-accueil", name="block_livraison_new_accueil",options={"expose"=true})
  182.      */
  183.     public function blockLivraisonNewAccueil(Request $request): Response
  184.     {
  185.         $dataRequest $request->request->all();
  186.         $this->session->set('longiAdresse',$dataRequest['longi']);
  187.         $this->session->set('latAdresse',$dataRequest['lat']);
  188.         $this->session->set('addresseAdresse',$dataRequest['addresseAdresse']);
  189.         $this->session->set('postalcodeAdresse',$dataRequest['postalcode']);
  190.         $this->session->set('cityAdresse',$dataRequest['cityAdresse']);
  191.         $this->session->set('CountryLiv',$dataRequest['CountryLiv']);
  192.         $this->session->set('CountryCodeLiv',$dataRequest['CountryCodeLiv']);
  193.         $dataLivrason $this->checkout_service->getModeLivraisonSansStock($dataRequest);
  194.         $dataLivrason['latLongi'] = ['lat' => $dataRequest['lat'],'longi'=>$dataRequest['longi']];
  195.         return $this->render('front/accueil/block_livraison_new_accueil.html.twig'$dataLivrason);
  196.     }
  197.     /**
  198.      * @Route("/check-livraison-new-accueil", name="check_livraison_new_accueil",options={"expose"=true})
  199.      */
  200.     public function checkLivraisonNewAccueil(Request $request): Response
  201.     {
  202.         $dataRequest $request->request->all();
  203.         $this->session->set('longiAdresse',$dataRequest['longi']);
  204.         $this->session->set('latAdresse',$dataRequest['lat']);
  205.         $this->session->set('addresseAdresse',$dataRequest['addresseAdresse']);
  206.         $this->session->set('postalcodeAdresse',$dataRequest['postalcode']);
  207.         $this->session->set('cityAdresse',$dataRequest['cityAdresse']);
  208.         $this->session->set('CountryLiv',$dataRequest['CountryLiv']);
  209.         $this->session->set('CountryCodeLiv',$dataRequest['CountryCodeLiv']);
  210.         $dataLivrason $this->checkout_service->getModeLivraisonSansStock($dataRequest);
  211.         $dataLivrason['latLongi'] = ['lat' => $dataRequest['lat'],'longi'=>$dataRequest['longi']];
  212.         return $this->render('front/accueil/block_product_new_accueil.html.twig'$dataLivrason);
  213.     }
  214.     /**
  215.      * @Route("/block-livraison-time-accueil", name="block_livraison_time_accueil",options={"expose"=true})
  216.      */
  217.     public function blockLivraisontime(Request $request): Response
  218.     {
  219.         $dataRequest $request->request->all();
  220.         $this->session->set('longiAdresse',$dataRequest['longi']);
  221.         $this->session->set('latAdresse',$dataRequest['lat']);
  222.         $this->session->set('addresseAdresse',$dataRequest['addresseAdresse']);
  223.         $this->session->set('postalcodeAdresse',$dataRequest['postalcode']);
  224.         $this->session->set('cityAdresse',$dataRequest['cityAdresse']);
  225.         $this->session->set('CountryLiv',$dataRequest['CountryLiv']);
  226.         $this->session->set('CountryCodeLiv',$dataRequest['CountryCodeLiv']);
  227.         $dataLivrason $this->checkout_service->getModeLivraisonSansStock($dataRequest);
  228.         $time =false ;
  229.         if($dataLivrason['imprimeurZoneChalandise'] ){
  230.            $time $this->cartService->getFirstTime($dataLivrason['imprimeurZoneChalandise']->getId());
  231.         }
  232.         $responce = new Response();
  233.         $responce->setContent($time?$time:'');
  234.         return $responce;
  235.     }
  236.     /**
  237.      * @Route("/besoin-produits", name="besoin_produits",options={"expose"=true})
  238.      */
  239.     public function besoinProduits(Request $request): Response
  240.     {
  241.         $data $this->checkout_service->getDataLivraisonWithOrNotImprimeur();
  242.         $response $this->render('front/accueil/besoin-products-new.html.twig',$data);
  243.         return $response;
  244.     }
  245.     /**
  246.      * @Route("/besoin-produits-preference", name="besoin_produits_preference",options={"expose"=true})
  247.      */
  248.     public function besoinProduitsPreference(Request $request): Response
  249.     {
  250.         $requestAll $request->request->all();
  251.         $array = [];
  252.         if($requestAll){
  253.             $i ;
  254.             $arrayGlobal = [];
  255.             foreach ($requestAll as $item){
  256.                 $products $this->em->getRepository(BesoinProductPage::class)->getByCategoryAndCretere($item);
  257.                 $tab = [];
  258.                 if($products){
  259.                     foreach ($products as $product){
  260.                         $tab[$product->getId()] = $product->getId();
  261.                     }
  262.                 }
  263.                 if($i == ){
  264.                     $arrayGlobal $tab ;
  265.                 }else{
  266.                     $arrayGlobal array_intersect($arrayGlobal $tab);
  267.                 }
  268.                 $i ++ ;
  269.             }
  270.             if($arrayGlobal){
  271.                 foreach ($arrayGlobal as $value){
  272.                     $product $this->em->getRepository(BesoinProductPage::class)->find($value);
  273.                     $array[$product->getCategory()->getName()]['category'] = $product->getCategory();
  274.                     $array[$product->getCategory()->getName()]['products'][] = $product;
  275.                 }
  276.             }
  277.         }
  278.         $response $this->render('front/accueil/besoin-product-bloc/content-search-preference.html.twig',['categorys' => $array]);
  279.         return $response;
  280.     }
  281.     /**
  282.      * @Route("/besoin-produits-default", name="besoin_produits_default",options={"expose"=true})
  283.      */
  284.     public function besoinProduitsdefault(Request $request): Response
  285.     {
  286.         $categorys $this->em->getRepository(BesoinProductPageCategory::class)->getAllActive();
  287.         $response $this->render('front/accueil/besoin-product-bloc/content-new.html.twig',['categorys'=>$categorys]);
  288.         return $response;
  289.     }
  290.     /**
  291.      * @Route("/besoin-produits-2", name="besoin_produits_2",options={"expose"=true})
  292.      */
  293.     public function besoinProduitsNew(Request $request): Response
  294.     {
  295.         $response $this->render('front/accueil/besoin-products-2.html.twig');
  296.         return $response;
  297.     }
  298.     /**
  299.      * @Route("/besoin-produits/search", name="searchBesoinProduct",options={"expose"=true})
  300.      */
  301.     public function searchBesoinProduct(Request $request) : Response
  302.     {
  303.         $requestData $request->query->get('search');
  304.         $data $this->nbDesigner->searchProductOption($request,$requestData,$this->getUser());
  305.         $response $this->render('front/accueil/besoin-product-bloc/content-search.html.twig',['data'=>$data,'valueInput'=>$requestData]);
  306.         return $response;
  307.     }
  308.     /**
  309.      * @Route("/besoin-produits-crello-add-to-cart/{id}", name="besoin_produits_crollo_add_to_cart",options={"expose"=true})
  310.      */
  311.     public function besoinProduitsCrelloAddToCart(Request $request,$id): Response
  312.     {
  313.         $data $this->nbDesigner->addToCartNewNbDesignerNosCrea($request,$this->getUser(),$id);
  314.         if($data){
  315.             $redirect =  $this->generateUrl('product_option', array('token'=>$data->getToken(),'product'=>$data->getProduct()->getId()));
  316.         }else{
  317.             $redirect $this->generateUrl('besoin_produits');
  318.         }
  319.         $responce = new Response();
  320.         $responce->setContent($redirect);
  321.         return $responce;
  322.     }
  323.     /**
  324.      * @Route("/besoin-produits-old", name="besoin_produits_old",options={"expose"=true})
  325.      */
  326.     public function besoinProduitsOld(Request $request): Response
  327.     {
  328.         $response $this->render('front/accueil/index-products.html.twig');
  329.         return $response;
  330.     }
  331.     /**
  332.      * @Route("/webhook-stripe", name="webhook_stripe_copees")
  333.      */
  334.     public function webhookStripe(Request $request): Response
  335.     {
  336.         $endpoint_secret 'whsec_7Hzm2izHMWSwhcPNWCbDmWGX3FJdHujM';
  337.         $payload = @file_get_contents('php://input');
  338.         $sig_header $_SERVER['HTTP_STRIPE_SIGNATURE'];
  339.         $event null;
  340.         try {
  341.             $event = \Stripe\Webhook::constructEvent(
  342.                 $payload$sig_header$endpoint_secret
  343.             );
  344.         } catch(\UnexpectedValueException $e) {
  345.             exit();
  346.         } catch(\Stripe\Exception\SignatureVerificationException $e) {
  347.             exit();
  348.         }
  349.         if ($event->type == "payment_intent.succeeded") {
  350.             $intent $event->data->object;
  351.             $charge $intent->id;
  352.             $order $this->em->getRepository(Orders::class)->findBy(array('chargeStripeId'=> $charge),array('id'=>'desc'));
  353.             if (isset($order[0]) && $order[0] && !$order[0]->getIsValid()) {
  354.                 $cart $order[0]->getCart();
  355.                 $order[0]->setIsValid(true);
  356.                 $status $this->em->getRepository(Stats::class)->findOneBy(array('statusNbr' => Stats::ENCOURT));
  357.                 $order[0]->setStatus($status);
  358.                 $nameFacture $this->facture_service->uploadFacture($order[0]->getId());  //creation facture
  359.                 $order[0]->setPathFacture($nameFacture);
  360.                 $order[0]->setIsAbonnementPro($cart->getIsAbonnementPro());
  361.                 $this->em->persist($order[0]);
  362.                 $this->em->flush();
  363.                 $this->stripeConnectService->createRefundByPaymentIntentIfEmptyDetail($order[0], $cart); // refound 0.5€ if 0€ in order
  364.                 http_response_code(200);
  365.             }
  366.             exit();
  367.         } elseif ($event->type == "payment_intent.payment_failed") {
  368.             exit();
  369.         }elseif ( $event->type == "charge.dispute.closed" or $event->type == "charge.dispute.funds_withdrawn") {
  370.             $dispute $event->data->object;
  371.             $charge $dispute->payment_intent;
  372.             $factureAbo $this->em->getRepository(CompteAbonnementProFacture::class)->findBy(array('chargeStripeId'=> $charge),array('id'=>'desc'));
  373.             $factureAboCommandes $this->em->getRepository(CompteAbonnementProCommandesFactures::class)->findBy(array('chargeStripeId'=> $charge),array('id'=>'desc'));
  374.             if(($factureAbo && $factureAbo[0])){
  375.                 $facture $factureAbo[0];
  376.                 $facture->setStatusPaiement(CompteAbonnementProFacture::STATUS_IMPAYE);
  377.                 $this->em->persist($facture);
  378.                 $this->em->flush();
  379.             }
  380.             if(($factureAboCommandes && $factureAboCommandes[0])){
  381.                 $factureCommande $factureAboCommandes[0];
  382.                 $factureCommande->setStatusPaiement(CompteAbonnementProCommandesFactures::STATUS_IMPAYE);
  383.                 $this->em->persist($factureCommande);
  384.                 $this->em->flush();
  385.             }
  386.             http_response_code(200);
  387.             exit();
  388.         }
  389.     }
  390.     /**
  391.      * @Route("/webhook-request-merci-facteur", name="webhook_request_merci_facteur")
  392.      */
  393.     public function webhookRequestMerciFacteur(Request $request) : Response
  394.     {
  395.         if (isset($_POST['event'])) {
  396.             $objectEvent json_decode($_POST['event']);
  397.             if ((is_object($objectEvent) and $objectEvent->name_event == 'printed') or (is_object($objectEvent) and $objectEvent->name_event == 'new-state') or (is_object($objectEvent) and $objectEvent->name_event == 'delivered')) {
  398.                 $objectDetail json_decode($_POST['detail']);
  399.                 foreach ($objectDetail as $detail) {
  400.                     $idEvent $detail->id_envoi;
  401.                     $object $this->em->getRepository(StuartOrder::class)->findOneBy(array('idJob' => $idEvent));
  402.                     $order null;
  403.                     if ($object) {
  404.                         $order $object->getOrders();
  405.                         $object->setTrakingurl($detail->ref_courrier);
  406.                         $object->setTrakckingPoste($detail->tracking_number);
  407.                         $object->setStatus($detail->statut_description);
  408.                         $this->em->persist($object);
  409.                         $this->em->flush();
  410.                     }
  411.                     $this->notifications->mailRequestDetailPoste($detail$order);
  412.                 }
  413.             }
  414.         }
  415.         http_response_code(200);
  416.         exit();
  417.     }
  418.     /**
  419.      * @Route("/offre-B2B", name="offre_B2B")
  420.      */
  421.     public function offreB2B(Request $request) : Response
  422.     {
  423.         return $this->redirectToRoute('offre_B2B_2');
  424.         $response $this->render('front/accueil/offre-b2b.html.twig');
  425.         return $response;
  426.     }
  427.     /**
  428.      * @Route("/offre-B2B-2", name="offre_B2B_2")
  429.      */
  430.     public function offreB2B2(Request $request) : Response
  431.     {
  432.         $response $this->render('front/accueil/offre-b2b2.html.twig');
  433.         return $response;
  434.     }
  435.     /**
  436.      * @Route("/page/{url}", name="page_cms_front")
  437.      */
  438.     public function pageCms(Request $request,$url) : Response
  439.     {
  440.         $page $this->em->getRepository(Page::class)->findOneBy(['url'=>$url]);
  441.         if($page){
  442.             if($page->getPageType() == Page::PAGE_VILLE){
  443.                 $response $this->render('front/page-cms/page-ville.html.twig',['page'=>$page]);
  444.             }elseif ($page->getPageType() == Page::PAGE_METIER){
  445.                 $response $this->render('front/page-cms/page-metier.html.twig',['page'=>$page]);
  446.             }elseif ($page->getPageType() == Page::PAGE_PRODUIT){
  447.                 $response $this->render('front/page-cms/page-produit.html.twig',['page'=>$page]);
  448.             }else{
  449.                 $response $this->render('front/error.html.twig');
  450.             }
  451.         }else{
  452.             $response $this->render('front/error.html.twig');
  453.         }
  454.         return $response;
  455.     }
  456.     /**
  457.      * @Route("/change-country", name="change_country_code" ,options={"expose"=true})
  458.      */
  459.     public function ChangeCountry(Request $request) : Response
  460.     {
  461.         $referer $request->headers->get('referer'); // get the referer, it can be empty!
  462.         if (!\is_string($referer) || !$referer) {
  463.             $refererRoute 'accueil';
  464.         }
  465.         $refererPathInfo Request::create($referer)->getPathInfo();
  466.         $routeInfos $this->router->match($refererPathInfo);
  467.         $refererRoute $routeInfos['_route'] ?? 'accueil';
  468.         unset($routeInfos['_route']);
  469.         unset($routeInfos['_controller']);
  470.         $routeInfos['_locale'] = $this->session->get('_locale');
  471.         return $this->redirectToRoute($refererRoute,$routeInfos);
  472.     }
  473. //    /**
  474. //     * @Route("/aqsdqsdqsdaa", name="changeazeaze_country_code" ,options={"expose"=true})
  475. //     * @IsGranted("ROLE_SUPER_ADMINISTRATOR")
  476. //     */
  477. //    public function aazeazeaz(Request $request) : Response
  478. //    {
  479. //        $imprimeur = $this->em->getRepository(Imprimeur::class)->find(29);
  480. //        $orderDetailVirement = $this->em->getRepository(OrderDetailVirement::class)->find(12412);
  481. //        $orderDetails = $orderDetailVirement->getOrderDetail();
  482. ////        $nameFacture = $this->facture_service->uploadFactureVirementDetails30j($orderDetails,$orderDetailVirement);  //creation facture virement 30j
  483. //        foreach ($orderDetails as $orderDetail) {
  484. //            $orderDetail->setPathFactureVirement('not_facture');
  485. //            $orderDetail->setPayoutStripeId('po_1Oh6vtQ1EFGM3mS7em6SNaSO');
  486. //            $this->em->persist($orderDetail);
  487. //        }
  488. //        // set orderDetailVirement
  489. //        $orderDetailVirement->setPayoutStripeId('po_1Oh6vtQ1EFGM3mS7em6SNaSO');
  490. //        $orderDetailVirement->setPathFactureVirement('not_facture');
  491. //        $this->em->persist($orderDetailVirement);
  492. //        $this->em->flush();
  493. //
  494. ////        $this->notifications->sendOrderDetailVirement30j($imprimeur, 'Virement imprimeur', $orderDetailVirement, $nameFacture,$orderDetails); // send order virement to imprimeur
  495. //        die();
  496. //    }
  497.     /**
  498.      * @Route("/lab-copees", name="lab_copees")
  499.      */
  500.     public function labCopees(Request $request) : Response
  501.     {
  502.         $response $this->render('front/accueil/labCopees.html.twig');
  503.         return $response;
  504.     }
  505.     /**
  506.      * @Route("/change-receiver-notif-b2b/{token}", name="change_mail_receiver_b2b_notif",options={"expose"=true})
  507.      */
  508.     public function changeNotifCustomerB2c(Request $request,$token) : Response
  509.     {
  510.         if($token){
  511.             $notif $this->em->getRepository(NotifB2b::class)->findOneBy(['token'=>$token]);
  512.             if($notif){
  513.                 $customer $notif->getCustomer();
  514.                 if($customer){
  515.                     $customer->setIsNotReceiver(true);
  516.                     $this->em->persist($customer);
  517.                     $this->em->flush();
  518.                     $response $this->render('front/pageDeleteNotification.html.twig');
  519.                     return $response;
  520.                 }
  521.             }
  522.         }
  523.         $response = new Response(1);
  524.         return $response;
  525.     }
  526. }