29 lines
921 B
Dart
29 lines
921 B
Dart
/// 支付方式项(get-payment-methods 返回的 renew 单项)
|
||
class PaymentMethodItem {
|
||
const PaymentMethodItem({
|
||
required this.paymentMethod,
|
||
this.subPaymentMethod,
|
||
this.name,
|
||
this.icon,
|
||
this.recommend = false,
|
||
});
|
||
|
||
final String paymentMethod; // resource,如 GOOGLEPAY/APPLEPAY
|
||
final String? subPaymentMethod; // ceremony
|
||
final String? name; // brigade 展示名称
|
||
final String? icon; // greylist 图标 URL
|
||
final bool recommend; // deny 取反为推荐
|
||
|
||
factory PaymentMethodItem.fromJson(Map<String, dynamic> json) {
|
||
return PaymentMethodItem(
|
||
paymentMethod: json['resource']?.toString() ?? '',
|
||
subPaymentMethod: json['ceremony']?.toString(),
|
||
name: json['brigade']?.toString(),
|
||
icon: json['greylist']?.toString(),
|
||
recommend: json['deny'] != true,
|
||
);
|
||
}
|
||
|
||
String get displayName => name?.isNotEmpty == true ? name! : paymentMethod;
|
||
}
|