/**
  * @param Payment $payment
  * @return Attendee
  */
 public function confirmPayment(Payment $payment)
 {
     $attendee = $this->repository->findOneByPayment($payment);
     if ($attendee === null) {
         return;
     }
     // TODO refactor this!
     if ($attendee->isStudentRegistration()) {
         $attendee->setStatus(Attendee::CHECK_PAYMENT);
     } else {
         $attendee->approve();
     }
     $this->repository->update($attendee);
     $message = $this->deliveryService->getMessageFromTemplate('PaymentConfirmation', array('user_name' => $attendee->getUser()->getName(), 'event_name' => $attendee->getEvent()->getName()));
     $message->setTo($attendee->getUser()->getEmail());
     $this->deliveryService->send($message);
     return $attendee;
 }
 /**
  * @param Attendee $attendee
  */
 public function confirm(Attendee $attendee)
 {
     $attendee->setStatus(Attendee::APPROVED);
     $attendee->setArrived(true);
     $this->repository->update($attendee);
 }