diff --git a/doc/api/resources/orders.rst b/doc/api/resources/orders.rst index d93e90c8fb..8f6c03997b 100644 --- a/doc/api/resources/orders.rst +++ b/doc/api/resources/orders.rst @@ -178,6 +178,7 @@ tax_rule integer The ID of the u secret string Secret code printed on the tickets for validation addon_to integer Internal ID of the position this position is an add-on for (or ``null``) subevent integer ID of the date inside an event series this position belongs to (or ``null``). +discount integer ID of a discount that has been used during the creation of this position in some way (or ``null``). pseudonymization_id string A random ID, e.g. for use in lead scanning apps checkins list of objects List of **successful** check-ins with this ticket ├ id integer Internal ID of the check-in event @@ -371,6 +372,7 @@ List of all orders "secret": "z3fsn8jyufm5kpk768q69gkbyr5f4h6w", "addon_to": null, "subevent": null, + "discount": null, "pseudonymization_id": "MQLJvANO3B", "seat": null, "checkins": [ @@ -546,6 +548,7 @@ Fetching individual orders "secret": "z3fsn8jyufm5kpk768q69gkbyr5f4h6w", "addon_to": null, "subevent": null, + "discount": null, "pseudonymization_id": "MQLJvANO3B", "seat": null, "checkins": [ @@ -1487,6 +1490,7 @@ List of all order positions "tax_rule": null, "tax_value": "0.00", "secret": "z3fsn8jyufm5kpk768q69gkbyr5f4h6w", + "discount": null, "pseudonymization_id": "MQLJvANO3B", "seat": null, "addon_to": null, @@ -1597,6 +1601,7 @@ Fetching individual positions "secret": "z3fsn8jyufm5kpk768q69gkbyr5f4h6w", "addon_to": null, "subevent": null, + "discount": null, "pseudonymization_id": "MQLJvANO3B", "seat": null, "checkins": [ diff --git a/src/pretix/api/serializers/order.py b/src/pretix/api/serializers/order.py index 81af4a1c96..e29d0f5dc4 100644 --- a/src/pretix/api/serializers/order.py +++ b/src/pretix/api/serializers/order.py @@ -410,13 +410,13 @@ class OrderPositionSerializer(I18nAwareModelSerializer): class Meta: model = OrderPosition fields = ('id', 'order', 'positionid', 'item', 'variation', 'price', 'attendee_name', 'attendee_name_parts', - 'company', 'street', 'zipcode', 'city', 'country', 'state', + 'company', 'street', 'zipcode', 'city', 'country', 'state', 'discount', 'attendee_email', 'voucher', 'tax_rate', 'tax_value', 'secret', 'addon_to', 'subevent', 'checkins', 'downloads', 'answers', 'tax_rule', 'pseudonymization_id', 'pdf_data', 'seat', 'canceled') read_only_fields = ( 'id', 'order', 'positionid', 'item', 'variation', 'price', 'voucher', 'tax_rate', 'tax_value', 'secret', 'addon_to', 'subevent', 'checkins', 'downloads', 'answers', 'tax_rule', 'pseudonymization_id', 'pdf_data', - 'seat', 'canceled' + 'seat', 'canceled', 'discount', ) def __init__(self, *args, **kwargs): diff --git a/src/tests/api/test_order_create.py b/src/tests/api/test_order_create.py index 2c97fc972c..e622ddc804 100644 --- a/src/tests/api/test_order_create.py +++ b/src/tests/api/test_order_create.py @@ -341,6 +341,7 @@ def test_order_create_simulate(token_client, organizer, event, item, quota, ques 'tax_value': '0.00', 'addon_to': None, 'subevent': None, + 'discount': None, 'checkins': [], 'downloads': [], 'answers': [ @@ -409,13 +410,13 @@ def test_order_create_positionids_addons_simulated(token_client, organizer, even {'id': 0, 'order': '', 'positionid': 1, 'item': item.pk, 'variation': None, 'price': '23.00', 'attendee_name': 'Peter', 'attendee_name_parts': {'full_name': 'Peter', '_scheme': 'full'}, 'company': None, 'street': None, 'zipcode': None, 'city': None, 'country': None, 'state': None, 'attendee_email': None, - 'voucher': None, 'tax_rate': '0.00', 'tax_value': '0.00', + 'voucher': None, 'tax_rate': '0.00', 'tax_value': '0.00', 'discount': None, 'addon_to': None, 'subevent': None, 'checkins': [], 'downloads': [], 'answers': [], 'tax_rule': None, 'pseudonymization_id': 'PREVIEW', 'seat': None, 'canceled': False}, {'id': 0, 'order': '', 'positionid': 2, 'item': item.pk, 'variation': None, 'price': '23.00', 'attendee_name': 'Peter', 'attendee_name_parts': {'full_name': 'Peter', '_scheme': 'full'}, 'company': None, 'street': None, 'zipcode': None, 'city': None, 'country': None, 'state': None, 'attendee_email': None, - 'voucher': None, 'tax_rate': '0.00', 'tax_value': '0.00', + 'voucher': None, 'tax_rate': '0.00', 'tax_value': '0.00', 'discount': None, 'addon_to': 1, 'subevent': None, 'checkins': [], 'downloads': [], 'answers': [], 'tax_rule': None, 'pseudonymization_id': 'PREVIEW', 'seat': None, 'canceled': False} ] diff --git a/src/tests/api/test_orders.py b/src/tests/api/test_orders.py index 2519586657..ecddf1483b 100644 --- a/src/tests/api/test_orders.py +++ b/src/tests/api/test_orders.py @@ -157,6 +157,7 @@ TEST_ORDERPOSITION_RES = { "attendee_name": "Peter", "attendee_email": None, "voucher": None, + "discount": None, "tax_rate": "0.00", "tax_value": "0.00", "tax_rule": None,