protected function checkRequest()
{
if ('prod' === $this->getKernel()->getEnvironment()) {
throw new \RuntimeException('Debug Payment is not authorized in production environment.');
}
$reference = $this->getRequest()->get('reference');
$order = $this->getOrderManager()->findOneBy(array('reference' => $reference));
if (!$order) {
throw new NotFoundHttpException(sprintf('Order with reference "%s" not found.', $reference));
}
if ($this->getRequest()->get('check') !== $this->getDebugPayment()->generateUrlCheck($order)) {
throw new InvalidTransactionException($reference);
}
return $order;
}