Exemplo n.º 1
0
 public function cancel()
 {
     if ($this->isCanceled()) {
         throw new \Ess\M2ePro\Model\Exception\Logic('QTY reserve is already canceled.');
     }
     if (!$this->isPlaced()) {
         return false;
     }
     try {
         $this->performAction(self::ACTION_ADD, self::STATE_CANCELED);
         if ($this->isCanceled()) {
             $this->order->addSuccessLog('QTY reserve has been canceled.');
         }
     } catch (\Exception $e) {
         $this->order->addErrorLog('QTY reserve was not canceled. Reason: %msg%', array('msg' => $e->getMessage()));
         return false;
     }
     return true;
 }