Ejemplo n.º 1
0
class SysDictSchema(BaseSchema):
    """
    系统字典校验器
    """
    __model__ = SysDict

    value = fields.Str(
        validate=validates.MyLength(max=64, encode_str=Unicode.UTF_8.value))
    label = fields.Str(required=True,
                       validate=validates.MyLength(
                           min=1,
                           max=64,
                           encode_str=Unicode.UTF_8.value,
                           not_empty=False))
    type = fields.Str(required=True,
                      validate=validates.MyLength(
                          min=1,
                          max=64,
                          encode_str=Unicode.UTF_8.value,
                          not_empty=False))
    description = fields.Str(
        validate=validates.MyLength(max=225, encode_str=Unicode.UTF_8.value))
    sort = fields.Integer()

    def only_create(self):
        return super().only_create() + ('value', 'label', 'type',
                                        'description', 'sort')

    def only_page(self):
        return super().only_page() + ('type', 'description')
Ejemplo n.º 2
0
class FileSchema(BaseSchema):
    """
    文件校验器
    """
    __model__ = FileModel

    md5_id = fields.Str(required=True,
                        validate=validates.MyLength(
                            min=1,
                            max=64,
                            not_empty=False,
                            encode_str=Unicode.UTF_8.value),
                        load_from='md5Id')
    file_name = fields.Str(required=True,
                           validate=validates.MyLength(
                               min=1,
                               max=64,
                               not_empty=False,
                               encode_str=Unicode.UTF_8.value),
                           load_from='fileName')
    file_format = fields.Str(required=True,
                             validate=validates.MyLength(min=1,
                                                         max=20,
                                                         not_empty=False),
                             load_from='fileFormat')
    # file_path = fields.Str(required=True, validate=validates.MyLength(min=1, not_empty=False), load_from='filePath')
    file_size = fields.Decimal(places=2, required=True, load_from='fileSize')
    file_base64 = fields.Str(required=True,
                             validate=validates.MyLength(min=1,
                                                         not_empty=False),
                             load_from='fileBase64')

    def only_md5_upload(self):
        return super().only_create() + ('md5_id', 'file_name', 'file_format')
Ejemplo n.º 3
0
class MenuSchema(BaseSchema):
    """
    系统菜单校验器
    """
    __model__ = Menu

    parent_id = fields.Str(
        required=True,
        validate=validates.MyLength(min=1, max=64, not_empty=False, encode_str=Unicode.UTF_8.value),
        load_from='parentId'
    )
    name = fields.Str(
        required=True,
        validate=validates.MyLength(min=1, max=30, not_empty=False, encode_str=Unicode.UTF_8.value),
    )
    icon = fields.Str(
        validate=validates.MyLength(max=64, encode_str=Unicode.UTF_8.value),
    )
    sort = fields.Integer()
    href = fields.Str()
    spread = fields.Boolean(required=True)

    children = fields.Nested('self', dump_only=True, many=True)

    def only_create(self):
        return super().only_create() + ('parent_id', 'name', 'icon', 'sort', 'href', 'spread')

    def only_put(self):
        return super().only_put() + ('parent_id', 'name', 'icon', 'sort', 'href', 'spread')
Ejemplo n.º 4
0
class UserSchema(DataEntitySchema):
    """
    用户校验器
    """
    __model__ = User

    login_name = fields.Str(required=True,
                            validate=MyValidates.MyLength(min=1,
                                                          max=100,
                                                          not_empty=False),
                            load_from='loginName')

    password = fields.Str(required=True,
                          validate=MyValidates.MyLength(min=1,
                                                        max=100,
                                                        not_empty=False))
    no = fields.Str(validate=validate.Length(max=100))
    name = fields.Str(required=True, validate=validate.Length(min=1, max=100))
    email = fields.Str(validate=validate.Length(max=200))
    phone = fields.Str(validate=validate.Length(max=200))
    mobile = fields.Str(validate=validate.Length(max=200))
    user_type = fields.Str(validate=validate.Length(max=1),
                           load_from='userType')
    login_ip = fields.Str(validate=validate.Length(max=100),
                          load_from='loginIp')
    login_date = fields.DateTime(load_from='loginDate')
    login_flag = fields.Str(validate=validate.Length(max=64),
                            load_from='loginFlag')
    photo = fields.Str(validate=validate.Length(max=1000))
    old_login_name = fields.Str(validate=validate.Length(min=1, max=100),
                                load_from='oldLoginName')
    new_password = fields.Str(required=True,
                              validate=validate.Length(min=1, max=100),
                              load_from='newPassword')
    old_login_ip = fields.Str(load_from='oldLoginIp')
    old_login_date = fields.DateTime(load_from='oldLoginDate')

    # file_data = fields.Nested(
    #     FileSchema,
    #     required=True,
    #     load_only=True,
    #     load_from='fileData'
    # )
    #
    # loan_type = fields.Nested(
    #     LoanTypeSchema,
    #     only=('id', 'loan_type_name', 'loan_dir'),
    #     required=True,
    #     load_from='loanType'
    # )

    def partial_db(self):
        return 'new_password',

    # noinspection PyMethodMayBeStatic
    def only_login(self):
        return 'login_name', 'password'
