mirror of
https://github.com/pretix/pretix.git
synced 2025-12-05 21:32:28 +00:00
Compare commits
1 Commits
api_organi
...
scan-debug
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fa715ac4b |
@@ -152,6 +152,11 @@ class CheckinListViewSet(viewsets.ModelViewSet):
|
||||
@action(detail=True, methods=['POST'], url_name='failed_checkins')
|
||||
@transaction.atomic()
|
||||
def failed_checkins(self, *args, **kwargs):
|
||||
additional_log_data = {}
|
||||
if 'debug_data' in self.request.data:
|
||||
# Intentionally undocumented, might be removed again
|
||||
additional_log_data['debug_data'] = self.request.data.pop('debug_data')
|
||||
|
||||
serializer = FailedCheckinSerializer(
|
||||
data=self.request.data,
|
||||
context={'event': self.request.event}
|
||||
@@ -194,14 +199,16 @@ class CheckinListViewSet(viewsets.ModelViewSet):
|
||||
'reason_explanation': c.error_explanation,
|
||||
'datetime': c.datetime,
|
||||
'type': c.type,
|
||||
'list': c.list.pk
|
||||
'list': c.list.pk,
|
||||
**additional_log_data,
|
||||
}, user=self.request.user, auth=self.request.auth)
|
||||
else:
|
||||
self.request.event.log_action('pretix.event.checkin.unknown', data={
|
||||
'datetime': c.datetime,
|
||||
'type': c.type,
|
||||
'list': c.list.pk,
|
||||
'barcode': c.raw_barcode
|
||||
'barcode': c.raw_barcode,
|
||||
**additional_log_data,
|
||||
}, user=self.request.user, auth=self.request.auth)
|
||||
|
||||
return Response(serializer.data, status=201)
|
||||
|
||||
@@ -35,7 +35,7 @@ from tests.const import SAMPLE_PNG
|
||||
|
||||
from pretix.api.serializers.item import QuestionSerializer
|
||||
from pretix.base.models import (
|
||||
Checkin, CheckinList, InvoiceAddress, Order, OrderPosition,
|
||||
Checkin, CheckinList, InvoiceAddress, Order, OrderPosition, LogEntry,
|
||||
)
|
||||
|
||||
|
||||
@@ -1128,11 +1128,17 @@ def test_store_failed(token_client, organizer, clist, event, order):
|
||||
), {
|
||||
'raw_barcode': '123456',
|
||||
'nonce': '4321',
|
||||
'error_reason': 'invalid'
|
||||
'error_reason': 'invalid',
|
||||
'debug_data': {'foo': 'bar'},
|
||||
}, format='json')
|
||||
assert resp.status_code == 201
|
||||
with scopes_disabled():
|
||||
assert Checkin.all.filter(successful=False).exists()
|
||||
for le in LogEntry.objects.filter():
|
||||
print(le.parsed_data)
|
||||
assert LogEntry.objects.filter(action_type='pretix.event.checkin.unknown').first().parsed_data['debug_data'] == {
|
||||
'foo': 'bar'
|
||||
}
|
||||
|
||||
resp = token_client.post('/api/v1/organizers/{}/events/{}/checkinlists/{}/failed_checkins/'.format(
|
||||
organizer.slug, event.slug, clist.pk,
|
||||
@@ -1162,7 +1168,7 @@ def test_store_failed(token_client, organizer, clist, event, order):
|
||||
'raw_barcode': '123456',
|
||||
'nonce': '1234',
|
||||
'position': p.pk,
|
||||
'error_reason': 'unpaid'
|
||||
'error_reason': 'unpaid',
|
||||
}, format='json')
|
||||
assert resp.status_code == 201
|
||||
with scopes_disabled():
|
||||
|
||||
Reference in New Issue
Block a user