forked from CGM_Public/pretix_original
Stripe: Fix MultipleObjectsReturned in webhook
This commit is contained in:
@@ -213,12 +213,12 @@ def webhook(request, *args, **kwargs):
|
|||||||
else:
|
else:
|
||||||
return HttpResponse("Not interested in this data type", status=200)
|
return HttpResponse("Not interested in this data type", status=200)
|
||||||
|
|
||||||
try:
|
rso = ReferencedStripeObject.objects.select_related('order', 'order__event').filter(
|
||||||
rso = ReferencedStripeObject.objects.select_related('order', 'order__event').get(
|
reference__in=[lid for lid in lookup_ids if lid]
|
||||||
reference__in=[lid for lid in lookup_ids if lid]
|
).first()
|
||||||
)
|
if rso:
|
||||||
return func(rso.order.event, event_json, objid, rso)
|
return func(rso.order.event, event_json, objid, rso)
|
||||||
except ReferencedStripeObject.DoesNotExist:
|
else:
|
||||||
if event_json['data']['object']['object'] == "charge" and 'payment_intent' in event_json['data']['object']:
|
if event_json['data']['object']['object'] == "charge" and 'payment_intent' in event_json['data']['object']:
|
||||||
# If we receive a charge webhook *before* the payment intent webhook, we don't know the charge ID yet
|
# If we receive a charge webhook *before* the payment intent webhook, we don't know the charge ID yet
|
||||||
# and can't match it -- but we know the payment intent ID!
|
# and can't match it -- but we know the payment intent ID!
|
||||||
|
|||||||
Reference in New Issue
Block a user