35 lines
590 B
Python
35 lines
590 B
Python
|
import datetime
|
||
|
from schwifty import IBAN, BIC
|
||
|
|
||
|
|
||
|
def mandatory(field: str) -> bool:
|
||
|
return bool(field)
|
||
|
|
||
|
|
||
|
def empty(field: str) -> bool:
|
||
|
return not bool(field)
|
||
|
|
||
|
|
||
|
def iso_date(field: str) -> bool:
|
||
|
try:
|
||
|
datetime.datetime.strptime(field, "%Y-%m-%d")
|
||
|
return True
|
||
|
except ValueError:
|
||
|
return False
|
||
|
|
||
|
|
||
|
def valid_iban(field: str) -> bool:
|
||
|
try:
|
||
|
IBAN(field)
|
||
|
return True
|
||
|
except ValueError:
|
||
|
return False
|
||
|
|
||
|
|
||
|
def valid_bic(field: str) -> bool:
|
||
|
try:
|
||
|
BIC(field)
|
||
|
return True
|
||
|
except ValueError:
|
||
|
return False
|