src/Controller/TunnelGiftController.php line 134

  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Country;
  4. use App\Entity\GiftCode;
  5. use App\Entity\PaymentMethod;
  6. use App\Entity\PromoCode;
  7. use App\Entity\ReminderUser;
  8. use App\Entity\User;
  9. use App\Entity\UserGiftPayment;
  10. use App\Helper\FacebookSAPI;
  11. use App\Helper\GeoPlugin;
  12. use App\Helper\IpToCountry;
  13. use App\Service\MailchimpAPI;
  14. use App\Service\MailingTransac;
  15. use Doctrine\Persistence\ManagerRegistry;
  16. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  17. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  18. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  19. use Symfony\Component\Form\Extension\Core\Type\PasswordType;
  20. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  21. use Symfony\Component\Form\Extension\Core\Type\TextType;
  22. use Symfony\Component\HttpFoundation\RedirectResponse;
  23. use Symfony\Component\HttpFoundation\Request;
  24. use Symfony\Component\HttpFoundation\Response;
  25. use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
  26. use Symfony\Component\Routing\Annotation\Route;
  27. use Symfony\Component\Routing\Generator\UrlGenerator;
  28. use Symfony\Bundle\SecurityBundle\Security;
  29. #[Route('/{_locale}')]
  30. class TunnelGiftController extends AbstractController
  31. {
  32.     private $doctrine;
  33.     private $entityManager;
  34.     
  35.     public function __construct(ManagerRegistry $doctrine)
  36.     {
  37.         $this->doctrine $doctrine;
  38.         $this->entityManager $this->doctrine->getManager();
  39.     }
  40.     
  41.     public static function generateGiftCode($doctrineUserGiftPayment $payment)
  42.     {
  43.         $em $doctrine->getManager();
  44.         $paymentMethod $payment->getPayment();
  45.         
  46.         $codes $doctrine->getRepository(GiftCode::class)->getUniqueCode($paymentMethod->getQuantite(),$paymentMethod->getMontant(),'achatCadeau');
  47.         while($code array_shift($codes))
  48.         {
  49.             $payment->addGiftCode($code);
  50.             $em->persist($code);
  51.         }
  52.         $em->flush();
  53.     }
  54.     
  55.     protected function getCurrency($country_code){
  56.         switch($country_code){
  57.             case 'CA':
  58.                 $currency '$CAN';
  59.             break;
  60.             case 'CH':
  61.                 $currency "CHF";
  62.             break;
  63.             case 'MA':
  64.                 $currency "MAD";
  65.             break;
  66.             default:
  67.                 $currency "&euro;";
  68.             break;
  69.         }
  70.         return $currency;
  71.     }
  72.     protected function getUserIsoCode($request$session)
  73.     {
  74.         $ipAddress $request->getClientIp();
  75.         if ($session->get('country_iso',null) == null) {
  76.             try {
  77.                 $geo = new GeoPlugin();
  78.                 $geo->locate($ipAddress);
  79.                 $countryCode $geo->countryCode;
  80.                 if($countryCode == null)
  81.                     $countryCode 'FR';
  82.             } catch (\Exception $e) {
  83.                 $countryCode 'FR';
  84.             }
  85.             $session->set('country_iso'$countryCode);
  86.         } else {
  87.             $countryCode $session->get('country_iso',null);
  88.         }
  89.         return $countryCode;
  90.     }
  91.     
  92.     #[Route('/cadeau/offrir.html'name'tunnel_gift_register')]
  93.     public function offrir(Request $request): Response
  94.     {
  95.         $session $request->getSession();
  96.         if ($request->getMethod() == 'POST')
  97.         {
  98.             if($formule $request->request->get('subscription',null))
  99.             {
  100.                 $session->set('formule'$formule);
  101.                 return $this->redirectToRoute('front_gift_facturation');
  102.             }
  103.         }
  104.         TunnelController::detectCountry($request);
  105.         TunnelController::setPromoCode($request$session$this->doctrine);
  106.         $reduction false;TunnelController::getReduction($session$this->doctrine);
  107.         $url_promo_code false;$session->get('url_promo_code',false);
  108.         $promoCode false;$session->get('promo_code',false);
  109.         
  110.         $displayReduction $reduction !== false;
  111.         
  112.         $country_code $session->get('payment_code');
  113.         $currency $this->getCurrency($country_code);
  114.         
  115.         $prices $this->doctrine->getRepository(PaymentMethod::class)->getGiftPrices($country_code,$reduction,$url_promo_code);
  116.         
  117.         $formule $session->get('formule''choice2');
  118.         $wordsNb 3500;//$this->doctrine->getRepository(Word::class)->getRoundedCount();
  119.         return $this->renderForm('tunnel_gift/choose.html.twig', [
  120.             'prices' => $prices
  121.             'currency' => $currency
  122.             'choice' => $formule,
  123.             'displayReduction' => $displayReduction
  124.             'codeReduction' => $promoCode
  125.             'montantReduction' => floor($reduction),
  126.             'wordsNb' => $wordsNb
  127.             'isPromoUrl' => $url_promo_code
  128.         ]);
  129.     }
  130.     
  131.     #[Route('/cadeau/facturation.html'name'front_gift_facturation')]
  132.     public function facturation(Request $request): Response
  133.     {
  134.         $session $request->getSession();
  135.         /** @var User $user */
  136.         $user = new User(); //on crée un user vide pour récupérer les informations
  137.         /** @var User $currentUser */
  138.         $currentUser $this->getUser();
  139.         
  140.         if($currentUser)
  141.         {
  142.             $user->setFirstName($currentUser->getFirstName());
  143.             $user->setLastName($currentUser->getLastName());
  144.             $user->setEmail($currentUser->getEmail());
  145.             $user->setAddress($currentUser->getAddress());
  146.             $user->setZipCode($currentUser->getZipCode());
  147.             $user->setCity($currentUser->getCity());
  148.             $user->setEcountry($currentUser->getEcountry());
  149.             $country $user->getEcountry();
  150.             if($country == null)
  151.                 $country 68;
  152.             else
  153.                 $country $country->getId();
  154.         } else {
  155.             $user->setFirstName($session->get('firstName'""));
  156.             $user->setLastName($session->get('lastName'""));
  157.             $user->setEmail($session->get('email'""));
  158.             $user->setAddress($session->get('address'""));
  159.             $user->setZipCode($session->get('zipCode'""));
  160.             $user->setCity($session->get('city'""));
  161.             $user->setEcountry($session->get('country'null));
  162.             $country $session->get('country'"");
  163.             if($country == "")
  164.                 $country 68;
  165.         }
  166.         
  167.         $defaultCountry $this->doctrine->getRepository(Country::class)->findOneByIsoCode($country);
  168.         if(!$defaultCountry)
  169.             $defaultCountry $this->doctrine->getRepository(Country::class)->findOneByCanonicalName('france-metropolitaine');
  170.             
  171.         $user->setECountry($defaultCountry);
  172.         
  173.         $form $this->createFormBuilder($user, ['validation_groups' => ['facturation'], 'translation_domain' => 'tunnel'])
  174.             ->add('firstname'TextType::class, ['label' => 'Nom'])
  175.             ->add('lastname'TextType::class, ['label' => 'Prénom'])
  176.             ->add('email'EmailType::class)
  177.             ->add('address'TextType::class, ['label' => 'Adresse'])
  178.             ->add('zipCode'TextType::class, ['label' => 'Code postal'])
  179.             ->add('city'TextType::class, ['label' => 'Ville'])
  180.             ->add('ecountry'EntityType::class, ['class' => Country::class, 'label' => 'Pays''choice_label' => 'canonicalName''choice_translation_domain' => 'countries'])
  181.             ->add('save'SubmitType::class, ['label' => 'Continuer'])
  182.             ->getForm();
  183.         $form->handleRequest($request);
  184.         if ($form->isSubmitted() && $form->isValid())
  185.         {
  186.             $user $form->getData();
  187.             $session->set('lastName'$user->getLastName());
  188.             $session->set('firstName'$user->getFirstName());
  189.             $session->set('email'$user->getEmail());
  190.             $session->set('address'$user->getAddress());
  191.             $session->set('city'$user->getCity());
  192.             $session->set('zipCode'$user->getZipCode());
  193.             $session->set('country'$user->getEcountry()->getId());
  194.             
  195.             return $this->redirectToRoute('front_gift_payment');
  196.         }
  197.         return $this->renderForm('tunnel_gift/billing.html.twig', [
  198.             'form' => $form
  199.         ]);
  200.     }
  201.     #[Route('/cadeau/paiement.html'name'front_gift_payment')]
  202.     public function paiement(Request $request): Response
  203.     {
  204.         $session $request->getSession();
  205.         $type 'cb';
  206.         if($request->getMethod() == 'POST')
  207.         {
  208.             $type $request->get('type','cb');
  209.         }
  210.         $currentChoice $session->get('formule'null);
  211.         if($currentChoice == null)
  212.         {
  213.             return $this->redirectToRoute('default_price');
  214.         }
  215.         $payment_id $this->doctrine->getRepository(PaymentMethod::class)->getChoiceGift($currentChoice,$session);
  216.         $paymentMethod $this->doctrine->getRepository(PaymentMethod::class)->findOneById($payment_id);
  217.         if($paymentMethod != null && $paymentMethod->getType() == PaymentMethod::TYPE_CODECADEAU)
  218.         {
  219.             $prixBase $prix $paymentMethod->getValeur();
  220.             
  221.             $reduction TunnelController::getReduction($session$this->doctrine);
  222.             $url_promo_code $session->get('url_promo_code',false);
  223.             $prix TunnelController::getPriceReduction($paymentMethod,$prix,$reduction,$url_promo_code);
  224.             
  225.             if(!$url_promo_code || ($url_promo_code && $paymentMethod->getMontant() != 1)){
  226.                 $displayReduction $reduction !== false;
  227.             }else{
  228.                 $displayReduction false;
  229.             }
  230.             $montant $paymentMethod->getMontant();
  231.             $prixMois round($prix $montant2PHP_ROUND_HALF_DOWN);
  232.             $prix number_format($prix2','' ');
  233.             $prixBase number_format($prixBase2','' ');
  234.             $prixMois number_format($prixMois2','' ');
  235.             
  236.             $currency IpToCountry::getCurrency($session);
  237.             
  238.             $time $paymentMethod->getMontant();
  239.             
  240.             $country $this->doctrine->getRepository(Country::class)->findOneById($session->get('country'));
  241.             if($country == null)
  242.                 $country $this->doctrine->getRepository(Country::class)->findOneByCanonicalName('france-metropolitaine');
  243.             return $this->render('tunnel_gift/payment.html.twig', [
  244.                 'nom' => $session->get('lastName'),
  245.                 'prenom' => $session->get('firstName'),
  246.                 'adresse' => $session->get('address'),
  247.                 'ville' => $session->get('city'),
  248.                 'zipCode' => $session->get('zipCode'),
  249.                 'pays' => $country,
  250.                 'email' => $session->get('email'),
  251.                 'paymentMethod' => $session->get('formule'),
  252.                 'paymentType' => $paymentMethod->getType(),
  253.                 'paymentDuration' => $montant,
  254.                 'currency' => $currency,
  255.                 'prix' => $prix,
  256.                 'prixBase' => $prixBase,
  257.                 'prixMois' => $prixMois,
  258.                 'time' => $time,
  259.                 'displayReduction' => $displayReduction,
  260.                 'type' => $type,
  261.             ]);
  262.         }
  263.     }
  264.     
  265.     #[Route('/cadeau/delayed_payment.html'name'gift_delayed_payment')]
  266.     public function delayed_payment(Request $request): Response
  267.     {
  268.         $session $request->getSession();
  269.         /** @var User $user */
  270.         $user $this->getUser();
  271.         $formule $request->request->get('formule',0);
  272.         $isTransfer $request->request->get('transfer',null) != null;
  273.         $type $request->get('type',0);
  274.         $currentChoice $session->get('formule'null);
  275.         $payment_id $this->doctrine->getRepository(PaymentMethod::class)->getChoiceGift($currentChoice,$session);
  276.         $paymentMethod $this->doctrine->getRepository(PaymentMethod::class)->findOneById($payment_id);
  277.         if($paymentMethod != null && $paymentMethod->getType() == PaymentMethod::TYPE_CODECADEAU)
  278.         {
  279.             switch ($type){
  280.                 case "cheque":
  281.                     $route 'gift_subscription_check';
  282.                 break;
  283.                 case "virement":
  284.                     $route 'gift_subscription_transfer';
  285.                 break;
  286.             }
  287.             
  288.             $time '' time() . '';
  289.             $sReference base_convert($time1036) . '#' random_int(19999);
  290.             $sMontant $paymentMethod->getValeur();
  291.             $reduction TunnelController::getReduction($session$this->doctrine);
  292.             $displayReduction $reduction !== false;
  293.             $url_promo_code $session->get('url_promo_code',false);
  294.             $sMontant TunnelController::getPriceReduction($paymentMethod,$sMontant,$reduction,$url_promo_code);
  295.             $payment self::createPayment($this->doctrine,$session,$user,$request->getLocale(),$sReference);
  296.             $payment->setMontant($sMontant);
  297.             $payment->setMontantReel($sMontant/$paymentMethod->getBaseReel());
  298.             $payment->setPayment($paymentMethod);
  299.             $payment->setReference($sReference);
  300.             $payment->setType($type);
  301.             $this->entityManager->flush();
  302.             $country_code $session->get('payment_code');
  303.             
  304.             $currency $this->getCurrency($country_code);
  305.             
  306.             self::resetSession($session);
  307.             return $this->render('tunnel_gift/form_cheque.html.twig', [
  308.                 'montant' => $sMontant,
  309.                 'time' => $paymentMethod->getMontant(), 
  310.                 'reference' => $sReference,
  311.                 'route' => $route,
  312.                 'currency' => $currency
  313.             ]);
  314.         }
  315.         return new Response("error");
  316.     }
  317.     
  318.     #[Route('/cadeau/virement-bancaire.html'name'gift_subscription_transfer')]
  319.     public function sendBankTransfer(Request $requestMailingTransac $mailer): Response
  320.     {
  321.         $session $request->getSession();
  322.         $montant $request->get('montant',0);
  323.         $currency $request->get('currency',0);
  324.         $reference $request->get('reference',"");
  325.         $time intval($request->get('time',0));
  326.         
  327.         $montant number_format($montant,2);
  328.         $montant str_replace("."","$montant);
  329.         $mail $session->get('email'null);
  330.         if($mail){
  331.             $mailer->sendBankTransferMail($mail,$montant,$currency,$reference,$time,'gift');
  332.         }
  333.         
  334.         return $this->render('tunnel_gift/sendBankTransfer.html.twig', [
  335.             'montant' => $montant
  336.             'reference' => $reference,
  337.             'time' => $time,
  338.             'currency' => $currency,
  339.         ]);
  340.     }
  341.     
  342.     #[Route('/cadeau/envoi-cheque.html'name'gift_subscription_check')]
  343.     public function sendCheck(Request $requestMailingTransac $mailer): Response
  344.     {
  345.         $session $request->getSession();
  346.         $montant $request->get('montant',0);
  347.         $currency $request->get('currency',0);
  348.         $reference $request->get('reference',"");
  349.         $time intval($request->get('time',0));
  350.         
  351.         $montant number_format($montant,2);
  352.         $montant str_replace("."","$montant);
  353.         $mail $session->get('email'null);
  354.         if($mail){
  355.             $mailer->sendChequeMail($mail,$montant,$currency,$reference,$time,'gift');
  356.         }
  357.         
  358.         return $this->render('tunnel_gift/sendCheque.html.twig', [
  359.             'montant' => $montant
  360.             'reference' => $reference,
  361.             'time' => $time,
  362.             'currency' => $currency,
  363.         ]);
  364.     }
  365.     
  366.     static function createPayment($doctrine,$session,$user,$locale,$sReference)
  367.     {
  368.         $em $doctrine->getManager();
  369.         $payment = new UserGiftPayment();
  370.         $payment->setFirstName($session->get('firstName'));
  371.         $payment->setLastName($session->get('lastName'));
  372.         $payment->setAddress($session->get('address'));
  373.         $payment->setZipCode($session->get('zipCode'));
  374.         $payment->setCity($session->get('city'));
  375.         $payment->setEmail($session->get('email'));
  376.         
  377.         $payment->setLocale($locale);
  378.         $payment->setIsCredit(false);
  379.         
  380.         $country $doctrine->getRepository(Country::class)->findOneById($session->get('country'));
  381.         if($country == null)
  382.             $country $doctrine->getRepository(Country::class)->findOneByCanonicalName('france-metropolitaine');
  383.         $payment->setECountry($country);
  384.         $payment->setCountry("");
  385.         
  386.         $payment->setEmail($session->get('email'));
  387.         if($user != null)
  388.             $payment->setUser($user);
  389.         $payment->setWaitingPayment(true);
  390.         $payment->setReference($sReference);
  391.         
  392.         $pk md5($session->get('firstName') . $session->get('lastName') . $session->get('address') . $sReference);
  393.         $payment->setPrivateKey($pk);
  394.         
  395.         $code $doctrine->getRepository(PromoCode::class)->getPromoCode($session->get('promo_code',null));
  396.         $payment->setPromoCode($code);
  397.         
  398.         $em->persist($payment);
  399.         
  400.         return $payment;
  401.     }
  402.     
  403.     #[Route('/cadeau/detail.html'name'gift_detail')]
  404.     public function showDetailGift(Request $request): Response
  405.     {
  406.         $id $request->get('id',0);
  407.         $userPayment $this->doctrine->getRepository(UserGiftPayment::class)->findOneBy(array("privateKey" => $id));
  408.         if($userPayment != null){
  409.             $request->setLocale($userPayment->getLocale());
  410.             $request->attributes->set('_locale'$userPayment->getLocale());
  411.             return $this->render('tunnel_gift/detail.html.twig', [
  412.                 "payment" => $userPayment
  413.             ]);
  414.         }else{
  415.             return $this->render('tunnel_gift/detail.html.twig', [
  416.                 "payment" => null
  417.             ]);
  418.         }
  419.     }
  420.     #[Route('/cadeau/print.html'name'gift_print')]
  421.     public function sendPrintGift(Request $request): Response
  422.     {
  423.         $id $request->get('id',0);
  424.         $userPayment $this->doctrine->getRepository(UserGiftPayment::class)->findOneBy(array("privateKey" => $id));
  425.         if($userPayment != null){
  426.             $request->setLocale($userPayment->getLocale());
  427.             $request->attributes->set('_locale'$userPayment->getLocale());
  428.             $giftCodes $userPayment->getGiftCodes();
  429.             if($giftCodes->count() > 0)
  430.                 $giftCode $giftCodes[0];
  431.             return $this->render('tunnel_gift/print.html.twig', [
  432.                 "payment" => $userPayment,
  433.                 "locale" => $userPayment->getLocale(),
  434.                 "code" => $giftCode
  435.             ]);
  436.         }else{
  437.             return $this->render('tunnel_gift/detail.html.twig', [
  438.                 "payment" => null
  439.             ]);
  440.         }
  441.     }
  442.     #[Route('/cadeau.html'name'gift_code_html')]
  443.     #[Route('/cadeau'name'gift_code')]
  444.     public function register(Request $requestUserPasswordHasherInterface $passwordHasherMailchimpAPI $mailchimpSecurity $security): Response
  445.     {
  446.         $session $request->getSession();
  447.         $user $this->getUser();
  448.         //$user = $this->getUser();
  449.         if($user instanceof User
  450.         {
  451.             //on passe la phase registration
  452.             return $this->redirectToRoute('gift_activate');
  453.         }
  454.         $user = new User(); //on crée un user vide pour récupérer les informations
  455.         $codeOk null;
  456.         $form $this->createFormBuilder($user, ['validation_groups' => ['registration''giftCode'], 'translation_domain' => 'tunnel'])
  457.             ->add('username'TextType::class, ['label' => 'Choisissez un pseudo'])
  458.             ->add('email'RepeatedType::class, [
  459.                 'type' => EmailType::class,
  460.                 'required' => true,
  461.                 'first_options'  => ['label' => 'Entrez votre e-mail'],
  462.                 'second_options' => ['label' => 'Répétez votre e-mail'],
  463.             ])
  464.             ->add('plainPassword'PasswordType::class, ['attr' => ['class' => 'w-75'], 'label' => 'Choisissez un mot de passe'])
  465.             ->add('code'TextType::class, ['label' => 'Entre ton code-abo :'])
  466.             ->add('submit'SubmitType::class, ['label' => 'Continuer'])
  467.             ->getForm();
  468.         $form->handleRequest($request);
  469.         if ($form->isSubmitted() && $form->isValid())
  470.         {
  471.             $user $form->getData();
  472.             $codeOk false;
  473.             $code $this->doctrine->getRepository(GiftCode::class)->getCodeByFull($user->getCode());
  474.             if($code != null && $code->isOk())
  475.             {
  476.                 $codeOk true;
  477.             }
  478.             
  479.             if($codeOk)
  480.             {
  481.                 $email $user->getEmail();
  482.                 $password $user->getPlainPassword();
  483.                 //hasher le password
  484.                 $hashedPassword $passwordHasher->hashPassword(
  485.                     $user,
  486.                     $password
  487.                 );
  488.                 $user->setPassword($hashedPassword);
  489.                 $user->setLocale($request->getLocale());
  490.                 $session $request->getSession();
  491.                 $countryCode $this->getUserIsoCode($request$session);
  492.                 $defaultCountry $this->doctrine->getRepository(Country::class)->findOneByIsoCode($countryCode);
  493.                 if(!$defaultCountry || $countryCode == "FR")
  494.                     $defaultCountry $this->doctrine->getRepository(Country::class)->findOneByCanonicalName('france-metropolitaine');
  495.                 //$currentUser->setSiteUrl(IpToCountry::getExtension($session));
  496.                 $user->setEcountry($defaultCountry);
  497.                 $user->addRole(User::ROLE_GIFT);
  498.                 $user->setMailConfirmedAt(new \DateTimeImmutable());
  499.                 $user->setSubscriptionDate(new \DateTimeImmutable());
  500.                 $newDate = new \DateTimeImmutable('now');
  501.                 $newDate $newDate->modify('+'.($code->getMontant()).' month');
  502.                 //Now set the new expiration date
  503.                 $user->setSubscriptionExpireAt($newDate);
  504.                 $code->setUtilisation($code->getUtilisation() - 1);
  505.                 $this->entityManager->persist($user);
  506.                 $this->entityManager->flush();
  507.                 $session $request->getSession();
  508.                 $session->set('user_data_id',$user->getId());
  509.                 //FB API !
  510.                 //$event_id = $this->sendFBMsgRegister($user);
  511.                 //$session->set('reg_event_id',$event_id);
  512.                 $this->doctrine->getRepository(ReminderUser::class)->addEmail($user->getEmail(),$user->getUsername(), $request->getLocale());
  513.                 $mailchimp->addUser($user);
  514.                 $security->login($user'security.authenticator.form_login.main');
  515.                 
  516.                 return $this->redirectToRoute('user_homepage');
  517.             }
  518.         }
  519.         return $this->renderForm('tunnel_gift/register.html.twig', [
  520.             'form' => $form,
  521.             'codeOk' => $codeOk
  522.         ]);
  523.     }
  524.     public function checkGiftCode($code) {
  525.         if(preg_match("#[^-]+-[^-]+-[^-]+-[^-]+#",$code))
  526.         {
  527.             return true;
  528.         }else{
  529.             return false;
  530.         }
  531.     }
  532.     #[Route('/cadeau/activate.html'name'gift_activate')]
  533.     public function activate(Request $request): Response
  534.     {
  535.         return $this->renderForm('tunnel_gift/activate.html.twig', [
  536.             'form' => $form
  537.         ]);
  538.     }
  539.     #[Route('/cadeau/confirmation.html'name'gift_activate')]
  540.     public function confirmation(Request $request): Response
  541.     {
  542.         return $this->render('tunnel_gift/confirmation.html.twig', [
  543.         ]);
  544.     }
  545.     #[Route('/cadeau/abonnement-cb-reussi.html'name'gift_subscription_cb')]
  546.     #[Route('/cadeau/abonnement-reussi.html'name'gift_subscription_confirmed')]
  547.     #[Route('/cadeau/abonnement-paypal-reussi.html'name'gift_subscription_paypal')]
  548.     public function showConfirmSubscription(Request $request): Response
  549.     {
  550.         return $this->render('tunnel_gift/subscriptionConfirmed.html.twig', [
  551.         ]);
  552.     }
  553.     
  554.     static function resetSession()
  555.     {
  556.         /*$request = $this->container->get('request');
  557.         $session = $request->getSession();
  558.         $session->set('formule', 'choice2');
  559.                 
  560.         $session->set('occasion', 1);
  561.         $session->set('presentation', 1);
  562.         $session->set('destinataire', null);
  563.         $session->set('expediteur', null);
  564.         $session->set('message', null);
  565.                 
  566.         $session->set('lastName', null);
  567.         $session->set('firstName', null);
  568.         $session->set('email', null);
  569.         $session->set('address', null);
  570.         $session->set('city', null);
  571.         $session->set('zipCode', null);
  572.         $session->set('country', null);*/
  573.     }
  574. }