예제 #1
0
파일: Payment.php 프로젝트: Studio-40/Payum
 /**
  * {@inheritDoc}
  */
 public function addAction(ActionInterface $action, $forcePrepend = false)
 {
     if ($action instanceof PaymentAwareInterface) {
         $action->setPayment($this);
     }
     if ($action instanceof ApiAwareInterface) {
         $apiSet = false;
         foreach ($this->apis as $api) {
             try {
                 $action->setApi($api);
                 $apiSet = true;
                 break;
             } catch (UnsupportedApiException $e) {
             }
         }
         if (false == $apiSet) {
             throw new LogicException(sprintf('Cannot find right api supported by %s', get_class($action)));
         }
     }
     $forcePrepend ? array_unshift($this->actions, $action) : array_push($this->actions, $action);
 }
 /**
  * {@inheritDoc}
  */
 public function onExecute($request, ActionInterface $action)
 {
     if ($action instanceof GenericTokenFactoryAwareInterface) {
         $action->setGenericTokenFactory($this->genericTokenFactory);
     }
 }
예제 #3
0
 /**
  * {@inheritDoc}
  */
 public function onExecute($request, ActionInterface $action)
 {
     if ($action instanceof LoggerAwareInterface) {
         $action->setLogger($this->logger);
     }
 }
 /**
  * @param \Payum\Core\Action\ActionInterface $action
  * @param mixed                              $request
  *
  * @throws RequestNotSupportedException
  */
 public static function assertSupports(ActionInterface $action, $request)
 {
     if (false == $action->supports($request)) {
         throw static::createActionNotSupported($action, $request);
     }
 }
예제 #5
0
 /**
  * @test
  *
  * @dataProvider provideNotSupportedRequests
  *
  * @expectedException \Payum\Core\Exception\RequestNotSupportedException
  */
 public function throwIfNotSupportedRequestGivenAsArgumentForExecute($request)
 {
     $this->action->execute($request);
 }