API: add log_action/webhook for confirmed payments (#3395)

This commit is contained in:
Richard Schreiber
2023-06-09 09:29:32 +02:00
committed by GitHub
parent 570357e9be
commit 74e9a4ad2d
2 changed files with 11 additions and 2 deletions

View File

@@ -661,7 +661,16 @@ class OrderViewSet(viewsets.ModelViewSet):
with language(order.locale, self.request.event.settings.region):
payment = order.payments.last()
# OrderCreateSerializer creates at most one payment
if payment and payment.state == OrderPayment.PAYMENT_STATE_CONFIRMED:
order.log_action(
'pretix.event.order.payment.confirmed', {
'local_id': payment.local_id,
'provider': payment.provider,
},
user=request.user if request.user.is_authenticated else None,
auth=request.auth,
)
order_placed.send(self.request.event, order=order)
if order.status == Order.STATUS_PAID:
order_paid.send(self.request.event, order=order)