Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cuenca_validations/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'BatchFileMetadata',
'Beneficiary',
'BillPaymentQuery',
'BillPaymentRequest',
'CardErrorType',
'CardFundingType',
'CardholderVerificationMethod',
Expand Down Expand Up @@ -58,6 +59,9 @@
'SavingRequest',
'SavingUpdateRequest',
'ServiceProviderCategory',
'ServiceProviderField',
'ServiceProviderFieldType',
'ServiceProviderQuery',
'SessionQuery',
'SessionRequest',
'SessionType',
Expand Down Expand Up @@ -121,6 +125,7 @@
PosCapability,
SavingCategory,
ServiceProviderCategory,
ServiceProviderFieldType,
SessionType,
State,
TrackDataMethod,
Expand All @@ -133,7 +138,7 @@
WalletTransactionType,
WebhookEvent,
)
from .files import BatchFileMetadata
from .files import BatchFileMetadata, ServiceProviderField
from .general import (
JSONEncoder,
SantizedDict,
Expand Down Expand Up @@ -163,6 +168,7 @@
IdentityQuery,
PageSize,
QueryParams,
ServiceProviderQuery,
SessionQuery,
StatementQuery,
TransactionQuery,
Expand All @@ -173,6 +179,7 @@
)
from .requests import (
ApiKeyUpdateRequest,
BillPaymentRequest,
CurpValidationRequest,
EndpointRequest,
EndpointUpdateRequest,
Expand Down
7 changes: 7 additions & 0 deletions cuenca_validations/types/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,3 +612,10 @@ class PlatformType(str, Enum):
bridge = 'bridge'
connect = 'connect'
spei = 'spei'


class ServiceProviderFieldType(str, Enum):
barcode = 'barcode'
account_number = 'account_number'
credit_card_number = 'credit_card_number'
phone_number = 'phone_number'
12 changes: 10 additions & 2 deletions cuenca_validations/types/files.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
from typing import Optional
from typing import List, Optional

from pydantic import BaseModel, HttpUrl

from .enums import KYCFileType
from .enums import KYCFileType, ServiceProviderFieldType


class BatchFileMetadata(BaseModel):
id: Optional[str]
is_back: bool
type: KYCFileType
url: HttpUrl


class ServiceProviderField(BaseModel):
is_active: bool
requires_accountholder_name: bool
mask: str
topup_amounts: List[int]
type: ServiceProviderFieldType
4 changes: 4 additions & 0 deletions cuenca_validations/types/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,7 @@ class SessionQuery(QueryParams):

class FileQuery(QueryParams):
type: Optional[KYCFileType] = None


class ServiceProviderQuery(QueryParams):
categories: Optional[str] = None
10 changes: 10 additions & 0 deletions cuenca_validations/types/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
PlatformType,
PosCapability,
SavingCategory,
ServiceProviderFieldType,
SessionType,
State,
TrackDataMethod,
Expand Down Expand Up @@ -647,3 +648,12 @@ class WebhookRequest(BaseModel):
event: WebhookEventType
object_type: WebhookObject
data: DictStrAny


class BillPaymentRequest(BaseRequest):
amount: StrictPositiveInt
field_type: ServiceProviderFieldType
account_number: str
provider_id: str
accountholder_name: Optional[str]
user_id: Optional[str]
2 changes: 1 addition & 1 deletion cuenca_validations/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.11.0'
__version__ = '0.11.1'
17 changes: 17 additions & 0 deletions tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
)
from cuenca_validations.types.requests import (
ApiKeyUpdateRequest,
BillPaymentRequest,
ChargeRequest,
CurpValidationRequest,
EndpointRequest,
Expand Down Expand Up @@ -514,3 +515,19 @@ def test_identity_update_request():
assert IdentityUpdateRequest(
user_id=user_id, rfc_file=rfc_file, extension=extension
)


def test_bill_payment_request():
amount = 100
field_type = 'barcode'
account_number = '1234567890'
provider_id = 'PR01'
accountholder_name = 'Frida Khalo'

assert BillPaymentRequest(
amount=amount,
field_type=field_type,
account_number=account_number,
provider_id=provider_id,
accountholder_name=accountholder_name,
)