/**
  * Cancels a transaction
  *
  * @param \DateTime $transactionAt
  * @return null|int
  */
 protected function cancelTransaction($transactionAt)
 {
     $monthNo = $transactionAt->format('m');
     $year = $transactionAt->format('Y');
     $this->transData = $this->transaction->getLatestTransactionByTermId($this->termId, $monthNo, $year);
     if ($this->transData) {
         if ($this->transData->getInvoiceID() > 0) {
             $this->transactionAmount += $this->transData->getAmount();
         }
         $this->transData->setStatusId($this->transStatusCancelled);
         $this->transaction->updateTransaction($this->transData);
         $previousId = $this->transData->getId();
         $this->tsData = $this->transactionSupport->getTransactionSupport($previousId);
         $this->tsData->setTransDate($transactionAt->format('Y-m-d'))->setBand($this->band);
         $this->transactionSupport->updateTransactionSupport($this->tsData);
         return $previousId;
     }
     return null;
 }