From f7d763df9198daca8ea070e18c7c4bd4effc178f Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Wed, 31 Jul 2019 09:06:08 +0200 Subject: [PATCH] On incoming cmutuel payments, always wait one day It seems that sometimes cmutuel will show a truncated version of the transaction in the report for a while, and then later replace it with the complete text (without any indication that this has been done) in the reports. When using the manual GUI instead of the reports, these transactions show up with something like "details are missing", but that information does not exist in the reports. Some patterns indicate that this happens when a payment arrives towards the end of the day, which seems to be common with for example transferwise transfers. For that reason, attempt to work around it by delaying processing of all incoming payments until the day after they arrived, at the hope that this makes the full text appear. --- code/pgeusite/cmutuel/management/commands/cmscrape.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/pgeusite/cmutuel/management/commands/cmscrape.py b/code/pgeusite/cmutuel/management/commands/cmscrape.py index 907cf2c..f5be767 100755 --- a/code/pgeusite/cmutuel/management/commands/cmscrape.py +++ b/code/pgeusite/cmutuel/management/commands/cmscrape.py @@ -182,6 +182,12 @@ class Command(BaseCommand): description = row[3] balance = Decimal(row[4]) + if opdate.date() == datetime.date.today() and amount > 0 and description.startswith("VIR "): + # For incoming transfers we sometimes don't get the full transaction text + # right away. Because, reasons unknown. So if the transaction is actually + # dated today and it starts with VIR, we ignore it until we get to tomorrow. + continue + if not CMutuelTransaction.objects.filter(opdate=opdate, valdate=valdate, amount=amount, description=description).exists(): trans = CMutuelTransaction(opdate=opdate, valdate=valdate, -- 2.30.2