code: protected function updateState(SaleInterface $sale)
      {
          if (parent::updateState($sale)) {
              if (in_array($sale->getState(), OrderStates::getStockableStates(), true)) {
                  if (($sale->getState() === OrderStates::STATE_COMPLETED) && (null === $sale->getCompletedAt())) {
                      $sale->setCompletedAt(new \DateTime());
                  } elseif (($sale->getState() !== OrderStates::STATE_COMPLETED) && (null !== $sale->getCompletedAt())) {
                      $sale->setCompletedAt(null);
                  }
  
                  if (null === $sale->getAcceptedAt()) {
                      $sale->setAcceptedAt(new \DateTime());
                  }
              } else {
                  $sale
                      ->setAcceptedAt(null)
                      ->setCompletedAt(null);
              }
  
              return true;
          }
  
          return false;
      }
docs: @inheritdoc
  
  @param OrderInterface $sale