Fix #3984 -- API: Add phone to customer resource (#3992)

* Fix #3984 -- API: Add phone to customer resource

* add "phone": None to test

---------

Co-authored-by: Mira Weller <weller@rami.io>
This commit is contained in:
Raphael Michel
2024-03-19 10:17:44 +01:00
committed by GitHub
co-authored by Mira Weller
parent 35800e21c7
commit 7e60d13910
4 changed files with 16 additions and 2 deletions
+11
View File
@@ -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,
}
+2 -2
View File
@@ -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:
+2
View File
@@ -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",
+1
View File
@@ -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,