function it_recalculates_order_promotions_taxes_and_shipping_charges(PromotionProcessorInterface $promotionProcessor, OrderTaxesApplicatorInterface $taxesApplicator, ShippingChargesProcessorInterface $shippingChargesProcessor, OrderInterface $order)
 {
     $promotionProcessor->process($order)->shouldBeCalled();
     $taxesApplicator->apply($order)->shouldBeCalled();
     $shippingChargesProcessor->applyShippingCharges($order)->shouldBeCalled();
     $this->recalculate($order);
 }
 /**
  * @param OrderInterface $order
  *
  * @return OrderInterface
  */
 public function recalculate(OrderInterface $order)
 {
     $this->pricesRecalculator->recalculate($order);
     $this->shippingChargesProcessor->applyShippingCharges($order);
     $this->promotionProcessor->process($order);
     $this->taxesApplicator->apply($order);
 }
Exemple #3
0
 /**
  * @param OrderInterface $order
  *
  * @return OrderInterface
  */
 public function recalculate(OrderInterface $order)
 {
     $this->adjustmentsRemover->removeFrom($order);
     $this->pricesRecalculator->recalculate($order);
     $this->shippingChargesProcessor->applyShippingCharges($order);
     $this->promotionProcessor->process($order);
     $this->taxesProcessor->process($order);
 }
 /**
  * @param GenericEvent $event
  *
  * @throws UnexpectedTypeException
  */
 public function processOrderPromotion(GenericEvent $event)
 {
     $order = $event->getSubject();
     if (!$order instanceof OrderInterface) {
         throw new UnexpectedTypeException($order, OrderInterface::class);
     }
     $this->promotionProcessor->process($order);
 }
 function it_recalculates_order_promotions_taxes_and_shipping_charges(AdjustmentsRemoverInterface $adjustmentsRemover, PromotionProcessorInterface $promotionProcessor, PricesRecalculatorInterface $pricesRecalculator, OrderTaxesProcessorInterface $taxesProcessor, ShippingChargesProcessorInterface $shippingChargesProcessor, OrderInterface $order)
 {
     $adjustmentsRemover->removeFrom($order)->shouldBeCalled();
     $pricesRecalculator->recalculate($order)->shouldBeCalled();
     $promotionProcessor->process($order)->shouldBeCalled();
     $taxesProcessor->process($order)->shouldBeCalled();
     $shippingChargesProcessor->applyShippingCharges($order)->shouldBeCalled();
     $this->recalculate($order);
 }
 /**
  * Get the order from event and run the promotion processor on it.
  *
  * @param GenericEvent $event
  *
  * @throws UnexpectedTypeException
  */
 public function processOrderPromotion(GenericEvent $event)
 {
     $order = $event->getSubject();
     if (!$order instanceof OrderInterface) {
         throw new UnexpectedTypeException($order, 'Sylius\\Component\\Core\\Model\\OrderInterface');
     }
     $this->promotionProcessor->process($order);
     $order->calculateTotal();
 }
 /**
  * {@inheritdoc}
  */
 public function process(OrderInterface $order)
 {
     $this->promotionProcessor->process($order);
 }
Exemple #8
0
 public function change(GenericEvent $event)
 {
     $cart = $event->getSubject();
     $this->orderShipmentProcessor->process($cart);
     $this->promotionProcessor->process($cart);
 }
 /**
  * {@inheritdoc}
  */
 public function process(OrderInterface $order)
 {
     /** @var CoreOrderInterface $order */
     Assert::isInstanceOf($order, CoreOrderInterface::class);
     $this->promotionProcessor->process($order);
 }