Example #1
0
 /**
  * Create an order from the basket contents
  *
  * @param OrderInterface $order
  * @param bool $clear
  * @return \dlds\ecom\models\OrderInterface
  * @throws \Exception
  */
 public function createOrder(OrderInterface $order, $clear = true)
 {
     try {
         $order->saveFromBasket($this);
         $clear && $this->clear();
         return $order;
     } catch (\Exception $exception) {
         throw $exception;
     }
 }
Example #2
0
 /**
  * Creates a new transaction based on an order. Also calls dlds\ecom\Component::finalizeTransaction
  *
  * @param OrderInterface $order
  * @return Transaction
  */
 public function createTransaction(OrderInterface $order)
 {
     $transaction = $this->createService(self::SERVICE_PAYMENT)->createTransaction($order->getPKValue(), $order->getTransactionSum());
     $this->component->finalizeTransaction($order, $transaction);
     return $transaction;
 }