Implement getting user's name

This commit is contained in:
Mark Veidemanis 2022-04-23 11:53:19 +01:00
parent 6e20d8c693
commit 22f708758a
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 16 additions and 0 deletions

View File

@ -72,6 +72,22 @@ class Verify(util.Base):
rtrn = self.process_callback(content_json)
return rtrn
def get_external_user_id_details(self, external_user_id):
# /resources/applicants/-;externalUserId={externalUserId}/one
url = f"{settings.Verify.Base}/resources/applicants/-;externalUserId={external_user_id}/one"
resp = self.sign_request(requests.Request("GET", url))
s = requests.Session()
response = s.send(resp)
info = response.json()
if "info" in info:
if {"firstName", "lastName"}.issubset(set(info["info"].keys())):
first_name = info["info"]["firstName"]
last_name = info["info"]["lastName"]
if first_name.startswith("MR "):
first_name = first_name[3:]
print("info", info)
return (first_name, last_name)
def create_applicant_and_get_link(self, external_user_id):
"""
Create the applicant and return the authentication link.