mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 10:33:30 +00:00
getIban might return null from the bunq API. Fixes #1378 as it gets imported now :)
This commit is contained in:
@@ -320,23 +320,27 @@ class BunqRoutine implements RoutineInterface
|
|||||||
private function convertToAccount(LabelMonetaryAccount $party, string $expectedType): Account
|
private function convertToAccount(LabelMonetaryAccount $party, string $expectedType): Account
|
||||||
{
|
{
|
||||||
Log::debug('in convertToAccount()');
|
Log::debug('in convertToAccount()');
|
||||||
// find opposing party by IBAN first.
|
|
||||||
$result = $this->accountRepository->findByIbanNull($party->getIban(), [$expectedType]);
|
|
||||||
if (null !== $result) {
|
|
||||||
Log::debug(sprintf('Search for %s resulted in account %s (#%d)', $party->getIban(), $result->name, $result->id));
|
|
||||||
|
|
||||||
return $result;
|
if ($party->getIban() !== null) {
|
||||||
}
|
// find opposing party by IBAN first.
|
||||||
|
$result = $this->accountRepository->findByIbanNull($party->getIban(), [$expectedType]);
|
||||||
// try to find asset account just in case:
|
|
||||||
if ($expectedType !== AccountType::ASSET) {
|
|
||||||
$result = $this->accountRepository->findByIbanNull($party->getIban(), [AccountType::ASSET]);
|
|
||||||
if (null !== $result) {
|
if (null !== $result) {
|
||||||
Log::debug(sprintf('Search for Asset "%s" resulted in account %s (#%d)', $party->getIban(), $result->name, $result->id));
|
Log::debug(sprintf('Search for %s resulted in account %s (#%d)', $party->getIban(), $result->name, $result->id));
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try to find asset account just in case:
|
||||||
|
if ($expectedType !== AccountType::ASSET) {
|
||||||
|
$result = $this->accountRepository->findByIbanNull($party->getIban(), [AccountType::ASSET]);
|
||||||
|
if (null !== $result) {
|
||||||
|
Log::debug(sprintf('Search for Asset "%s" resulted in account %s (#%d)', $party->getIban(), $result->name, $result->id));
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create new account:
|
// create new account:
|
||||||
$data = [
|
$data = [
|
||||||
'user_id' => $this->job->user_id,
|
'user_id' => $this->job->user_id,
|
||||||
|
Reference in New Issue
Block a user