public function isSecurityTokenValid(Customweb_Payment_ExternalCheckout_IContext $context, $token) { if (!$context instanceof Customweb_SaferpayCw_Model_ExternalCheckoutContext) { throw new Customweb_Core_Exception_CastException('Customweb_SaferpayCw_Model_ExternalCheckoutContext'); } if ($context->getSecurityToken() !== null && $context->getSecurityToken() === $token) { $expiryDate = $context->getSecurityTokenExpiryDate(); if (!empty($expiryDate)) { $expiryDate = new Customweb_Core_DateTime(DateTime::createFromFormat("Y-m-d H:i:s", $expiryDate)); if ($expiryDate->getTimestamp() > time()) { return true; } } } return false; }
public function isSecurityTokenValid(Customweb_Payment_ExternalCheckout_IContext $context, $token) { if (!$context instanceof Customweb_Payment_ExternalCheckout_AbstractContext) { throw new Customweb_Core_Exception_CastException('Customweb_Payment_ExternalCheckout_AbstractContext'); } if ($context->getSecurityToken() !== null && $context->getSecurityToken() === $token) { $expiryDate = $context->getSecurityTokenExpiryDate(); if ($expiryDate instanceof DateTime) { $expiryDate = new Customweb_Core_DateTime($expiryDate); if ($expiryDate->getTimestamp() > time()) { return true; } } } return false; }