Skip to content
Snippets Groups Projects
Commit 36a15ca71f24 authored by Cédric Krier's avatar Cédric Krier :atom:
Browse files

Support negative amount

It is not officially in the standard but some banks generate file with
negative amount.

Closes #39
parent 2a75a0cfc73b
No related branches found
No related tags found
1 merge request!8Support negative amount
Pipeline #85271 passed
* Support negative amount
* Add support to Python 3.10, 3.11, 3.12
Version 0.6.0 - 2021-09-18
......
......@@ -40,7 +40,7 @@
(?P<booking>\d{4})?
(?P<sign>D|C|RC|RD)
(?P<code>\w)?? # ING skips this mandatory field
(?P<amount>(\d|,){1,15})
(?P<amount>(-|\d)(\d|,){0,14})
(?P<id>\w{4})
(?P<reference>.{0,34})""", re.VERBOSE)
......
......@@ -112,6 +112,19 @@
self.assertEqual(description, None)
class TestMT940Transaction(unittest.TestCase):
def test_transaction(self):
for transaction, result in [
('240325C-50000,00NMSCREV20240325AAAAAAA010O9902538776',
(datetime.date(2024, 3, 25), None, Decimal('-50000.00'),
'NMSC', 'REV20240325AAAAAAA010O9902538776', '', None,
'')),
]:
with self.subTest(transaction=transaction):
self.assertEqual(MT940._get_transaction(transaction), result)
class TestRaboDescription(unittest.TestCase):
def test_one_tag(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment