Skip to content

Commit 27b809d

Browse files
committed
Fix issue when cancelled orders appear without any total.
Fixes #161
1 parent 0dcc5b3 commit 27b809d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

csv2ofx/mappings/amazon.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,15 @@ def filter_pending(row):
4848
return row['date'] != 'pending'
4949

5050

51+
def filter_cancelled(row):
52+
"""
53+
Cancelled orders have no total.
54+
"""
55+
return bool(row['total'])
56+
57+
5158
def filter(row):
52-
return filter_pending(row) and filter_payment(row)
59+
return filter_pending(row) and filter_payment(row) and filter_cancelled(row)
5360

5461

5562
mapping = {

0 commit comments

Comments
 (0)