/**
  * @param GetResponseForExceptionEvent $event
  */
 public function onKernelException(GetResponseForExceptionEvent $event)
 {
     if (false == $event->getException() instanceof ReplyInterface) {
         return;
     }
     $response = $this->replyToSymfonyResponseConverter->convert($event->getException());
     if (false == $response->headers->has('X-Status-Code')) {
         $response->headers->set('X-Status-Code', $response->getStatusCode());
     }
     $event->setResponse($response);
 }
Exemplo n.º 2
0
 /**
  * receiveNotifyUnsafe.
  *
  * @method receiveNotifyUnsafe
  *
  * @param string $gatewayName
  *
  * @return mixed
  */
 public function receiveNotifyUnsafe($gatewayName)
 {
     try {
         $gateway = $this->getPayum()->getGateway($gatewayName);
         $gateway->execute(new Notify(null));
         return $this->responseFactory->make(null, 204);
     } catch (ReplyInterface $reply) {
         return $this->converter->convert($reply);
     }
 }
 /**
  * @test
  *
  * @expectedException \Payum\Core\Exception\LogicException
  * @expectedExceptionMessage Cannot convert reply Mock_Base_
  */
 public function shouldChangeReplyToLogicExceptionIfNotSupported()
 {
     $notSupportedReply = $this->getMock('Payum\\Core\\Reply\\Base');
     $listener = new ReplyToSymfonyResponseConverter();
     $listener->convert($notSupportedReply);
 }