2025-11-16 11:25:27 +00:00
|
|
|
import 'package:mnemo_cards_common_backend/mnemo_cards_common_backend.dart';
|
|
|
|
|
import 'package:mnemo_cards_common/mnemo_cards_common.dart';
|
|
|
|
|
|
|
|
|
|
extension SubscriptionPlanModelExt on SubscriptionPlanModel {
|
|
|
|
|
Future<SubscriptionPlanDto> toDto() async {
|
|
|
|
|
return SubscriptionPlanDto(
|
|
|
|
|
id: id?.toString() ?? '',
|
|
|
|
|
titleLead: ui?.titleLead?.notEmptyOrNull,
|
|
|
|
|
title: ui?.title?.notEmptyOrNull,
|
|
|
|
|
subtitle: ui?.subtitle?.notEmptyOrNull,
|
|
|
|
|
subtitleCrossed: ui?.subtitleCrossed?.notEmptyOrNull,
|
|
|
|
|
price: price,
|
|
|
|
|
pricePerMonth: ui?.pricePerMonth?.notEmptyOrNull,
|
|
|
|
|
currency: currency,
|
|
|
|
|
tip: ui?.tip?.notEmptyOrNull,
|
|
|
|
|
tipColor: ui?.tipColor?.notEmptyOrNull,
|
|
|
|
|
features: features,
|
|
|
|
|
deeplink: PurchaseInitDeeplink(
|
|
|
|
|
id: id.toString(),
|
|
|
|
|
productType: MnemoCardsProductType.subscription,
|
|
|
|
|
paymentId: paymentId?.notEmptyOrNull ?? '',
|
|
|
|
|
paymentSystem: paymentSystem,
|
|
|
|
|
).uri.toString(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<SubscriptionPlanAdminDto> toAdminDto() async {
|
|
|
|
|
return SubscriptionPlanAdminDto(
|
|
|
|
|
id: id?.toString(),
|
|
|
|
|
price: price,
|
|
|
|
|
ui: ui?.toDto() ?? SubscriptionPlanUIDto(),
|
|
|
|
|
currency: currency,
|
|
|
|
|
durationDays: durationDays,
|
|
|
|
|
features: features,
|
|
|
|
|
paymentId: paymentId?.notEmptyOrNull,
|
|
|
|
|
paymentSystem: paymentSystem,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension SubscriptionPlanUIExt on SubscriptionPlanUI {
|
|
|
|
|
SubscriptionPlanUIDto toDto() => SubscriptionPlanUIDto(
|
2025-12-20 18:26:15 +00:00
|
|
|
titleLead: titleLead?.notEmptyOrNull,
|
|
|
|
|
title: title?.notEmptyOrNull,
|
|
|
|
|
subtitle: subtitle?.notEmptyOrNull,
|
|
|
|
|
subtitleCrossed: subtitleCrossed?.notEmptyOrNull,
|
|
|
|
|
pricePerMonth: pricePerMonth?.notEmptyOrNull,
|
|
|
|
|
currency: currency?.notEmptyOrNull,
|
|
|
|
|
tip: tip?.notEmptyOrNull,
|
|
|
|
|
tipColor: tipColor?.notEmptyOrNull,
|
|
|
|
|
);
|
2025-11-16 11:25:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension SubscriptionPlanUIDtoExt on SubscriptionPlanUIDto {
|
|
|
|
|
SubscriptionPlanUI toModel() => SubscriptionPlanUI(
|
2025-12-20 18:26:15 +00:00
|
|
|
titleLead: titleLead,
|
|
|
|
|
title: title,
|
|
|
|
|
subtitle: subtitle,
|
|
|
|
|
subtitleCrossed: subtitleCrossed,
|
|
|
|
|
pricePerMonth: pricePerMonth,
|
|
|
|
|
currency: currency,
|
|
|
|
|
tip: tip,
|
|
|
|
|
tipColor: tipColor,
|
|
|
|
|
);
|
2025-11-16 11:25:27 +00:00
|
|
|
}
|