Skip to content

Commit

Permalink
Include BIC in import routine
Browse files Browse the repository at this point in the history
  • Loading branch information
JC5 committed Mar 19, 2018
1 parent 3114695 commit e2ecaf5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/Import/Object/ImportAccount.php
Expand Up @@ -38,6 +38,8 @@ class ImportAccount
/** @var Account */
private $account;
/** @var array */
private $accountBic = [];
/** @var array */
private $accountIban = [];
/** @var array */
private $accountId = [];
Expand All @@ -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
Expand Down Expand Up @@ -105,6 +107,14 @@ public function setExpectedType(string $expectedType)
$this->expectedType = $expectedType;
}

/**
* @param array $accountBic
*/
public function setAccountBic(array $accountBic): void
{
$this->accountBic = $accountBic;
}

/**
* @codeCoverageIgnore
*
Expand Down Expand Up @@ -388,6 +398,7 @@ private function store(): bool
'active' => true,
'virtualBalance' => '0',
'account_type_id' => null,
'BIC' => $this->accountBic['value'] ?? null,
];

$this->account = $this->repository->store($data);
Expand Down
3 changes: 3 additions & 0 deletions app/Import/Object/ImportJournal.php
Expand Up @@ -283,6 +283,9 @@ public function setValue(array $array)
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);
Expand Down
6 changes: 6 additions & 0 deletions config/csv.php
Expand Up @@ -266,6 +266,12 @@
'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,
Expand Down

0 comments on commit e2ecaf5

Please sign in to comment.