tdd 진행
This commit is contained in:
@@ -158,6 +158,45 @@ class SubscriptionPlan {
|
||||
required this.hasPriority,
|
||||
});
|
||||
|
||||
/// JSON에서 구독 플랜 객체 생성
|
||||
factory SubscriptionPlan.fromJson(Map<String, dynamic> json) {
|
||||
return SubscriptionPlan(
|
||||
type: SubscriptionPlanType.values.firstWhere(
|
||||
(e) => e.toString().split('.').last == json['type'],
|
||||
orElse: () => SubscriptionPlanType.free,
|
||||
),
|
||||
name: json['name'],
|
||||
description: json['description'],
|
||||
monthlyPrice: json['monthlyPrice'].toDouble(),
|
||||
yearlyPrice: json['yearlyPrice'].toDouble(),
|
||||
currency: json['currency'],
|
||||
features: List<String>.from(json['features']),
|
||||
maxMembers: json['maxMembers'],
|
||||
maxEvents: json['maxEvents'],
|
||||
hasAdvancedStats: json['hasAdvancedStats'] ?? false,
|
||||
hasCustomization: json['hasCustomization'] ?? false,
|
||||
hasPriority: json['hasPriority'] ?? false,
|
||||
);
|
||||
}
|
||||
|
||||
/// 구독 플랜 객체를 JSON으로 변환
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'type': type.toString().split('.').last,
|
||||
'name': name,
|
||||
'description': description,
|
||||
'monthlyPrice': monthlyPrice,
|
||||
'yearlyPrice': yearlyPrice,
|
||||
'currency': currency,
|
||||
'features': features,
|
||||
'maxMembers': maxMembers,
|
||||
'maxEvents': maxEvents,
|
||||
'hasAdvancedStats': hasAdvancedStats,
|
||||
'hasCustomization': hasCustomization,
|
||||
'hasPriority': hasPriority,
|
||||
};
|
||||
}
|
||||
|
||||
/// 기본 구독 플랜 목록 반환
|
||||
static List<SubscriptionPlan> getDefaultPlans() {
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user