/**
  * Set the exchange item from a ProductUnit.
  *
  * @param ProductUnit $unit
  * @param null | StockLocation $stockLocation
  * @throws \LogicException
  *
  * @return Assembler
  */
 public function setExchangeItem(ProductUnit $unit, StockLocation $stockLocation = null)
 {
     if (!$this->_return->item) {
         throw new \LogicException("You can not set the exchange item without having previously set the return item");
     }
     $this->_return->item->exchangeItem = $item = new OrderItem();
     $item->populate($unit);
     $item->listPrice = $unit->getPrice('retail', $this->_currencyID);
     $item->actualPrice = $item->listPrice;
     $item->rrp = $unit->getPrice('rrp', $this->_currencyID);
     $item->basePrice = $item->actualPrice;
     $taxRates = $this->_taxLoader->getProductTaxRates($unit->product, $this->_return->getPayableAddress('delivery') ?: $this->_defaultAddress);
     // Re-evaluate tax rates for address
     $taxes = [];
     $item->taxRate = 0;
     foreach ($taxRates as $rate) {
         $taxes[$rate->getType()] = $rate->getRate();
         $item->taxRate += $rate->getRate();
     }
     $item->setTaxRates($taxes);
     $this->_calculateTax($item);
     $item->stockLocation = $stockLocation;
     // Adjust the balance to reflect the exchange item
     $balance = $item->gross - $this->_return->item->gross;
     $this->_return->item->calculatedBalance = $balance;
     return $this;
 }