Skip to content

Firefly III: a personal finances manager

Include BIC in import routine

James Colee2ecaf5bcffa
diff --git a/app/Import/Object/ImportAccount.php b/app/Import/Object/ImportAccount.php
index 990d17d495..c05e910f93 100644
--- a/app/Import/Object/ImportAccount.php
+++ b/app/Import/Object/ImportAccount.php
@@ -38,6 +38,8 @@ class ImportAccount
/** @var Account */
private $account;
/** @var array */
+ private $accountBic = [];
+ /** @var array */
private $accountIban = [];
/** @var array */
private $accountId = [];
@@ -51,7 +53,7 @@ class ImportAccount
private $expectedType = '';
/**
* This value is used to indicate the other account ID (the opposing transaction's account),
- * if it is know. If so, this particular importaccount may never return an Account with this ID.
+ * if it is know. If so, this particular import account may never return an Account with this ID.
* If it would, this would result in a transaction from-to the same account.
*
* @var int
@@ -105,6 +107,14 @@ class ImportAccount
$this->expectedType = $expectedType;
}
+ /**
+ * @param array $accountBic
+ */
+ public function setAccountBic(array $accountBic): void
+ {
+ $this->accountBic = $accountBic;
+ }
+
/**
* @codeCoverageIgnore
*
@@ -388,6 +398,7 @@ class ImportAccount
'active' => true,
'virtualBalance' => '0',
'account_type_id' => null,
+ 'BIC' => $this->accountBic['value'] ?? null,
];
$this->account = $this->repository->store($data);
diff --git a/app/Import/Object/ImportJournal.php b/app/Import/Object/ImportJournal.php
index 740e60e0cf..62fc5d4602 100644
--- a/app/Import/Object/ImportJournal.php
+++ b/app/Import/Object/ImportJournal.php
@@ -283,6 +283,9 @@ class ImportJournal
case 'opposing-id':
$this->opposing->setAccountId($array);
break;
+ case 'opposing-bic':
+ $this->opposing->setAccountBic($array);
+ break;
case 'tags-comma':
case 'tags-space':
$this->setTags($array);
diff --git a/config/csv.php b/config/csv.php
index 3b72a48efd..cde6ea3d08 100644
--- a/config/csv.php
+++ b/config/csv.php
@@ -266,6 +266,12 @@ return [
'converter' => 'AccountId',
'mapper' => 'OpposingAccounts',
],
+ 'opposing-bic' => [
+ 'mappable' => false,
+ 'pre-process-map' => false,
+ 'field' => 'opposing-account-bic',
+ 'converter' => 'AccountBic',
+ ],
'opposing-name' => [
'mappable' => true,
'pre-process-map' => false,