mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[UPD] parse more fields as of (#71)
* [UPD] parse more fields for MT940 as of https://www.ing.nl/media/ING_ming_mt940s_24_juli_tcm162-46356.pdf p 8ff * [FIX] There is no CR or LF in mt940 data to be parsed. The calling logic from the MT940 parser concatenates all lines from a mt940 tag.
This commit is contained in:
@@ -83,14 +83,28 @@ def handle_common_subfields(transaction, subfields):
|
|||||||
for counterpart_field in ['CNTP', 'BENM', 'ORDP']:
|
for counterpart_field in ['CNTP', 'BENM', 'ORDP']:
|
||||||
if counterpart_field in subfields:
|
if counterpart_field in subfields:
|
||||||
get_counterpart(transaction, subfields[counterpart_field])
|
get_counterpart(transaction, subfields[counterpart_field])
|
||||||
|
if not transaction.message:
|
||||||
|
transaction.message = ''
|
||||||
# REMI: Remitter information (text entered by other party on trans.):
|
# REMI: Remitter information (text entered by other party on trans.):
|
||||||
if 'REMI' in subfields:
|
if 'REMI' in subfields:
|
||||||
transaction.message = (
|
transaction.message += (
|
||||||
'/'.join(x for x in subfields['REMI'] if x))
|
subfields['REMI'][2]
|
||||||
|
# this might look like
|
||||||
|
# /REMI/USTD//<remittance info>/
|
||||||
|
# or
|
||||||
|
# /REMI/STRD/CUR/<betalingskenmerk>/
|
||||||
|
if len(subfields['REMI']) >= 3 and subfields['REMI'][0] in [
|
||||||
|
'STRD', 'USTD'
|
||||||
|
]
|
||||||
|
else
|
||||||
|
'/'.join(x for x in subfields['REMI'] if x)
|
||||||
|
)
|
||||||
|
# EREF: End-to-end reference
|
||||||
|
if 'EREF' in subfields:
|
||||||
|
transaction.message += '/'.join(filter(bool, subfields['EREF']))
|
||||||
# Get transaction reference subfield (might vary):
|
# Get transaction reference subfield (might vary):
|
||||||
if transaction.eref in subfields:
|
if transaction.eref in subfields:
|
||||||
transaction.eref = ''.join(
|
transaction.eref = ''.join(subfields[transaction.eref])
|
||||||
subfields[transaction.eref])
|
|
||||||
|
|
||||||
|
|
||||||
class MT940(object):
|
class MT940(object):
|
||||||
|
|||||||
Reference in New Issue
Block a user