Exemplo n.º 1
0
 /**
  * Perform actual mapping
  * 
  * @return mixed
  */
 protected function performMap()
 {
     $dstAddress = \XLite\Model\Shipping::getInstance()->getDestinationAddress($this->inputData);
     if (!Processor\PitneyBowes::isCountryApplicable($dstAddress['country'])) {
         \XLite\Module\XC\PitneyBowes\Model\Shipping\Processor\PitneyBowes::logDebug($dstAddress['country'] . ' is not an applicable country');
         return null;
     }
     $basket = new API\DataTypes\Basket();
     $basket->merchantId = $this->config->merchant_code;
     $basket->basketCurrency = $this->inputData->getOrder()->getCurrency()->getCode();
     $basket->quoteCurrency = $this->inputData->getOrder()->getCurrency()->getCode();
     $consignee = $this->getConsignee();
     if (null !== $consignee) {
         $basket->consignee = $consignee;
     } else {
         unset($basket->consignee);
     }
     $basket->shippingAddress = $this->getShippingAdress();
     foreach ($this->inputData->getItems() as $orderItem) {
         $basket->basketLines[] = $this->getBasketLine($orderItem);
     }
     $basket->toHubTransportations[] = $this->getToHubTransportation();
     $basket->parcels = $this->getParcels();
     return $basket;
 }