Ejemplo n.º 1
0
 /**
  * Itemsproc function for payment method select field
  *
  * @param array $config
  */
 public function getPaymentMethods(array &$config)
 {
     $paymentMethods = $this->paymentService->getPaymentMethods();
     foreach ($paymentMethods as $value => $label) {
         array_push($config['items'], [$label, $value]);
     }
 }
Ejemplo n.º 2
0
 /**
  * @test
  * @dataProvider paymentActionEnabledForCustomPaymentMethodDataProvider
  * @return void
  */
 public function paymentActionEnabledForCustomPaymentMethodReturnsExpectedResult($action, $expected)
 {
     $mockPaymentInstance = $this->getAccessibleMock('DERHANSEN\\SfEventMgt\\Payment\\Invoice', ['isRedirectEnabled', 'isSuccessLinkEnabled', 'isFailureLinkEnabled', 'isCancelLinkEnabled', 'isNotifyLinkEnabled'], [], '', false);
     $mockPaymentInstance->expects($this->any())->method('isRedirectEnabled')->will($this->returnValue(true));
     $mockPaymentInstance->expects($this->any())->method('isSuccessLinkEnabled')->will($this->returnValue(true));
     $mockPaymentInstance->expects($this->any())->method('isFailureLinkEnabled')->will($this->returnValue(true));
     $mockPaymentInstance->expects($this->any())->method('isCancelLinkEnabled')->will($this->returnValue(true));
     $mockPaymentInstance->expects($this->any())->method('isNotifyLinkEnabled')->will($this->returnValue(true));
     $this->subject = $this->getAccessibleMock('DERHANSEN\\SfEventMgt\\Service\\PaymentService', ['getPaymentInstance'], [], '', false);
     $this->subject->expects($this->once())->method('getPaymentInstance')->will($this->returnValue($mockPaymentInstance));
     $this->assertEquals($expected, $this->subject->paymentActionEnabled('invoice', $action));
 }
Ejemplo n.º 3
0
 /**
  * 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;
     }
 }
Ejemplo n.º 4
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);
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * Registration view for an event
  *
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event Event
  *
  * @return void
  */
 public function registrationAction(Event $event)
 {
     if ($event->getRestrictPaymentMethods()) {
         $paymentMethods = $this->paymentService->getRestrictedPaymentMethods($event);
     } else {
         $paymentMethods = $this->paymentService->getPaymentMethods();
     }
     $this->view->assign('event', $event);
     $this->view->assign('paymentMethods', $paymentMethods);
 }