コード例 #1
0
 /**
  * @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;
 }