public function getReferringTransactionAttempts($refTransactionId, $transactionOperation = null) {
    $attempts = array();

    if ($refTransactionId !== null && isset($this->transactions) && is_array($this->transactions) && count($this->transactions) > 0) {
      foreach ($this->transactions as $transaction) {
        if ($refTransactionId === $transaction->getRefTransactionId() &&
            ($transactionOperation == null || $transactionOperation === $transaction->getOperation())) {
          $attempts[] = $transaction;
        }
      }

      // Sort the array by transaction date ascending
      if (count($attempts) > 1) {
        usort($attempts,
            function ($t1, $t2) {
              $date1 = $t1->getDate();
              $date2 = $t2->getDate();

              if ($date1 === null && $date2 !== null) {
                return -1;
              }
              if ($date1 !== null && $date2 === null) {
                return 1;
              }

              return ($date1 === $date2 ? 0 : ($date1 < $date2 ? -1 : 1));
            });
      }
    }

    return $attempts;
  }