src/Controller/PayementController.php line 441

Open in your IDE?
  1. <?php
  2. // src/Controller/typeproduit
  3. namespace App\Controller;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use App\Entity\Commande;
  7. use App\Entity\ParentSejour;
  8. use App\Entity\Ref;
  9. use Symfony\Component\HttpFoundation\JsonResponse;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  12. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  13. use App\Service\EmailsCmdService;
  14. use App\Service\PayementService;
  15. use App\Service\SejourService;
  16. use Doctrine\Persistence\ManagerRegistry;
  17. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  18. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  19. /**
  20.  * @Route("/Payement")
  21.  */
  22. class PayementController extends AbstractController
  23. {
  24.     private $em;
  25.     private $session;
  26.     private $EmailServie;
  27.     private $params;
  28.     private $sejourService;
  29.     private $PayementService;
  30.     public function __construct(ManagerRegistry $emSessionInterface $sessionEmailsCmdService $EmailCommandeService\Swift_Mailer $mailerParameterBagInterface $paramsSejourService $sejourServicePayementService $PayementService)
  31.     {
  32.         $this->em $em;
  33.         $this->session $session;
  34.         $this->EmailServie $EmailCommandeService;
  35.         $this->params $params;
  36.         $this->sejourService $sejourService;
  37.         $this->PayementService $PayementService;
  38.     }
  39.     /**
  40.      * @Route("/", name="payementTest", methods={"GET"})
  41.      */
  42.     public function analyticsBloc(): Response
  43.     {
  44.         $identifiant $this->params->get('analytics');
  45.         return $this->render('Payement/PayementForm.html.twig', [
  46.             'identifiant' => $identifiant,
  47.         ]);
  48.     }
  49.     /**
  50.      * @Route("/accept_url/{id}", name="moneticoAcceptUrl")
  51.      */
  52.     function moneticoAcceptUrl($id)
  53.     {
  54.         ini_set("max_execution_time", -1);
  55.         ini_set('memory_limit''-1');
  56.         $em $this->container->get('doctrine')->getManager();
  57.         //generate Num Facture
  58.         $dateSJoue = new \Datetime();
  59.         $annes $dateSJoue->format('y');
  60.         $moi $dateSJoue->format('m');
  61.         $val   $this->em->getRepository(Commande::class)->serachNombreFacture();
  62.         $val $val 1;
  63.         $valx sprintf('%04d'$val);
  64.         $valx1 "20" $annes $moi $valx;
  65.         $sats $this->em->getRepository(Ref::class)->find(33);
  66.         $comande $this->em->getRepository(Commande::class)->find($id);
  67.         $session $this->session;
  68.         $session->set('paymentmoniteco''succses');
  69.         $session->set('paymentup2pay''succses');
  70.         $Products $session->get("Panier_Acompa");
  71.         $sejour =   $comande->getIdSejour();
  72.         foreach ($Products as $com) {
  73.             if (array_key_exists('statut'$com)) {
  74.                 if ($com["statut"] == "saved") {
  75.                     $nrbconnx $this->em->getRepository(ParentSejour::class)->findBy(["idSejour" => $sejour->getId(), "payment" => 1]);
  76.                     if (sizeof($nrbconnx) >= 5) {
  77.                         $sejour->setAlbumgratuie(1);
  78.                         $this->em->getManager()->persist($sejour);
  79.                         $this->em->getManager()->flush();
  80.                     }
  81.                 }
  82.             }
  83.         }
  84.         $comande->setStatut($sats);
  85.         $comande->setStatut($sats);
  86.         $comande->setNumfacture($valx1);
  87.         $this->em->getManager()->persist($comande);
  88.         $this->em->getManager()->flush();
  89.         $comande->setNumfacture(substr($comande->getNumfacture(), '0'6) . $comande->getId());
  90.         $this->em->getManager()->persist($comande);
  91.         $this->em->getManager()->flush();
  92.         $resulat $session->get("paymentmoniteco");
  93.         $montanttotalcomande $comande->getMontantrth();
  94.         $session->set('montanttotalcomande'$montanttotalcomande);
  95.         //dd($montanttotalcomande);
  96.         $lengthPanier $session->get('Panier_Acompa');
  97.         $session->set('Panierlength'$lengthPanier);
  98.         $Products = [];
  99.         $session->set('Panier_Acompa'$Products);
  100.         //send mail
  101.         $this->EmailServie->MailValiderCommandeAccomp($comande->getIdUser()->getEmail(), $comande);
  102.         if ($comande->getMontanenv() == || $comande->getMontanenv() == 1) {
  103.             // $this->EmailServie->MailCommandeSuivieAccomp($comande->getIdUser()->getEmail(),$comande);
  104.         } else {
  105.             //  $this->EmailServie->MailExpCommandeSansSuivieAccomp($comande->getIdUser()->getEmail());
  106.         }
  107.         return $this->redirectToRoute('Commander_Acompa');
  108.     }
  109.     /**
  110.      * @Route("/error_url/{id}", name="moneticoExceptionUrl")
  111.      */
  112.     function moneticoExceptionUrl($id)
  113.     {
  114.         $em $this->container->get('doctrine')->getManager();
  115.         $sats $this->em->getRepository(Ref::class)->find(34);
  116.         $comande $this->em->getRepository(Commande::class)->find($id);
  117.         $session $this->session;
  118.         $session->set('paymentmoniteco''echec');
  119.         $session->set('paymentup2pay''echec');
  120.         $comande->setStatut($sats);
  121.         $this->em->getManager()->persist($comande);
  122.         $this->em->getManager()->flush();
  123.         $Products $session->get("Panier_Acompa");
  124.         $resulat $session->get("paymentmoniteco");
  125.         $montanttotalcomande $comande->getMontantrth();
  126.         $session->set('montanttotalcomande'$montanttotalcomande);
  127.         //dd($montanttotalcomande);
  128.         return $this->redirectToRoute('Commander_Acompa');
  129.     }
  130.     /**
  131.      * @Route("/error_url_comande_parent/{id}", name="moneticoExceptionUrl_parent_comande")
  132.      */
  133.     function moneticoExceptionUrl_comande($id)
  134.     {
  135.         $em $this->container->get('doctrine')->getManager();
  136.         $sats $this->em->getRepository(Ref::class)->find(34);
  137.         $comande $this->em->getRepository(Commande::class)->find($id);
  138.         $session $this->session;
  139.         $session->set('paymentmoniteco''echec');
  140.         $comande->setStatut($sats);
  141.         $this->em->getManager()->persist($comande);
  142.         $this->em->getManager()->flush();
  143.         $Products $session->get("Panier_Acompa");
  144.         $resulat $session->get("paymentmoniteco");
  145.         $montanttotalcomande $comande->getMontantrth();
  146.         $session->set('montanttotalcomande'$montanttotalcomande);
  147.         //dd($montanttotalcomande);
  148.         return $this->redirectToRoute('SuiviCommandeparent');
  149.     }
  150.     /**
  151.      * @Route("/accept_url_comande_parent/{id}", name="moneticoAcceptUrl_parent_comande")
  152.      */
  153.     function moneticoAcceptUrl_comande($id)
  154.     {
  155.         $em $this->container->get('doctrine')->getManager();
  156.         $dateSJoue = new \Datetime();
  157.         $annes $dateSJoue->format('y');
  158.         $moi $dateSJoue->format('m');
  159.         $val   $this->em->getRepository(Commande::class)->serachNombreFacture();
  160.         $val $val 1;
  161.         $valx sprintf('%04d'$val);
  162.         $valx1 "20" $annes $moi $valx;
  163.         $sats $this->em->getRepository(Ref::class)->find(33);
  164.         $comande $this->em->getRepository(Commande::class)->find($id);
  165.         $session $this->session;
  166.         $session->set('paymentmoniteco''succses');
  167.         $comande->setStatut($sats);
  168.         $comande->setNumfacture($valx1);
  169.         $this->em->getManager()->persist($comande);
  170.         $this->em->getManager()->flush();
  171.         $comande->setNumfacture(substr($comande->getNumfacture(), '0'6) . $comande->getId());
  172.         $this->em->getManager()->persist($comande);
  173.         $this->em->getManager()->flush();
  174.         //log promotion
  175.         if (!is_null($comande->getIdPromotion())) {
  176.             $sejourService $this->sejourService;
  177.             $logPromotion $sejourService->createLogPromotion($comande->getIdPromotion(), $comande$comande->getIdUser());
  178.             $comande->setLogPromo($logPromotion);
  179.             $this->em->getManager()->persist($comande);
  180.             $this->em->getManager()->flush();
  181.         }
  182.         //
  183.         $Products $session->get("Panier_Acompa");
  184.         $resulat $session->get("paymentmoniteco");
  185.         $montanttotalcomande $comande->getMontantrth();
  186.         $session->set('montanttotalcomande'$montanttotalcomande);
  187.         //dd($montanttotalcomande);
  188.         $Products = [];
  189.         $session->set('Panier'$Products);
  190.         //sendmail 
  191.         $sendTo $comande->getIdUser()->getEmail();
  192.         $sendmail $this->EmailServie->MailValiderCommandeParent($sendTo$comande);
  193.         return $this->redirectToRoute('SuiviCommandeparent');
  194.     }
  195.     /**
  196.      * @Route("/error_url_comande_Acompa/{id}", name="moneticoExceptionUrl_comande_Acompa_V")
  197.      */
  198.     function moneticoExceptionUrl_comande_Acompa_V($id)
  199.     {
  200.         $em $this->container->get('doctrine')->getManager();
  201.         $sats $this->em->getRepository(Ref::class)->find(34);
  202.         $comande $this->em->getRepository(Commande::class)->find($id);
  203.         $session $this->session;
  204.         $session->set('paymentmoniteco''echec');
  205.         $comande->setStatut($sats);
  206.         $this->em->getManager()->persist($comande);
  207.         $this->em->getManager()->flush();
  208.         $Products $session->get("Panier_Acompa");
  209.         $resulat $session->get("paymentmoniteco");
  210.         $montanttotalcomande $comande->getMontantrth();
  211.         $session->set('montanttotalcomande'$montanttotalcomande);
  212.         //dd($montanttotalcomande);
  213.         return $this->redirectToRoute('SuiviCommand', ['id' => $comande->getIdSejour()->getId()]);
  214.     }
  215.     /**
  216.      * @Route("/accept_url_comande_ACOMPA/{id}", name="moneticoAcceptUrl_comande_Acompa_V")
  217.      */
  218.     function moneticoExceptionUrl_comande_AcompaV($id)
  219.     {
  220.         $em $this->container->get('doctrine')->getManager();
  221.         $dateSJoue = new \Datetime();
  222.         $annes $dateSJoue->format('y');
  223.         $moi $dateSJoue->format('m');
  224.         $val   $this->em->getRepository(Commande::class)->serachNombreFacture();
  225.         $val $val 1;
  226.         $valx sprintf('%04d'$val);
  227.         $valx1 "20" $annes $moi $valx;
  228.         $sats $this->em->getRepository(Ref::class)->find(33);
  229.         $comande $this->em->getRepository(Commande::class)->find($id);
  230.         $session $this->session;
  231.         $session->set('paymentmoniteco''succses');
  232.         $Products $session->get("Panier_Acompa");
  233.         $sejour =   $comande->getIdSejour();
  234.         //eliminate panier offer
  235.         $comande->setStatut($sats);
  236.         $comande->setNumfacture($valx1);
  237.         $this->em->getManager()->persist($comande);
  238.         $this->em->getManager()->flush();
  239.         $comande->setNumfacture(substr($comande->getNumfacture(), '0'6) . $comande->getId());
  240.         $this->em->getManager()->persist($comande);
  241.         $this->em->getManager()->flush();
  242.         $Products $session->get("Panier_Acompa");
  243.         $resulat $session->get("paymentmoniteco");
  244.         $montanttotalcomande $comande->getMontantrth();
  245.         $session->set('montanttotalcomande'$montanttotalcomande);
  246.         //dd($montanttotalcomande);
  247.         $Products = [];
  248.         $session->set('Panier_Acompa'$Products);
  249.         return $this->redirectToRoute('SuiviCommand', ['id' => $comande->getIdSejour()->getId()]);
  250.     }
  251.     /**
  252.      * @Route("/accept_url_parent/{id}", name="moneticoAcceptUrl_parent")
  253.      */
  254.     function moneticoAcceptUrl_parent($id)
  255.     {
  256.         ini_set("max_execution_time", -1);
  257.         ini_set('memory_limit''-1');
  258.         $em $this->container->get('doctrine')->getManager();
  259.         $sats $this->em->getRepository(Ref::class)->find(33);
  260.         $comande $this->em->getRepository(Commande::class)->find($id);
  261.         if ($comande->getStatut()->getId() != 33) {
  262.             $dateSJoue = new \Datetime();
  263.             $annes $dateSJoue->format('y');
  264.             $moi $dateSJoue->format('m');
  265.             $val $this->em->getRepository(Commande::class)->serachNombreFacture();
  266.             $val $val 1;
  267.             $valx sprintf('%04d'$val);
  268.             $valx1 "20" $annes $moi $valx;
  269.             $comande->setStatut($sats);
  270.             $comande->setNumfacture($valx1);
  271.             $this->em->getManager()->persist($comande);
  272.             $this->em->getManager()->flush();
  273.             $comande->setNumfacture(substr($comande->getNumfacture(), '0'6) . $comande->getId());
  274.             $this->em->getManager()->persist($comande);
  275.             $this->em->getManager()->flush();
  276.         }
  277.         $session $this->session;
  278.         $session->set('paymentmoniteco''succses');
  279.         $session->set('paymentup2pay''succses');
  280.         $resulat $session->get("paymentmoniteco");
  281.         $montanttotalcomande $comande->getMontantrth();
  282.         $session->set('montanttotalcomande'$montanttotalcomande);
  283.         //dd($montanttotalcomande);
  284.         $lengthPanier $session->get('Panier');
  285.         $session->set('Panierlength'$lengthPanier);
  286.         $Products = [];
  287.         $session->set('Panier'$Products);
  288.         $this->EmailServie->MailValiderCommandeParent($comande->getIdUser()->getEmail(), $comande);
  289.         if ($comande->getMontanenv() == || $comande->getMontanenv() == 1) {
  290.             //  $this->EmailServie->MailCommandeSuivieParent($comande->getIdUser()->getEmail(),$comande);
  291.         } else {
  292.             //  $this->EmailServie->MailExpCommandeSansSuivieParent($comande->getIdUser()->getEmail());
  293.         }
  294.         return $this->redirectToRoute('Commander');
  295.     }
  296.     /**
  297.      * @Route("/error_url_parent/{id}", name="moneticoExceptionUrl_parent")
  298.      */
  299.     function moneticoExceptionUrl_parent($id)
  300.     {
  301.         $em $this->container->get('doctrine')->getManager();
  302.         $sats $this->em->getRepository(Ref::class)->find(34);
  303.         $comande $this->em->getRepository(Commande::class)->find($id);
  304.         $session $this->session;
  305.         $session->set('paymentmoniteco''echec');
  306.         $session->set('paymentup2pay''echec');
  307.         $session->set('referenceup2pay'$id);
  308.         $comande->setStatut($sats);
  309.         $this->em->getManager()->persist($comande);
  310.         $this->em->getManager()->flush();
  311.         $resulat $session->get("paymentmoniteco");
  312.         $montanttotalcomande $comande->getMontantrth();
  313.         $session->set('montanttotalcomande'$montanttotalcomande);
  314.         //dd($montanttotalcomande);
  315.         return $this->redirectToRoute('Commander');
  316.     }
  317.     /**
  318.      * @Route("/chargement_form_up2pay", name="chargement_form_up2pay")
  319.      */
  320.     function chargeFormUp2payAction(Request $request)
  321.     {
  322.         $em $this->container->get('doctrine')->getManager();
  323.         $comandeId $request->get('id');
  324.         $comande $this->em->getRepository(Commande::class)->findOneBy(['id' => $comandeId]);
  325.         $PayementService $this->PayementService;
  326.         $type $request->get('type');
  327.         $firstName $comande->getIdUser()->getNom();
  328.         if ($firstName == null || $firstName == '') {
  329.             $firstName "john";
  330.         }
  331.         $lastName $comande->getIdUser()->getPrenom();
  332.         if ($lastName == null || $lastName == '') {
  333.             $lastName "Doe";
  334.         }
  335.         $addressLine1 "3 rue de l'église";
  336.         $city "Ostheim";
  337.         $postalCode "68150";
  338.         $pbx_site '6062073';                              //variable de test 9999999
  339.         $pbx_rang '001';                                    //variable de test 95
  340.         $pbx_identifiant '38027616';                      //variable de test 123456789
  341.         $pbx_cmd $comande->getNumComande();                //variable de test cmd_test1
  342.         if ($type == "parent") {
  343.             $pbx_effectue $this->generateUrl("moneticoAcceptUrl_parent", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  344.             $pbx_annule $this->generateUrl("moneticoExceptionUrl_parent", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  345.             $pbx_refuse $this->generateUrl("moneticoExceptionUrl_parent", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  346.             $mail  $comande->getIdUser()->getEmail();
  347.         }
  348.         if ($type == "Acompa") {
  349.             $pbx_effectue $this->generateUrl("moneticoAcceptUrl", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  350.             $pbx_annule $this->generateUrl("moneticoExceptionUrl", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  351.             $pbx_refuse $this->generateUrl("moneticoExceptionUrl", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  352.             $mail $comande->getIdUser()->getReponseemail();
  353.             if (($mail == null) || ($mail == "") || ($mail == " ")) {
  354.                 $mail "contact@5sur5sejour.com";
  355.             }
  356.         }
  357.         $pbx_porteur $mail;                    //variable de test test@test.fr
  358.         // Paramétrage de l'url de retour back office site (notification de paiement IPN) :
  359.         $pbx_repondre_a '';
  360.         //$pbx_repondre_a = $this->generateUrl("moneticoExceptionUrl", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  361.         // Paramétrage des données retournées via l'IPN :
  362.         $pbx_retour 'Mt:M;Ref:R;Auto:A;Erreur:E';
  363.         // On récupére la date au format ISO-8601 :
  364.         $dateTime date("c");
  365.         //$montant = $comande->getMontantrth() . "EUR";
  366.         $pbx_total $comande->getMontantrth();
  367.         $pbx_total = (int)((string)($pbx_total 100));
  368.         // Suppression des points ou virgules dans le montant                        
  369.         $pbx_total str_replace(","""$pbx_total);
  370.         $pbx_total str_replace("."""$pbx_total);
  371.         // Nombre de produit envoyé dans PBX_SHOPPINGCART :
  372.         $pbx_nb_produit '1';                                    //variable de test 5
  373.         // Construction de PBX_SHOPPINGCART :
  374.         $pbx_shoppingcart "<?xml version=\"1.0\" encoding=\"utf-8\"?><shoppingcart><total><totalQuantity>".$pbx_nb_produit."</totalQuantity></total></shoppingcart>";
  375.         // Choix de l'authentification dans PBX_SOUHAITAUTHENT
  376.         $pbx_souhaitauthent '01';        //variable de test authentification 3DS (1 par défaut, 2 pour exemption 3DS)
  377.         // Valeurs envoyes dans PBX_BILLING :
  378.         $pbx_prenom_fact $firstName;                                                             //variable de test Jean-Marie
  379.         $pbx_nom_fact $lastName;                                                                 //variable de test Thomson
  380.         $pbx_adresse1_fact $addressLine1;                                                         //variable de test 1 rue de Paris
  381.         $pbx_adresse2_fact '';                                                                 //variable de test <vide>
  382.         $pbx_zipcode_fact $postalCode;                                                         //variable de test 75001
  383.         $pbx_city_fact $city;                                     //variable de test Paris
  384.         $pbx_country_fact '250';        //variable de test 250 (pour la France)
  385.         // Construction de PBX_BILLING :
  386.         $pbx_billing "<?xml version=\"1.0\" encoding=\"utf-8\"?><Billing><Address><FirstName>".$pbx_prenom_fact."</FirstName>".
  387.                         "<LastName>".$pbx_nom_fact."</LastName><Address1>".$pbx_adresse1_fact."</Address1>".
  388.                         "<Address2>".$pbx_adresse2_fact."</Address2><ZipCode>".$pbx_zipcode_fact."</ZipCode>".
  389.                         "<City>".$pbx_city_fact."</City><CountryCode>".$pbx_country_fact."</CountryCode>".
  390.                         "</Address></Billing>";
  391.         // Recette (paiements de test)  :
  392.         //$urletrans ="https://recette-tpeweb.e-transactions.fr/php/";
  393.         // Production (paiements réels) :
  394.             // URL principale :
  395.                 $urletrans ="https://tpeweb.e-transactions.fr/php/";
  396.             // URL secondaire :
  397.                 //$urletrans ="https://tpeweb1.e-transactions.fr/php/";
  398.         // $hmackey = 'A5FD6D11DA2B9C4112201B4D797EC2B32B877C09A0CF56CE8007D91ACBA9A6D9E026149A7E8441D39A9F52C61E0D250ACC6DEC6815EA02621AEE525576CF4DAE';
  399.         $hmackey 'A5FD6D11DA2B9C4112201B4D797EC2B32B877C09A0CF56CE8007D91ACBA9A6D9E026149A7E8441D39A9F52C61E0D250ACC6DEC6815EA02621AEE525576CF4DAE';
  400.         $pbx_prenom_fact strtoupper($pbx_prenom_fact);
  401.         $pbx_nom_fact strtoupper($pbx_nom_fact);
  402.         $pbx_adresse1_fact strtoupper($pbx_adresse1_fact);
  403.         $pbx_adresse2_fact strtoupper($pbx_adresse2_fact);
  404.         $pbx_city_fact strtoupper($pbx_city_fact);
  405.         $pbx_country_fact strtoupper($pbx_country_fact);
  406.         // --------------- TRAITEMENT DES VARIABLES ---------------
  407.         // On crée la chaéne a hacher sans URLencodage
  408.         $msg "PBX_SITE=" $pbx_site .
  409.             "&PBX_RANG=" $pbx_rang .
  410.             "&PBX_IDENTIFIANT=" $pbx_identifiant .
  411.             "&PBX_SOURCE=RWD" .
  412.             "&PBX_TOTAL=" $pbx_total .
  413.             "&PBX_DEVISE=978" .
  414.             "&PBX_CMD=" $pbx_cmd .
  415.             "&PBX_PORTEUR=" $pbx_porteur .
  416.             "&PBX_REPONDRE_A=" $pbx_repondre_a .
  417.             "&PBX_RETOUR=" $pbx_retour .
  418.             "&PBX_EFFECTUE=" $pbx_effectue .
  419.             "&PBX_ANNULE=" $pbx_annule .
  420.             "&PBX_REFUSE=" $pbx_refuse .
  421.             "&PBX_HASH=SHA512" .
  422.             "&PBX_TIME=" $dateTime .
  423.             "&PBX_SHOPPINGCART=" $pbx_shoppingcart .
  424.             "&PBX_BILLING=" $pbx_billing .
  425.             "&PBX_SOUHAITAUTHENT=" $pbx_souhaitauthent;
  426.         $binKey pack("H*"$hmackey);
  427.         $hmac strtoupper(hash_hmac('sha512'$msg$binKey));
  428.         return new JsonResponse(array(
  429.             'urletrans' => $urletrans,
  430.             'pbx_site' => $pbx_site,
  431.             'pbx_rang' => $pbx_rang,
  432.             'pbx_identifiant' => $pbx_identifiant,
  433.             'pbx_total' => $pbx_total,
  434.             'pbx_cmd' => $pbx_cmd,
  435.             'pbx_porteur' => $pbx_porteur,
  436.             'pbx_repondre_a' => $pbx_repondre_a,
  437.             'pbx_retour' => $pbx_retour,
  438.             'pbx_effectue' => $pbx_effectue,
  439.             'pbx_annule' => $pbx_annule,
  440.             'pbx_refuse' => $pbx_refuse,
  441.             'dateTime' => $dateTime,
  442.             'pbx_shoppingcart' => $pbx_shoppingcart,
  443.             'pbx_billing' => $pbx_billing,
  444.             'pbx_souhaitauthent' => $pbx_souhaitauthent,
  445.             'hmac' => $hmac
  446.         ));
  447.     }
  448.     /**
  449.      * @Route("/chargement_form", name="chargement_form")
  450.      */
  451.     function chargeFormOgoneAction(Request $request)
  452.     {
  453.         $em $this->container->get('doctrine')->getManager();
  454.         $comandeId $request->get('id');
  455.         $type $request->get('type');
  456.         $comande $this->em->getRepository(Commande::class)->find($comandeId);
  457.         $firstName $comande->getIdUser()->getNom();
  458.         if ($firstName == null || $firstName == '') {
  459.             $firstName "john";
  460.         }
  461.         $lastName $comande->getIdUser()->getPrenom();
  462.         if ($lastName == null || $lastName == '') {
  463.             $lastName "Doe";
  464.         }
  465.         //        $addressLine1 =$comande->getIdUser()->getAdresslivraison()->getRuevoi();if($addressLine1 == null ||$addressLine1 == '' ){  $addressLine1="3 rue de l'église";}
  466.         $addressLine1 "3 rue de l'église";
  467.         $city "Ostheim"// habib modified  pour des raison Bug
  468.         $postalCode "68150";
  469.         //      $postalCode= trim ($postalCode) ;
  470.         $country "FR";
  471.         $contexte = array("billing" => array("firstName" => $firstName"lastName" => $lastName"addressLine1" => $addressLine1"city" => $city"postalCode" => $postalCode"country" => $country));
  472.         //param de payement
  473.         $contexte_commande base64_encode(json_encode($contexte));
  474.         $PayementService $this->PayementService;
  475.         $version $this->params->get('version'); //done
  476.         $TPE $this->params->get('TPE'); //done
  477.         $dateTime $dateNow = new \DateTime();
  478.         $date $dateTime->format("d/m/Y:H:i:s");
  479.         //"05/05/2019:11:55:23" ;
  480.         $montant $comande->getMontantrth() . "EUR";
  481.         $reference $comande->getNumComande();
  482.         if ($type == "parent") {
  483.             $url_retour_ok $this->generateUrl("moneticoAcceptUrl_parent", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  484.             $url_retour_err $this->generateUrl("moneticoExceptionUrl_parent", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  485.             $mail  $comande->getIdUser()->getEmail();
  486.         }
  487.         if ($type == "Acompa") {
  488.             $url_retour_ok $this->generateUrl("moneticoAcceptUrl", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  489.             $url_retour_err $this->generateUrl("moneticoExceptionUrl", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  490.             $mail $comande->getIdUser()->getReponseemail();
  491.             if (($mail == null) || ($mail == "") || ($mail == " ")) {
  492.                 $mail "contact@5sur5sejour.com";
  493.             }
  494.         }
  495.         $lgue "FR"//done
  496.         $societe "5sur5sejou"//done
  497.         $desactivemoyenpaiement "paypal";
  498.         $textelibre "5sur5sejour"//
  499.         //$mail = "youssef.saad29@gmail.com";//
  500.         $SHAIN $this->params->get('shain');
  501.         $param = array(
  502.             'version' => $version,
  503.             'TPE' => $TPE,
  504.             'date' => $date,
  505.             'montant' => $montant,
  506.             'reference' => $reference,
  507.             'url_retour_ok' => $url_retour_ok,
  508.             'url_retour_err' => $url_retour_err,
  509.             'lgue' => $lgue,
  510.             'societe' => $societe,
  511.             'contexte_commande' => $contexte_commande,
  512.             'texte-libre' => $textelibre,
  513.             'mail' => $mail,
  514.             'desactivemoyenpaiement' => $desactivemoyenpaiement
  515.         );
  516.         $MAC $PayementService->monetico_hash_parameters('sha1'$param$SHAIN);
  517.         //utf8_encode
  518.         return new JsonResponse(array(
  519.             'version' => $version,
  520.             'TPE' => $TPE,
  521.             'date' => $date,
  522.             'montant' => $montant,
  523.             'reference' => $reference,
  524.             'MAC' => $MAC,
  525.             'url_retour_ok' => utf8_encode($url_retour_ok),
  526.             'url_retour_err' => utf8_encode($url_retour_err),
  527.             'lgue' => $lgue,
  528.             'societe' => $societe,
  529.             'contexte_commande' => utf8_encode($contexte_commande),
  530.             'textelibre' => utf8_encode($textelibre),
  531.             'mail' => utf8_encode($mail),
  532.             'desactivemoyenpaiement' => $desactivemoyenpaiement
  533.         ));
  534.         // return new JsonResponse(array('TITLE'=>$title,'ACCEPTURL'=>$ACCEPTURL,'DECLINEURL'=>$DECLINEURL,'EXCEPTIONURL'=>$EXCEPTIONURL,'CANCELURL'=>$CANCELURL,'orderID'=>$orderID,'PSPID'=>$PSPID,'CURRENCY'=>$CURRENCY,'LANGUAGE'=>$LANGUAGE,'PrixOgone'=>$PrixOgone,'shastring'=>$shastring));
  535.     }
  536.     /**
  537.      * @Route("/chargement_form_paypal", name="chargement_form_paypal")
  538.      */
  539.     function chargeFormOgoneActionPaypal(Request $request)
  540.     {
  541.         $em $this->container->get('doctrine')->getManager();
  542.         $comandeId $request->get('id');
  543.         $type $request->get('type');
  544.         $comande $this->em->getRepository(Commande::class)->find($comandeId);
  545.         $firstName $comande->getIdUser()->getNom();
  546.         if ($firstName == null || $firstName == '') {
  547.             $firstName "john";
  548.         }
  549.         $lastName $comande->getIdUser()->getPrenom();
  550.         if ($lastName == null || $lastName == '') {
  551.             $lastName "Doe";
  552.         }
  553.         //        $addressLine1 =$comande->getIdUser()->getAdresslivraison()->getRuevoi();if($addressLine1 == null ||$addressLine1 == '' ){  $addressLine1="3 rue de l'église";}
  554.         $addressLine1 "3 rue de l'église";
  555.         $city "Ostheim"// habib modified  pour des raison Bug
  556.         $postalCode "68150";
  557.         //      $postalCode= trim ($postalCode) ;
  558.         $country "FR";
  559.         $contexte = array("billing" => array("firstName" => $firstName"lastName" => $lastName"addressLine1" => $addressLine1"city" => $city"postalCode" => $postalCode"country" => $country));
  560.         //param de payement
  561.         $contexte_commande base64_encode(json_encode($contexte));
  562.         $PayementService $this->PayementService;
  563.         $version $this->params->get('version'); //done
  564.         $TPE $this->params->get('TPE'); //done
  565.         $dateTime $dateNow = new \DateTime();
  566.         $date $dateTime->format("d/m/Y:H:i:s");
  567.         //"05/05/2019:11:55:23" ;
  568.         $montant $comande->getMontantrth() . "EUR";
  569.         $reference $comande->getNumComande();
  570.         if ($type == "parent") {
  571.             $url_retour_ok $this->generateUrl("moneticoAcceptUrl_parent", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  572.             $url_retour_err $this->generateUrl("moneticoExceptionUrl_parent", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  573.             $mail  $comande->getIdUser()->getEmail();
  574.         }
  575.         if ($type == "Acompa") {
  576.             $url_retour_ok $this->generateUrl("moneticoAcceptUrl", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  577.             $url_retour_err $this->generateUrl("moneticoExceptionUrl", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  578.             $mail $comande->getIdUser()->getReponseemail();
  579.             if (($mail == null) || ($mail == "") || ($mail == " ")) {
  580.                 $mail "contact@5sur5sejour.com";
  581.             }
  582.         }
  583.         $lgue "FR"//done
  584.         $societe "5sur5sejou"//done
  585.         $protocole "paypal";
  586.         $textelibre "5sur5sejour"//
  587.         //$mail = "youssef.saad29@gmail.com";//
  588.         $SHAIN $this->params->get('shain');
  589.         $param = array(
  590.             'version' => $version,
  591.             'TPE' => $TPE,
  592.             'date' => $date,
  593.             'montant' => $montant,
  594.             'reference' => $reference,
  595.             'url_retour_ok' => $url_retour_ok,
  596.             'url_retour_err' => $url_retour_err,
  597.             'lgue' => $lgue,
  598.             'societe' => $societe,
  599.             'contexte_commande' => $contexte_commande,
  600.             'texte-libre' => $textelibre,
  601.             'mail' => $mail,
  602.             'protocole' => $protocole
  603.         );
  604.         $MAC $PayementService->monetico_hash_parameters('sha1'$param$SHAIN);
  605.         //utf8_encode
  606.         return new JsonResponse(array(
  607.             'version' => $version,
  608.             'TPE' => $TPE,
  609.             'date' => $date,
  610.             'montant' => $montant,
  611.             'reference' => $reference,
  612.             'MAC' => $MAC,
  613.             'url_retour_ok' => utf8_encode($url_retour_ok),
  614.             'url_retour_err' => utf8_encode($url_retour_err),
  615.             'lgue' => $lgue,
  616.             'societe' => $societe,
  617.             'contexte_commande' => utf8_encode($contexte_commande),
  618.             'textelibre' => utf8_encode($textelibre),
  619.             'mail' => utf8_encode($mail),
  620.             'protocole' => $protocole
  621.         ));
  622.         // return new JsonResponse(array('TITLE'=>$title,'ACCEPTURL'=>$ACCEPTURL,'DECLINEURL'=>$DECLINEURL,'EXCEPTIONURL'=>$EXCEPTIONURL,'CANCELURL'=>$CANCELURL,'orderID'=>$orderID,'PSPID'=>$PSPID,'CURRENCY'=>$CURRENCY,'LANGUAGE'=>$LANGUAGE,'PrixOgone'=>$PrixOgone,'shastring'=>$shastring));
  623.     }
  624.     /**
  625.      * @Route("/chargement_form_comande", name="chargement_form_creation_comand")
  626.      */
  627.     function chargeFormOgoneActionfromcomandecre(Request $request)
  628.     {
  629.         $em $this->container->get('doctrine')->getManager();
  630.         $comandeId $request->get('id');
  631.         $type $request->get('type');
  632.         $comande $this->em->getRepository(Commande::class)->find($comandeId);
  633.         $firstName $comande->getIdUser()->getNom();
  634.         if ($firstName == null || $firstName == '') {
  635.             $firstName "john";
  636.         }
  637.         $lastName $comande->getIdUser()->getPrenom();
  638.         if ($lastName == null || $lastName == '') {
  639.             $lastName "Doe";
  640.         }
  641.         //        $addressLine1 =$comande->getIdUser()->getAdresslivraison()->getRuevoi();if($addressLine1 == null ||$addressLine1 == '' ){  $addressLine1="3 rue de l'église";}
  642.         $addressLine1 "3 rue de l'église";
  643.         $city "Ostheim"// habib modified  pour des raison Bug
  644.         $postalCode "68150";
  645.         //      $postalCode= trim ($postalCode) ;
  646.         $country "FR";
  647.         $contexte = array("billing" => array("firstName" => $firstName"lastName" => $lastName"addressLine1" => $addressLine1"city" => $city"postalCode" => $postalCode"country" => $country));
  648.         //param de payement
  649.         $contexte_commande base64_encode(json_encode($contexte));
  650.         $PayementService $this->PayementService;
  651.         $version $this->params->get('version'); //done
  652.         $TPE $this->params->get('TPE'); //done
  653.         $dateTime $dateNow = new \DateTime();
  654.         $date $dateTime->format("d/m/Y:H:i:s");
  655.         //"05/05/2019:11:55:23" ;
  656.         $montant $comande->getMontantrth() . "EUR";
  657.         $reference $comande->getNumComande();
  658.         if ($type == "parent") {
  659.             $url_retour_ok $this->generateUrl("moneticoAcceptUrl_parent_comande", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  660.             $url_retour_err $this->generateUrl("moneticoExceptionUrl_parent_comande", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  661.             $mail  $comande->getIdUser()->getEmail();
  662.         }
  663.         if ($type == "Acompa") {
  664.             $url_retour_ok $this->generateUrl("moneticoAcceptUrl_comande_Acompa_V", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  665.             $url_retour_err $this->generateUrl("moneticoExceptionUrl_comande_Acompa_V", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  666.             $mail $comande->getIdUser()->getReponseemail();
  667.             if (($mail == null) || ($mail == "") || ($mail == " ")) {
  668.                 $mail "contact@5sur5sejour.com";
  669.             }
  670.         }
  671.         $lgue "FR"//done
  672.         $societe "5sur5sejou"//done
  673.         $textelibre "5sur5sejour"//
  674.         //$mail = "youssef.saad29@gmail.com";//
  675.         $desactivemoyenpaiement "paypal";
  676.         $SHAIN $this->params->get('shain');
  677.         $param = array(
  678.             'version' => $version,
  679.             'TPE' => $TPE,
  680.             'date' => $date,
  681.             'montant' => $montant,
  682.             'reference' => $reference,
  683.             'url_retour_ok' => $url_retour_ok,
  684.             'url_retour_err' => $url_retour_err,
  685.             'lgue' => $lgue,
  686.             'societe' => $societe,
  687.             'contexte_commande' => $contexte_commande,
  688.             'texte-libre' => $textelibre,
  689.             'mail' => $mail,
  690.             'desactivemoyenpaiement' => $desactivemoyenpaiement
  691.         );
  692.         $MAC $PayementService->monetico_hash_parameters('sha1'$param$SHAIN);
  693.         //utf8_encode
  694.         return new JsonResponse(array(
  695.             'version' => $version,
  696.             'TPE' => $TPE,
  697.             'date' => $date,
  698.             'montant' => $montant,
  699.             'reference' => $reference,
  700.             'MAC' => $MAC,
  701.             'url_retour_ok' => utf8_encode($url_retour_ok),
  702.             'url_retour_err' => utf8_encode($url_retour_err),
  703.             'lgue' => $lgue,
  704.             'societe' => $societe,
  705.             'contexte_commande' => utf8_encode($contexte_commande),
  706.             'textelibre' => utf8_encode($textelibre),
  707.             'mail' => utf8_encode($mail),
  708.             'desactivemoyenpaiement' => $desactivemoyenpaiement
  709.         ));
  710.         // return new JsonResponse(array('TITLE'=>$title,'ACCEPTURL'=>$ACCEPTURL,'DECLINEURL'=>$DECLINEURL,'EXCEPTIONURL'=>$EXCEPTIONURL,'CANCELURL'=>$CANCELURL,'orderID'=>$orderID,'PSPID'=>$PSPID,'CURRENCY'=>$CURRENCY,'LANGUAGE'=>$LANGUAGE,'PrixOgone'=>$PrixOgone,'shastring'=>$shastring));
  711.     }
  712.     /**
  713.      * @Route("/chargement_form_comande_Paypal", name="chargement_form_creation_comand_Paypal")
  714.      */
  715.     function chargeFormOgoneActionfromcomandecre_Paypal(Request $request)
  716.     {
  717.         $em $this->container->get('doctrine')->getManager();
  718.         $comandeId $request->get('id');
  719.         $type $request->get('type');
  720.         $comande $this->em->getRepository(Commande::class)->find($comandeId);
  721.         $firstName $comande->getIdUser()->getNom();
  722.         if ($firstName == null || $firstName == '') {
  723.             $firstName "john";
  724.         }
  725.         $lastName $comande->getIdUser()->getPrenom();
  726.         if ($lastName == null || $lastName == '') {
  727.             $lastName "Doe";
  728.         }
  729.         //        $addressLine1 =$comande->getIdUser()->getAdresslivraison()->getRuevoi();if($addressLine1 == null ||$addressLine1 == '' ){  $addressLine1="3 rue de l'église";}
  730.         $addressLine1 "3 rue de l'église";
  731.         $city "Ostheim"// habib modified  pour des raison Bug
  732.         $postalCode "68150";
  733.         //      $postalCode= trim ($postalCode) ;
  734.         $country "FR";
  735.         $contexte = array("billing" => array("firstName" => $firstName"lastName" => $lastName"addressLine1" => $addressLine1"city" => $city"postalCode" => $postalCode"country" => $country));
  736.         //param de payement
  737.         $contexte_commande base64_encode(json_encode($contexte));
  738.         $PayementService $this->PayementService;
  739.         $version $this->params->get('version'); //done
  740.         $TPE $this->params->get('TPE'); //done
  741.         $dateTime $dateNow = new \DateTime();
  742.         $date $dateTime->format("d/m/Y:H:i:s");
  743.         //"05/05/2019:11:55:23" ;
  744.         $montant $comande->getMontantrth() . "EUR";
  745.         $reference $comande->getNumComande();
  746.         if ($type == "parent") {
  747.             $url_retour_ok $this->generateUrl("moneticoAcceptUrl_parent_comande", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  748.             $url_retour_err $this->generateUrl("moneticoExceptionUrl_parent_comande", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  749.             $mail  $comande->getIdUser()->getEmail();
  750.         }
  751.         if ($type == "Acompa") {
  752.             $url_retour_ok $this->generateUrl("moneticoAcceptUrl_comande_Acompa_V", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  753.             $url_retour_err $this->generateUrl("moneticoExceptionUrl_comande_Acompa_V", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  754.             $mail $comande->getIdUser()->getReponseemail();
  755.             if (($mail == null) || ($mail == "") || ($mail == " ")) {
  756.                 $mail "contact@5sur5sejour.com";
  757.             }
  758.         }
  759.         $lgue "FR"//done
  760.         $societe "5sur5sejou"//done
  761.         $textelibre "5sur5sejour"//
  762.         //$mail = "youssef.saad29@gmail.com";//
  763.         $SHAIN $this->params->get('shain');
  764.         $protocole "paypal";
  765.         $param = array(
  766.             'version' => $version,
  767.             'TPE' => $TPE,
  768.             'date' => $date,
  769.             'montant' => $montant,
  770.             'reference' => $reference,
  771.             'url_retour_ok' => $url_retour_ok,
  772.             'url_retour_err' => $url_retour_err,
  773.             'lgue' => $lgue,
  774.             'societe' => $societe,
  775.             'contexte_commande' => $contexte_commande,
  776.             'texte-libre' => $textelibre,
  777.             'mail' => $mail,
  778.             'protocole' => $protocole
  779.         );
  780.         $MAC $PayementService->monetico_hash_parameters('sha1'$param$SHAIN);
  781.         //utf8_encode
  782.         return new JsonResponse(array(
  783.             'version' => $version,
  784.             'TPE' => $TPE,
  785.             'date' => $date,
  786.             'montant' => $montant,
  787.             'reference' => $reference,
  788.             'MAC' => $MAC,
  789.             'url_retour_ok' => utf8_encode($url_retour_ok),
  790.             'url_retour_err' => utf8_encode($url_retour_err),
  791.             'lgue' => $lgue,
  792.             'societe' => $societe,
  793.             'contexte_commande' => utf8_encode($contexte_commande),
  794.             'textelibre' => utf8_encode($textelibre),
  795.             'mail' => utf8_encode($mail),
  796.             'protocole' => $protocole
  797.         ));
  798.         // return new JsonResponse(array('TITLE'=>$title,'ACCEPTURL'=>$ACCEPTURL,'DECLINEURL'=>$DECLINEURL,'EXCEPTIONURL'=>$EXCEPTIONURL,'CANCELURL'=>$CANCELURL,'orderID'=>$orderID,'PSPID'=>$PSPID,'CURRENCY'=>$CURRENCY,'LANGUAGE'=>$LANGUAGE,'PrixOgone'=>$PrixOgone,'shastring'=>$shastring));
  799.     }
  800.     //for connextion payeent 
  801. }