Esempio n. 1
0
 /**
  * Update order's shipping state.
  *
  * @param OrderInterface $order
  * @param string         $transition
  */
 public function updateOrderShipmentStates(OrderInterface $order, $transition = ShipmentTransitions::SYLIUS_PREPARE)
 {
     if ($order->isBackorder()) {
         $transition = ShipmentTransitions::SYLIUS_BACKORDER;
     }
     $this->processor->updateShipmentStates($order->getShipments(), $transition);
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function resolveShippingState(OrderInterface $order)
 {
     if ($order->isBackorder()) {
         $order->setShippingState(OrderShippingStates::BACKORDER);
         return;
     }
     $order->setShippingState($this->getShippingState($order));
 }
Esempio n. 3
0
 function it_marks_order_as_returned_if_all_shipments_were_returned(OrderInterface $order, ShipmentInterface $shipment1, ShipmentInterface $shipment2)
 {
     $order->isBackorder()->shouldBeCalled()->willReturn(false);
     $order->getShipments()->willReturn(array($shipment1, $shipment2));
     $shipment1->getState()->willReturn(ShipmentInterface::STATE_RETURNED);
     $shipment2->getState()->willReturn(ShipmentInterface::STATE_RETURNED);
     $order->setShippingState(OrderShippingStates::RETURNED)->shouldBeCalled();
     $this->resolveShippingState($order);
 }
 function it_updates_order_shipment_states_to_other_if_order_is_not_be_backordered(ShipmentInterface $shipment, OrderInterface $order)
 {
     $order->isBackorder()->willReturn(false);
     $order->getShipments()->willReturn([$shipment]);
     $this->updateOrderShipmentStates($order, 'foo');
 }