Repository and test clean up.

This commit is contained in:
James Cole
2018-02-28 21:32:59 +01:00
parent 54ba18975a
commit 5b8adbfd0c
19 changed files with 67 additions and 88 deletions

View File

@@ -197,18 +197,6 @@ class JournalRepository implements JournalRepositoryInterface
return null;
}
/**
* Get account of transaction that is more than zero. Only works with unsplit journals.
*
* @param TransactionJournal $journal
*
* @return Account
*/
public function getDestinationAccount(TransactionJournal $journal): Account
{
return $journal->transactions()->where('amount', '<', 0)->first()->account;
}
/**
* Returns the first positive transaction for the journal. Useful when editing journals.
*
@@ -438,18 +426,6 @@ class JournalRepository implements JournalRepositoryInterface
return $note->text;
}
/**
* Get account of transaction that is less than zero. Only works with unsplit journals.
*
* @param TransactionJournal $journal
*
* @return Account
*/
public function getSourceAccount(TransactionJournal $journal): Account
{
return $journal->transactions()->where('amount', '>', 0)->first()->account;
}
/**
* Return all tags as strings in an array.
*
@@ -542,6 +518,22 @@ class JournalRepository implements JournalRepositoryInterface
return true;
}
/**
* @param int $transactionId
*
* @return bool
*/
public function reconcileById(int $transactionId): bool
{
/** @var Transaction $transaction */
$transaction = $this->user->transactions()->find($transactionId);
if (!is_null($transaction)) {
return $this->reconcile($transaction);
}
return false;
}
/**
* @param TransactionJournal $journal
* @param int $order