API: Add discount to order position serializer

This commit is contained in:
Raphael Michel
2022-11-03 15:29:20 +01:00
parent 0b95f89882
commit cb3b1f3ac5
4 changed files with 11 additions and 4 deletions
+5
View File
@@ -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": [
+2 -2
View File
@@ -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):
+3 -2
View File
@@ -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}
]
+1
View File
@@ -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,