cuenca-validations 2.1.7.dev2__py3-none-any.whl → 2.1.7.dev5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -55,6 +55,7 @@ __all__ = [
55
55
  'PlatformRequest',
56
56
  'PlatformType',
57
57
  'PosCapability',
58
+ 'Profession',
58
59
  'QueryParams',
59
60
  'Rfc',
60
61
  'QuestionnairesRequest',
@@ -134,6 +135,7 @@ from .enums import (
134
135
  Language,
135
136
  PlatformType,
136
137
  PosCapability,
138
+ Profession,
137
139
  SATRegimeCode,
138
140
  SavingCategory,
139
141
  ServiceProviderCategory,
@@ -40,7 +40,6 @@ from ..types.enums import (
40
40
  TrackDataMethod,
41
41
  TransactionTokenValidationStatus,
42
42
  UserCardNotification,
43
- UserStatus,
44
43
  VerificationType,
45
44
  WalletTransactionType,
46
45
  WebhookEvent,
@@ -72,7 +71,6 @@ from .identities import (
72
71
  Password,
73
72
  PhoneNumber,
74
73
  Rfc,
75
- TOSAgreement,
76
74
  )
77
75
  from .morals import (
78
76
  AuditDetails,
@@ -429,6 +427,9 @@ class UserRequest(BaseModel):
429
427
  ...,
430
428
  description='ID of previously validated email verification',
431
429
  )
430
+ tos_agreement: UserTOSAgreementRequest = Field(
431
+ ..., description='TOS agreement for the user'
432
+ )
432
433
 
433
434
  model_config = ConfigDict(
434
435
  json_schema_extra={
@@ -462,9 +463,7 @@ class UserRequest(BaseModel):
462
463
 
463
464
 
464
465
  class UserUpdateRequest(BaseModel):
465
- phone_number: Optional[PhoneNumber] = None
466
- email_address: Optional[EmailStr] = None
467
- profession: Optional[str] = None
466
+ profession: Optional[Profession] = None
468
467
  verification_id: Optional[str] = None
469
468
  email_verification_id: Optional[str] = None
470
469
  phone_verification_id: Optional[str] = None
@@ -474,9 +473,6 @@ class UserUpdateRequest(BaseModel):
474
473
  proof_of_address: Optional[KYCFile] = None
475
474
  proof_of_life: Optional[KYCFile] = None
476
475
  signature: Optional[KYCFile] = None
477
- status: Optional[UserStatus] = None
478
- terms_of_service: Optional[TOSRequest] = None
479
- platform_terms_of_service: Optional[TOSAgreement] = None
480
476
  curp_document_uri: Optional[SerializableHttpUrl] = None
481
477
 
482
478
  @field_validator('beneficiaries')
@@ -484,8 +480,8 @@ class UserUpdateRequest(BaseModel):
484
480
  def beneficiary_percentage(
485
481
  cls, beneficiaries: Optional[list[Beneficiary]] = None
486
482
  ):
487
- if beneficiaries and sum(b.percentage for b in beneficiaries) > 100:
488
- raise ValueError('The total percentage is more than 100.')
483
+ if beneficiaries and sum(b.percentage for b in beneficiaries) != 100:
484
+ raise ValueError('The total percentage should be 100%')
489
485
  return beneficiaries
490
486
 
491
487
 
@@ -1 +1 @@
1
- __version__ = '2.1.7.dev2'
1
+ __version__ = '2.1.7.dev5'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cuenca_validations
3
- Version: 2.1.7.dev2
3
+ Version: 2.1.7.dev5
4
4
  Summary: Cuenca common validations
5
5
  Home-page: https://github.com/cuenca-mx/cuenca-validations
6
6
  Author: Cuenca
@@ -4,8 +4,8 @@ cuenca_validations/errors.py,sha256=OtM8EgiKqYdz9Hn66AbBO96orL1or7efkyt0vh0Zxbs,
4
4
  cuenca_validations/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  cuenca_validations/typing.py,sha256=1QCu81IbVZZpyInjyeAuO-nF36gpT5Gi4o6V9PozuOU,204
6
6
  cuenca_validations/validators.py,sha256=wzwLnJ4wHggZvqp3mearbFkzvDERGeTNvJkuofQnuMc,1484
7
- cuenca_validations/version.py,sha256=Ds4XNfrbQkluTtAFbk9v0sDPjZYssaa0x1zVUHfpyNY,27
8
- cuenca_validations/types/__init__.py,sha256=UNb7auBcD0qp-x9TX7TNNj8IKo7uaI7xHaf9PYmaziY,4765
7
+ cuenca_validations/version.py,sha256=t_ZE4qAissTLU3mpMGxmvUi0gveTc5dOA6cEKwJL51c,27
8
+ cuenca_validations/types/__init__.py,sha256=1xGfD2tlFsPlhIy-T7BZPs-vvEgDoc6ZW2iXFLbyQpM,4799
9
9
  cuenca_validations/types/card.py,sha256=UGzz8NTFAverUmdUKAK1oGHnOnjSNTpIRUm93vKSSGY,1295
10
10
  cuenca_validations/types/enums.py,sha256=o2XmufNIBhx88KDVARnpoXqLkyXVP89XMW0DDPDH9NI,19424
11
11
  cuenca_validations/types/files.py,sha256=2CszbwF9ytXV9suFFwyDjYG4XxY8UhCjRw3HttVXXNw,269
@@ -14,15 +14,15 @@ cuenca_validations/types/helpers.py,sha256=6rHUhwoQ7jJZtGcW3LX-W5ZDl42PWE1RoBpGm
14
14
  cuenca_validations/types/identities.py,sha256=FBpWUwRfy99jBr2Zhuv9gArnnUe12o3A2kbs25i9nwo,4470
15
15
  cuenca_validations/types/morals.py,sha256=m8kAedevmwfSPTA9GYe03l7pkgipynwYgKfejyVtnuI,1813
16
16
  cuenca_validations/types/queries.py,sha256=KCRx0sPzWDtDDbZysmFGVgANgfqil17EITWaG7tGQ-A,4700
17
- cuenca_validations/types/requests.py,sha256=Zp7-Yd0vEt8fPqJd4eAA9LvSxbQRCUo57fSjJOQIlY0,20642
18
- cuenca_validations-2.1.7.dev2.dist-info/licenses/LICENSE,sha256=wR76FmxBbfnQpwELkkE5iMF8sFIafEMgXLTE4N4WPTc,1063
17
+ cuenca_validations/types/requests.py,sha256=-47_fJrsTpZwYVSYUpNsLhMwLhncyv6dxAeVpxAWqo8,20482
18
+ cuenca_validations-2.1.7.dev5.dist-info/licenses/LICENSE,sha256=wR76FmxBbfnQpwELkkE5iMF8sFIafEMgXLTE4N4WPTc,1063
19
19
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  tests/test_card.py,sha256=QAfRz7e11gWICPnFJZ2tiYgUsFV3C9TwzJXrDnDNXFw,1202
21
21
  tests/test_errors.py,sha256=ixiIgEuBuzfsL5p4uCFdF32XqFRtTPF6EVhGJ0keOrI,930
22
22
  tests/test_helpers.py,sha256=ubzpi1UXCryLQdgsT_Zm2IX-XE_4L0dnHnhLwH06xK8,748
23
23
  tests/test_statement.py,sha256=IOE0rRRBgBZSJv_FLaETEyn5NzzXKMNTqgjv99GX-68,1436
24
- tests/test_types.py,sha256=TlFJ5Hb6Sn9HwSrYJbULUKH89BdwTUva5QKCoTRZS_A,19005
25
- cuenca_validations-2.1.7.dev2.dist-info/METADATA,sha256=NvTlTALqLPigyZXcYBA9BA6xxF1lzh2JhXXL-6eEfRI,1599
26
- cuenca_validations-2.1.7.dev2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
27
- cuenca_validations-2.1.7.dev2.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
28
- cuenca_validations-2.1.7.dev2.dist-info/RECORD,,
24
+ tests/test_types.py,sha256=TimSUqe0YX83qIzo7p6XUy8YYuf19a7M3iPkVKw0iMg,19203
25
+ cuenca_validations-2.1.7.dev5.dist-info/METADATA,sha256=uhhQmpUuuRbj77vU8ggcDAWZ6R0hrf61EDRXaW0pOjs,1599
26
+ cuenca_validations-2.1.7.dev5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
+ cuenca_validations-2.1.7.dev5.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
28
+ cuenca_validations-2.1.7.dev5.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
tests/test_types.py CHANGED
@@ -22,6 +22,7 @@ from cuenca_validations.types import (
22
22
  from cuenca_validations.types.enums import (
23
23
  Country,
24
24
  EcommerceIndicator,
25
+ Profession,
25
26
  SessionType,
26
27
  State,
27
28
  )
@@ -306,7 +307,7 @@ def test_saving_update_request():
306
307
  def test_user_request():
307
308
  request = dict(
308
309
  curp='ABCD920604HDFSRN03',
309
- profession='worker',
310
+ profession=Profession.employee,
310
311
  address=dict(
311
312
  street='calle 1',
312
313
  ext_number='2',
@@ -319,6 +320,10 @@ def test_user_request():
319
320
  ),
320
321
  phone_verification_id='VE12345678',
321
322
  email_verification_id='VE0987654321',
323
+ tos_agreement=dict(
324
+ tos_id='TOS123',
325
+ location=dict(latitude=19.4326, longitude=-99.1332),
326
+ ),
322
327
  )
323
328
  assert UserRequest(**request).model_dump() == request
324
329
 
@@ -427,7 +432,7 @@ def test_user_update_request():
427
432
  birth_date=dt.date(2020, 1, 1).isoformat(),
428
433
  phone_number='+525555555555',
429
434
  user_relationship='brother',
430
- percentage=50,
435
+ percentage=100,
431
436
  ),
432
437
  ]
433
438
  assert UserUpdateRequest(**request)
@@ -438,12 +443,21 @@ def test_user_update_request():
438
443
  birth_date=dt.date(2020, 1, 1).isoformat(),
439
444
  phone_number='+525555555555',
440
445
  user_relationship='brother',
441
- percentage=101,
446
+ percentage=50,
447
+ ),
448
+ dict(
449
+ name='José Pérez',
450
+ birth_date=dt.date(2020, 1, 2).isoformat(),
451
+ phone_number='+525544444444',
452
+ user_relationship='brother',
453
+ percentage=51,
442
454
  ),
443
455
  ]
444
- with pytest.raises(ValueError) as v:
456
+ with pytest.raises(ValidationError) as v:
445
457
  UserUpdateRequest(**request)
446
- assert 'The total percentage is more than 100.' in str(v)
458
+
459
+ assert 'The total percentage should be 100%' in str(v)
460
+ request.pop('beneficiaries')
447
461
 
448
462
  tos_request = dict(
449
463
  terms_of_service=dict(
@@ -474,12 +488,6 @@ def test_user_update_request():
474
488
  )
475
489
  UserUpdateRequest(**kyc_request)
476
490
 
477
- # chagning to invalid request
478
- tos_request['terms_of_service']['ip'] = 'not valid ip'
479
- with pytest.raises(ValueError) as v:
480
- UserUpdateRequest(**tos_request)
481
- assert 'not valid ip' in str(v.value)
482
-
483
491
 
484
492
  def test_session_request():
485
493
  data = dict(