def validate_payment_type(self, value): try: if not value.data or value.data == "0": self.payment_type.data = None else: self.payment_type.data = PayTypeEnum(int(value.data)) except Exception as e: raise StopValidation("无效的payment_type")
def validate_pay_type(self, value): try: if value.data not in ["1", "2"]: raise StopValidation("无效的交易类型") self.pay_type.data = PayTypeEnum(int(value.data)) except Exception as e: raise StopValidation("无效的交易类型")
def order_type(self) -> PayTypeEnum: return PayTypeEnum(self._order_type)
def validate_type(self, value): try: self.type.data = PayTypeEnum(int(value.data)) except Exception as e: raise StopValidation("无效的订单类型")
def validate_pay_type(self, value): try: self.pay_type.data = PayTypeEnum(value.data) except Exception as e: raise StopValidation("无效的pay_type")
def payment_way(self) -> PayTypeEnum: return PayTypeEnum(self._p_way)