/**
  * Shows a list of all registration of the current frontend user
  *
  * @return void
  */
 public function listAction()
 {
     $demand = $this->createUserRegistrationDemandObjectFromSettings($this->settings);
     $demand->setUser($this->registrationService->getCurrentFeUserObject());
     $registrations = $this->registrationRepository->findRegistrationsByUserRegistrationDemand($demand);
     $this->view->assign('registrations', $registrations);
 }
 /**
  * The cleanup command
  *
  * @return void
  */
 public function cleanupCommand()
 {
     $fullSettings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT, 'SfEventMgt', 'Pievent');
     $settings = $fullSettings['plugin.']['tx_sfeventmgt.']['settings.'];
     $this->registrationService->handleExpiredRegistrations($settings['registration.']['deleteExpiredRegistrations']);
     // Clear cache for configured pages
     $this->utilityService->clearCacheForConfiguredUids($settings);
 }
 /**
  * The cleanup command
  *
  * @return void
  */
 public function cleanupCommand()
 {
     $fullSettings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT, 'SfEventMgt', 'Pievent');
     $settings = $fullSettings['plugin.']['tx_sfeventmgt.']['settings.'];
     $this->registrationService->handleExpiredRegistrations($settings['registration.']['deleteExpiredRegistrations']);
     $pidList = explode(',', $settings['clearCacheUids']);
     $this->cacheService->clearPageCache($pidList);
 }
 /**
  * @test
  * @return void
  */
 public function isWaitlistRegistrationReturnsTrueIfEventFullyBookedAndNotEnoughFreePlaces()
 {
     $registrations = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', [], [], '', false);
     $registrations->expects($this->any())->method('count')->will($this->returnValue(11));
     $event = new Event();
     $event->setEnableWaitlist(true);
     $event->setMaxParticipants(10);
     $event->setRegistration($registrations);
     $this->assertTrue($this->subject->isWaitlistRegistration($event, 1));
 }
 /**
  * @test
  */
 public function confirmDependingRegistrationsConfirmsDependingRegistrations()
 {
     $mockRegistration = $this->getMock('DERHANSEN\\SfEventMgt\\Domain\\Model\\Registration', array(), array(), '', FALSE);
     $foundRegistration1 = $this->getMock('DERHANSEN\\SfEventMgt\\Domain\\Model\\Registration', array(), array(), '', FALSE);
     $foundRegistration1->expects($this->any())->method('setConfirmed');
     $foundRegistration2 = $this->getMock('DERHANSEN\\SfEventMgt\\Domain\\Model\\Registration', array(), array(), '', FALSE);
     $foundRegistration2->expects($this->any())->method('setConfirmed');
     /** @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registrations */
     $registrations = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     $registrations->attach($foundRegistration1);
     $registrations->attach($foundRegistration2);
     $registrationRepository = $this->getMock('DERHANSEN\\SfEventMgt\\Domain\\Repository\\RegistrationRepository', array('findByMainRegistration', 'update'), array(), '', FALSE);
     $registrationRepository->expects($this->once())->method('findByMainRegistration')->will($this->returnValue($registrations));
     $registrationRepository->expects($this->exactly(2))->method('update');
     $this->inject($this->subject, 'registrationRepository', $registrationRepository);
     $this->subject->confirmDependingRegistrations($mockRegistration);
 }
 /**
  * Test if expected array is returned if cancellation deadline expired
  *
  * @test
  * @return void
  */
 public function checkCancelRegistrationIfCancellationDeadlineExpiredTest()
 {
     $reguid = 1;
     $hmac = 'valid-hmac';
     $mockEvent = $this->getMock('DERHANSEN\\SfEventMgt\\Domain\\Model\\Event', array(), array(), '', FALSE);
     $mockEvent->expects($this->any())->method('getEnableCancel')->will($this->returnValue(TRUE));
     $mockEvent->expects($this->any())->method('getCancelDeadline')->will($this->returnValue(new \DateTime('yesterday')));
     $mockRegistration = $this->getMock('DERHANSEN\\SfEventMgt\\Domain\\Model\\Registration', array(), array(), '', FALSE);
     $mockRegistration->expects($this->any())->method('getEvent')->will($this->returnValue($mockEvent));
     $mockRegistrationRepository = $this->getMock('DERHANSEN\\SfEventMgt\\Domain\\Repository\\RegistrationRepository', array('findByUid'), array(), '', FALSE);
     $mockRegistrationRepository->expects($this->once())->method('findByUid')->with(1)->will($this->returnValue($mockRegistration));
     $this->inject($this->subject, 'registrationRepository', $mockRegistrationRepository);
     $mockHashService = $this->getMock('TYPO3\\CMS\\Extbase\\Security\\Cryptography\\HashService', array('validateHmac'), array(), '', FALSE);
     $mockHashService->expects($this->once())->method('validateHmac')->will($this->returnValue(TRUE));
     $this->inject($this->subject, 'hashService', $mockHashService);
     $result = $this->subject->checkCancelRegistration($reguid, $hmac);
     $expected = array(TRUE, $mockRegistration, 'event.message.cancel_failed_deadline_expired', 'cancelRegistration.title.failed');
     $this->assertEquals($expected, $result);
 }
