Skip to content
12 changes: 10 additions & 2 deletions mati/resources/verifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,17 @@ def proof_of_residency_document(self) -> Optional[VerificationDocument]:
def proof_of_life_document(self) -> Optional[Liveness]:
if not self.steps:
return None
pol = [pol for pol in self.steps if pol.id == 'liveness']
pol = [pol for pol in self.steps if pol.id in ['liveness', 'selfie']]
return pol[-1] if pol else None

@property
def proof_of_life_url(self) -> Optional[str]:
pol = self.proof_of_life_document
if not pol:
return None
data = getattr(pol, 'data', {}) or {}
return data.get('video_url') or data.get('selfie_photo_url')

@property
def proof_of_life_errors(self) -> List[Errors]:
return [
Expand All @@ -97,7 +105,7 @@ def proof_of_life_errors(self) -> List[Errors]:
else None,
)
for pol in self.steps # type: ignore
if pol.id == 'liveness' and pol.error
if pol.id in ['liveness', 'selfie'] and pol.error
]

@property
Expand Down
2 changes: 1 addition & 1 deletion mati/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.0.7'
__version__ = '2.0.8'
2 changes: 2 additions & 0 deletions tests/resources/test_verifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test_retrieve_full_verification(client: Client):
assert verification.govt_id_validation.is_valid
assert verification.proof_of_life_validation.is_valid
assert verification.proof_of_residency_validation.is_valid
assert verification.proof_of_life_url
assert not verification.govt_id_document.errors
assert not verification.proof_of_residency_document.errors
assert not verification.proof_of_life_errors
Expand All @@ -37,6 +38,7 @@ def test_verification_without_liveness(client: Client):
verification = client.verifications.retrieve('5d9fb1f5bfbfac001a349bfb')
verification.steps = []
assert not verification.proof_of_life_document
assert not verification.proof_of_life_url


@pytest.mark.vcr
Expand Down
Loading