Automatically process InvoiceDeduction accounting rows from Adyen
authorMagnus Hagander <magnus@hagander.net>
Fri, 6 Oct 2017 08:52:51 +0000 (10:52 +0200)
committerMagnus Hagander <magnus@hagander.net>
Fri, 6 Oct 2017 08:52:51 +0000 (10:52 +0200)
We now know enough that we do the same thing every time they show up, so
let's just automate that.

postgresqleu/adyen/management/commands/process_adyen_reports.py

index dbcbb2f562a003bfe7ed466f41bd6bb453885771..c9fbabfb042d2185cba8b044c757c4f74ff9b56f 100644 (file)
@@ -167,12 +167,15 @@ class Command(BaseCommand):
                        elif t == 'DepositCorrection':
                                # Modification of our deposit account - in either direction!
                                acctrows.append((settings.ACCOUNTING_ADYEN_MERCHANT_ACCOUNT, accstr, -amount, None))
+                       elif t == 'InvoiceDeduction':
+                               # Adjustment of the invoiced costs. So adjust the payment fees!
+                               acctrows.append((settings.ACCOUNTING_ADYEN_FEE_ACCOUNT, accstr, -amount, None))
                        elif t == 'Refunded' or t == 'RefundedBulk':
                                # Refunded - should already be booked against the refunding account
                                acctrows.append((settings.ACCOUNTING_ADYEN_REFUNDS_ACCOUNT, accstr, -amount, None))
                        else:
-                               # There is at least InvoiceDeduction, but we'll process those
-                               # completely manually for now
+                               # Other rows that we don't know about will generate an open accounting entry
+                               # for manual fixing.
                                pass
                if len(acctrows) == len(types):
                        # If all entries were processed, the accounting entry should