From 5f50d08707ace9b4a7d0790495fc260377bf58d1 Mon Sep 17 00:00:00 2001 From: Lukas Bockstaller Date: Mon, 10 Aug 2026 14:48:08 +0200 Subject: [PATCH] transition "PENDING_REVIEW" paypal payment into "PENDING" state --- src/pretix/plugins/paypal2/views.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/pretix/plugins/paypal2/views.py b/src/pretix/plugins/paypal2/views.py index 7a125e4593..b1d172bccb 100644 --- a/src/pretix/plugins/paypal2/views.py +++ b/src/pretix/plugins/paypal2/views.py @@ -471,8 +471,8 @@ def webhook(request, *args, **kwargs): elif payment.state in (OrderPayment.PAYMENT_STATE_PENDING, OrderPayment.PAYMENT_STATE_CREATED, OrderPayment.PAYMENT_STATE_CANCELED, OrderPayment.PAYMENT_STATE_FAILED): if sale['status'] == 'COMPLETED': - any_captures = False all_captures_completed = True + any_pending_review = False for purchaseunit in sale['purchase_units']: for capture in purchaseunit['payments']['captures']: try: @@ -483,9 +483,9 @@ def webhook(request, *args, **kwargs): if capture['status'] not in ('COMPLETED', 'REFUNDED', 'PARTIALLY_REFUNDED'): all_captures_completed = False - else: - any_captures = True - if any_captures and all_captures_completed: + if capture['status_details']['reason'] == "PENDING_REVIEW": + any_pending_review = True + if all_captures_completed: try: payment.info = json.dumps(sale.dict()) payment.save(update_fields=['info']) @@ -493,6 +493,9 @@ def webhook(request, *args, **kwargs): prov.log_payment_duration(payment) except Quota.QuotaExceededException: pass + if any_pending_review: + payment.state = OrderPayment.PAYMENT_STATE_PENDING + payment.save() elif sale['status'] == 'APPROVED': try: request.session['payment_paypal_oid'] = payment.info_data['id']