215 lines
5.0 KiB
Dart
215 lines
5.0 KiB
Dart
import 'entity.dart';
|
|
|
|
/// 支付商品项
|
|
class PaymentProductItem extends Entity {
|
|
PaymentProductItem({
|
|
this.productId,
|
|
this.activityId,
|
|
this.actualAmount,
|
|
this.originAmount,
|
|
this.bonus,
|
|
this.title,
|
|
});
|
|
|
|
final String? productId;
|
|
final String? activityId;
|
|
final String? actualAmount;
|
|
final String? originAmount;
|
|
final int? bonus;
|
|
final String? title;
|
|
|
|
@override
|
|
factory PaymentProductItem.fromJson(Map<String, dynamic> json) {
|
|
return PaymentProductItem(
|
|
productId: json['productId'] as String?,
|
|
activityId: json['activityId'] as String?,
|
|
actualAmount: json['actualAmount'] as String?,
|
|
originAmount: json['originAmount'] as String?,
|
|
bonus: json['bonus'] as int?,
|
|
title: json['title'] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'productId': productId,
|
|
'activityId': activityId,
|
|
'actualAmount': actualAmount,
|
|
'originAmount': originAmount,
|
|
'bonus': bonus,
|
|
'title': title,
|
|
};
|
|
}
|
|
|
|
/// 支付商品列表响应
|
|
class PaymentProductsResponse extends Entity {
|
|
PaymentProductsResponse({
|
|
this.productList,
|
|
});
|
|
|
|
final List<PaymentProductItem>? productList;
|
|
|
|
@override
|
|
factory PaymentProductsResponse.fromJson(Map<String, dynamic> json) {
|
|
final list = json['productList'] as List<dynamic>?;
|
|
return PaymentProductsResponse(
|
|
productList: list
|
|
?.map((e) => PaymentProductItem.fromJson(e as Map<String, dynamic>))
|
|
.toList(),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'productList': productList?.map((e) => e.toJson()).toList(),
|
|
};
|
|
}
|
|
|
|
/// 支付方式项
|
|
class PaymentMethodItem extends Entity {
|
|
PaymentMethodItem({
|
|
this.paymentMethod,
|
|
this.subPaymentMethod,
|
|
this.name,
|
|
this.icon,
|
|
this.recommend,
|
|
});
|
|
|
|
final String? paymentMethod;
|
|
final String? subPaymentMethod;
|
|
final String? name;
|
|
final String? icon;
|
|
final bool? recommend;
|
|
|
|
@override
|
|
factory PaymentMethodItem.fromJson(Map<String, dynamic> json) {
|
|
return PaymentMethodItem(
|
|
paymentMethod: json['paymentMethod'] as String?,
|
|
subPaymentMethod: json['subPaymentMethod'] as String?,
|
|
name: json['name'] as String?,
|
|
icon: json['icon'] as String?,
|
|
recommend: json['recommend'] as bool?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'paymentMethod': paymentMethod,
|
|
'subPaymentMethod': subPaymentMethod,
|
|
'name': name,
|
|
'icon': icon,
|
|
'recommend': recommend,
|
|
};
|
|
}
|
|
|
|
/// 支付方式列表响应
|
|
class PaymentMethodsResponse extends Entity {
|
|
PaymentMethodsResponse({
|
|
this.paymentMethods,
|
|
});
|
|
|
|
final List<PaymentMethodItem>? paymentMethods;
|
|
|
|
@override
|
|
factory PaymentMethodsResponse.fromJson(Map<String, dynamic> json) {
|
|
final list = json['paymentMethods'] as List<dynamic>?;
|
|
return PaymentMethodsResponse(
|
|
paymentMethods: list
|
|
?.map((e) => PaymentMethodItem.fromJson(e as Map<String, dynamic>))
|
|
.toList(),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'paymentMethods': paymentMethods?.map((e) => e.toJson()).toList(),
|
|
};
|
|
}
|
|
|
|
/// 创建订单响应
|
|
class CreatePaymentResponse extends Entity {
|
|
CreatePaymentResponse({
|
|
this.orderId,
|
|
this.payUrl,
|
|
this.status,
|
|
});
|
|
|
|
final String? orderId;
|
|
final String? payUrl;
|
|
final String? status;
|
|
|
|
@override
|
|
factory CreatePaymentResponse.fromJson(Map<String, dynamic> json) {
|
|
return CreatePaymentResponse(
|
|
orderId: json['orderId'] as String?,
|
|
payUrl: json['payUrl'] as String?,
|
|
status: json['status'] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'orderId': orderId,
|
|
'payUrl': payUrl,
|
|
'status': status,
|
|
};
|
|
}
|
|
|
|
/// 订单详情响应
|
|
class OrderDetailResponse extends Entity {
|
|
OrderDetailResponse({
|
|
this.orderId,
|
|
this.status,
|
|
this.amount,
|
|
});
|
|
|
|
final String? orderId;
|
|
final String? status;
|
|
final String? amount;
|
|
|
|
@override
|
|
factory OrderDetailResponse.fromJson(Map<String, dynamic> json) {
|
|
return OrderDetailResponse(
|
|
orderId: json['orderId'] as String?,
|
|
status: json['status'] as String?,
|
|
amount: json['amount'] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'orderId': orderId,
|
|
'status': status,
|
|
'amount': amount,
|
|
};
|
|
}
|
|
|
|
/// Google Pay 回调响应
|
|
class GooglePayCallbackResponse extends Entity {
|
|
GooglePayCallbackResponse({
|
|
this.orderId,
|
|
this.status,
|
|
this.creditsAdded,
|
|
});
|
|
|
|
final String? orderId;
|
|
final String? status;
|
|
final bool? creditsAdded;
|
|
|
|
@override
|
|
factory GooglePayCallbackResponse.fromJson(Map<String, dynamic> json) {
|
|
return GooglePayCallbackResponse(
|
|
orderId: json['orderId'] as String?,
|
|
status: json['status'] as String?,
|
|
creditsAdded: json['creditsAdded'] as bool?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'orderId': orderId,
|
|
'status': status,
|
|
'creditsAdded': creditsAdded,
|
|
};
|
|
}
|