mirror of
https://github.com/pretix/pretix.git
synced 2026-09-13 16:14:40 +00:00
gate abort_pending_payment_allowed by timeout and "APPROVED" state
This commit is contained in:
@@ -519,6 +519,20 @@ class PaypalMethod(BasePaymentProvider):
|
|||||||
def abort_pending_allowed(self):
|
def abort_pending_allowed(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def abort_pending_payment_allowed(self, payment):
|
||||||
|
if payment.info_data.get('create_time', False):
|
||||||
|
create_time = datetime.fromisoformat(payment.info_data['create_time'])
|
||||||
|
if datetime.now(tz=timezone.utc) - create_time > timedelta(minutes=30):
|
||||||
|
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):
|
def _create_paypal_order(self, request, payment=None, cart_total=None):
|
||||||
self.init_api()
|
self.init_api()
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user