+def parse_payment_feedback(f):
+ lines = csv.reader(StringIO(f.read().decode('cp1250')))
+ for line in lines:
+ if not line: continue
+ print(line)
+ assert line[0] in ('1', '2')
+ if line[0] == '1':
+ # Totals line.
+ continue
+ booking_date = line[3]
+ booking_date = datetime.strptime(booking_date, '%Y%m%d')
+ payment_id = line[7]
+ is_dd = line[16] == 'DD'
+ realised = line[17] == '1'
+ reject_code = line[18]
+ yield payment_id, booking_date, is_dd, realised, reject_code
+
+
+
+