Ejemplo n.º 5
0
class OcrFileSchema(BaseSchema):
    """
    OCR模型校验
    """
    __model__ = OcrFile
    __file_formats = (FileFormat.JPEG.value, FileFormat.JPG.value,
                      FileFormat.PNG.value)

    app_id = fields.Str(required=True,
                        validate=MyValidates.MyLength(min=1,
                                                      max=64,
                                                      not_empty=False),
                        load_from='appId')

    app_sys_id = fields.Str(required=True,
                            validate=MyValidates.MyLength(min=1,
                                                          max=64,
                                                          not_empty=False),
                            load_from='appSysId')

    app_sys_code = fields.Str(required=True,
                              validate=MyValidates.MyLength(min=1,
                                                            max=64,
                                                            not_empty=False),
                              load_from='appSysCode')

    file_id = fields.Str(required=True,
                         validate=MyValidates.MyLength(min=1,
                                                       max=64,
                                                       not_empty=False),
                         load_from='fileId')

    file_data = fields.Nested(FileSchema,
                              required=True,
                              load_only=True,
                              load_from='fileData')

    @validates('file_data')
    def validate_file_data(self, value):
        """
        文件校验
        :param value:
        :return:
        """
        if isinstance(value, dict):
            # 前面校验失败会返回dict而不是对象
            pass
        else:
            if value.file_name.find(os.curdir) != -1:
                raise ValidationError('文件名包含特殊字符')
            if value.file_format.upper() not in self.__file_formats:
                raise ValidationError('无效的文件格式')

    def only_create(self):
        return super().only_create() + \
               ('app_id', 'app_sys_code', 'file_data.file_name', 'file_data.file_format', 'file_data.file_base64')
Ejemplo n.º 6
0
class AppSysSchema(BaseSchema):
    """
    应用系统校验器
    """
    __model__ = AppSys

    code = fields.Str(required=True,
                      validate=validates.MyLength(min=1,
                                                  max=64,
                                                  not_empty=False))
    desc = fields.Str(required=True,
                      validate=validates.MyLength(min=1,
                                                  max=50,
                                                  not_empty=False))

    def only_create(self):
        return super().only_create() + ('code', 'desc')
Ejemplo n.º 7
0
class MyResponseSchema(Schema):
    __model__ = MyResponse

    class Meta:
        strict = True

    code = fields.Str(required=True,
                      validate=MyValidates.MyLength(min=1, not_empty=False))
    msg = fields.Str(required=True,
                     validate=MyValidates.MyLength(min=1, not_empty=False))

    @post_load
    def make_object(self, data):
        """
        序列化对象
        :param data:
        :return:
        """
        return self.__model__(**data) if self.__model__ else data
Ejemplo n.º 8
0
class AudioLexerNeSchema(BaseSchema):
    """
    词性分析命名实体校验器
    """
    __model__ = AudioLexerNeModel

    code = fields.Str(required=True,
                      validate=MyValidates.MyLength(min=1,
                                                    max=64,
                                                    not_empty=False))
    title = fields.Str(required=True,
                       validate=MyValidates.MyLength(min=1,
                                                     max=60,
                                                     not_empty=False))
    color = fields.Str(required=True,
                       validate=MyValidates.MyLength(min=1,
                                                     max=30,
                                                     not_empty=False))

    def only_create(self):
        return super().only_create() + ('code', 'title', 'color')
