Attempt to better handle payment exceptions in adyen processing
authorMagnus Hagander <magnus@hagander.net>
Fri, 30 Mar 2018 16:14:11 +0000 (18:14 +0200)
committerMagnus Hagander <magnus@hagander.net>
Fri, 30 Mar 2018 16:14:11 +0000 (18:14 +0200)
commit29e86583bfcb11844bb18eb71a8046c2d14559b1
treef4b920baafe1051d10015413f2d168be9fe5c8b3
parent36229cb3135c459117b3382c095db78a378eb94d
Attempt to better handle payment exceptions in adyen processing

The invoice API actually allows us to get the reason for why the
processing failed, so use that instead of just throwing an exception.

In particular this lets us track the case of invalid size payment in
relation to invoice amount (never happened so far), and also payments
that happen after the invoice has been deleted (theoretically possible
with creditcard payments, but very much realistic with iban payments --
it's more surprising it hasn't happened before).

In these cases create an empty accounting record that can be processed,
instead of leaving things in incomplete state.
postgresqleu/adyen/util.py