Exemplo n.º 1
0
 /**
  * Map single quote
  * 
  * @param mixed $quote Single quote line
  * 
  * @return \XLite\Model\Shipping\Rate
  */
 protected function mapSingleQuote($quote)
 {
     $rate = null;
     if (isset($quote->total->value)) {
         $rate = new \XLite\Model\Shipping\Rate();
         $rate->setBaseRate($this->getBaseRate($quote));
         $method = Processor\PitneyBowes::getMethod($this->getMethodCode($quote));
         $rate->setMethod($method);
         $rate->setMarkupRate($this->getMarkupRate($quote));
         if (isset($quote->totalTransportation->minDays) || isset($quote->totalTransportation->maxDays)) {
             $extraData = new \XLite\Core\CommonCell();
             $extraData->deliveryMinDays = $quote->totalTransportation->minDays + intval($this->config->min_delivery_adjustment);
             $extraData->deliveryMaxDays = $quote->totalTransportation->maxDays + intval($this->config->max_delivery_adjustment);
             $rate->setExtraData($extraData);
         }
     }
     if (isset($quote->errors)) {
         foreach ($quote->errors as $error) {
             \XLite\Logger::logCustom("PitneyBowes", $error->error, false);
         }
     }
     return $rate;
 }