petsHero-AI/lib/features/recharge/models/payment_method_item.dart
2026-03-12 20:40:37 +08:00

29 lines
936 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/// 支付方式项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 为 true 时显示 Recommended
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;
}