public function createSecurityToken(Customweb_Payment_ExternalCheckout_IContext $context)
 {
     if (!$context instanceof Customweb_SaferpayCw_Model_ExternalCheckoutContext) {
         throw new Customweb_Core_Exception_CastException('Customweb_SaferpayCw_Model_ExternalCheckoutContext');
     }
     $token = Customweb_Core_Util_Rand::getUuid();
     if ($context->getSecurityToken() == null) {
         $context->setSecurityToken($token);
         $context->setSecurityTokenExpiryDate(Customweb_Core_DateTime::_()->addHours(4)->format("Y-m-d H:i:s"));
         $context->save();
     }
     return $context->getSecurityToken();
 }
 public function createSecurityToken(Customweb_Payment_ExternalCheckout_IContext $context)
 {
     if (!$context instanceof Customweb_Payment_ExternalCheckout_AbstractContext) {
         throw new Customweb_Core_Exception_CastException('Customweb_Payment_ExternalCheckout_AbstractContext');
     }
     $token = Customweb_Core_Util_Rand::getUuid();
     if ($context->getSecurityToken() == null) {
         $context->setSecurityToken($token);
         $context->setSecurityTokenExpiryDate(Customweb_Core_DateTime::_()->addHours(4));
         $this->entityManager->persist($context);
     }
     return $context->getSecurityToken();
 }