fix: improve UX for legacy users migrating to tariff mode
- instant_switch handler: redirect legacy users (tariff_id=NULL) to tariff_switch migration flow instead of dead-end popup - autopay skip: notify user once (7-day cooldown) when autopay is skipped for legacy subscription, explaining they need to choose a tariff for autopay to work
This commit is contained in:
@@ -3382,7 +3382,8 @@ async def show_instant_switch_list(
|
||||
return
|
||||
|
||||
if not subscription.tariff_id:
|
||||
await callback.answer('У вашей подписки нет тарифа', show_alert=True)
|
||||
# Legacy subscription without tariff — redirect to tariff_switch migration flow
|
||||
await show_tariff_switch_list(callback, db_user, db, state)
|
||||
return
|
||||
|
||||
# Получаем текущий тариф
|
||||
|
||||
@@ -1082,6 +1082,25 @@ class MonitoringService:
|
||||
sub_id=sub.id,
|
||||
user_id=sub.user_id,
|
||||
)
|
||||
# Notify user once that autopay won't work without a tariff
|
||||
autopay_legacy_key = f'autopay_legacy_notified:{sub.user_id}'
|
||||
try:
|
||||
if not await cache.exists(autopay_legacy_key):
|
||||
user = sub.user
|
||||
if user and user.telegram_id and self.bot:
|
||||
await self.bot.send_message(
|
||||
chat_id=user.telegram_id,
|
||||
text=(
|
||||
'⚠️ <b>Автоплатёж приостановлен</b>\n\n'
|
||||
'Ваша подписка была создана до введения тарифов. '
|
||||
'Для работы автоплатежа необходимо выбрать тариф.\n\n'
|
||||
'Перейдите в раздел «Моя подписка» → «Продлить», чтобы выбрать тариф.'
|
||||
),
|
||||
parse_mode='HTML',
|
||||
)
|
||||
await cache.set(autopay_legacy_key, 1, expire=86400 * 7)
|
||||
except Exception as notify_err:
|
||||
logger.debug('Не удалось уведомить о пропуске autopay для legacy подписки', error=notify_err)
|
||||
continue
|
||||
|
||||
days_before_expiry = (sub.end_date - current_time).days
|
||||
|
||||
Reference in New Issue
Block a user