Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft bank account validation #310

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 2 additions & 0 deletions cuenca/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'Account',
'Arpc',
'BalanceEntry',
'BankAccountValidations',
'BillPayment',
'Card',
'CardActivation',
Expand Down Expand Up @@ -49,6 +50,7 @@
ApiKey,
Arpc,
BalanceEntry,
BankAccountValidations,
BillPayment,
Card,
CardActivation,
Expand Down
3 changes: 3 additions & 0 deletions cuenca/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'ApiKey',
'Account',
'Arpc',
'BankAccountValidations',
'BalanceEntry',
'BillPayment',
'Card',
Expand Down Expand Up @@ -41,6 +42,7 @@
from .api_keys import ApiKey
from .arpc import Arpc
from .balance_entries import BalanceEntry
from .bank_account_validations import BankAccountValidations
from .bill_payments import BillPayment
from .card_activations import CardActivation
from .card_transactions import CardTransaction
Expand Down Expand Up @@ -82,6 +84,7 @@
Account,
Arpc,
BalanceEntry,
BankAccountValidations,
BillPayment,
Card,
CardActivation,
Expand Down
73 changes: 73 additions & 0 deletions cuenca/resources/bank_account_validation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import datetime as dt
from typing import ClassVar, Optional, cast

from clabe import Clabe
from cuenca_validations.types import (
BankAccountStatus,
BankAccountValidationQuery,
BankAccountValidationRequest,
Country,
CurpField,
Gender,
Rfc,
State,
)

from ..http import Session, session as global_session
from .base import Creatable, Queryable, Retrievable


class BankAccountValidation(Creatable, Retrievable, Queryable):
_resource: ClassVar = 'bank_account_validations'
_query_params: ClassVar = BankAccountValidationQuery

updated_at: dt.datetime
status: BankAccountStatus
platform_id: str
clabe: Clabe
transfer_id: str
names: Optional[str] = None
first_surname: Optional[str] = None
second_surname: Optional[str] = None
curp: Optional[CurpField] = None
rfc: Optional[Rfc] = None
gender: Optional[Gender] = None
date_of_birth: Optional[dt.date] = None
state_of_birth: Optional[State] = None
nationality: Optional[Country] = None
country_of_birth: Optional[Country] = None

class Config:
schema_extra = {
'example': {
'id': 'BAbUFjZTUbR3Oqj3vvzHcwBg',
'created_at': '2022-11-16T17:15:35.288128',
'updated_at': '2022-11-16T17:15:35.288128',
'status': 'succeeded',
'platform_id': 'PT-123',
'clabe': '127841000000000003',
'transfer_id': 'TR-123',
'names': 'José',
'first_surname': 'López',
'second_surname': 'Pérez',
'curp': 'LOPJ900101HDFPRS04',
'rfc': 'LOPJ9001016S5',
'gender': 'male',
'date_of_birth': '1990-01-01',
'state_of_birth': 'DF',
'nationality': 'MX',
'country_of_birth': 'MX',
}
}

@classmethod
def create(
cls,
clabe: Clabe,
session: Session = global_session,
) -> 'BankAccountValidation':
req = BankAccountValidationRequest(clabe=clabe)
return cast(
'BankAccountValidation',
cls._create(session=session, **req.dict()),
)
2 changes: 1 addition & 1 deletion cuenca/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '0.15.4'
__version__ = '0.15.5.dev0'
CLIENT_VERSION = __version__
API_VERSION = '2020-03-19'
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
requests==2.27.1
cuenca-validations==0.11.11
cuenca-validations==0.11.12.dev2
dataclasses>=0.7;python_version<"3.7"