Beispiel #1
0
 /**
  * Update tax related fields for shipping
  *
  * @param Address $address
  * @param \Magento\Tax\Service\V1\Data\TaxDetails\Item $shippingTaxDetails
  * @param \Magento\Tax\Service\V1\Data\TaxDetails\Item $baseShippingTaxDetails
  * @return $this
  */
 protected function processShippingTaxInfo(Address $address, $shippingTaxDetails, $baseShippingTaxDetails)
 {
     $address->setTotalAmount('shipping', $shippingTaxDetails->getRowTotal());
     $address->setBaseTotalAmount('shipping', $baseShippingTaxDetails->getRowTotal());
     $address->setTotalAmount('shipping_hidden_tax', $shippingTaxDetails->getDiscountTaxCompensationAmount());
     $address->setBaseTotalAmount('shipping_hidden_tax', $baseShippingTaxDetails->getDiscountTaxCompensationAmount());
     $address->setShippingInclTax($shippingTaxDetails->getRowTotalInclTax());
     $address->setBaseShippingInclTax($baseShippingTaxDetails->getRowTotalInclTax());
     $address->setShippingTaxAmount($shippingTaxDetails->getRowTax());
     $address->setBaseShippingTaxAmount($baseShippingTaxDetails->getRowTax());
     //Add the shipping tax to total tax amount
     $address->addTotalAmount('tax', $shippingTaxDetails->getRowTax());
     $address->addBaseTotalAmount('tax', $baseShippingTaxDetails->getRowTax());
     if ($this->_config->discountTax($address->getQuote()->getStore())) {
         $address->setShippingAmountForDiscount($shippingTaxDetails->getRowTotalInclTax());
         $address->setBaseShippingAmountForDiscount($baseShippingTaxDetails->getRowTotalInclTax());
     }
     return $this;
 }
Beispiel #2
0
 /**
  * Update tax related fields for shipping
  *
  * @param Address $address
  * @param \Magento\Tax\Service\V1\Data\TaxDetails\Item $shippingTaxDetails
  * @param \Magento\Tax\Service\V1\Data\TaxDetails\Item $baseShippingTaxDetails
  * @return $this
  */
 protected function updateShippingTaxInfo(Address $address, $shippingTaxDetails, $baseShippingTaxDetails)
 {
     $address->setTotalAmount('shipping', $shippingTaxDetails->getRowTotal());
     $address->setBaseTotalAmount('shipping', $baseShippingTaxDetails->getRowTotal());
     $address->setShippingTaxAmount($shippingTaxDetails->getRowTax());
     $address->setBaseShippingTaxAmount($baseShippingTaxDetails->getRowTax());
     $address->setTotalAmount('shipping_hidden_tax', $shippingTaxDetails->getDiscountTaxCompensationAmount());
     $address->setBaseTotalAmount('shipping_hidden_tax', $baseShippingTaxDetails->getDiscountTaxCompensationAmount());
     $address->setShippingInclTax($shippingTaxDetails->getRowTotalInclTax());
     $address->setBaseShippingInclTax($baseShippingTaxDetails->getRowTotalInclTax());
     if ($this->_config->discountTax($this->_store)) {
         $address->setShippingAmountForDiscount($shippingTaxDetails->getRowTotalInclTax());
         $address->setBaseShippingAmountForDiscount($baseShippingTaxDetails->getRowTotalInclTax());
     }
     //Add taxes applied to shipping to applied taxes
     $appliedTaxes = $shippingTaxDetails->getAppliedTaxes();
     $baseAppliedTaxes = $baseShippingTaxDetails->getAppliedTaxes();
     $appliedTaxesArray = $this->convertAppliedTaxes($appliedTaxes, $baseAppliedTaxes);
     $this->_saveAppliedTaxes($address, $appliedTaxesArray, $shippingTaxDetails->getRowTax(), $baseShippingTaxDetails->getRowTax(), $shippingTaxDetails->getTaxPercent());
     return $this;
 }