Пример #7
0
 /**
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration
  * @param string $hmac
  */
 public function cancelAction($registration, $hmac)
 {
     $this->validateHmacForAction($registration, $hmac, $this->actionMethodName);
     $this->proceedWithAction($registration, $this->actionMethodName);
     $values = ['html' => ''];
     $paymentMethod = $registration->getPaymentmethod();
     /**
      * Update- and remove flags
      */
     $updateRegistration = false;
     $removeRegistration = false;
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'ProcessCancel' . ucfirst($paymentMethod), [&$values, &$updateRegistration, &$removeRegistration, $registration, GeneralUtility::_GET(), $this]);
     if ($updateRegistration) {
         $this->registrationRepository->update($registration);
     }
     if ($removeRegistration) {
         // First cancel depending registrations
         if ($registration->getAmountOfRegistrations() > 1) {
             $this->registrationService->cancelDependingRegistrations($registration);
         }
         $this->registrationRepository->remove($registration);
     }
     $this->view->assign('result', $values);
 }
 /**
  * Calls the handleExpiredRegistrations Service
  *
  * @return void
  */
 public function handleExpiredRegistrationsAction()
 {
     $this->registrationService->handleExpiredRegistrations($this->settings['registration']['deleteExpiredRegistrations']);
     $this->redirect('list', 'Administration', 'SfEventMgt', array('demand' => NULL, 'messageId' => 1));
 }
Пример #9
0
 /**
  * Cancels 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 cancelRegistrationAction($reguid, $hmac)
 {
     /* @var $registration Registration */
     list($failed, $registration, $messageKey, $titleKey) = $this->registrationService->checkCancelRegistration($reguid, $hmac);
     if ($failed === false) {
         // Send notifications (must run before cancelling the registration)
         $this->notificationService->sendUserMessage($registration->getEvent(), $registration, $this->settings, MessageType::REGISTRATION_CANCELLED);
         $this->notificationService->sendAdminMessage($registration->getEvent(), $registration, $this->settings, MessageType::REGISTRATION_CANCELLED);
         // First cancel depending registrations
         if ($registration->getAmountOfRegistrations() > 1) {
             $this->registrationService->cancelDependingRegistrations($registration);
         }
         // Finally cancel registration
         $this->registrationRepository->remove($registration);
         // Clear cache for configured pages
         $this->utilityService->clearCacheForConfiguredUids($this->settings);
     }
     $this->view->assign('messageKey', $messageKey);
     $this->view->assign('titleKey', $titleKey);
 }
Пример #10
0
 /**
  * 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);
 }