From 2be49d8cab31930904fcfd596f02c8f450e7dc98 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Thu, 21 Nov 2019 17:22:11 +0100 Subject: [PATCH] Bank transfer: Do not cause duplicate payments --- src/pretix/plugins/banktransfer/views.py | 26 ++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/pretix/plugins/banktransfer/views.py b/src/pretix/plugins/banktransfer/views.py index a0ed667d2..bab1dfe5f 100644 --- a/src/pretix/plugins/banktransfer/views.py +++ b/src/pretix/plugins/banktransfer/views.py @@ -111,26 +111,22 @@ class ActionView(View): } try: p.confirm(user=self.request.user) - except Quota.QuotaExceededException as e: - return JsonResponse({ - 'status': 'error', - 'message': str(e) - }) + except Quota.QuotaExceededException: + pass except SendMailException: return JsonResponse({ 'status': 'error', 'message': _('Problem sending email.') }) - else: - trans.state = BankTransaction.STATE_VALID - trans.save() - trans.order.payments.filter( - provider='banktransfer', - state__in=(OrderPayment.PAYMENT_STATE_CREATED, OrderPayment.PAYMENT_STATE_PENDING), - ).update(state=OrderPayment.PAYMENT_STATE_CANCELED) - return JsonResponse({ - 'status': 'ok', - }) + trans.state = BankTransaction.STATE_VALID + trans.save() + trans.order.payments.filter( + provider='banktransfer', + state__in=(OrderPayment.PAYMENT_STATE_CREATED, OrderPayment.PAYMENT_STATE_PENDING), + ).update(state=OrderPayment.PAYMENT_STATE_CANCELED) + return JsonResponse({ + 'status': 'ok', + }) def _assign(self, trans, code): try: