From 7f0604ff8b112499b4f7bc7488d36a23dd5f4837 Mon Sep 17 00:00:00 2001 From: Martin Gross Date: Wed, 29 Jun 2022 15:41:52 +0200 Subject: [PATCH] PP/PPv2: Fix display of retry-message on pending captures --- src/pretix/plugins/paypal/payment.py | 5 ++++- src/pretix/plugins/paypal2/payment.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pretix/plugins/paypal/payment.py b/src/pretix/plugins/paypal/payment.py index 271f384e52..16931a44bc 100644 --- a/src/pretix/plugins/paypal/payment.py +++ b/src/pretix/plugins/paypal/payment.py @@ -468,7 +468,10 @@ class Paypal(BasePaymentProvider): def payment_pending_render(self, request, payment) -> str: retry = True try: - if payment.info and payment.info_data['state'] == 'pending': + if ( + payment.info + and payment.info_data['transactions'][0]['related_resources'][0]['sale']['state'] == 'pending' + ): retry = False except KeyError: pass diff --git a/src/pretix/plugins/paypal2/payment.py b/src/pretix/plugins/paypal2/payment.py index adeb2c41e4..52526ebe00 100644 --- a/src/pretix/plugins/paypal2/payment.py +++ b/src/pretix/plugins/paypal2/payment.py @@ -698,7 +698,10 @@ class PaypalMethod(BasePaymentProvider): def payment_pending_render(self, request, payment) -> str: retry = True try: - if payment.info and payment.info_data['state'] == 'pending': + if ( + payment.info + and payment.info_data['purchase_units'][0]['payments']['captures'][0]['status'] == 'pending' + ): retry = False except KeyError: pass