feat: 컨트롤러에 결제 금액 표시 로직 추가

This commit is contained in:
JiWoong Sul
2026-01-14 00:18:30 +09:00
parent a0b24f9a75
commit 6e7a7d2477
2 changed files with 41 additions and 13 deletions

View File

@@ -10,6 +10,7 @@ import '../services/subscription_url_matcher.dart';
import '../widgets/common/snackbar/app_snackbar.dart';
import '../l10n/app_localizations.dart';
import '../utils/billing_date_util.dart';
import '../utils/billing_cost_util.dart';
import 'package:permission_handler/permission_handler.dart' as permission;
/// AddSubscriptionScreen의 비즈니스 로직을 관리하는 Controller
@@ -485,14 +486,22 @@ class AddSubscriptionController {
try {
// 콤마 제거하고 숫자만 추출
final monthlyCost =
final inputCost =
double.parse(monthlyCostController.text.replaceAll(',', ''));
// 이벤트 가격 파싱
// 결제 주기에 따라 월 비용으로 변환
final monthlyCost =
BillingCostUtil.convertToMonthlyCost(inputCost, billingCycle);
// 이벤트 가격 파싱 및 월 비용 변환
double? eventPrice;
if (isEventActive && eventPriceController.text.isNotEmpty) {
eventPrice =
final inputEventPrice =
double.tryParse(eventPriceController.text.replaceAll(',', ''));
if (inputEventPrice != null) {
eventPrice =
BillingCostUtil.convertToMonthlyCost(inputEventPrice, billingCycle);
}
}
// 선택일이 오늘(또는 과거)이면 결제 주기에 맞춰 다음 회차로 보정하여 저장 + 영업일 이월