diff --git a/.travis.yml b/.travis.yml
index 461be9b..bdb0a92 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,9 @@
language: python
python:
- - "3.5"
- "3.6"
+ - "3.7"
+ - "3.8"
install:
- pip install -e .[test]
diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt
index 33f1209..e5d1ea2 100644
--- a/docs/HISTORY.txt
+++ b/docs/HISTORY.txt
@@ -1,3 +1,9 @@
+1.6.0
+-----
+
+- Since version 0.6.5 ofxstatement requires a statement line to have either id, refnum or check_no. To avoid failing
+ the conversion, there's now a unique MD5 hashed ID computed from the date, payee, amount and balance.
+
1.5.0
-----
diff --git a/setup.py b/setup.py
index 8e9a4bb..4acecef 100644
--- a/setup.py
+++ b/setup.py
@@ -9,7 +9,7 @@
import unittest
-version = "1.5.0"
+version = "1.6.0"
setup(name='ofxstatement-revolut',
version=version,
diff --git a/src/ofxstatement/plugins/revolut.py b/src/ofxstatement/plugins/revolut.py
index 3880743..39ee5dc 100644
--- a/src/ofxstatement/plugins/revolut.py
+++ b/src/ofxstatement/plugins/revolut.py
@@ -1,6 +1,7 @@
import csv
import re
from datetime import datetime
+from hashlib import md5
from ofxstatement.plugin import Plugin
from ofxstatement.parser import CsvStatementParser
@@ -124,6 +125,11 @@ def parse_record(self, line):
stmt_line.memo += u' '
stmt_line.memo += u'({})'.format(line[c["Notes"]].strip())
+ # Generate a unique ID
+ balance = self.parse_amount(line[c["Balance (...)"]])
+ stmt_line.id = md5(f"{stmt_line.date}-{stmt_line.payee}-{stmt_line.amount}-{balance}".encode())\
+ .hexdigest()
+
return stmt_line
diff --git a/src/ofxstatement/tests/samples/2018-april.ofx b/src/ofxstatement/tests/samples/2018-april.ofx
index 40dc41d..284350e 100644
--- a/src/ofxstatement/tests/samples/2018-april.ofx
+++ b/src/ofxstatement/tests/samples/2018-april.ofx
@@ -10,4 +10,4 @@ OLDFILEUID:NONE
NEWFILEUID:NONE
-->
-0
INFO20181111141713ENG00
INFOEURRevolutRevolut - EURCHECKINGPOS20180408-11.00Shop APOS20180406-49.76Shop BPOS20180406-8.00Shop CPOS20180406-17.37Shop DPOS20180406-1.95Shop EPOS20180405-5.40Shop FDEP20180402200.00Top-Up by *1234POS20180402-15.54Shop GPOS20180401-122.10Shop H
\ No newline at end of file
+0
INFO20181111141713ENG00
INFOEURRevolutRevolut - EURCHECKINGPOS20180408-11.00510fe2b6f621d27915d12e38bacf3668Shop APOS20180406-49.76eac16c811c423955bc657bc070034655Shop BPOS20180406-8.001891409f52283c9155e9650010771446Shop CPOS20180406-17.37837c8ac67b261c000bab79b86bdbe9d6Shop DPOS20180406-1.9527cb3569e3ed08f0d5f44fbc2ff782f7Shop EPOS20180405-5.40efecb957e0db8c75ffcd1d88e6e0f614Shop FDEP20180402200.005d488b885ed7639cbf2465ba6a7c17faTop-Up by *1234POS20180402-15.541f5d35cb7233428c4b3ce7a90cbb886eShop GPOS20180401-122.10da98b7d7611a3e4bd46ab8561f289798Shop H
\ No newline at end of file
diff --git a/src/ofxstatement/tests/samples/2019-september.ofx b/src/ofxstatement/tests/samples/2019-september.ofx
index b9ce0b3..ac9ef1f 100644
--- a/src/ofxstatement/tests/samples/2019-september.ofx
+++ b/src/ofxstatement/tests/samples/2019-september.ofx
@@ -10,4 +10,4 @@ OLDFILEUID:NONE
NEWFILEUID:NONE
-->
-0
INFO20190922141713ENG00
INFOEURRevolutRevolut - EURCHECKINGPOS20190915-21.97Shop APOS20190910-11.62Shop BPOS20190910-8.44Shop CDEP20190909200.00Top-Up by *1234POS20190908-58.83Shop DPOS20190830-7.95ShopEPOS20180828-200.00Exchanged to GBPPOS20180715-140.00Exchanged to USDPOS20180628140.00Transfer In
\ No newline at end of file
+0
INFO20190922141713ENG00
INFOEURRevolutRevolut - EURCHECKINGPOS20190915-21.97cc03243263eaadf1a96193f9cbf19935Shop APOS20190910-11.6229fff06e117bf015cfbf63c7d7111836Shop BPOS20190910-8.4457157647ba43e16c73824356f6fe07c8Shop CDEP20190909200.00559b40a21a6632e109560df081d8c747Top-Up by *1234POS20190908-58.834ffc84384e2745d2fb520f0e9ec20243Shop DPOS20190830-7.951cf13d8831b3f75563082d48e2ba8592ShopEPOS20180828-200.00dbd38579949cc60a125710a593f24bddExchanged to GBPPOS20180715-140.00c8117326ec8f3db2db07a2cdd555e134Exchanged to USDPOS20180628140.00ecfd00333097f821c09f4043ccf203f6Transfer In
\ No newline at end of file
diff --git a/src/ofxstatement/tests/samples/config.ini b/src/ofxstatement/tests/samples/config.ini
index f169964..d898634 100644
--- a/src/ofxstatement/tests/samples/config.ini
+++ b/src/ofxstatement/tests/samples/config.ini
@@ -1,5 +1,4 @@
[revolut]
plugin = revolut
-account = FI1234567890123456
+account = Revolut - EUR
currency = EUR
-date_format = %%Y-%%m-%%d
diff --git a/src/ofxstatement/tests/test_revolut.py b/src/ofxstatement/tests/test_revolut.py
index 04db531..02d9de0 100644
--- a/src/ofxstatement/tests/test_revolut.py
+++ b/src/ofxstatement/tests/test_revolut.py
@@ -11,14 +11,14 @@
class RevolutTest(unittest.TestCase):
- def load_configuration(self):
- here = os.path.dirname(__file__)
- cfname = os.path.join(here, 'samples', 'config.ini')
- return configuration.read(cfname)
-
- def test_configuration(self):
- config = self.load_configuration()
- self.assertEqual(config['revolut']['date_format'], '%Y-%m-%d')
+ @classmethod
+ def setUpClass(cls):
+ def get_default_location_mock():
+ current_path = os.path.dirname(os.path.realpath(__file__))
+ return os.path.join(current_path, 'samples', 'config.ini')
+
+ # Use the config.ini found under samples/
+ configuration.get_default_location = get_default_location_mock
@freeze_time('2018-11-11 14:17:13')
def test_statement_april2018(self):