예제 #1
0
 /**
  * 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);
         }
     }
 }
예제 #2
0
 /**
  * @test
  * @return void
  */
 public function getPaidReturnsInitialValueForBoolean()
 {
     $this->assertSame(false, $this->subject->getPaid());
 }