Ejemplo n.º 9
0
class ImgTypeSchema(BaseSchema):
    """
    图片类型校验
    """
    __model__ = ImgTypeModel

    type_code = fields.Str(
        required=True,
        validate=validates.MyLength(min=1, max=10, not_empty=False),
        load_from='typeCode'
    )

    type_explain = fields.Str(required=True, validate=validates.Length(min=1, max=20), load_from='typeExplain')
    is_ocr = fields.Boolean(required=True, load_from='isOcr')

    def only_create(self):
        return super().only_create() + ('type_code', 'type_explain', 'is_ocr')
Ejemplo n.º 10
0
class PageSchema(BaseSchema):
    """
    分页实体校验器
    """
    __model__ = Page

    code = fields.Str(
        validate=validates.MyLength(max=64, encode_str=Unicode.UTF_8.value))
    msg = fields.Str()
    page = fields.Integer(required=True)
    page_size = fields.Integer(required=True, load_from='pageSize')
    total = fields.Integer()
    total_page = fields.Integer(load_from='totalPage')
    data = fields.Str(dump_only=True)

    def only_create(self):
        return super().only_create() + ('page', 'page_size')
Ejemplo n.º 11
0
class ImgDataSchema(BaseSchema):
    """
    图片文件校验器
    """
    __model__ = ImgDataModel
    __file_formats = (FileFormat.PDF.value, FileFormat.JPG.value,
                      FileFormat.PNG.value)

    app_id = fields.Str(required=True,
                        validate=MyValidates.MyLength(min=1,
                                                      max=64,
                                                      not_empty=False),
                        load_from='appId')

    app_sys_id = fields.Str(required=True,
                            validate=MyValidates.MyLength(min=1,
                                                          max=64,
                                                          not_empty=False),
                            load_from='appSysId')

    page_num = fields.Integer(load_from='pageNum')
    success_num = fields.Integer(load_from='successNum')
    fail_num = fields.Integer(load_from='failNum')
    is_handle = fields.Boolean(load_from='isHandle')
    push_url = fields.Str(validate=validate.URL(), load_from='pushUrl')
    push_times = fields.Integer(load_from='pushTimes')
    is_push = fields.Boolean(load_from='isPush')

    app_sys_code = fields.Str(required=True,
                              validate=MyValidates.MyLength(min=1,
                                                            max=64,
                                                            not_empty=False),
                              load_from='appSysCode')

    file_data = fields.Nested(FileSchema,
                              required=True,
                              many=True,
                              load_only=True,
                              load_from='fileData')

    img_details = fields.Nested(ImgDetailSchema,
                                many=True,
                                only=('id', 'parent_file_id', 'file_id',
                                      'file_data', 'file_path', 'err_code',
                                      'err_msg', 'img_type'),
                                load_from='imgDetails')

    @validates('file_data')
    def validate_file_data(self, values):
        """
        文件校验
        :param values:
        :return:
        """
        for value in values:
            if isinstance(value, dict):
                # 前面校验失败会返回dict而不是对象
                pass
            else:
                if value.file_name.find(os.curdir) != -1:
                    raise ValidationError('文件名包含特殊字符')
                if value.file_format.upper() not in self.__file_formats:
                    raise ValidationError('无效的文件格式')

    @classmethod
    def filter_img_details(cls, img_details, filter_fields):
        """
        过滤图片明细指定字段
        :param list img_details: 图片明细字典列表
        :param list filter_fields: 待过滤字段列表
        :return:
        """
        if is_not_empty(img_details) and is_not_empty(filter_fields):
            for img_detail in img_details:
                for filter_field in filter_fields:
                    img_detail.pop(filter_field)
        return img_details

    def only_create(self):
        return super().only_create() + \
               ('app_id', 'app_sys_code',
                'file_data.file_name', 'file_data.file_format', 'file_data.file_base64', 'push_url')

    def only_page(self):
        return super().only_page() + ('app_sys_id', )

    def dump_only_get(self):
        return super().dump_only_get() + \
               ('app_id', 'app_sys_code', 'page_num', 'success_num', 'fail_num', 'is_handle', 'push_url',
                'push_times', 'is_push')

    def dump_only_page(self):
        return super().dump_only_page() + \
               ('app_id', 'app_sys_code', 'page_num', 'success_num', 'fail_num', 'is_handle', 'push_url',
                'push_times', 'is_push')
