Skip to content

Commit 41fc2b5

Browse files
KYC Verifications 🥇 (#263)
* KYC Verifications: First Approach * Curp added * KYCVerifications done and tested * Casette * Receiving address. New pre release * fix * kyc verifications Co-authored-by: AlexViquez <alexviquez22@gmail.com>
1 parent 4c9a948 commit 41fc2b5

8 files changed

Lines changed: 144 additions & 1 deletion

File tree

‎cuenca/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
'FileBatch',
1818
'Identity',
1919
'IdentityEvent',
20+
'KYCVerification',
2021
'LimitedWallet',
2122
'LoginToken',
2223
'Saving',
@@ -57,6 +58,7 @@
5758
FileBatch,
5859
Identity,
5960
IdentityEvent,
61+
KYCVerification,
6062
LimitedWallet,
6163
LoginToken,
6264
Saving,

‎cuenca/resources/__init__.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
'FileBatch',
1717
'Identity',
1818
'IdentityEvent',
19+
'KYCVerification',
1920
'LimitedWallet',
2021
'LoginToken',
2122
'Saving',
@@ -49,6 +50,7 @@
4950
from .files import File
5051
from .identities import Identity
5152
from .identity_events import IdentityEvent
53+
from .kyc_verifications import KYCVerification
5254
from .limited_wallets import LimitedWallet
5355
from .login_tokens import LoginToken
5456
from .resources import RESOURCES
@@ -85,6 +87,7 @@
8587
FileBatch,
8688
Identity,
8789
IdentityEvent,
90+
KYCVerification,
8891
LimitedWallet,
8992
LoginToken,
9093
Saving,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import datetime as dt
2+
from typing import ClassVar, Optional, cast
3+
4+
from cuenca_validations.types import Address, CurpField, Rfc
5+
from pydantic.dataclasses import dataclass
6+
7+
from ..http import Session, session as global_session
8+
from .base import Creatable, Retrievable
9+
10+
11+
@dataclass
12+
class KYCVerification(Creatable, Retrievable):
13+
_resource: ClassVar = 'kyc_verifications'
14+
15+
platform_id: str
16+
created_at: dt.datetime
17+
deactivated_at: Optional[dt.datetime]
18+
verification_id: Optional[str]
19+
curp: Optional[CurpField] = None
20+
rfc: Optional[Rfc] = None
21+
address: Optional[Address] = None
22+
23+
@classmethod
24+
def create(cls, session: Session = global_session) -> 'KYCVerification':
25+
return cast('KYCVerification', cls._create(session=session))

‎cuenca/resources/users.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def update(
8282
proof_of_address: Optional[KYCFileUpdateRequest] = None,
8383
proof_of_life: Optional[KYCFileUpdateRequest] = None,
8484
terms_of_service: Optional[TOSUpdateRequest] = None,
85+
verification_id: Optional[str] = None,
8586
*,
8687
session: Session = global_session,
8788
):
@@ -95,6 +96,7 @@ def update(
9596
proof_of_address=proof_of_address,
9697
proof_of_life=proof_of_life,
9798
terms_of_service=terms_of_service,
99+
verification_id=verification_id,
98100
)
99101
return cast(
100102
'User',

‎cuenca/version.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = '0.9.2'
1+
__version__ = '0.9.3'
22
CLIENT_VERSION = __version__
33
API_VERSION = '2020-03-19'
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
interactions:
2+
- request:
3+
body: '{}'
4+
headers:
5+
Accept:
6+
- '*/*'
7+
Accept-Encoding:
8+
- gzip, deflate
9+
Authorization:
10+
- DUMMY
11+
Connection:
12+
- keep-alive
13+
Content-Length:
14+
- '2'
15+
Content-Type:
16+
- application/json
17+
User-Agent:
18+
- cuenca-python/0.9.2
19+
X-Cuenca-Api-Version:
20+
- '2020-03-19'
21+
method: POST
22+
uri: https://sandbox.cuenca.com/kyc_verifications
23+
response:
24+
body:
25+
string: '{"id":"KYCY01","identity_id":null,"platform_id":"PT01","created_at":"2022-05-04T21:49:28.696688","updated_at":"2022-05-04T21:49:28.697159","deactivated_at":null,"verification_id":null,"curp":null,"rfc":null,"address":null}'
26+
headers:
27+
Connection:
28+
- keep-alive
29+
Content-Length:
30+
- '246'
31+
Content-Type:
32+
- application/json
33+
Date:
34+
- Wed, 04 May 2022 21:49:28 GMT
35+
x-amz-apigw-id:
36+
- Rns0XHhNCYcFwdg=
37+
x-amzn-Remapped-Connection:
38+
- keep-alive
39+
x-amzn-Remapped-Content-Length:
40+
- '246'
41+
x-amzn-Remapped-Date:
42+
- Wed, 04 May 2022 21:49:28 GMT
43+
x-amzn-Remapped-Server:
44+
- nginx/1.20.2
45+
x-amzn-RequestId:
46+
- d2c3bb25-34c1-4858-9de2-d1b4e60d2c81
47+
status:
48+
code: 201
49+
message: Created
50+
version: 1
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Accept:
6+
- '*/*'
7+
Accept-Encoding:
8+
- gzip, deflate
9+
Authorization:
10+
- DUMMY
11+
Connection:
12+
- keep-alive
13+
User-Agent:
14+
- cuenca-python/0.9.2
15+
X-Cuenca-Api-Version:
16+
- '2020-03-19'
17+
method: GET
18+
uri: https://sandbox.cuenca.com/kyc_verifications/KYC01
19+
response:
20+
body:
21+
string: '{"id":"KYC01","identity_id":null,"platform_id":"PT01","created_at":"2022-05-04T21:27:15.954000","updated_at":"2022-05-04T21:27:15.954000","deactivated_at":null,"verification_id":null,"curp":null,"rfc":null,"address":null}'
22+
headers:
23+
Connection:
24+
- keep-alive
25+
Content-Length:
26+
- '246'
27+
Content-Type:
28+
- application/json
29+
Date:
30+
- Wed, 04 May 2022 21:49:29 GMT
31+
x-amz-apigw-id:
32+
- Rns0cHpJiYcF_OQ=
33+
x-amzn-Remapped-Connection:
34+
- keep-alive
35+
x-amzn-Remapped-Content-Length:
36+
- '246'
37+
x-amzn-Remapped-Date:
38+
- Wed, 04 May 2022 21:49:29 GMT
39+
x-amzn-Remapped-Server:
40+
- nginx/1.20.2
41+
x-amzn-RequestId:
42+
- 071182a0-b23e-47f0-bb92-68fdc35ec070
43+
status:
44+
code: 200
45+
message: OK
46+
version: 1
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import pytest
2+
3+
from cuenca import KYCVerification
4+
5+
6+
@pytest.mark.vcr
7+
def test_kyc_verification_create():
8+
kyc_verification: KYCVerification = KYCVerification.create()
9+
assert kyc_verification.id
10+
11+
12+
@pytest.mark.vcr
13+
def test_kyc_verification_retrieve():
14+
kyc_verification: KYCVerification = KYCVerification.retrieve('KYC01')
15+
assert kyc_verification.id

0 commit comments

Comments
 (0)