diff --git a/doc/api/resources/customers.rst b/doc/api/resources/customers.rst index 251a06c8a..06f4ebd16 100644 --- a/doc/api/resources/customers.rst +++ b/doc/api/resources/customers.rst @@ -19,6 +19,7 @@ external_identifier string External ID of the API, but is read-only for customers created through a SSO integration. email string Customer email address +phone string Customer phone number name string Name of this customer (or ``null``) name_parts object of strings Decomposition of name (i.e. given name, family name) is_active boolean Whether this account is active @@ -39,6 +40,10 @@ password string Can only be set Passwords can now be set through the API during customer creation. +.. versionchanged:: 2024.3 + + The attribute ``phone`` has been added. + Endpoints --------- @@ -71,6 +76,7 @@ Endpoints "identifier": "8WSAJCJ", "external_identifier": null, "email": "customer@example.org", + "phone": "+493012345678", "name": "John Doe", "name_parts": { "_scheme": "full", @@ -118,6 +124,7 @@ Endpoints "identifier": "8WSAJCJ", "external_identifier": null, "email": "customer@example.org", + "phone": "+493012345678", "name": "John Doe", "name_parts": { "_scheme": "full", @@ -155,6 +162,7 @@ Endpoints { "email": "test@example.org", + "phone": "+493012345678", "password": "verysecret", "send_email": true } @@ -171,6 +179,7 @@ Endpoints "identifier": "8WSAJCJ", "external_identifier": null, "email": "test@example.org", + "phone": "+493012345678", ... } @@ -215,6 +224,7 @@ Endpoints "identifier": "8WSAJCJ", "external_identifier": null, "email": "test@example.org", + "phone": "+493012345678", … } @@ -249,6 +259,7 @@ Endpoints "identifier": "8WSAJCJ", "external_identifier": null, "email": null, + "phone": null, … } diff --git a/src/pretix/api/serializers/organizer.py b/src/pretix/api/serializers/organizer.py index 68bdb6bf4..5fce6adee 100644 --- a/src/pretix/api/serializers/organizer.py +++ b/src/pretix/api/serializers/organizer.py @@ -79,8 +79,8 @@ class CustomerSerializer(I18nAwareModelSerializer): class Meta: model = Customer - fields = ('identifier', 'external_identifier', 'email', 'name', 'name_parts', 'is_active', 'is_verified', 'last_login', 'date_joined', - 'locale', 'last_modified', 'notes') + fields = ('identifier', 'external_identifier', 'email', 'phone', 'name', 'name_parts', 'is_active', + 'is_verified', 'last_login', 'date_joined', 'locale', 'last_modified', 'notes') def update(self, instance, validated_data): if instance and instance.provider_id: diff --git a/src/tests/api/test_customers.py b/src/tests/api/test_customers.py index 0b0b5bc36..9d8f38168 100644 --- a/src/tests/api/test_customers.py +++ b/src/tests/api/test_customers.py @@ -29,6 +29,7 @@ def customer(organizer, event): return organizer.customers.create( identifier="8WSAJCJ", email="foo@example.org", + phone="+493012345678", name_parts={"_legacy": "Foo"}, name_cached="Foo", is_verified=False, @@ -39,6 +40,7 @@ TEST_CUSTOMER_RES = { "identifier": "8WSAJCJ", "external_identifier": None, "email": "foo@example.org", + "phone": "+493012345678", "name": "Foo", "name_parts": { "_legacy": "Foo", diff --git a/src/tests/api/test_reusable_media.py b/src/tests/api/test_reusable_media.py index 9688f2d65..242dddaf9 100644 --- a/src/tests/api/test_reusable_media.py +++ b/src/tests/api/test_reusable_media.py @@ -155,6 +155,7 @@ def test_medium_detail(token_client, organizer, event, medium, giftcard, custome "identifier": customer.identifier, "external_identifier": None, "email": "foo@example.org", + "phone": None, "name": "Foo", "name_parts": {"_legacy": "Foo"}, "is_active": True,