diff --git a/mati/resources/identities.py b/mati/resources/identities.py index 27186c0..e0defab 100644 --- a/mati/resources/identities.py +++ b/mati/resources/identities.py @@ -2,9 +2,7 @@ from dataclasses import dataclass, field from typing import ClassVar, List, Optional, Union, cast -from ..types import UserValidationFile from .base import Resource -from .user_verification_data import UserValidationData @dataclass @@ -50,11 +48,3 @@ def refresh(self, client=None) -> None: identity = self.retrieve(self.id, client=client) for k, v in identity.__dict__.items(): setattr(self, k, v) - - def upload_validation_data( - self, user_validation_files: List[UserValidationFile], client=None - ) -> List[dict]: - client = client or self._client - return UserValidationData.upload( - self.id, user_validation_files, client=client - ) diff --git a/mati/resources/verifications.py b/mati/resources/verifications.py index 879031c..41d11d6 100644 --- a/mati/resources/verifications.py +++ b/mati/resources/verifications.py @@ -5,10 +5,12 @@ from ..types.enums import ( DocumentScore, Liveness, + UserValidationFile, VerificationDocument, VerificationDocumentStep, ) from .base import Resource +from .user_verification_data import UserValidationData @dataclass @@ -51,6 +53,18 @@ def retrieve(cls, verification_id: str, client=None) -> 'Verification': resp = client.get(endpoint) return cast('Verification', cls._from_dict(resp)) + @classmethod + def upload_validation_data( + cls, + user_validation_files: List[UserValidationFile], + identity_id: str, + client=None, + ) -> List[dict]: + client = client or cls._client + return UserValidationData.upload( + identity_id, user_validation_files, client=client + ) + @property def is_pending(self) -> bool: return self.identity['status'] in ['running', 'pending'] diff --git a/mati/version.py b/mati/version.py index 98061f3..b5135ab 100644 --- a/mati/version.py +++ b/mati/version.py @@ -1 +1 @@ -__version__ = '0.3.5.dev1' # pragma: no cover +__version__ = '0.3.5.dev2' # pragma: no cover diff --git a/tests/resources/test_user_verification_data.py b/tests/resources/test_user_verification_data.py index f986b8a..3ce4dd2 100644 --- a/tests/resources/test_user_verification_data.py +++ b/tests/resources/test_user_verification_data.py @@ -4,6 +4,7 @@ import pytest from mati.resources import Identity +from mati.resources.verifications import Verification from mati.types import ( PageType, UserValidationFile, @@ -50,12 +51,13 @@ def test_ine_and_liveness_upload(identity: Identity): content=front, input_type=ValidationInputType.selfie_photo, ) - resp = identity.upload_validation_data( + resp = Verification.upload_validation_data( [ user_validation_file, user_validation_file_back, user_validation_live, user_validation_photo, - ] + ], + identity.id, ) assert all([resp[i]['result'] for i in range(3)]) is True