code: protected function updateState(SupplierOrderInterface $order)
      {
          $changed = $this->stateResolver->resolve($order);
  
          // If order state is 'completed' and 'competed at' date is not set
          if ($order->getState() === SupplierOrderStates::STATE_COMPLETED
              && null === $order->getCompletedAt()
          ) {
              // Set the 'completed at' date
              $order->setCompletedAt(new \DateTime());
              $changed = true;
          }
  
          return $changed;
      }
docs: Updates the state.
  
  @param SupplierOrderInterface $order
  
  @return bool Whether or not the supplier order has been changed.