public function markContextAsFailed(Customweb_Payment_ExternalCheckout_IContext $context, $message) { if (!$context instanceof Customweb_Payment_ExternalCheckout_AbstractContext) { throw new Customweb_Core_Exception_CastException('Customweb_Payment_ExternalCheckout_AbstractContext'); } if ($context->getState() == Customweb_Payment_ExternalCheckout_IContext::STATE_COMPLETED) { throw new Exception("The external checkout context cannot be set to state FAILED, while the context is already in state COMPLETED."); } $context->setState(Customweb_Payment_ExternalCheckout_IContext::STATE_FAILED); $context->setFailedErrorMessage($message); $this->refreshFailedContext($context); $this->entityManager->persist($context); }
public function markContextAsFailed(Customweb_Payment_ExternalCheckout_IContext $context, $message) { if (!$context instanceof Customweb_SaferpayCw_Model_ExternalCheckoutContext) { throw new Customweb_Core_Exception_CastException('Customweb_SaferpayCw_Model_ExternalCheckoutContext'); } if ($context->getState() == Customweb_Payment_ExternalCheckout_IContext::STATE_COMPLETED) { throw new Exception("The external checkout context cannot be set to state FAILED, while the context is already in state COMPLETED."); } $context->setState(Customweb_Payment_ExternalCheckout_IContext::STATE_FAILED); $context->setFailedErrorMessage($message); $context->save(); Mage::getSingleton('core/session')->addError($message); }