Skip to content

Commit

Permalink
changes in verification upload documents
Browse files Browse the repository at this point in the history
  • Loading branch information
alexviquez committed Sep 12, 2022
1 parent 1d69a3e commit ee459da
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
10 changes: 0 additions & 10 deletions mati/resources/identities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
14 changes: 14 additions & 0 deletions mati/resources/verifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
from ..types.enums import (
DocumentScore,
Liveness,
UserValidationFile,
VerificationDocument,
VerificationDocumentStep,
)
from .base import Resource
from .user_verification_data import UserValidationData


@dataclass
Expand Down Expand Up @@ -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']
Expand Down
2 changes: 1 addition & 1 deletion mati/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.3.5.dev1' # pragma: no cover
__version__ = '0.3.5.dev2' # pragma: no cover
6 changes: 4 additions & 2 deletions tests/resources/test_user_verification_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest

from mati.resources import Identity
from mati.resources.verifications import Verification
from mati.types import (
PageType,
UserValidationFile,
Expand Down Expand Up @@ -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

0 comments on commit ee459da

Please sign in to comment.