Repository: siddhantgoel/beancount-dkb

Issue:
Support Tagesgeld in v2
Hi! Great project.

I tried the importer with the new DKB interface and thus the new csv files and it works flawlessly for the Girokonto.

The "Tagesgeld" (aka. Savings) account doesn't unfortunately. As far as I can tell, the only difference is that the header states "Tagesgeld" instead of "Girokonto" thus a simple change of the regex in `extractors/ec.py:243` should suffice. That is

Changing

```python
r'^"Girokonto"'
```

to

```python
r'^"(Girokonto|Tagesgeld)"'
```

fixes the issue for me and the extractor is able to handle the savings account as well. Similar to #135 and #136 

For reference, the header of the "Tagesgeld" savings account looks like this:

```csv
"Tagesgeld";"DE99120300001234567890"

"Kontostand vom 01.01.2025:";"123,45 €"
""
"Buchungsdatum";"Wertstellung";"Status";"Zahlungspflichtige*r";"Zahlungsempfänger*in";"Verwendungszweck";"Umsatztyp";"IBAN";"Betrag (€)";"Gläubiger-ID";"Mandatsreferenz";"Kundenreferenz"
```

Cheers!

Discussion:
@siddhantgoel: Closed by #217 .

Solution patch:
diff --git a/beancount_dkb/extractors/ec.py b/beancount_dkb/extractors/ec.py
index 8e0101c..d298ccb 100644
--- a/beancount_dkb/extractors/ec.py
+++ b/beancount_dkb/extractors/ec.py
@@ -240,7 +240,7 @@ class V2Extractor(BaseExtractor):
             metadata_lines = self.extract_metadata_lines()
 
             regex = re.compile(
-                r'^"Girokonto"'
+                r'^"(Girokonto|Tagesgeld)"'
                 + self.csv_delimiter
                 + '"'
                 + re.escape(re.sub(r"\s+", "", self.iban, flags=re.UNICODE))


Test patch:
diff --git a/tests/test_ec_v2.py b/tests/test_ec_v2.py
index 4f7786c..6aa0322 100644
--- a/tests/test_ec_v2.py
+++ b/tests/test_ec_v2.py
@@ -104,6 +104,31 @@ def tmp_file_multiple_transaction(tmp_path, header):
     return tmp_file
 
 
+@pytest.fixture
+def tmp_file_tagesgeld_no_transactions(tmp_path, header):
+    """
+    Fixture for a temporary file for a Savings account (i.e. "Tagesgeld")
+    with no transactions
+    """
+
+    tmp_file = tmp_path / f"{IBAN}.csv"
+    tmp_file.write_text(
+        _format(
+            """
+            "Tagesgeld"{delimiter}"{iban}"
+            ""
+            "Kontostand vom 30.06.2023:"{delimiter}"5.000,01 EUR"
+            ""
+            {header}
+            """,  # NOQA
+            dict(iban=IBAN, header=header.value, delimiter=header.delimiter),
+        ),
+        encoding=ENCODING,
+    )
+
+    return tmp_file
+
+
 def test_file_encoding_raises_deprecation_warning():
     with pytest.deprecated_call():
         ECImporter(IBAN, "Assets:DKB:EC", file_encoding="utf-8")
@@ -115,6 +140,12 @@ def test_identify_correct(tmp_file_single_transaction):
     assert importer.identify(tmp_file_single_transaction)
 
 
+def test_identify_tagesgeld(tmp_file_tagesgeld_no_transactions):
+    importer = ECImporter(IBAN, "Assets:DKB:Savings")
+
+    assert importer.identify(tmp_file_tagesgeld_no_transactions)
+
+
 def test_extract_no_transactions(tmp_file_no_transactions):
     importer = ECImporter(IBAN, "Assets:DKB:EC")