示例#1
0
 /**
  * @return Result
  * @throws Main\NotSupportedException
  */
 public function calculateDelivery()
 {
     if ($this->isSystem()) {
         throw new Main\NotSupportedException();
     }
     if ($this->getDeliveryId() == 0) {
         return new Delivery\CalculationResult();
     }
     /** @var Result $deliveryCalculate */
     $deliveryCalculate = Delivery\Services\Manager::calculate($this);
     if (!$deliveryCalculate->isSuccess()) {
         return $deliveryCalculate;
     }
     $data = $deliveryCalculate->getData();
     $data['AVAILABLE'] = Delivery\Services\Manager::checkServiceRestrictions($this->getDeliveryId(), $this);
     $deliveryCalculate->setData($data);
     return $deliveryCalculate;
 }