/** * @param TransactionId $transactionId * @return Transaction */ public function transactionOfId(TransactionId $transactionId) { /** @var Result $result */ $result = $this->repository->query()->where('id', '==', $transactionId->getValue())->execute(); if ($result === false) { return null; } if ($result->count() == 0) { return null; } $encryptedTransaction = $this->documentToEncryptedTransaction($result->first()); return $encryptedTransaction; }
/** * @param EncryptedTransaction $encryptedTransaction * @return bool */ public function equals(EncryptedTransaction $encryptedTransaction) { if ($this->id->equals($encryptedTransaction->getId())) { return true; } else { return false; } }
/** * @return TransactionId * @throws \Exception */ public function nextIdentity() { $id = strtoupper(str_replace('.', '', uniqid('', true))); return TransactionId::create($id); }