Skip to content

Commit 73a1046

Browse files
committed
SDK-509: Remove age_verified from new profile, add strict Django requirement
1 parent 4e1b874 commit 73a1046

File tree

12 files changed

+135
-176
lines changed

12 files changed

+135
-176
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ family_name = profile.family_name.value
128128
full_name = profile.full_name.value
129129
phone_number = profile.phone_number.value
130130
date_of_birth = profile.date_of_birth.value
131-
age_verified = profile.age_verified.value
132131
postal_address = profile.postal_address.value
133132
gender = profile.gender.value
134133
nationality = profile.nationality.value
@@ -155,6 +154,12 @@ timestamp = source_anchor.signed_timestamp
155154
origin_server_certs = source_anchor.origin_server_certs
156155
```
157156

157+
If you have chosen `Verify Condition` on the [Yoti Dashboard](https://www.yoti.com/dashboard/applications) with the age condition of "Over 18", you can retrieve the user information as follows:
158+
```python
159+
age_verification_attribute = profile.get_attribute("age_over:18")
160+
```
161+
You can retrieve the sources and verifiers in the same way as detailed above.
162+
158163
## AML Integration
159164

160165
Yoti provides an AML (Anti Money Laundering) check service to allow a deeper KYC process to prevent fraud. This is a chargeable service, so please contact [[email protected]](mailto:[email protected]) for more information.
@@ -281,8 +286,7 @@ For information on testing with multiple Python versions, see [VERSION-SUPPORT.m
281286
* [X] Full Name `full_name`
282287
* [X] Mobile Number `phone_number`
283288
* [X] Email Address `email_address`
284-
* [X] Age / Date of Birth `date_of_birth`
285-
* [X] Age / Age Verified `age_verified`
289+
* [X] Date of Birth `date_of_birth`
286290
* [X] Address `postal_address`
287291
* [X] Gender `gender`
288292
* [X] Nationality `nationality`
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Django>=1.11
21
yoti>=2.4.0
2+
Django==1.11
33
python-dotenv>=0.7.1
44
django-sslserver

examples/yoti_example_django/yoti_example/templates/profile.html

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,21 @@ <h3>Yoti Profile</h3>
5656
</td>
5757
</tr>
5858
{% endif %}
59-
{% if profile.given_names %}
59+
{% if given_names %}
6060
<tr>
6161
<th scope="row">Given Name(s)</th>
62-
<td>{{ profile.given_names.value }}</td>
62+
<td>{{ given_names.value }}</td>
6363
<td colspan="3" width="33%">
6464
<table class="table">
6565
<tbody>
66-
{% for source in profile.given_names.sources %}
66+
{% for source in given_names.sources %}
6767
<tr class="row no-gutters">
6868
<td class="col-md-3">Source</td>
6969
<td class="col-md-6">{{ source.value }}</td>
7070
<td class="col-md-3">{{ source.sub_type }}</td>
7171
</tr>
7272
{% endfor %}
73-
{% for verifier in profile.given_names.verifiers %}
73+
{% for verifier in given_names.verifiers %}
7474
<tr class="row no-gutters">
7575
<td class="col-md-3">Verifier</td>
7676
<td class="col-md-6">{{ verifier.value }}</td>
@@ -82,21 +82,21 @@ <h3>Yoti Profile</h3>
8282
</td>
8383
</tr>
8484
{% endif %}
85-
{% if profile.family_name %}
85+
{% if family_name %}
8686
<tr>
8787
<th scope="row">Family Name</th>
88-
<td>{{profile.family_name.value }}</td>
88+
<td>{{family_name.value }}</td>
8989
<td colspan="3">
9090
<table class="table">
9191
<tbody>
92-
{% for source in profile.family_name.sources %}
92+
{% for source in family_name.sources %}
9393
<tr class="row no-gutters">
9494
<td class="col-md-3">Source</td>
9595
<td class="col-md-6">{{ source.value }}</td>
9696
<td class="col-md-3">{{ source.sub_type }}</td>
9797
</tr>
9898
{% endfor %}
99-
{% for verifier in profile.family_name.verifiers %}
99+
{% for verifier in family_name.verifiers %}
100100
<tr class="row no-gutters">
101101
<td class="col-md-3">Verifier</td>
102102
<td class="col-md-6">{{ verifier.value }}</td>
@@ -108,21 +108,21 @@ <h3>Yoti Profile</h3>
108108
</td>
109109
</tr>
110110
{% endif %}
111-
{% if profile.full_name %}
111+
{% if full_name %}
112112
<tr>
113113
<th scope="row">Full Name</th>
114-
<td>{{profile.full_name.value }}</td>
114+
<td>{{full_name.value }}</td>
115115
<td colspan="3">
116116
<table class="table">
117117
<tbody>
118-
{% for source in profile.full_name.sources %}
118+
{% for source in full_name.sources %}
119119
<tr class="row no-gutters">
120120
<td class="col-md-3">Source</td>
121121
<td class="col-md-6">{{ source.value }}</td>
122122
<td class="col-md-3">{{ source.sub_type }}</td>
123123
</tr>
124124
{% endfor %}
125-
{% for verifier in profile.full_name.verifiers %}
125+
{% for verifier in full_name.verifiers %}
126126
<tr class="row no-gutters">
127127
<td class="col-md-3">Verifier</td>
128128
<td class="col-md-6">{{ verifier.value }}</td>
@@ -134,21 +134,21 @@ <h3>Yoti Profile</h3>
134134
</td>
135135
</tr>
136136
{% endif %}
137-
{% if profile.phone_number %}
137+
{% if phone_number %}
138138
<tr>
139139
<th scope="row">Phone</th>
140-
<td>{{profile.phone_number.value }}</td>
140+
<td>{{phone_number.value }}</td>
141141
<td colspan="3">
142142
<table class="table">
143143
<tbody>
144-
{% for source in profile.phone_number.sources %}
144+
{% for source in phone_number.sources %}
145145
<tr class="row no-gutters">
146146
<td class="col-md-3">Source</td>
147147
<td class="col-md-6">{{ source.value }}</td>
148148
<td class="col-md-3">{{ source.sub_type }}</td>
149149
</tr>
150150
{% endfor %}
151-
{% for verifier in profile.phone_number.verifiers %}
151+
{% for verifier in phone_number.verifiers %}
152152
<tr class="row no-gutters">
153153
<td class="col-md-3">Verifier</td>
154154
<td class="col-md-6">{{ verifier.value }}</td>
@@ -160,21 +160,21 @@ <h3>Yoti Profile</h3>
160160
</td>
161161
</tr>
162162
{% endif %}
163-
{% if profile.email_address %}
163+
{% if email_address %}
164164
<tr>
165165
<th scope="row">Email</th>
166-
<td>{{profile.email_address.value }}</td>
166+
<td>{{email_address.value }}</td>
167167
<td colspan="3">
168168
<table class="table">
169169
<tbody>
170-
{% for source in profile.email_address.sources %}
170+
{% for source in email_address.sources %}
171171
<tr class="row no-gutters">
172172
<td class="col-md-3">Source</td>
173173
<td class="col-md-6">{{ source.value }}</td>
174174
<td class="col-md-3">{{ source.sub_type }}</td>
175175
</tr>
176176
{% endfor %}
177-
{% for verifier in profile.email_address.verifiers %}
177+
{% for verifier in email_address.verifiers %}
178178
<tr class="row no-gutters">
179179
<td class="col-md-3">Verifier</td>
180180
<td class="col-md-6">{{ verifier.value }}</td>
@@ -186,21 +186,21 @@ <h3>Yoti Profile</h3>
186186
</td>
187187
</tr>
188188
{% endif %}
189-
{% if profile.date_of_birth %}
189+
{% if date_of_birth %}
190190
<tr>
191191
<th scope="row">Date Of Birth</th>
192-
<td>{{profile.date_of_birth.value }}</td>
192+
<td>{{date_of_birth.value }}</td>
193193
<td colspan="3">
194194
<table class="table">
195195
<tbody>
196-
{% for source in profile.date_of_birth.sources %}
196+
{% for source in date_of_birth.sources %}
197197
<tr class="row no-gutters">
198198
<td class="col-md-3">Source</td>
199199
<td class="col-md-6">{{ source.value }}</td>
200200
<td class="col-md-3">{{ source.sub_type }}</td>
201201
</tr>
202202
{% endfor %}
203-
{% for verifier in profile.date_of_birth.verifiers %}
203+
{% for verifier in date_of_birth.verifiers %}
204204
<tr class="row no-gutters">
205205
<td class="col-md-3">Verifier</td>
206206
<td class="col-md-6">{{ verifier.value }}</td>
@@ -212,21 +212,21 @@ <h3>Yoti Profile</h3>
212212
</td>
213213
</tr>
214214
{% endif %}
215-
{% if profile.age_verified is not None %}
215+
{% if user_is_age_verified is not None %}
216216
<tr>
217217
<th scope="row">Age verified</th>
218-
<td>{{profile.age_verified.value }}</td>
218+
<td>{{user_is_age_verified.value }}</td>
219219
<td colspan="3">
220220
<table class="table">
221221
<tbody>
222-
{% for source in profile.age_verified.sources %}
222+
{% for source in user_is_age_verified.sources %}
223223
<tr class="row no-gutters">
224224
<td class="col-md-3">Source</td>
225225
<td class="col-md-6">{{ source.value }}</td>
226226
<td class="col-md-3">{{ source.sub_type }}</td>
227227
</tr>
228228
{% endfor %}
229-
{% for verifier in profile.age_verified.verifiers %}
229+
{% for verifier in user_is_age_verified.verifiers %}
230230
<tr class="row no-gutters">
231231
<td class="col-md-3">Verifier</td>
232232
<td class="col-md-6">{{ verifier.value }}</td>
@@ -238,21 +238,21 @@ <h3>Yoti Profile</h3>
238238
</td>
239239
</tr>
240240
{% endif %}
241-
{% if profile.postal_address %}
241+
{% if postal_address %}
242242
<tr>
243243
<th scope="row">Address</th>
244-
<td>{{profile.postal_address.value }}</td>
244+
<td>{{postal_address.value }}</td>
245245
<td colspan="3">
246246
<table class="table">
247247
<tbody>
248-
{% for source in profile.postal_address.sources %}
248+
{% for source in postal_address.sources %}
249249
<tr class="row no-gutters">
250250
<td class="col-md-3">Source</td>
251251
<td class="col-md-6">{{ source.value }}</td>
252252
<td class="col-md-3">{{ source.sub_type }}</td>
253253
</tr>
254254
{% endfor %}
255-
{% for verifier in profile.postal_address.verifiers %}
255+
{% for verifier in postal_address.verifiers %}
256256
<tr class="row no-gutters">
257257
<td class="col-md-3">Verifier</td>
258258
<td class="col-md-6">{{ verifier.value }}</td>
@@ -264,21 +264,21 @@ <h3>Yoti Profile</h3>
264264
</td>
265265
</tr>
266266
{% endif %}
267-
{% if profile.gender %}
267+
{% if gender %}
268268
<tr>
269269
<th scope="row">Gender</th>
270-
<td>{{profile.gender.value }}</td>
270+
<td>{{gender.value }}</td>
271271
<td colspan="3">
272272
<table class="table">
273273
<tbody>
274-
{% for source in profile.gender.sources %}
274+
{% for source in gender.sources %}
275275
<tr class="row no-gutters">
276276
<td class="col-md-3">Source</td>
277277
<td class="col-md-6">{{ source.value }}</td>
278278
<td class="col-md-3">{{ source.sub_type }}</td>
279279
</tr>
280280
{% endfor %}
281-
{% for verifier in profile.gender.verifiers %}
281+
{% for verifier in gender.verifiers %}
282282
<tr class="row no-gutters">
283283
<td class="col-md-3">Verifier</td>
284284
<td class="col-md-6">{{ verifier.value }}</td>
@@ -290,21 +290,21 @@ <h3>Yoti Profile</h3>
290290
</td>
291291
</tr>
292292
{% endif %}
293-
{% if profile.nationality %}
293+
{% if nationality %}
294294
<tr>
295295
<th scope="row">Nationality</th>
296-
<td>{{profile.nationality.value }}</td>
296+
<td>{{nationality.value }}</td>
297297
<td colspan="3">
298298
<table class="table">
299299
<tbody>
300-
{% for source in profile.nationality.sources %}
300+
{% for source in nationality.sources %}
301301
<tr class="row no-gutters">
302302
<td class="col-md-3">Source</td>
303303
<td class="col-md-6">{{ source.value }}</td>
304304
<td class="col-md-3">{{ source.sub_type }}</td>
305305
</tr>
306306
{% endfor %}
307-
{% for verifier in profile.nationality.verifiers %}
307+
{% for verifier in nationality.verifiers %}
308308
<tr class="row no-gutters">
309309
<td class="col-md-3">Verifier</td>
310310
<td class="col-md-6">{{ verifier.value }}</td>
@@ -316,21 +316,21 @@ <h3>Yoti Profile</h3>
316316
</td>
317317
</tr>
318318
{% endif %}
319-
{% if profile.selfie %}
319+
{% if selfie %}
320320
<tr>
321321
<th scope="row">Selfie as base64 data</th>
322322
<td><img width="200" alt="base64photo" src="{{base64_selfie_uri}}"/></td>
323323
<td colspan="3">
324324
<table class="table">
325325
<tbody>
326-
{% for source in profile.selfie.sources %}
326+
{% for source in selfie.sources %}
327327
<tr class="row no-gutters">
328328
<td class="col-md-3">Source</td>
329329
<td class="col-md-6">{{ source.value }}</td>
330330
<td class="col-md-3">{{ source.sub_type }}</td>
331331
</tr>
332332
{% endfor %}
333-
{% for verifier in profile.selfie.verifiers %}
333+
{% for verifier in selfie.verifiers %}
334334
<tr class="row no-gutters">
335335
<td class="col-md-3">Verifier</td>
336336
<td class="col-md-6">{{ verifier.value }}</td>
@@ -347,14 +347,14 @@ <h3>Yoti Profile</h3>
347347
<td colspan="3">
348348
<table class="table">
349349
<tbody>
350-
{% for source in profile.selfie.sources %}
350+
{% for source in selfie.sources %}
351351
<tr class="row no-gutters">
352352
<td class="col-md-3">Source</td>
353353
<td class="col-md-6">{{ source.value }}</td>
354354
<td class="col-md-3">{{ source.sub_type }}</td>
355355
</tr>
356356
{% endfor %}
357-
{% for verifier in profile.selfie.verifiers %}
357+
{% for verifier in selfie.verifiers %}
358358
<tr class="row no-gutters">
359359
<td class="col-md-3">Verifier</td>
360360
<td class="col-md-6">{{ verifier.value }}</td>

examples/yoti_example_django/yoti_example/views.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,18 @@ class AuthView(TemplateView):
2424
def get(self, request, *args, **kwargs):
2525
client = Client(YOTI_CLIENT_SDK_ID, YOTI_KEY_FILE_PATH)
2626
activity_details = client.get_activity_details(request.GET['token'])
27-
context = vars(activity_details.profile)
27+
profile = activity_details.profile
28+
profile_dict = vars(profile)
29+
30+
context = profile_dict.get('attributes')
2831
context['base64_selfie_uri'] = getattr(activity_details, 'base64_selfie_uri')
2932
context['user_id'] = getattr(activity_details, 'user_id')
3033

31-
selfie = context.get('profile', {}).get('selfie')
34+
age_verified = profile.get_attribute('age_over:18') # age condition defined in dashboard
35+
if age_verified is not None:
36+
context['age_verified'] = age_verified
37+
38+
selfie = context.get('selfie')
3239
if selfie is not None:
3340
self.save_image(selfie.value)
3441
return self.render_to_response(context)

examples/yoti_example_flask/app.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,18 @@ def index():
3535
def auth():
3636
client = Client(YOTI_CLIENT_SDK_ID, YOTI_KEY_FILE_PATH)
3737
activity_details = client.get_activity_details(request.args['token'])
38-
context = vars(activity_details.profile)
38+
profile = activity_details.profile
39+
profile_dict = vars(profile)
40+
41+
context = profile_dict.get('attributes')
3942
context['base64_selfie_uri'] = getattr(activity_details, 'base64_selfie_uri')
4043
context['user_id'] = getattr(activity_details, 'user_id')
4144

42-
selfie = context.get('profile', {}).get('selfie')
45+
age_verified = profile.get_attribute('age_over:18') # age condition defined in dashboard
46+
if age_verified is not None:
47+
context['age_verified'] = age_verified
48+
49+
selfie = context.get('selfie')
4350
if selfie is not None:
4451
save_image(selfie.value)
4552
return render_template('profile.html',

0 commit comments

Comments
 (0)