diff --git a/src/pretix/base/payment.py b/src/pretix/base/payment.py index a9ba5c9993..c8047bbd5c 100644 --- a/src/pretix/base/payment.py +++ b/src/pretix/base/payment.py @@ -333,16 +333,6 @@ class BasePaymentProvider: """ return False - def abort_pending_payment_allowed(self, payment: OrderPayment) -> bool: - """ - Whether a user can abort this specific payment. - The result is OR'ed with the result of ``BasePaymentProvider.abort_pending_allowed``. - The same other caveats apply. It is sufficient to only implement either - ``abort_pending_payment_allowed`` or ``abort_pending_allowed`` - - """ - return False - @property def requires_invoice_immediately(self): """ @@ -1029,8 +1019,7 @@ class BasePaymentProvider: On success, you should set ``payment.state = OrderPayment.PAYMENT_STATE_CANCELED`` (or call the super method). On failure, you should raise a PaymentException. """ - if payment.state == OrderPayment.PAYMENT_STATE_PENDING and not ( - self.abort_pending_allowed or self.abort_pending_payment_allowed(payment)): + if payment.state == OrderPayment.PAYMENT_STATE_PENDING and not self.abort_pending_allowed: raise PaymentException(_( "This payment is already being processed and can not be canceled any more." )) diff --git a/src/pretix/plugins/paypal2/payment.py b/src/pretix/plugins/paypal2/payment.py index 2cbe55831a..1b58dd7b64 100644 --- a/src/pretix/plugins/paypal2/payment.py +++ b/src/pretix/plugins/paypal2/payment.py @@ -519,22 +519,6 @@ class PaypalMethod(BasePaymentProvider): def abort_pending_allowed(self): return False - def abort_pending_payment_allowed(self, payment): - if payment.info_data.get('create_time', False): - gs = GlobalSettingsObject() - debounce_timeout = timedelta(minutes=gs.settings.payment_paypal_abort_pending_payment_allowed_timeout) - create_time = datetime.fromisoformat(payment.info_data['create_time']) - if datetime.now(tz=timezone.utc) - create_time > debounce_timeout: - return True - - if payment.info_data.get('status', None) == "APPROVED": - # PayPal has recorded the customer approval. But not further processed it. - # The payment state will probably change with the next webhook we will receive, - # but in this time we cannot allow the customer to trigger a second payment. - return False - - return False - def _create_paypal_order(self, request, payment=None, cart_total=None): self.init_api() kwargs = {} diff --git a/src/pretix/presale/views/order.py b/src/pretix/presale/views/order.py index 693cb79e71..67afda9262 100644 --- a/src/pretix/presale/views/order.py +++ b/src/pretix/presale/views/order.py @@ -349,11 +349,10 @@ class OrderDetails(EventViewMixin, OrderDetailMixin, CartMixin, TicketPageMixin, pp = lp.payment_provider ctx['last_payment_info'] = pp.payment_pending_render(self.request, ctx['last_payment']) - if lp.state == OrderPayment.PAYMENT_STATE_PENDING and not ( - pp.abort_pending_allowed or pp.abort_pending_payment_allowed(lp)): + if lp.state == OrderPayment.PAYMENT_STATE_PENDING and not pp.abort_pending_allowed: ctx['can_pay'] = False - ctx['can_pay'] = ctx['can_pay'] and self.order._can_be_paid() is True + ctx['can_pay'] = ctx['can_pay'] and self.order._can_be_paid() elif self.order.status == Order.STATUS_PAID: ctx['can_pay'] = False @@ -612,8 +611,7 @@ class OrderPayChangeMethod(EventViewMixin, OrderDetailMixin, TemplateView): if self.open_payment: pp = self.open_payment.payment_provider - if self.open_payment.state == OrderPayment.PAYMENT_STATE_PENDING and not ( - pp.abort_pending_allowed or pp.abort_pending_payment_allowed(self.open_payment)): + if self.open_payment.state == OrderPayment.PAYMENT_STATE_PENDING and not pp.abort_pending_allowed: messages.error(request, _('A payment is currently pending for this order.')) return redirect(self.get_order_url()) @@ -1720,8 +1718,7 @@ class OrderChangeMixin: if totaldiff > Decimal('0.00') and self.order.status == Order.STATUS_PENDING: for p in self.order.payments.filter(state=OrderPayment.PAYMENT_STATE_PENDING): - if not (p.payment_provider.abort_pending_allowed or p.payment_provider.abort_pending_payment_allowed( - p)): + if not p.payment_provider.abort_pending_allowed: raise OrderError(_('You may not change your order in a way that requires additional payment while ' 'we are processing your current payment. Please check back after your current ' 'payment has been accepted.'))