from Utils.ObjUtil import SpecObject from Utils.ValidateUtil import ValidateAttr, Validate class IDCardFront(SpecObject): """身份证正面""" name = ValidateAttr(field='name', type=str) gender = ValidateAttr(field='gender', in_list=['男', '女']) nationality = ValidateAttr(field='nationality', type=str) birth_day = ValidateAttr(field='birth_day', func=Validate.date_format) address = ValidateAttr(field='address', type=str) id_num = ValidateAttr(field='id_num', type=str) fields_map = { '姓名': 'name', '性别': 'gender', '民族': 'nationality', '出生': 'birth_day', '住址': 'address', '身份证号码': 'id_num' } class IDCardBack(SpecObject): """身份证反面""" issuing_authority = ValidateAttr(field='issuing_authority', type=str) validity_period = ValidateAttr(field='validity_period', type=str) fields_map = { "签发机关": "issuing_authority", "有效期限": "validity_period" } class BusinessLicense(SpecObject): """营业执照""" reg_num = ValidateAttr(field='reg_num', type=str) name = ValidateAttr(field='name', type=str) capital = ValidateAttr(field='capital', type=str) type = ValidateAttr(field='type', type=str) establish_date = ValidateAttr(field='establish_date', type=str) person = ValidateAttr(field='person', type=str) business = ValidateAttr(field='business', type=str) address = ValidateAttr(field='address', type=str) fields_map = { '统一社会信用代码': "reg_num", '名称': "name", '注册资本': "capital", '类型': "type", '成立日期': "establish_date", '法定代表人': "person", '经营范围': "business", '住所': "address" } class UploadMaterial(SpecObject): """上传材料""" cid = ValidateAttr(field='cid', type=str, length=8) image = ValidateAttr(field='image', func=Validate.image, mark='图片格式') verify_status = ValidateAttr(field='verify_status', in_list=["是", "否"], mark='认证状态') fields_map = { "cid": "企业ID", "image": "图片", "verify_status": "已认证" } def upload_id_card(self): """上传身份证""" def upload_business_license(self): """上传营业执照""" class RealCompanyVerify(object): """企业认证三要素""" cid = ValidateAttr(field='cid', type=str, length=8) code = ValidateAttr(field='code', type=str) name = ValidateAttr(field='name', type=str) legal_person = ValidateAttr(field='legal_person', type=str) fields_map = { "cid": "企业ID", "code": "统一社会信用代码", "name": "企业名称", "legal_person": "法人姓名", } def verify(self): """企业认证"""