Author: Adam Piotrowski (adam@wellcommerce.org)
Inheritance: extends WellCommerce\Bundle\CoreBundle\Entity\TimestampableInterface, extends WellCommerce\Bundle\ShippingBundle\Entity\ShippingMethodAwareInterface
 protected function collectShippingCost(ShippingMethodCostInterface $shippingMethodCost = null)
 {
     if (null !== $shippingMethodCost) {
         $cost = $shippingMethodCost->getCost();
         $baseCurrency = $cost->getCurrency();
         $grossAmount = $cost->getGrossAmount();
         return $this->helper->convert($grossAmount, $baseCurrency);
     }
     return 0;
 }
Exemplo n.º 2
0
 /**
  * Prepares order shipping details
  *
  * @param OrderInterface              $order
  * @param ShippingMethodCostInterface $shippingMethodCost
  */
 protected function prepareShippingTotals(OrderInterface $order, ShippingMethodCostInterface $shippingMethodCost)
 {
     $cost = $shippingMethodCost->getCost();
     $baseCurrency = $cost->getCurrency();
     $shippingTotal = new OrderTotal();
     $shippingTotal->setGrossAmount($this->currencyHelper->convert($cost->getGrossAmount(), $baseCurrency, $order->getCurrency()));
     $shippingTotal->setNetAmount($this->currencyHelper->convert($cost->getNetAmount(), $baseCurrency, $order->getCurrency()));
     $shippingTotal->setTaxAmount($this->currencyHelper->convert($cost->getTaxAmount(), $baseCurrency, $order->getCurrency()));
     $shippingTotal->setTaxRate($this->currencyHelper->convert($cost->getTaxRate()));
     $shippingTotal->setCurrency($order->getCurrency());
     $order->setShippingTotal($shippingTotal);
 }