Ejemplo n.º 1
0
 /**
  * @Route("/action/payzen_response", name="_payzen_response")
  */
 public function payzenResponseAction(Request $request)
 {
     $vads_effective_amount = $request->request->get('vads_effective_amount');
     $vads_auth_result = $request->request->get('vads_auth_result');
     $vads_auth_number = $request->request->get('vads_auth_number');
     $vads_trans_date = $request->request->get('vads_trans_date');
     $id = $request->request->get('vads_cust_id');
     $key = $this->get('defiinformatique_payzen_payment')->getCertificat();
     $normalizers = array(new GetSetMethodNormalizer());
     $serializer = new Serializer($normalizers);
     $datas = $serializer->normalize($_POST);
     if ($this->get('defiinformatique_payzen_payment')->checkSignature($datas, $key) == 'true') {
         if ($vads_auth_result == '00') {
             $em = $this->getDoctrine()->getManager();
             $adherent = $em->getRepository('ALBInscriptionsBundle:Adherents')->find($id);
             //$transmissionDate = date('Y-m-d H:i:s', mktime(substr($vads_trans_date, 0, 2), substr($vads_trans_date, 2, 2), substr($vads_trans_date, 4, 2), substr($vads_trans_date, 4, 2), substr($vads_trans_date, 6, 2), substr($vads_trans_date, 0, 4)));
             $ticket = new Tickets();
             $ticket->setIdadherent($adherent);
             $ticket->setMontant($vads_effective_amount / 100);
             $ticket->setMoyenpaiement('3');
             $ticket->setCommentaire('Rechargement');
             $ticket->setRefpaiementenligne($vads_auth_number);
             $ticket->setCreated(new \DateTime());
             $ticket->setUpdated(new \DateTime());
             $ticket->setValider('1');
             $em->persist($ticket);
             $em->flush();
         }
     }
     return new Response();
 }
 /**
  * @Route("/parrainage/{IdSortie}", name="parrainage")
  * @Template()
  */
 public function parrainageAction(Request $request, $IdSortie)
 {
     $user = $this->getUser();
     $id = $user->getId();
     $em = $this->getDoctrine()->getManager();
     $sortie = $em->getRepository('ALBInscriptionsBundle:Sorties')->find($IdSortie);
     $activite = $sortie->getIdactivite();
     $bureau = $this->get("alb_inscriptions.alb_manager")->isBureauGroupe($id, $activite->getIdgroupes());
     $dateactivite = $sortie->getIdtransports()->getDate();
     $tarifs = $this->get("alb_inscriptions.alb_manager")->getTarifActivite($activite, $dateactivite);
     $tarif = $tarifs[0]['tarif'];
     $tarifnegatif = $tarif - ($tarif + $tarif);
     if ('POST' === $request->getMethod()) {
         $parrain = $em->getRepository('ALBInscriptionsBundle:Adherents')->find($id);
         $idadherent = $request->request->get('adherent');
         $adherent = $em->getRepository('ALBInscriptionsBundle:Adherents')->find($idadherent);
         $idlieux = $request->request->get('LieuxDepart');
         $lieu = $em->getRepository('ALBInscriptionsBundle:lieuxDepartArrets')->find($idlieux);
         $inscription = new Inscriptions();
         $inscription->setIdadherent($adherent);
         $inscription->setIdsorties($sortie);
         $inscription->setIdlieuxdepart($lieu);
         $inscription->setCommentaire($request->request->get('commentaire'));
         $inscription->setIdparrain($parrain);
         //$inscription->setValider(0);
         $inscription->setCreated(new \DateTime());
         $inscription->setUpdated(new \DateTime());
         $inscription->setAnnule(false);
         if ($bureau and $request->request->get('nominvite')) {
             $inscription->setInvite(true);
             $inscription->setNominvite($request->request->get('nominvite'));
             $date = substr($request->request->get('datenaissanceinvite'), 6, 4) . substr($request->request->get('datenaissanceinvite'), 3, 2) . substr($request->request->get('datenaissanceinvite'), 0, 2);
             $inscription->setDatenaissanceinvite(new \DateTime($date));
             $inscription->setIdadherent(null);
         } else {
             $inscription->setInvite(false);
             $ticket = new Tickets();
             $ticket->setIdadherent($adherent);
             $ticket->setMontant($tarifnegatif);
             $ticket->setCreated(new \DateTime());
             $ticket->setUpdated(new \DateTime());
             $ticket->setValider(true);
             $ticket->setIdinscriptions($inscription);
             $em->persist($ticket);
         }
         $em->persist($inscription);
         $em->flush();
         //if(!$this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')){
         $IdInscription = $inscription->getId();
         $montant = $this->get("alb_inscriptions.alb_manager")->getSolde($idadherent);
         $solde = $montant[0]['solde'];
         $this->mailInscriptionAction($IdInscription, $solde);
         //}
         return $this->redirect($this->generateUrl('agenda'));
     }
     $lieux = $this->get("alb_inscriptions.alb_manager")->getListeLieuxDepart($sortie->getId());
     $activites = $sortie->getIdactivite();
     $listedesparticipants = $this->get("alb_inscriptions.alb_manager")->getListeDesParticipants($id, $activites, $tarif);
     //$listedesinscrits = $this->get("alb_inscriptions.alb_manager")->getListeSortie($IdSortie);
     $listedesinscrits = $this->get("alb_inscriptions.alb_manager")->getListeSortieCeJour($IdSortie);
     //        var_dump($listedesparticipants);
     return array('adherents' => $listedesparticipants, 'inscrits' => $listedesinscrits, 'sortie' => $sortie, 'lieux' => $lieux, 'bureau' => $bureau);
 }