Ejemplo n.º 12
0
class ImgDetailSchema(BaseSchema):
    """
    图片资料明细
    """
    __model__ = ImgDetailModel

    img_data_id = fields.Str(required=True,
                             validate=MyValidates.MyLength(min=1,
                                                           max=64,
                                                           not_empty=False),
                             load_from='imgDataId')

    parent_file_id = fields.Str(required=True,
                                validate=MyValidates.MyLength(min=1,
                                                              max=64,
                                                              not_empty=False),
                                load_from='parentFileId')

    file_id = fields.Str(required=True,
                         validate=MyValidates.MyLength(min=1,
                                                       max=64,
                                                       not_empty=False),
                         load_from='fileId')

    img_type_id = fields.Str(required=True,
                             validate=MyValidates.MyLength(min=1,
                                                           max=64,
                                                           not_empty=False),
                             load_from='imgTypeId')

    is_handle = fields.Boolean(load_from='isHandle')

    err_code = fields.Str()
    err_msg = fields.Str(validate=validate.Length(max=100))
    file_data = fields.Str(required=True, dump_only=True)
    file_path = fields.Str(required=True, dump_only=True)
    file_md5 = fields.Str(required=True, dump_only=True)
    img_type_code = fields.Str(required=True,
                               validate=MyValidates.MyLength(min=1,
                                                             max=10,
                                                             not_empty=False),
                               load_only=True,
                               load_from='imgTypeCode')

    img_type = fields.Nested(ImgTypeSchema,
                             only=('type_code', 'type_explain'),
                             load_from='imgType')

    def only_patch_type(self):
        return super().only_update() + (
            'id',
            'img_type_code',
        )

    def only_flow_page(self):
        return super().only_page() + (
            'img_data_id',
            'is_handle',
        )

    def dump_only_page(self):
        return super().dump_only_page() + \
               ('img_data_id', 'parent_file_id', 'file_id', 'img_type_id', 'is_handle', 'err_code', 'err_msg',
                'img_type', 'file_md5', )
