Browse Source

Add balance

pull/492/head
James Cole 2 years ago
parent
commit
52baca6919
No known key found for this signature in database GPG Key ID: B49A324B7EAD6D80
  1. 5
      app/Services/Nordigen/Model/Account.php
  2. 2
      app/Services/Nordigen/Services/AccountInformationCollector.php
  3. 9
      app/Services/Shared/Model/ImportServiceAccount.php

5
app/Services/Nordigen/Model/Account.php

@ -131,6 +131,11 @@ class Account
return $this->bban;
}
public function getBalances(): array
{
return $this->balances;
}
/**
* @param string $bban
*/

2
app/Services/Nordigen/Services/AccountInformationCollector.php

@ -133,7 +133,7 @@ class AccountInformationCollector
$account->setStatus($information['status'] ?? '');
$account->setUsage($information['usage'] ?? '');
// set owner info (could be array or string)
// set owner info (could be an array or string)
$ownerAddress = [];
if (array_key_exists('ownerAddressUnstructured', $information) && is_array($information['ownerAddressUnstructured'])) {
$ownerAddress = $information['ownerAddressUnstructured'];

9
app/Services/Shared/Model/ImportServiceAccount.php

@ -28,6 +28,7 @@ namespace App\Services\Shared\Model;
use App\Services\CSV\Converter\Iban as IbanConverter;
use App\Services\Nordigen\Model\Account as NordigenAccount;
use App\Services\Nordigen\Model\Balance;
use App\Services\Spectre\Model\Account as SpectreAccount;
class ImportServiceAccount
@ -57,7 +58,7 @@ class ImportServiceAccount
$iban = '';
}
$return[] = self::fromArray(
$current = self::fromArray(
[
'id' => $account->getIdentifier(),
'name' => $account->getFullName(),
@ -75,6 +76,12 @@ class ImportServiceAccount
],
]
);
/** @var Balance $balance */
foreach ($account->getBalances() as $balance) {
$key = sprintf('Balance (%s) (%s)', $balance->type, $balance->currency);
$current->extra[$key] = $balance->amount;
}
$return[] = $current;
}
return $return;

Loading…
Cancel
Save