Skip to content

Commit

Permalink
Merge pull request #227 from pat-s/debitumnetwork
Browse files Browse the repository at this point in the history
Add support for Debitum Network
  • Loading branch information
ChrisRBe authored Oct 1, 2020
2 parents cc92e2e + ea872c5 commit 8edf498
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions config/debitumnetwork.yml
Original file line number Diff line number Diff line change
@@ -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'
1 change: 1 addition & 0 deletions parse-account-statements.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Mintos
- Robocash
- Swaper
- Debitum Network
Copyright 2018-03-17 ChrisRBe
"""
Expand Down
25 changes: 25 additions & 0 deletions src/test/test_p2p_account_statement_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
4 changes: 4 additions & 0 deletions src/test/testdata/debitum.csv
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8edf498

Please sign in to comment.