fix: add tariff identification to remaining notification gaps

- MiniApp renewal success message: add tariff label to _build_renewal_success_message
- Admin buy subscription: add tariff line to user notification
- Promocode subscription days: add tariff label to effect message
- Fix cosmetic double-space in autopay success tariff line
This commit is contained in:
Fringg
2026-03-28 19:19:18 +03:00
parent 092b9f63b2
commit cddb8d6332
4 changed files with 30 additions and 7 deletions
+5 -1
View File
@@ -4990,12 +4990,16 @@ async def admin_buy_subscription_execute(callback: types.CallbackQuery, db_user:
try:
if callback.bot and target_user.telegram_id:
tariff_line = ''
if settings.is_multi_tariff_enabled() and getattr(subscription, 'tariff', None):
tariff_line = f'\n📦 Тариф: «{subscription.tariff.name}»'
await callback.bot.send_message(
chat_id=target_user.telegram_id,
text=f'💳 <b>Администратор продлил вашу подписку</b>\n\n'
f'📅 Подписка продлена на {period_days} дней\n'
f'💰 Списано с баланса: {settings.format_price(price_kopeks)}\n'
f'📅 Подписка действительна до: {format_datetime(subscription.end_date)}',
f'📅 Подписка действительна до: {format_datetime(subscription.end_date)}'
f'{tariff_line}',
parse_mode='HTML',
)
except Exception as e:
+1 -1
View File
@@ -1795,7 +1795,7 @@ class MonitoringService:
tariff_label = f' «{subscription.tariff.name}»'
message = texts.AUTOPAY_SUCCESS.format(days=days, amount=settings.format_price(amount))
if tariff_label:
message += f'\n📦 Тариф: {tariff_label}'
message += f'\n📦 Тариф:{tariff_label}'
await self._send_message_with_logo(
chat_id=user.telegram_id,
text=message,
+4 -1
View File
@@ -336,7 +336,10 @@ class PromoCodeService:
await extend_subscription(db, target_sub, promocode.subscription_days)
await self.subscription_service.update_remnawave_user(db, target_sub)
effects.append(f'⏰ Подписка продлена на {promocode.subscription_days} дней')
tariff_label = ''
if settings.is_multi_tariff_enabled() and getattr(target_sub, 'tariff', None):
tariff_label = f' «{target_sub.tariff.name}»'
effects.append(f'⏰ Подписка{tariff_label} продлена на {promocode.subscription_days} дней')
logger.info(
'✅ Подписка пользователя продлена на дней в RemnaWave',
_format_user_log=self._format_user_log(user),
+20 -4
View File
@@ -4484,19 +4484,35 @@ def _build_renewal_success_message(
amount_label = settings.format_price(max(0, charged_amount))
date_label = format_local_datetime(subscription.end_date, '%d.%m.%Y %H:%M') if subscription.end_date else ''
tariff_label = ''
if settings.is_multi_tariff_enabled() and getattr(subscription, 'tariff', None):
tariff_label = f' «{subscription.tariff.name}»'
if language_code in {'ru', 'fa'}:
if charged_amount > 0:
message = (
f'Подписка продлена до {date_label}. ' if date_label else 'Подписка продлена. '
f'Подписка{tariff_label} продлена до {date_label}. '
if date_label
else f'Подписка{tariff_label} продлена. '
) + f'Списано {amount_label}.'
else:
message = f'Подписка продлена до {date_label}.' if date_label else 'Подписка успешно продлена.'
message = (
f'Подписка{tariff_label} продлена до {date_label}.'
if date_label
else f'Подписка{tariff_label} успешно продлена.'
)
elif charged_amount > 0:
message = (
f'Subscription renewed until {date_label}. ' if date_label else 'Subscription renewed. '
f'Subscription{tariff_label} renewed until {date_label}. '
if date_label
else f'Subscription{tariff_label} renewed. '
) + f'Charged {amount_label}.'
else:
message = f'Subscription renewed until {date_label}.' if date_label else 'Subscription renewed successfully.'
message = (
f'Subscription{tariff_label} renewed until {date_label}.'
if date_label
else f'Subscription{tariff_label} renewed successfully.'
)
if promo_discount_value > 0:
discount_label = settings.format_price(promo_discount_value)