Empty desription can sometimes be 'No information'
authorMagnus Hagander <magnus@hagander.net>
Thu, 14 Mar 2024 00:45:01 +0000 (01:45 +0100)
committerMagnus Hagander <magnus@hagander.net>
Thu, 14 Mar 2024 00:45:01 +0000 (01:45 +0100)
It seems on some records, wise returns 'No information', and on some it
returns '', so explicitly check for both these inthe backoff
functionality.

postgresqleu/transferwise/management/commands/transferwise_fetch_transactions.py

index 43745b98e3ec7b8aa8952d0cff4b321cfcc82004..dd7683f74401a9248d98731ec74959c7dccc62b8 100644 (file)
@@ -48,7 +48,7 @@ class Command(BaseCommand):
             # more details later. So if we see one of those, postpone it for up to 2 hours
             # (random magic value).
             if t['details']['type'] == 'UNKNOWN' and \
-               t['details']['description'] == '' and \
+               t['details']['description'] in ('', 'No information') and \
                datetime.now() - api.parse_datetime(t['date']) < timedelta(hours=2):
                 print("Skipping UNKNOWN transaction {}, no data and less than 2 hours old".format(t['referenceNumber']))
                 continue