diff --git a/payments_payu/provider.py b/payments_payu/provider.py index 6a02fbb..9609670 100644 --- a/payments_payu/provider.py +++ b/payments_payu/provider.py @@ -597,6 +597,13 @@ def process_notification(self, payment, request): type(payment).objects.filter(pk=payment.pk).update( captured_amount=payment.captured_amount ) + if status == PaymentStatus.CONFIRMED and payment.status != status: + logger.warning( + "Suspicious status change of payment %s: %s -> %s", + payment.id, + payment.status, + status, + ) payment.change_status(status) return HttpResponse("ok", status=200) return HttpResponse("not ok", status=500) diff --git a/tox.ini b/tox.ini index 1fbd827..6226350 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,7 @@ envlist = [testenv] setenv = PYTHONPATH = {toxinidir}:{toxinidir}/payments_payu -commands = coverage run --source payments_payu runtests.py +commands = python -W error::DeprecationWarning -m coverage run --source payments_payu runtests.py deps = django42: Django<4.3 django50: Django<5.1