private function parseBankAccount($account, $bankAccounts, $expenses, $includeTransactions, $vendorMap)
{
$obj = new stdClass();
$obj->account_name = '';
// look up bank account name
foreach ($bankAccounts as $bankAccount) {
if (Hash::check($account->id, $bankAccount->account_number)) {
$obj->account_name = $bankAccount->account_name;
}
}
// if we can't find a match skip the account
if (count($bankAccounts) && !$obj->account_name) {
return false;
}
$obj->masked_account_number = Utils::maskAccountNumber($account->id);
$obj->hashed_account_number = bcrypt($account->id);
$obj->type = $account->type;
$obj->balance = Utils::formatMoney($account->ledgerBalance, CURRENCY_DOLLAR);
if ($includeTransactions) {
$obj = $this->parseTransactions($obj, $account->response, $expenses, $vendorMap);
}
return $obj;
}