On incoming cmutuel payments, always wait one day
authorMagnus Hagander <[email protected]>
Wed, 31 Jul 2019 07:06:08 +0000 (09:06 +0200)
committerMagnus Hagander <[email protected]>
Wed, 31 Jul 2019 07:06:08 +0000 (09:06 +0200)
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

index 907cf2cff1eb915e0dc9fcc5d2b7401366e46a75..f5be767f8104bafe7e26584adb31970a57cc408c 100755 (executable)
@@ -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,