Implement getting the link
This commit is contained in:
parent
ae08955d6b
commit
b07dfad37e
|
@ -15,6 +15,14 @@ class Verify(util.Base):
|
||||||
Class to handle user verification.
|
Class to handle user verification.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def create_applicant_and_get_link(self, external_user_id):
|
||||||
|
"""
|
||||||
|
Create the applicant and return the authentication link.
|
||||||
|
"""
|
||||||
|
# applicant_id = self.create_applicant(external_user_id)
|
||||||
|
auth_url = self.get_authentication_link(external_user_id)
|
||||||
|
return auth_url
|
||||||
|
|
||||||
def get_authentication_link(self, external_user_id):
|
def get_authentication_link(self, external_user_id):
|
||||||
"""
|
"""
|
||||||
Get an external authentication link for a user.
|
Get an external authentication link for a user.
|
||||||
|
@ -49,19 +57,24 @@ class Verify(util.Base):
|
||||||
resp = self.sign_request(requests.Request("GET", url))
|
resp = self.sign_request(requests.Request("GET", url))
|
||||||
s = requests.Session()
|
s = requests.Session()
|
||||||
response = s.send(resp)
|
response = s.send(resp)
|
||||||
return response
|
response_json = response.json()
|
||||||
|
if "review" in response_json:
|
||||||
|
if "reviewResult" in response_json["review"]:
|
||||||
|
if "reviewAnswer" in response_json["review"]["reviewResult"]:
|
||||||
|
return response_json["review"]["reviewResult"]["reviewAnswer"]
|
||||||
|
return
|
||||||
|
|
||||||
def create_applicant(self, external_user_id, level_name):
|
def create_applicant(self, external_user_id):
|
||||||
"""
|
"""
|
||||||
Create an applicant.
|
Create an applicant.
|
||||||
"""
|
"""
|
||||||
body = {"externalUserId": external_user_id}
|
body = {"externalUserId": external_user_id}
|
||||||
params = {"levelName": level_name}
|
params = {"levelName": settings.Verify.LevelName}
|
||||||
headers = {"Content-Type": "application/json", "Content-Encoding": "utf-8"}
|
headers = {"Content-Type": "application/json", "Content-Encoding": "utf-8"}
|
||||||
resp = self.sign_request(
|
resp = self.sign_request(
|
||||||
requests.Request(
|
requests.Request(
|
||||||
"POST",
|
"POST",
|
||||||
f"{settings.Verify.Base}/resources/applicants?levelName={level_name}",
|
f"{settings.Verify.Base}/resources/applicants?levelName={settings.Verify.LevelName}",
|
||||||
params=params,
|
params=params,
|
||||||
data=json.dumps(body),
|
data=json.dumps(body),
|
||||||
headers=headers,
|
headers=headers,
|
||||||
|
|
Loading…
Reference in New Issue