This commit is contained in:
James Cole
2019-08-11 17:32:00 +02:00
parent cc243f9fb7
commit 1d2c834b2c
4 changed files with 13 additions and 16 deletions

View File

@@ -261,7 +261,7 @@ class TransactionJournalFactory
$sourceForeignCurrency = $foreignCurrency;
$destForeignCurrency = $foreignCurrency;
if ('Withdrawal' === $type->type) {
if (TransactionType::WITHDRAWAL === $type->type) {
// make sure currency is correct.
$currency = $this->getCurrency($currency, $sourceAccount);
// make sure foreign currency != currency.
@@ -273,7 +273,7 @@ class TransactionJournalFactory
$sourceForeignCurrency = $foreignCurrency;
$destForeignCurrency = $foreignCurrency;
}
if ('Deposit' === $type->type) {
if (TransactionType::DEPOSIT === $type->type) {
// make sure currency is correct.
$currency = $this->getCurrency($currency, $destinationAccount);
// make sure foreign currency != currency.
@@ -298,11 +298,6 @@ class TransactionJournalFactory
$destForeignCurrency = $currency;
}
// if transfer, switch accounts:
if (TransactionType::TRANSFER === $type->type) {
[$sourceAccount, $destinationAccount] = [$destinationAccount, $sourceAccount];
}
/** Create a basic journal. */
$journal = TransactionJournal::create(
[