Update API to match new end points.

This commit is contained in:
James Cole
2018-12-03 15:57:15 +01:00
parent c13d0da9fa
commit c0d6d0e28e
11 changed files with 123 additions and 159 deletions

View File

@@ -40,6 +40,11 @@ use Log;
*/
class TransactionFactory
{
/** @var User */
private $user;
use TransactionServiceTrait;
/**
* Constructor.
*/
@@ -50,11 +55,6 @@ class TransactionFactory
}
}
use TransactionServiceTrait;
/** @var User */
private $user;
/**
* @param array $data
*
@@ -109,8 +109,9 @@ class TransactionFactory
Log::debug('Start of TransactionFactory::createPair()', $data);
// all this data is the same for both transactions:
Log::debug('Searching for currency info.');
$currency = $this->findCurrency($data['currency_id'], $data['currency_code']);
//$description = $data['description'];
$defaultCurrency = app('amount')->getDefaultCurrencyByUser($this->user);
$currency = $this->findCurrency($data['currency_id'], $data['currency_code']);
$currency = $currency ?? $defaultCurrency;
// type of source account and destination account depends on journal type:
$sourceType = $this->accountType($journal, 'source');