import 'liveConsultation.m.dart'; import 'education.m.dart'; import 'notification.m.dart'; import 'package:fis_jsonrpc/utils.dart'; class CreateOrderResultDTO { String? orderCode; CreateOrderResultDTO({ this.orderCode, }); factory CreateOrderResultDTO.fromJson(Map map) { return CreateOrderResultDTO( orderCode: map['OrderCode'], ); } Map toJson() { final map = Map(); if (orderCode != null) { map['OrderCode'] = orderCode; } return map; } } enum OrderTypeEnum { General, } class CreateOrderRequest extends TokenRequest{ String? orderUserCode; String? productCode; String? tPORderCode; String? orderTitle; OrderTypeEnum orderType; double orderAmount; DateTime? payTime; PayStatusEnum payStatus; CreateOrderRequest({ this.orderUserCode, this.productCode, this.tPORderCode, this.orderTitle, this.orderType = OrderTypeEnum.General, this.orderAmount = 0, this.payTime, this.payStatus = PayStatusEnum.NoPay, String? token, }) : super( token: token, ); factory CreateOrderRequest.fromJson(Map map) { return CreateOrderRequest( orderUserCode: map['OrderUserCode'], productCode: map['ProductCode'], tPORderCode: map['TPORderCode'], orderTitle: map['OrderTitle'], orderType: OrderTypeEnum.values.firstWhere((e) => e.index == map['OrderType']), orderAmount: double.parse(map['OrderAmount'].toString()), payTime: map['PayTime'] != null ? DateTime.parse(map['PayTime']) : null, payStatus: PayStatusEnum.values.firstWhere((e) => e.index == map['PayStatus']), token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (orderUserCode != null) map['OrderUserCode'] = orderUserCode; if (productCode != null) map['ProductCode'] = productCode; if (tPORderCode != null) map['TPORderCode'] = tPORderCode; if (orderTitle != null) map['OrderTitle'] = orderTitle; map['OrderType'] = orderType.index; map['OrderAmount'] = orderAmount; if (payTime != null) map['PayTime'] = JsonRpcUtils.dateFormat(payTime!); map['PayStatus'] = payStatus.index; return map; } } class OrderDetailDTO extends BaseDTO{ String? code; String? orderUserName; String? orderUserCode; String? productCode; String? tPORderCode; String? orderTitle; OrderTypeEnum orderType; double orderAmount; DateTime? payTime; PayStatusEnum payStatus; OrderDetailDTO({ this.code, this.orderUserName, this.orderUserCode, this.productCode, this.tPORderCode, this.orderTitle, this.orderType = OrderTypeEnum.General, this.orderAmount = 0, this.payTime, this.payStatus = PayStatusEnum.NoPay, DateTime? createTime, DateTime? updateTime, }) : super( createTime: createTime, updateTime: updateTime, ); factory OrderDetailDTO.fromJson(Map map) { return OrderDetailDTO( code: map['Code'], orderUserName: map['OrderUserName'], orderUserCode: map['OrderUserCode'], productCode: map['ProductCode'], tPORderCode: map['TPORderCode'], orderTitle: map['OrderTitle'], orderType: OrderTypeEnum.values.firstWhere((e) => e.index == map['OrderType']), orderAmount: double.parse(map['OrderAmount'].toString()), payTime: map['PayTime'] != null ? DateTime.parse(map['PayTime']) : null, payStatus: PayStatusEnum.values.firstWhere((e) => e.index == map['PayStatus']), createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null, updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null, ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; if (orderUserName != null) map['OrderUserName'] = orderUserName; if (orderUserCode != null) map['OrderUserCode'] = orderUserCode; if (productCode != null) map['ProductCode'] = productCode; if (tPORderCode != null) map['TPORderCode'] = tPORderCode; if (orderTitle != null) map['OrderTitle'] = orderTitle; map['OrderType'] = orderType.index; map['OrderAmount'] = orderAmount; if (payTime != null) map['PayTime'] = JsonRpcUtils.dateFormat(payTime!); map['PayStatus'] = payStatus.index; return map; } } class GetOrderDetailRequest extends TokenRequest{ String? orderCode; GetOrderDetailRequest({ this.orderCode, String? token, }) : super( token: token, ); factory GetOrderDetailRequest.fromJson(Map map) { return GetOrderDetailRequest( orderCode: map['OrderCode'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (orderCode != null) map['OrderCode'] = orderCode; return map; } } class GetOrderPagesRequest extends PageRequest{ String? keyWord; GetOrderPagesRequest({ this.keyWord, int pageIndex = 0, int pageSize = 0, String? token, }) : super( pageIndex: pageIndex, pageSize: pageSize, token: token, ); factory GetOrderPagesRequest.fromJson(Map map) { return GetOrderPagesRequest( keyWord: map['KeyWord'], pageIndex: map['PageIndex'], pageSize: map['PageSize'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (keyWord != null) map['KeyWord'] = keyWord; return map; } } class PayInfoDTO { bool isSuccess; String? payUrl; PayInfoDTO({ this.isSuccess = false, this.payUrl, }); factory PayInfoDTO.fromJson(Map map) { return PayInfoDTO( isSuccess: map['IsSuccess'], payUrl: map['PayUrl'], ); } Map toJson() { final map = Map(); map['IsSuccess'] = isSuccess; if (payUrl != null) { map['PayUrl'] = payUrl; } return map; } } class GoToPayRequest extends TokenRequest{ PayTypeEnum payType; String? orderCode; GoToPayRequest({ this.payType = PayTypeEnum.Alipay_PAGE, this.orderCode, String? token, }) : super( token: token, ); factory GoToPayRequest.fromJson(Map map) { return GoToPayRequest( payType: PayTypeEnum.values.firstWhere((e) => e.index == map['PayType']), orderCode: map['OrderCode'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); map['PayType'] = payType.index; if (orderCode != null) map['OrderCode'] = orderCode; return map; } } class PayCallbackDTO extends BaseDTO{ bool isSuccess; PayCallbackDTO({ this.isSuccess = false, DateTime? createTime, DateTime? updateTime, }) : super( createTime: createTime, updateTime: updateTime, ); factory PayCallbackDTO.fromJson(Map map) { return PayCallbackDTO( isSuccess: map['IsSuccess'], createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null, updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null, ); } Map toJson() { final map = super.toJson(); map['IsSuccess'] = isSuccess; return map; } } class PayableTypeDTO { List? payTypes; PayableTypeDTO({ this.payTypes, }); factory PayableTypeDTO.fromJson(Map map) { return PayableTypeDTO( payTypes: map['PayTypes']?.cast().toList(), ); } Map toJson() { final map = Map(); if (payTypes != null) { map['PayTypes'] = payTypes; } return map; } }