From 0ff4fe09c7a7917bfcee611bee79bb0f3060cb36 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 11 Jul 2017 13:26:41 +0300 Subject: [PATCH] Merge OFX fixes --- app/Services/BankAccountService.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Services/BankAccountService.php b/app/Services/BankAccountService.php index 825e1e12e453..d19cdb5f07b1 100644 --- a/app/Services/BankAccountService.php +++ b/app/Services/BankAccountService.php @@ -128,6 +128,7 @@ class BankAccountService extends BaseService return $data; } catch (\Exception $e) { + Utils::logError($e); return false; } } @@ -183,11 +184,12 @@ class BankAccountService extends BaseService $ofxParser = new \OfxParser\Parser(); $ofx = $ofxParser->loadFromString($data); - $account->start_date = $ofx->BankAccount->Statement->startDate; - $account->end_date = $ofx->BankAccount->Statement->endDate; + $bankAccount = reset($ofx->bankAccounts); + $account->start_date = $bankAccount->statement->startDate; + $account->end_date = $bankAccount->statement->endDate; $account->transactions = []; - foreach ($ofx->BankAccount->Statement->transactions as $transaction) { + foreach ($bankAccount->statement->transactions as $transaction) { // ensure transactions aren't imported as expenses twice if (isset($expenses[$transaction->uniqueId])) { continue;