Ejemplo n.º 13
0
class MvsiSchema(BaseSchema):
    """
    机动车销售发票校验器
    """
    __model__ = Mvsi

    ocr_file_id = fields.Str(validate=MyValidates.MyLength(
        min=1, max=64, encode_str=Unicode.UTF_8.value, not_empty=False),
                             load_from='ocrFileId')
    code = fields.Str(
        validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value))
    number = fields.Str(
        validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value))
    issue_date = fields.DateTime(format=date._TIME_FORMAT[0],
                                 load_from='issueDate')
    machine_printed_code = fields.Str(validate=MyValidates.MyLength(
        max=20, encode_str=Unicode.UTF_8.value),
                                      load_from='machinePrintedCode')
    machine_printed_number = fields.Str(validate=MyValidates.MyLength(
        max=20, encode_str=Unicode.UTF_8.value),
                                        load_from='machinePrintedNumber')
    machine_number = fields.Str(validate=MyValidates.MyLength(
        max=20, encode_str=Unicode.UTF_8.value),
                                load_from='machineNumber')
    fiscal_code = fields.Str(validate=MyValidates.MyLength(
        max=190, encode_str=Unicode.UTF_8.value),
                             load_from='fiscalCode')
    buyer_name = fields.Str(validate=MyValidates.MyLength(
        max=20, encode_str=Unicode.UTF_8.value),
                            load_from='buyerName')
    buyer_organization_number = fields.Str(validate=MyValidates.MyLength(
        max=30, encode_str=Unicode.UTF_8.value),
                                           load_from='buyerOrganizationNumber')
    buyer_id = fields.Str(validate=MyValidates.MyLength(
        max=20, encode_str=Unicode.UTF_8.value),
                          load_from='buyerId')
    seller_name = fields.Str(load_from='sellerName')
    seller_phone = fields.Str(validate=MyValidates.MyLength(
        max=20, encode_str=Unicode.UTF_8.value),
                              load_from='sellerPhone')
    seller_id = fields.Str(validate=MyValidates.MyLength(
        max=20, encode_str=Unicode.UTF_8.value),
                           load_from='sellerId')
    seller_account = fields.Str(validate=MyValidates.MyLength(
        max=64, encode_str=Unicode.UTF_8.value),
                                load_from='sellerAccount')
    seller_address = fields.Str(load_from='sellerAddress')
    seller_bank = fields.Str(load_from='sellerBank')
    vehicle_type = fields.Str(load_from='vehicleType')
    brand_model = fields.Str(load_from='brandModel')
    manufacturing_location = fields.Str(validate=MyValidates.MyLength(
        max=225, encode_str=Unicode.UTF_8.value),
                                        load_from='manufacturingLocation')
    quality_certificate = fields.Str(validate=MyValidates.MyLength(
        max=20, encode_str=Unicode.UTF_8.value),
                                     load_from='qualityCertificate')
    import_certificate = fields.Str(validate=MyValidates.MyLength(
        max=18, encode_str=Unicode.UTF_8.value),
                                    load_from='importCertificate')
    inspection_number = fields.Str(validate=MyValidates.MyLength(
        max=20, encode_str=Unicode.UTF_8.value),
                                   load_from='inspectionNumber')
    engine_number = fields.Str(validate=MyValidates.MyLength(
        max=20, encode_str=Unicode.UTF_8.value),
                               load_from='engineNumber')
    vehicle_identification_number = fields.Str(
        validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value),
        load_from='vehicleIdentificationNumber')
    tonnage = fields.Str(validate=MyValidates.MyLength(
        max=10, encode_str=Unicode.UTF_8.value), )
    seating_capacity = fields.Str(validate=MyValidates.MyLength(
        max=10, encode_str=Unicode.UTF_8.value),
                                  load_from='seatingCapacity')
    tax_authority = fields.Str(load_from='taxAuthority')
    tax_authority_code = fields.Str(validate=MyValidates.MyLength(
        max=20, encode_str=Unicode.UTF_8.value),
                                    load_from='taxAuthorityCode')
    tax_payment_receipt = fields.Str(validate=MyValidates.MyLength(
        max=18, encode_str=Unicode.UTF_8.value),
                                     load_from='taxPaymentReceipt')
    tax_rate = fields.Str(validate=MyValidates.MyLength(
        max=6, encode_str=Unicode.UTF_8.value),
                          load_from='taxRate')
    tax = fields.Decimal(places=2)
    tax_exclusive_price = fields.Decimal(places=2,
                                         load_from='taxExclusivePrice')
    total = fields.Decimal(places=2)
    total_chinese = fields.Str(load_from='totalChinese')

    def only_create(self):
        return super().only_create() + \
               ('code', 'number', 'issue_date', 'machine_printed_code', 'machine_printed_number',
                'machine_number', 'fiscal_code', 'buyer_name', 'buyer_organization_number',
                'buyer_id', 'seller_name', 'seller_phone', 'seller_id', 'seller_account',
                'seller_address', 'seller_bank', 'vehicle_type', 'brand_model', 'manufacturing_location',
                'quality_certificate', 'import_certificate', 'inspection_number', 'engine_number',
                'vehicle_identification_number', 'tonnage', 'seating_capacity', 'tax_authority',
                'tax_authority_code', 'tax_payment_receipt', 'tax_rate', 'tax', 'tax_exclusive_price',
                'total', 'total_chinese')
