diff --git a/README.md b/README.md index 088b769..0a67d67 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Python 3 (implemented with python 3.6.4) ## Dependencies The configuration for this application is stored in yaml files. The module used for -loading yaml files is [ruamel.yaml](https://yaml.readthedocs.io/en/latest/). +loading yaml files is [ruamel.yaml](https://yaml.readthedocs.io/en/latest/). Install via: `pip install ruamel.yaml` @@ -51,13 +51,14 @@ parse-account-statements.py --type mintos src/test/testdata/mintos.csv * swaper - Supports current account statement format (as of 2018-05-01) exported to csv * bondora - Supports current account statement format (as of 2019-10-12); exported to csv * bondora go & grow - Supports current account statement format (as of 2019-10-12); exported to csv +* debitumnetwork - Supports current account statement format (as of 2020-09-08) exported to csv ### Alternative solution for Auxmoney Unfortunately, the output file of Auxmoney's reports is not suitable for being parsed by PP-P2P-Parser in a senseful way. As an alternative, you can check out the [PP-Auxmoney-Parser](https://github.com/StegSchreck/PP-Auxmoney-Parser) project. ## Configuration files -Configuration for this script is stored in yaml files located under the config subdirectory. +Configuration for this script is stored in yaml files located under the config subdirectory. The content directly reflects the format of the source account statement files. Example: diff --git a/config/debitumnetwork.yml b/config/debitumnetwork.yml new file mode 100644 index 0000000..5729d19 --- /dev/null +++ b/config/debitumnetwork.yml @@ -0,0 +1,13 @@ +--- +type_regex: !!map + deposit: "^DEPOSIT|^INVITED_REFERRAL_REWARD" + withdraw: "^WITHDRAW" + interest: "^REPAYMENT" + +csv_fieldnames: + booking_date: 'Date' + booking_date_format: '%Y-%m-%d' + booking_id: 'Transaction ID' + booking_type: 'Transaction Type' + booking_value: 'Turnover' + booking_details: 'Asset ID' diff --git a/parse-account-statements.py b/parse-account-statements.py old mode 100644 new mode 100755 index 84e8b9a..1ab93e4 --- a/parse-account-statements.py +++ b/parse-account-statements.py @@ -13,6 +13,7 @@ - Mintos - Robocash - Swaper + - Debitum Network Copyright 2018-03-17 ChrisRBe """ diff --git a/src/test/test_p2p_account_statement_parser.py b/src/test/test_p2p_account_statement_parser.py index ae1c1d7..82f317f 100644 --- a/src/test/test_p2p_account_statement_parser.py +++ b/src/test/test_p2p_account_statement_parser.py @@ -244,3 +244,28 @@ def test_swaper_parsing(self): 'Wert': '2000', 'Buchungswährung': 'EUR'}] self.assertEqual(expected_statement, self.base_parser.parse_account_statement()) + + def test_debitumnetwork_parsing(self): + """test parse_account_statement for debitum network""" + self.base_parser.account_statement_file = os.path.join(os.path.dirname(__file__), 'testdata', 'debitum.csv') + self.base_parser.config_file = os.path.join(os.path.dirname(__file__), + os.pardir, + os.pardir, + 'config', + 'debitumnetwork.yml') + expected_statement = [{'Datum': datetime.date(2020, 8, 25), + 'Wert': '121,91', + 'Buchungswährung': 'EUR', + 'Typ': 'Einlage', + 'Notiz': '405eea2a-7745-4588-8f08-5c1512987324: NA'}, + {'Datum': datetime.date(2020, 9, 7), + 'Wert': '10,03', + 'Buchungswährung': 'EUR', + 'Typ': 'Zinsen', + 'Notiz': 'b9da7662-de61-43d1-a179-c300d5695587: 6c4a6d93-faea-4d96-856c-7cdd3fb3023b'}, + {'Datum': datetime.date(2020, 9, 7), + 'Wert': '10', + 'Buchungswährung': 'EUR', + 'Typ': 'Einlage', + 'Notiz': '7260c567-fdb4-44d4-84ce-4256c7d7fb80: NA'}] + self.assertEqual(expected_statement, self.base_parser.parse_account_statement()) diff --git a/src/test/testdata/debitum.csv b/src/test/testdata/debitum.csv new file mode 100644 index 0000000..1635648 --- /dev/null +++ b/src/test/testdata/debitum.csv @@ -0,0 +1,4 @@ +Date,Transaction ID,Asset ID,Transaction Type,Turnover +2020-08-25,405eea2a-7745-4588-8f08-5c1512987324,NA,DEPOSIT,121.91 +2020-09-07,b9da7662-de61-43d1-a179-c300d5695587,6c4a6d93-faea-4d96-856c-7cdd3fb3023b,REPAYMENT,10.03 +2020-09-07,7260c567-fdb4-44d4-84ce-4256c7d7fb80,NA,INVITED_REFERRAL_REWARD,10