/**
  * Confirms the registration if possible and sends e-mails to admin and user
  *
  * @param int $reguid UID of registration
  * @param string $hmac HMAC for parameters
  *
  * @return void
  */
 public function confirmRegistrationAction($reguid, $hmac)
 {
     /* @var $registration Registration */
     list($failed, $registration, $messageKey, $titleKey) = $this->registrationService->checkConfirmRegistration($reguid, $hmac);
     if ($failed === false) {
         $registration->setConfirmed(true);
         $this->registrationRepository->update($registration);
         $messageType = MessageType::REGISTRATION_CONFIRMED;
         if ($registration->getWaitlist()) {
             $messageType = MessageType::REGISTRATION_WAITLIST_CONFIRMED;
         }
         // Send notifications to user and admin
         $this->notificationService->sendUserMessage($registration->getEvent(), $registration, $this->settings, $messageType);
         $this->notificationService->sendAdminMessage($registration->getEvent(), $registration, $this->settings, $messageType);
         // Confirm registrations depending on main registration if necessary
         if ($registration->getAmountOfRegistrations() > 1) {
             $this->registrationService->confirmDependingRegistrations($registration);
         }
     }
     // Redirect to payment provider if payment/redirect is enabled
     $paymentPid = (int) $this->settings['paymentPid'];
     if (!$failed && $paymentPid > 0 && $this->registrationService->redirectPaymentEnabled($registration)) {
         $this->uriBuilder->reset()->setTargetPageUid($paymentPid)->setUseCacheHash(false);
         $uri = $this->uriBuilder->uriFor('redirect', ['registration' => $registration, 'hmac' => $this->hashService->generateHmac('redirectAction-' . $registration->getUid())], 'Payment', 'sfeventmgt', 'Pipayment');
         $this->redirectToUri($uri);
     }
     $this->view->assign('messageKey', $messageKey);
     $this->view->assign('titleKey', $titleKey);
 }
 /**
  * Confirms all depending registrations based on the given main registration
  *
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration
  *
  * @return void
  */
 public function confirmDependingRegistrations($registration)
 {
     $registrations = $this->registrationRepository->findByMainRegistration($registration);
     foreach ($registrations as $foundRegistration) {
         /** @var \DERHANSEN\SfEventMgt\Domain\Model\Registration $foundRegistration */
         $foundRegistration->setConfirmed(TRUE);
         $this->registrationRepository->update($foundRegistration);
     }
 }
 /**
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration
  * @param string $hmac
  */
 public function notifyAction($registration, $hmac)
 {
     $this->validateHmacForAction($registration, $hmac, $this->actionMethodName);
     $this->proceedWithAction($registration, $this->actionMethodName);
     $values = ['html' => ''];
     $paymentMethod = $registration->getPaymentmethod();
     /**
      * Initialize update-flag
      *
      * If true, the externally called ProcessNotify method requested, that the registration should be updated
      */
     $updateRegistration = false;
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'ProcessNotify' . ucfirst($paymentMethod), [&$values, &$updateRegistration, $registration, GeneralUtility::_GET(), $this]);
     if ($updateRegistration) {
         $this->registrationRepository->update($registration);
     }
     $this->view->assign('result', $values);
 }
 /**
  * Confirms the registration if possible and sends e-mails to admin and user
  *
  * @param int $reguid UID of registration
  * @param string $hmac HMAC for parameters
  *
  * @return void
  */
 public function confirmRegistrationAction($reguid, $hmac)
 {
     /* @var $registration Registration */
     list($failed, $registration, $messageKey, $titleKey) = $this->registrationService->checkConfirmRegistration($reguid, $hmac);
     if ($failed === FALSE) {
         $registration->setConfirmed(TRUE);
         $this->registrationRepository->update($registration);
         // Send notifications to user and admin
         $this->notificationService->sendUserMessage($registration->getEvent(), $registration, $this->settings, MessageType::REGISTRATION_CONFIRMED);
         $this->notificationService->sendAdminMessage($registration->getEvent(), $registration, $this->settings, MessageType::REGISTRATION_CONFIRMED);
         // Confirm registrations depending on main registration if necessary
         if ($registration->getAmountOfRegistrations() > 1) {
             $this->registrationService->confirmDependingRegistrations($registration);
         }
     }
     $this->view->assign('messageKey', $messageKey);
     $this->view->assign('titleKey', $titleKey);
 }
 /**
  * Confirms the registration if possible and sends e-mails to admin and user
  *
  * @param int $reguid UID of registration
  * @param string $hmac HMAC for parameters
  *
  * @return void
  */
 public function confirmRegistrationAction($reguid, $hmac)
 {
     /* @var $registration Registration */
     $registration = NULL;
     $failed = FALSE;
     $messageKey = 'event.message.confirmation_successful';
     $titleKey = 'confirmRegistration.title.successful';
     if (!$this->hashService->validateHmac('reg-' . $reguid, $hmac)) {
         $failed = TRUE;
         $messageKey = 'event.message.confirmation_failed_wrong_hmac';
         $titleKey = 'confirmRegistration.title.failed';
     } else {
         $registration = $this->registrationRepository->findByUid($reguid);
     }
     if (!$failed && is_null($registration)) {
         $failed = TRUE;
         $messageKey = 'event.message.confirmation_failed_registration_not_found';
         $titleKey = 'confirmRegistration.title.failed';
     }
     if (!$failed && $registration->getConfirmationUntil() < new \DateTime()) {
         $failed = TRUE;
         $messageKey = 'event.message.confirmation_failed_confirmation_until_expired';
         $titleKey = 'confirmRegistration.title.failed';
     }
     if (!$failed && $registration->getConfirmed() === TRUE) {
         $failed = TRUE;
         $messageKey = 'event.message.confirmation_failed_already_confirmed';
         $titleKey = 'confirmRegistration.title.failed';
     }
     if ($failed === FALSE) {
         $registration->setConfirmed(TRUE);
         $this->registrationRepository->update($registration);
         // Send notifications to user and admin
         $this->notificationService->sendUserMessage($registration->getEvent(), $registration, $this->settings, MessageType::REGISTRATION_CONFIRMED);
         $this->notificationService->sendAdminMessage($registration->getEvent(), $registration, $this->settings, MessageType::REGISTRATION_CONFIRMED);
         // Confirm registrations depending on main registration if necessary
         if ($registration->getAmountOfRegistrations() > 1) {
             $this->registrationService->confirmDependingRegistrations($registration);
         }
     }
     $this->view->assign('messageKey', $messageKey);
     $this->view->assign('titleKey', $titleKey);
 }