mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
PayPal2: Skip webhook order capture if no OrderPayment exists yet
This commit is contained in:
@@ -505,9 +505,15 @@ def webhook(request, *args, **kwargs):
|
||||
except Quota.QuotaExceededException:
|
||||
pass
|
||||
elif sale['status'] == 'APPROVED':
|
||||
request.session['payment_paypal_oid'] = payment.info_data['id']
|
||||
try:
|
||||
request.session['payment_paypal_oid'] = payment.info_data['id']
|
||||
payment.payment_provider.execute_payment(request, payment)
|
||||
except KeyError:
|
||||
# We might receive the CHECKOUT.ORDER.APPROVED webhook early if the user approves the payment but
|
||||
# the order has not been created yet. In these cases, we will skip the immediate capture until
|
||||
# the Order and OrderPayment has been created, and we can capture the payment in the regular
|
||||
# execute_payment run.
|
||||
logger.info('PayPal2 - Did not capture/execute_payment from Webhook: payment was not yet populated.')
|
||||
except PaymentException as e:
|
||||
logger.exception('PayPal2 - Could not capture/execute_payment from Webhook: {}'.format(str(e)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user