/** * {@inheritdoc} */ public function resolve(OrderInterface $order) { if (OrderShippingStates::STATE_SHIPPED === $order->getShippingState()) { return; } /** @var StateMachineInterface $stateMachine */ $stateMachine = $this->stateMachineFactory->get($order, OrderShippingTransitions::GRAPH); if ($this->allShipmentsInStateButOrderStateNotUpdated($order, ShipmentInterface::STATE_SHIPPED, OrderShippingStates::STATE_SHIPPED)) { $stateMachine->apply(OrderShippingTransitions::TRANSITION_SHIP); } if ($this->isPartiallyShippedButOrderStateNotUpdated($order)) { $stateMachine->apply(OrderShippingTransitions::TRANSITION_PARTIALLY_SHIP); } }
/** * @param OrderInterface $order * * @return bool */ private function canOrderBeFulfilled(OrderInterface $order) { return OrderPaymentStates::STATE_PAID === $order->getPaymentState() && OrderShippingStates::STATE_SHIPPED === $order->getShippingState(); }