Add thing to apply rules to fints #2081

This commit is contained in:
James Cole 2019-02-12 21:01:12 +01:00
parent 58e55dc789
commit 2117fc2a5a
3 changed files with 6 additions and 3 deletions

View File

@ -82,8 +82,8 @@ class FinTS
return $account->getAccountNumber() === $accountNumber;
}
);
if (count($filteredAccounts) != 1) {
throw new FireflyException("Cannot find account with number " . $accountNumber);
if (1 !== count($filteredAccounts)) {
throw new FireflyException(sprintf('Cannot find account with number "%s"', $accountNumber));
}
return reset($filteredAccounts);

View File

@ -59,17 +59,19 @@ class NewFinTSJobHandler implements FinTSConfigurationInterface
$config['fints_bank_code'] = (string)($data['fints_bank_code'] ?? '');
$config['fints_username'] = (string)($data['fints_username'] ?? '');
$config['fints_password'] = (string)(Crypt::encrypt($data['fints_password']) ?? '');
$config['apply-rules'] = 1 === (int)$data['apply_rules'];
$this->repository->setConfiguration($this->importJob, $config);
$incomplete = false;
foreach ($config as $value) {
$incomplete = '' === $value or $incomplete;
}
if ($incomplete) {
return new MessageBag([trans('import.incomplete_fints_form')]);
}
$finTS = app(FinTS::class, ['config' => $this->importJob->configuration]);
if (true !== ($checkConnection = $finTS->checkConnection())) {
return new MessageBag([trans('import.fints_connection_failed', ['originalError' => $checkConnection])]);

View File

@ -20,6 +20,7 @@
{{ ExpandedForm.text('fints_bank_code', data.fints_bank_code, {required: true}) }}
{{ ExpandedForm.text('fints_username', data.fints_username, {helpText: trans('import.job_config_fints_username_help'), required: false}) }}
{{ ExpandedForm.password('fints_password', {required: true}) }}
{{ ExpandedForm.checkbox('apply_rules', 1, true) }}
</div>
</div>
</div>