/**
  * Returns, if payment redirect for the payment method is enabled
  *
  * @param Registration $registration
  * @return bool
  */
 public function redirectPaymentEnabled($registration)
 {
     if ($registration->getEvent()->getEnablePayment() === false) {
         return false;
     }
     /** @var AbstractPayment $paymentInstance */
     $paymentInstance = $this->paymentService->getPaymentInstance($registration->getPaymentmethod());
     if ($paymentInstance !== null && $paymentInstance->isRedirectEnabled()) {
         return true;
     } else {
         return false;
     }
 }
 /**
  * Checks if the given action can be called for the given registration / event and throws
  * an exception if action should not proceed
  *
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration
  * @param string $actionName
  * @throws PaymentException
  * @return void
  */
 protected function proceedWithAction($registration, $actionName)
 {
     if ($registration->getEvent()->getEnablePayment() === false) {
         $message = LocalizationUtility::translate('payment.messages.paymentNotEnabled', 'sf_event_mgt');
         throw new PaymentException($message, 1899934881);
     }
     if ($this->paymentService->paymentActionEnabled($registration->getPaymentmethod(), $actionName) === false) {
         $message = LocalizationUtility::translate('payment.messages.actionNotEnabled', 'sf_event_mgt');
         throw new PaymentException($message, 1899934882);
     }
     if ($registration->getPaid()) {
         $message = LocalizationUtility::translate('payment.messages.paymentAlreadyProcessed', 'sf_event_mgt');
         throw new PaymentException($message, 1899934883);
     }
     if ($registration->getEvent()->getRestrictPaymentMethods()) {
         $selectedPaymentMethods = explode(',', $registration->getEvent()->getSelectedPaymentMethods());
         if (!in_array($registration->getPaymentmethod(), $selectedPaymentMethods)) {
             $message = LocalizationUtility::translate('payment.messages.paymentMethodNotAvailable', 'sf_event_mgt');
             throw new PaymentException($message, 1899934884);
         }
     }
 }
 /**
  * @test
  * @return void
  */
 public function setPaymentmethodSetsPaymentmethod()
 {
     $this->subject->setPaymentmethod('invoice');
     $this->assertEquals('invoice', $this->subject->getPaymentmethod());
 }