Skip to content

Commit

Permalink
Added new VoidSelfie entry point
Browse files Browse the repository at this point in the history
  • Loading branch information
miguel-lorenzo committed Jun 1, 2020
1 parent 68c686a commit 6e6985a
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
34 changes: 34 additions & 0 deletions alice/onboarding/onboarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,40 @@ def delete_selfie(
)
)

def void_selfie(
self, user_id: str, verbose: bool = False
) -> Result[bool, OnboardingError]:
"""
This call is used to void the video of the user's face to the onboarding service.
This will NOT erase the biometric face profile.
Parameters
----------
user_id
User identifier
verbose
Used for print service response as well as the time elapsed
Returns
-------
A Result where if the operation is successful it returns True.
Otherwise, it returns an OnboardingError.
"""
response = self.onboarding_client.void_selfie(
user_id=user_id, verbose=verbose
)

if response.status_code == 200:
return isSuccess
else:
return Failure(
OnboardingError.from_response(
operation="void_selfie", response=response
)
)

def supported_documents(
self, user_id: str, verbose: bool = False
) -> Result[Dict[str, str], OnboardingError]:
Expand Down
32 changes: 32 additions & 0 deletions alice/onboarding/onboarding_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,38 @@ def delete_selfie(self, user_id: str, verbose: bool = False) -> Response:

return response

@timeit
def void_selfie(self, user_id: str, verbose: bool = False) -> Response:
"""
This call is used to void the video of the user's face to the onboarding service.
This will NOT erase the biometric face profile.
Parameters
----------
user_id
User identifier
verbose
Used for print service response as well as the time elapsed
Returns
-------
A Response object [requests library]
"""
print_intro("void_selfie", verbose=verbose)

backend_token = self.auth.create_backend_token(user_id).unwrap()
print_token("backend_token_with_user", backend_token, verbose=verbose)

headers = self._auth_headers(backend_token)

response = request("PATCH", self.url + "/user/selfie", headers=headers)

print_response(response=response, verbose=verbose)

return response

@timeit
def supported_documents(self, user_id: str, verbose: bool = False) -> Response:
"""
Expand Down
Empty file added yoti-pad-test.py
Empty file.

0 comments on commit 6e6985a

Please sign in to comment.