code: public function watch(Repository\PaymentRepositoryInterface $paymentRepository)
      {
          if (null === $term = $this->termRepository->findLongest()) {
              return false;
          }
  
          $today = new \DateTime();
          $today->setTime(0, 0, 0);
  
          $fromDate = clone $today;
          $fromDate->modify('-1 year');
  
          $states = [Model\PaymentStates::STATE_AUTHORIZED, Model\PaymentStates::STATE_CAPTURED];
  
          /** @var Model\PaymentMethodInterface $method */
          $method = $this->methodRepository->findOneBy([
              'factoryName' => Constants::FACTORY_NAME,
          ]);
  
          if (!$method || !$method->isOutstanding()) {
              return false;
          }
  
          $result = false;
          $payments = $paymentRepository->findByMethodAndStates($method, $states, $fromDate);
  
          foreach ($payments as $payment) {
              $sale = $payment->getSale();
  
              // Sale may not have a outstanding limit date
              if (null === $date = $sale->getOutstandingDate()) {
                  continue;
              }
  
              // If outstanding limit date is past
              $diff = $date->diff($today);
              if (0 < $diff->days && !$diff->invert) {
                  $payment->setState(Model\PaymentStates::STATE_EXPIRED);
  
                  $this->persist($payment);
  
                  $result = true;
              }
          }
  
          return $result;
      }
docs: Watch for outstanding payments.
  
  @param Repository\PaymentRepositoryInterface $paymentRepository
  
  @return bool Whether some payments have been updated.