Skip to content

Commit 4e1b874

Browse files
committed
SDK-508: Retain is_age_verified key for activity_details
1 parent 4d0bef2 commit 4e1b874

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ client = Client(YOTI_CLIENT_SDK_ID, YOTI_KEY_FILE_PATH)
120120
activity_details = client.get_activity_details(token)
121121

122122
profile = activity_details.profile
123+
user_profile = activity_details.user_profile #deprecated
123124

124125
selfie = profile.selfie.value
125126
given_names = profile.given_names.value
@@ -273,7 +274,6 @@ For information on testing with multiple Python versions, see [VERSION-SUPPORT.m
273274

274275
* Activity Details
275276
* [X] User ID `user_id`
276-
* [X] User Profile `user_profile` - **deprecated**, use `profile` instead
277277
* [X] Profile `profile`
278278
* [X] Photo `selfie`
279279
* [X] Given Names `given_names`

yoti_python_sdk/activity_details.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ def try_parse_age_verified_field(self, field):
5353
field.content_type
5454
)
5555
if age_verified == 'true':
56-
self.user_profile[config.ATTRIBUTE_AGE_VERIFIED] = True
56+
self.user_profile[config.KEY_AGE_VERIFIED_DEPRECATED] = True
5757
return
5858
if age_verified == 'false':
59-
self.user_profile[config.ATTRIBUTE_AGE_VERIFIED] = False
59+
self.user_profile[config.KEY_AGE_VERIFIED_DEPRECATED] = False
6060
return
6161

6262
print(

yoti_python_sdk/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
ATTRIBUTE_FULL_NAME = "full_name"
99
ATTRIBUTE_GENDER = "gender"
1010
ATTRIBUTE_GIVEN_NAMES = "given_names"
11-
ATTRIBUTE_AGE_VERIFIED = "age_verified"
1211
ATTRIBUTE_NATIONALITY = "nationality"
1312
ATTRIBUTE_PHONE_NUMBER = "phone_number"
1413
ATTRIBUTE_POSTAL_ADDRESS = "postal_address"
1514
ATTRIBUTE_SELFIE = "selfie"
1615
ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS = "structured_postal_address"
1716
ANCHOR_SOURCE = "SOURCE"
1817
ANCHOR_VERIFIER = "VERIFIER"
18+
KEY_AGE_VERIFIED = "age_verified"
19+
KEY_AGE_VERIFIED_DEPRECATED = "is_age_verified"
1920
KEY_FORMATTED_ADDRESS = "formatted_address"

yoti_python_sdk/profile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def given_names(self):
5353

5454
@property
5555
def age_verified(self):
56-
return self.get_attribute(config.ATTRIBUTE_AGE_VERIFIED)
56+
return self.get_attribute(config.KEY_AGE_VERIFIED)
5757

5858
@property
5959
def nationality(self):
@@ -88,10 +88,10 @@ def try_parse_age_verified_field(self, field, anchors):
8888
field.content_type
8989
)
9090
if age_verified == 'true':
91-
self.profile[config.ATTRIBUTE_AGE_VERIFIED] = Attribute(age_verified, True, anchors)
91+
self.profile[config.KEY_AGE_VERIFIED] = Attribute(age_verified, True, anchors)
9292
return
9393
if age_verified == 'false':
94-
self.profile[config.ATTRIBUTE_AGE_VERIFIED] = Attribute(age_verified, False, anchors)
94+
self.profile[config.KEY_AGE_VERIFIED] = Attribute(age_verified, False, anchors)
9595
return
9696

9797
print(

yoti_python_sdk/tests/test_activity_details.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,31 +97,31 @@ def test_try_parse_age_verified_both_missing_not_parsed():
9797
field = None
9898

9999
ActivityDetails.try_parse_age_verified_field(activity_details, field)
100-
assert not isinstance(activity_details.user_profile.get(config.ATTRIBUTE_AGE_VERIFIED), bool)
100+
assert not isinstance(activity_details.user_profile.get(config.KEY_AGE_VERIFIED_DEPRECATED), bool)
101101

102102

103103
def test_try_parse_age_verified_field_age_over():
104104
activity_details = ActivityDetails(successful_receipt())
105105
create_age_verified_field(activity_details, True, "true".encode(), 18)
106106

107107
ActivityDetails.try_parse_age_verified_field(activity_details, activity_details.field)
108-
assert activity_details.user_profile[config.ATTRIBUTE_AGE_VERIFIED] is True
108+
assert activity_details.user_profile[config.KEY_AGE_VERIFIED_DEPRECATED] is True
109109

110110

111111
def test_try_parse_age_verified_field_age_under():
112112
activity_details = ActivityDetails(successful_receipt())
113113
create_age_verified_field(activity_details, False, "false".encode(), 55)
114114

115115
ActivityDetails.try_parse_age_verified_field(activity_details, activity_details.field)
116-
assert activity_details.user_profile[config.ATTRIBUTE_AGE_VERIFIED] is False
116+
assert activity_details.user_profile[config.KEY_AGE_VERIFIED_DEPRECATED] is False
117117

118118

119119
def test_try_parse_age_verified_field_non_bool_value_not_parsed():
120120
activity_details = ActivityDetails(successful_receipt())
121121
create_age_verified_field(activity_details, True, "18".encode(), 18)
122122

123123
ActivityDetails.try_parse_age_verified_field(activity_details, activity_details.field)
124-
assert not isinstance(activity_details.user_profile.get(config.ATTRIBUTE_AGE_VERIFIED), bool)
124+
assert not isinstance(activity_details.user_profile.get(config.KEY_AGE_VERIFIED_DEPRECATED), bool)
125125

126126

127127
def test_try_parse_structured_postal_address_uk():

0 commit comments

Comments
 (0)