/** * @param Customweb_Form_IElementGroup $elementGroup */ public function __construct(Customweb_Form_IElementGroup $elementGroup = null) { if ($elementGroup !== null) { $this->setId($elementGroup->getId()); $this->setMachineName($elementGroup->getMachineName()); $this->setTitle($elementGroup->getTitle()); $this->setElements($elementGroup->getElements()); } else { $this->setId(Customweb_Core_Util_Rand::getUuid()); } }
/** * @param Customweb_Form_IButton $button */ public function __construct(Customweb_Form_IButton $button = null) { if ($button !== null) { $this->setId($button->getId()); $this->setMachineName($button->getMachineName()); $this->setTitle($button->getTitle()); $this->setType($button->getType()); } else { $this->setId(Customweb_Core_Util_Rand::getUuid()); $this->setType(self::TYPE_DEFAULT); } }
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(); }
/** * This method generates a signature for the given entity (e.g. controller) * and this transaction. The signature can be added for example to the * URL provided to the customer. * * The signature can than be checked with checkSecuritySignature(). This enables * to provided selective access to the transaction information. * * @param string $entityToSecure * @return string */ public function getSecuritySignature($entityToSecure) { if ($this->securityToken === null) { $this->securityToken = Customweb_Core_Util_Rand::getRandomString(64); } $entityToSecure = (string) $entityToSecure; return hash_hmac('sha512', $entityToSecure . $this->getTransactionId(), $this->securityToken); }
public function __construct(Customweb_Payment_Authorization_ITransactionContext $transactionContext) { $this->transactionContext = $transactionContext; $this->transactionId = $transactionContext->getTransactionId(); $this->authorizationAmount = $transactionContext->getOrderContext()->getOrderAmountInDecimals(); $this->currencyCode = $transactionContext->getOrderContext()->getCurrencyCode(); $this->createdOn = new Customweb_Date_DateTime(); $this->externalTransactionId = $this->generateExternalId(); $this->securityToken = Customweb_Core_Util_Rand::getRandomString(64); $skus = array(); foreach ($this->getTransactionContext()->getOrderContext()->getInvoiceItems() as $item) { if (isset($skus[$item->getSku()])) { throw new Exception("Could not start transaction because there are multiple line items with the same SKU."); } $skus[$item->getSku()] = $item->getSku(); } }