From: Yoan Le Clanche Date: Wed, 1 Jul 2026 14:56:21 +0000 (+0200) Subject: Do not raise when payment failed due to SuspiciousOperation X-Git-Tag: 3.0.2~7 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=5d9b9eb6398bcf3347acf6d4be6d9ea297c3ab74;p=teleforma.git Do not raise when payment failed due to SuspiciousOperation --- diff --git a/teleforma/views/payment.py b/teleforma/views/payment.py index 54b3c4f2..e50e5077 100644 --- a/teleforma/views/payment.py +++ b/teleforma/views/payment.py @@ -197,8 +197,14 @@ def bank_success(request, merchant_id): """ Bank success callback """ - log.info("bank_auto %r" % request.POST) - info = check_payment_info(request.POST) + log.info("bank_success %r" % request.POST) + try: + info = check_payment_info(request.POST) + except SuspiciousOperation: + # Browser-facing endpoint: reloads, back button, bots or GET redirects + # can hit this URL without the expected Seal/Data. Redirect to the + # failure page instead of raising a 400 with a full traceback. + return HttpResponseRedirect('/echec-de-paiement') order_id = info['order_id'] if info['valid']: payment = Payment.objects.get(pk=order_id)