Skip to content

Commit 23108d6

Browse files
authored
Merge pull request #201 from Bur0k/config/force_mt940
Add a config entry to force MT940
2 parents 47b12af + 2297134 commit 23108d6

File tree

6 files changed

+11
-0
lines changed

6 files changed

+11
-0
lines changed

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,4 @@ Bank specifics
9595
* For ING DiBa you need a password that is between 5 and 10 characters, not less not more as you will otherwise run into this error:
9696
* ```Anmeldung nur mit 10-stelliger Kontonummer und 5 bis 10-stelliger PIN möglich.```
9797
* *Note: this will not lead to your account being blocked due to to many attempts as you do not attempt a login funnily enough*
98+
* For Targobank, if your transactions are having [unhelpful descriptions](https://github.com/bnw/firefly-iii-fints-importer/pull/201), try setting `force_mt940=true` (only available in the configuration file, not the GUI). This will use a different API to retrieve your transactions that does not have this problem.

app/Choose2FADevice.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function Choose2FADevice()
2222
$session->set('skip_transaction_review', $request->request->get('skip_transaction_review'));
2323
$session->set('description_regex_match', $request->request->get('description_regex_match'));
2424
$session->set('description_regex_replace', $request->request->get('description_regex_replace'));
25+
$session->set('force_mt940', $request->request->get('force_mt940'));
2526
$fin_ts = FinTsFactory::create_from_session($session);
2627
$tan_mode = FinTsFactory::get_tan_mode($fin_ts, $session);
2728

app/CollectData.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ function CollectData()
6060
$session->set('choose_account_to', $configuration->choose_account_to);
6161
$session->set('description_regex_match', $configuration->description_regex_match);
6262
$session->set('description_regex_replace', $configuration->description_regex_replace);
63+
$session->set('force_mt940', $configuration->force_mt940);
6364

6465
$fin_ts = FinTsFactory::create_from_session($session);
6566
$tan_mode = FinTsFactory::get_tan_mode($fin_ts, $session);

app/ConfigurationFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Configuration {
2020
public $choose_account_to;
2121
public $description_regex_match;
2222
public $description_regex_replace;
23+
public $force_mt940;
2324
}
2425

2526
class ConfigurationFactory
@@ -55,6 +56,7 @@ static function load_from_file($fileName)
5556
}
5657
$configuration->description_regex_match = $contentArray["description_regex_match"];
5758
$configuration->description_regex_replace = $contentArray["description_regex_replace"];
59+
$configuration->force_mt940 = filter_var($contentArray["force_mt940"] ?? false, FILTER_VALIDATE_BOOLEAN);
5860

5961
return $configuration;
6062
}

app/Login.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ function () {
5252
$session->set('statement_format', 'camt'); // Default, let exception handling deal with it
5353
}
5454

55+
if ($session->get('force_mt940')) {
56+
Logger::info("Forcing MT940 format as per configuration");
57+
$session->set('statement_format', 'mt940');
58+
}
59+
5560
if ($automate_without_js)
5661
{
5762
$session->set('persistedFints', $fin_ts->persist());

data/configurations/example.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"description_regex_match": "/^(Übertrag \\/ Überweisung|Lastschrift \\/ Belastung)(.*)(END-TO-END-REF.*|Karte.*|KFN.*)(Ref\\..*)$/mi",
1414
"description_regex_replace": "$2 [$1 | $3 | $4]",
1515
"auto_submit_form_via_js": false,
16+
"force_mt940": false,
1617
"choose_account_automation":
1718
{
1819
"bank_account_iban": "",

0 commit comments

Comments
 (0)