/**
  * @test
  */
 public function shouldCreateWithActionAndObjectRequest()
 {
     $action = $this->getMock('Payum\\Action\\ActionInterface', array(), array(), 'Mock_Action24');
     $exception = RequestNotSupportedException::createActionNotSupported($action, new \stdClass());
     $this->assertInstanceOf('Payum\\Exception\\RequestNotSupportedException', $exception);
     $this->assertEquals('Action Mock_Action24 is not supported the request stdClass.', $exception->getMessage());
 }
 /**
  * {@inheritDoc}
  */
 public function execute($request)
 {
     /** @var $request ModelRequestInterface */
     if (false == $this->supports($request)) {
         throw RequestNotSupportedException::createActionNotSupported($this, $request);
     }
     $request->setModel($request->getModel()->getDetails());
     $this->payment->execute($request);
 }
Exemple #3
0
 /**
  * {@inheritdoc}
  */
 public function execute($request, $catchInteractive = false)
 {
     $action = null;
     try {
         $this->extensions->onPreExecute($request);
         if (false == ($action = $this->findActionSupported($request))) {
             throw RequestNotSupportedException::create($request);
         }
         $this->extensions->onExecute($request, $action);
         $action->execute($request);
         $this->extensions->onPostExecute($request, $action);
     } catch (InteractiveRequestInterface $interactiveRequest) {
         $interactiveRequest = $this->extensions->onInteractiveRequest($interactiveRequest, $request, $action) ?: $interactiveRequest;
         if ($catchInteractive) {
             return $interactiveRequest;
         }
         throw $interactiveRequest;
     } catch (\Exception $e) {
         $this->extensions->onException($e, $request, $action);
         throw $e;
     }
 }