Ejemplo n.º 1
0
 public function testGetBaseTotalAmount()
 {
     $code = 'wow';
     $amount = 42;
     $this->model->setBaseTotalAmount($code, $amount);
     $this->assertEquals($amount, $this->model->getBaseTotalAmount($code));
 }
Ejemplo n.º 2
0
 /**
  * @param \Magento\Quote\Model\Quote\Address\Total $total
  */
 protected function clearValues(\Magento\Quote\Model\Quote\Address\Total $total)
 {
     // $enabled = $this->helperData->isModuleEnabled();
     // $minimumOrderAmount = $this->helperData->getMinimumOrderAmount();
     // $subtotal = $total->getTotalAmount('subtotal');
     $total->setTotalAmount('subtotal', 0);
     $total->setBaseTotalAmount('subtotal', 0);
     $total->setTotalAmount('tax', 0);
     $total->setBaseTotalAmount('tax', 0);
     $total->setTotalAmount('discount_tax_compensation', 0);
     $total->setBaseTotalAmount('discount_tax_compensation', 0);
     $total->setTotalAmount('shipping_discount_tax_compensation', 0);
     $total->setBaseTotalAmount('shipping_discount_tax_compensation', 0);
     $total->setSubtotalInclTax(0);
     $total->setBaseSubtotalInclTax(0);
 }
Ejemplo n.º 3
0
 /**
  * Clear tax related total values in address
  *
  * @param Address\Total $total
  * @return void
  */
 protected function clearValues(Address\Total $total)
 {
     $total->setTotalAmount('subtotal', 0);
     $total->setBaseTotalAmount('subtotal', 0);
     $total->setTotalAmount('tax', 0);
     $total->setBaseTotalAmount('tax', 0);
     $total->setTotalAmount('discount_tax_compensation', 0);
     $total->setBaseTotalAmount('discount_tax_compensation', 0);
     $total->setTotalAmount('shipping_discount_tax_compensation', 0);
     $total->setBaseTotalAmount('shipping_discount_tax_compensation', 0);
     $total->setSubtotalInclTax(0);
     $total->setBaseSubtotalInclTax(0);
 }
 /**
  * Update tax related fields for shipping
  *
  * @param ShippingAssignmentInterface $shippingAssignment
  * @param QuoteAddress\Total $total
  * @param TaxDetailsItemInterface $shippingTaxDetails
  * @param TaxDetailsItemInterface $baseShippingTaxDetails
  * @return $this
  */
 protected function processShippingTaxInfo(ShippingAssignmentInterface $shippingAssignment, QuoteAddress\Total $total, $shippingTaxDetails, $baseShippingTaxDetails)
 {
     $total->setTotalAmount('shipping', $shippingTaxDetails->getRowTotal());
     $total->setBaseTotalAmount('shipping', $baseShippingTaxDetails->getRowTotal());
     $total->setTotalAmount('shipping_discount_tax_compensation', $shippingTaxDetails->getDiscountTaxCompensationAmount());
     $total->setBaseTotalAmount('shipping_discount_tax_compensation', $baseShippingTaxDetails->getDiscountTaxCompensationAmount());
     $total->setShippingInclTax($shippingTaxDetails->getRowTotalInclTax());
     $total->setBaseShippingInclTax($baseShippingTaxDetails->getRowTotalInclTax());
     $total->setShippingTaxAmount($shippingTaxDetails->getRowTax());
     $total->setBaseShippingTaxAmount($baseShippingTaxDetails->getRowTax());
     //Add the shipping tax to total tax amount
     $total->addTotalAmount('tax', $shippingTaxDetails->getRowTax());
     $total->addBaseTotalAmount('tax', $baseShippingTaxDetails->getRowTax());
     if ($this->_config->discountTax($shippingAssignment->getShipping()->getAddress()->getQuote()->getStore())) {
         $total->setShippingAmountForDiscount($shippingTaxDetails->getRowTotalInclTax());
         $total->setBaseShippingAmountForDiscount($baseShippingTaxDetails->getRowTotalInclTax());
     }
     return $this;
 }