コード例 #1
0
 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);
 }
コード例 #2
0
 /**
  * @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);
 }
コード例 #3
0
ファイル: OrderRecalculator.php プロジェクト: okwinza/Sylius
 /**
  * @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);
 }
コード例 #4
0
 /**
  * @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);
 }
コード例 #5
0
 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);
 }
コード例 #6
0
 /**
  * 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();
 }
コード例 #7
0
 /**
  * {@inheritdoc}
  */
 public function process(OrderInterface $order)
 {
     $this->promotionProcessor->process($order);
 }
コード例 #8
0
ファイル: CartSubscriber.php プロジェクト: enhavo/enhavo
 public function change(GenericEvent $event)
 {
     $cart = $event->getSubject();
     $this->orderShipmentProcessor->process($cart);
     $this->promotionProcessor->process($cart);
 }
コード例 #9
0
 /**
  * {@inheritdoc}
  */
 public function process(OrderInterface $order)
 {
     /** @var CoreOrderInterface $order */
     Assert::isInstanceOf($order, CoreOrderInterface::class);
     $this->promotionProcessor->process($order);
 }