/**
  * @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 #2
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);
 }
 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);
 }
 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);
 }
 function it_calls_shipping_processor_on_order(ShippingChargesProcessorInterface $shippingChargesProcessor, GenericEvent $event, OrderInterface $order)
 {
     $event->getSubject()->willReturn($order);
     $shippingChargesProcessor->applyShippingCharges($order)->shouldBeCalled();
     $this->processOrderShippingCharges($event);
 }
 /**
  * Get the order from event and run the shipping processor on it.
  *
  * @param GenericEvent $event
  */
 public function processOrderShippingCharges(GenericEvent $event)
 {
     $this->shippingChargesProcessor->applyShippingCharges($this->getOrder($event));
 }