]> git.ipfire.org Git - thirdparty/python-fints.git/commitdiff
Fix imports, add to trouble script
authorRaphael Michel <michel@rami.io>
Sat, 26 Oct 2024 14:40:38 +0000 (16:40 +0200)
committerRaphael Michel <michel@rami.io>
Sat, 26 Oct 2024 14:40:38 +0000 (16:40 +0200)
docs/trouble.rst
fints/formals.py

index f2ee0102726bae0ab85e10902919ba0861479fc5..0a4a9c7d9d04f7353b28a0ef1ba47fef468b080d 100644 (file)
@@ -103,7 +103,8 @@ the problem.
                 "Fetch holdings",
                 "Fetch scheduled debits",
                 "Fetch status protocol",
-                "Make a simple transfer"
+                "Make a simple transfer",
+                "Fetch statements as PDF",
             ]
 
             print("Choose an operation")
@@ -173,5 +174,19 @@ the problem.
 
                     while isinstance(res, NeedTANResponse):
                         res = ask_for_tan(res)
+                elif choice == 11:
+                    print("Select statement")
+                    statements = f.get_statements(account)
+                    for i, statement in enumerate(statements):
+                        print(i, f"Statement {statement.statement_number}/{statement.year}")
+                    choice = int(input("Choice: ").strip())
+                    statement = statements[choice]
+                    output_pdf = 'statement.pdf'
+                    res = f.get_statement(account, statement.statement_number, statement.year, StatementFormat.PDF)
+                    while isinstance(res, NeedTANResponse):
+                        res = ask_for_tan(res)
+                    with open(output_pdf, 'wb') as file:
+                        file.write(res.data)
+                    print("Written to", output_pdf)
             except FinTSUnsupportedOperation as e:
                 print("This operation is not supported by this bank:", e)
\ No newline at end of file
index d3cddf5c3d6b221f7257f83045856fb8a3689875..313a839552b7e9eecb757a021685a0721e6bf966 100644 (file)
@@ -1045,7 +1045,7 @@ class BookedCamtStatements1(DataElementGroup):
     camt_statements = DataElementField(type='bin', min_count=1, required=True, _d="camt-Umsätze gebucht")
 
 
-@document_enum
+@doc_enum
 class StatementFormat(RepresentableEnum):
     """Kontoauszugsformat
 
@@ -1055,7 +1055,7 @@ class StatementFormat(RepresentableEnum):
     PDF = '3'  # doc: printable format (e.g., PDF)
 
 
-@document_enum
+@doc_enum
 class Confirmation(RepresentableEnum):
     """Quittierung