/**
  * @param ShippingAssignmentInterface $shippingAssignment
  * @param QuoteAddress\Total $total
  * @param bool $useBaseCurrency
  * @return \Magento\Tax\Api\Data\QuoteDetailsItemInterface
  */
 public function getShippingDataObject(ShippingAssignmentInterface $shippingAssignment, QuoteAddress\Total $total, $useBaseCurrency)
 {
     $store = $shippingAssignment->getShipping()->getAddress()->getQuote()->getStore();
     if ($total->getShippingTaxCalculationAmount() === null) {
         //Save the original shipping amount because shipping amount will be overridden
         //with shipping amount excluding tax
         $total->setShippingTaxCalculationAmount($total->getShippingAmount());
         $total->setBaseShippingTaxCalculationAmount($total->getBaseShippingAmount());
     }
     if ($total->getShippingTaxCalculationAmount() !== null) {
         /** @var \Magento\Tax\Api\Data\QuoteDetailsItemInterface $itemDataObject */
         $itemDataObject = $this->quoteDetailsItemDataObjectFactory->create()->setType(self::ITEM_TYPE_SHIPPING)->setCode(self::ITEM_CODE_SHIPPING)->setQuantity(1);
         if ($useBaseCurrency) {
             $itemDataObject->setUnitPrice($total->getBaseShippingTaxCalculationAmount());
         } else {
             $itemDataObject->setUnitPrice($total->getShippingTaxCalculationAmount());
         }
         if ($total->getShippingDiscountAmount()) {
             if ($useBaseCurrency) {
                 $itemDataObject->setDiscountAmount($total->getBaseShippingDiscountAmount());
             } else {
                 $itemDataObject->setDiscountAmount($total->getShippingDiscountAmount());
             }
         }
         $itemDataObject->setTaxClassKey($this->taxClassKeyDataObjectFactory->create()->setType(TaxClassKeyInterface::TYPE_ID)->setValue($this->_config->getShippingTaxClass($store)));
         $itemDataObject->setIsTaxIncluded($this->_config->shippingPriceIncludesTax($store));
         return $itemDataObject;
     }
     return null;
 }