Ejemplo n.º 14
0
class MvsiResultSchema(Schema):
    __AMOUNT = ['¥', '$']

    code = fields.Str(validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value))
    number = fields.Str(validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value))
    issue_date = fields.DateTime(format=date._TIME_FORMAT[0], load_from='issueDate')
    machine_printed_code = fields.Str(
        validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value),
        load_from='machinePrintedCode'
    )
    machine_printed_number = fields.Str(
        validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value),
        load_from='machinePrintedNumber'
    )
    machine_number = fields.Str(
        validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value),
        load_from='machineNumber'
    )
    fiscal_code = fields.Str(
        validate=MyValidates.MyLength(max=190, encode_str=Unicode.UTF_8.value),
        load_from='fiscalCode'
    )
    buyer_name = fields.Str(
        validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value),
        load_from='buyerName'
    )
    buyer_organization_number = fields.Str(
        validate=MyValidates.MyLength(max=30, encode_str=Unicode.UTF_8.value),
        load_from='buyerOrganizationNumber'
    )
    buyer_id = fields.Str(validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value), load_from='buyerId')
    seller_name = fields.Str(load_from='sellerName')
    seller_phone = fields.Str(
        validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value),
        load_from='sellerPhone'
    )
    seller_id = fields.Str(validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value), load_from='sellerId')
    seller_account = fields.Str(
        validate=MyValidates.MyLength(max=64, encode_str=Unicode.UTF_8.value),
        load_from='sellerAccount'
    )
    seller_address = fields.Str(load_from='sellerAddress')
    seller_bank = fields.Str(load_from='sellerBank')
    vehicle_type = fields.Str(load_from='vehicleType')
    brand_model = fields.Str(load_from='brandModel')
    manufacturing_location = fields.Str(
        validate=MyValidates.MyLength(max=225, encode_str=Unicode.UTF_8.value),
        load_from='manufacturingLocation'
    )
    quality_certificate = fields.Str(
        validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value),
        load_from='qualityCertificate'
    )
    import_certificate = fields.Str(
        validate=MyValidates.MyLength(max=18, encode_str=Unicode.UTF_8.value),
        load_from='importCertificate'
    )
    inspection_number = fields.Str(
        validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value),
        load_from='inspectionNumber'
    )
    engine_number = fields.Str(
        validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value),
        load_from='engineNumber'
    )
    vehicle_identification_number = fields.Str(
        validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value),
        load_from='vehicleIdentificationNumber'
    )
    tonnage = fields.Str(
        validate=MyValidates.MyLength(max=10, encode_str=Unicode.UTF_8.value),
    )
    seating_capacity = fields.Str(
        validate=MyValidates.MyLength(max=10, encode_str=Unicode.UTF_8.value),
        load_from='seatingCapacity'
    )
    tax_authority = fields.Str(load_from='taxAuthority')
    tax_authority_code = fields.Str(
        validate=MyValidates.MyLength(max=20, encode_str=Unicode.UTF_8.value),
        load_from='taxAuthorityCode'
    )
    tax_payment_receipt = fields.Str(
        validate=MyValidates.MyLength(max=18, encode_str=Unicode.UTF_8.value),
        load_from='taxPaymentReceipt'
    )
    tax_rate = fields.Str(
        validate=MyValidates.MyLength(max=6, encode_str=Unicode.UTF_8.value),
        load_from='taxRate'
    )
    tax = fields.Decimal(places=2)
    tax_exclusive_price = fields.Decimal(places=2, load_from='taxExclusivePrice')
    total = fields.Decimal(places=2)
    total_chinese = fields.Str(load_from='totalChinese')

    error_code = fields.Str(load_from='errorCode')
    error_msg = fields.Str(load_from='errorMsg')

    @pre_load
    def pre_load_data(self, data):
        """
        预处理数据
        :param data:
        :return:
        """
        issue_date = data.get('issue_date')
        if is_not_empty(issue_date):
            # noinspection PyBroadException
            try:
                date.str_to_time(issue_date)
            except:
                data['issue_date'] = None

        data['tax_exclusive_price'] = str_util.amount_formatting(data.get('tax_exclusive_price'), self.__AMOUNT)
        data['tax'] = str_util.amount_formatting(data.get('tax'), self.__AMOUNT)
        data['total'] = str_util.amount_formatting(data.get('total'), self.__AMOUNT)
        return data

    @post_load
    def make_object(self, data):
        return MvsiResult(**data)

    def only_success(self):
        return 'code', 'number', 'issue_date', 'machine_printed_code', 'machine_printed_number', \
               'machine_number', 'fiscal_code', 'buyer_name', 'buyer_organization_number',\
               'buyer_id', 'seller_name', 'seller_phone', 'seller_id', 'seller_account',\
               'seller_address', 'seller_bank', 'vehicle_type', 'brand_model', 'manufacturing_location',\
               'quality_certificate', 'import_certificate', 'inspection_number', 'engine_number',\
               'vehicle_identification_number', 'tonnage', 'seating_capacity', 'tax_authority',\
               'tax_authority_code', 'tax_payment_receipt', 'tax_rate', 'tax', 'tax_exclusive_price',\
               'total', 'total_chinese'

    def only_error(self):
        return 'error_code', 'error_msg'