Skip to content

Commit

Permalink
Merge pull request #13 from PetrDlouhy/report_status_change
Browse files Browse the repository at this point in the history
Report status change
  • Loading branch information
PetrDlouhy authored Aug 16, 2024
2 parents a71798e + 53e2365 commit 770b2f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions payments_payu/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 770b2f1

Please sign in to comment.