/** * @param \Sonata\Component\Order\OrderInterface $order * * @throws \RuntimeException * * @return string */ public function generateUrlCheck(OrderInterface $order) { if (!$order->getCreatedAt() instanceof \DateTime) { throw new \RuntimeException(sprintf('The order must have a creation date - id:%s, reference:%s ', $order->getId(), $order->getReference())); } return sha1($order->getReference() . $order->getCreatedAt()->format("m/d/Y:G:i:s") . $order->getId() . $this->getOption('shop_secret_key')); }
/** * {@inheritdoc} */ public function order(OrderInterface $order) { if (!$order->getId()) { throw new \RuntimeException('The order is not persisted into the database'); } $this->generateReference($order, $this->registry->getManager()->getClassMetadata(get_class($order))->table['name']); }
/** * @param \Sonata\Component\Order\OrderInterface $order * @return void */ public function setOrder(OrderInterface $order) { $this->order = $order; $this->addInformation(sprintf('The transaction is linked to the Order : id = `%s` / Reference = `%s`', $order->getId(), $order->getReference())); }