コード例 #1
0
ファイル: Basket.php プロジェクト: opus-online/yii2-ecom
 /**
  * Create an order from the basket contents
  *
  * @param OrderInterface $order
  * @param bool $clear
  * @return \opus\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;
     }
 }
コード例 #2
0
ファイル: Payment.php プロジェクト: opus-online/yii2-ecom
 /**
  * Creates a new transaction based on an order. Also calls opus\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;
 }