diff --git a/bot.py b/bot.py
index 2fc73df3..b4a303e4 100644
--- a/bot.py
+++ b/bot.py
@@ -18,7 +18,7 @@ bot = Bot(token=API_TOKEN, default=DefaultBotProperties(parse_mode=ParseMode.HTM
storage = MemoryStorage()
dp = Dispatcher(bot=bot, storage=storage)
-version = "4.0.0-preAlpha(14-dev)"
+version = "4.0.0-Alpha(01-dev)"
register_middleware(dp)
diff --git a/database.py b/database.py
index 7c694e55..5d8149fd 100644
--- a/database.py
+++ b/database.py
@@ -5,7 +5,7 @@ from typing import Any
import asyncpg
import pytz
-from config import DATABASE_URL, REFERRAL_BONUS_PERCENTAGES
+from config import CASHBACK, DATABASE_URL, REFERRAL_BONUS_PERCENTAGES
from logger import logger
@@ -492,6 +492,25 @@ async def get_keys_by_server(tg_id: int | None, server_id: str, session: Any):
raise
+async def get_key_by_server(tg_id: int, client_id: str, session: Any):
+ query = """
+ SELECT
+ tg_id,
+ client_id,
+ email,
+ created_at,
+ expiry_time,
+ key,
+ server_id,
+ notified,
+ notified_24h
+ FROM keys
+ WHERE tg_id = $1 AND client_id = $2
+ """
+ record = await session.fetchrow(query, tg_id, client_id)
+ return record
+
+
async def get_balance(tg_id: int) -> float:
"""
Получает баланс пользователя из базы данных.
@@ -521,15 +540,15 @@ async def get_balance(tg_id: int) -> float:
async def update_balance(tg_id: int, amount: float, session: Any = None):
"""
- Обновляет баланс пользователя в базе данных.
+ Обновляет баланс пользователя в базе данных с учетом кэшбека.
Args:
- tg_id (int): Telegram ID пользователя
- amount (float): Сумма для обновления баланса
+ tg_id (int): Telegram ID пользователя.
+ amount (float): Сумма для обновления баланса.
session (Any, optional): Сессия базы данных. Если не передана, создается новая.
Raises:
- Exception: В случае ошибки при подключении к базе данных или обновлении баланса
+ Exception: В случае ошибки при подключении к базе данных или обновлении баланса.
"""
conn = None
try:
@@ -537,16 +556,21 @@ async def update_balance(tg_id: int, amount: float, session: Any = None):
conn = await asyncpg.connect(DATABASE_URL)
session = conn
+ extra = amount * (CASHBACK / 100.0) if CASHBACK > 0 else 0
+ total_amount = amount + extra
+
await session.execute(
"""
UPDATE connections
SET balance = balance + $1
WHERE tg_id = $2
""",
- amount,
+ total_amount,
tg_id,
)
- logger.info(f"Баланс пользователя {tg_id} обновлен на сумму {amount}")
+ logger.info(
+ f"Баланс пользователя {tg_id} обновлен на сумму {total_amount} (исходная сумма {amount}, кэшбек {extra})"
+ )
await handle_referral_on_balance_update(tg_id, amount)
diff --git a/handlers/admin/admin_coupons.py b/handlers/admin/admin_coupons.py
index 77f45797..64510d48 100644
--- a/handlers/admin/admin_coupons.py
+++ b/handlers/admin/admin_coupons.py
@@ -5,6 +5,7 @@ from aiogram.fsm.context import FSMContext
from aiogram.fsm.state import State, StatesGroup
from aiogram.types import CallbackQuery, Message
+from config import USERNAME_BOT
from database import create_coupon, delete_coupon, get_all_coupons
from filters.admin import IsAdminFilter
from keyboards.admin.coupons_kb import AdminCouponDeleteCallback, build_coupons_kb, build_coupons_list_kb
@@ -131,7 +132,8 @@ async def handle_coupons_list(callback_query: CallbackQuery, session: Any):
f"🏷️ Код: {coupon['code']}\n"
f"💰 Сумма: {coupon['amount']} рублей\n"
f"🔢 Лимит использования: {coupon['usage_limit']} раз\n"
- f"✅ Использовано: {coupon['usage_count']} раз\n\n"
+ f"✅ Использовано: {coupon['usage_count']} раз\n"
+ f"🔗 Ссылка: https://t.me/{USERNAME_BOT}?start=coupons_{coupon['code']}\n"
)
await callback_query.message.edit_text(text=coupon_list, reply_markup=kb)
diff --git a/handlers/admin/admin_panel.py b/handlers/admin/admin_panel.py
index a2fb540b..69ef4627 100644
--- a/handlers/admin/admin_panel.py
+++ b/handlers/admin/admin_panel.py
@@ -1,4 +1,4 @@
-from aiogram import F, Router, types
+from aiogram import F, Router
from aiogram.filters import Command
from aiogram.fsm.context import FSMContext
from aiogram.types import CallbackQuery, Message
diff --git a/handlers/admin/admin_sender.py b/handlers/admin/admin_sender.py
index 6e236045..b771101c 100644
--- a/handlers/admin/admin_sender.py
+++ b/handlers/admin/admin_sender.py
@@ -1,14 +1,14 @@
from datetime import datetime
from typing import Any
-from aiogram import F, Router, types
+from aiogram import F, Router
from aiogram.fsm.context import FSMContext
from aiogram.fsm.state import State, StatesGroup
from aiogram.types import CallbackQuery, Message
from filters.admin import IsAdminFilter
from keyboards.admin.panel_kb import AdminPanelCallback, build_admin_back_kb
-from keyboards.admin.sender_kb import AdminSenderCallback, build_sender_kb, build_clusters_kb
+from keyboards.admin.sender_kb import AdminSenderCallback, build_clusters_kb, build_sender_kb
from logger import logger
router = Router()
diff --git a/handlers/admin/admin_servers.py b/handlers/admin/admin_servers.py
index efffc44c..ac16235e 100644
--- a/handlers/admin/admin_servers.py
+++ b/handlers/admin/admin_servers.py
@@ -106,6 +106,13 @@ async def handle_server_name_input(message: Message, state: FSMContext, session:
server_name = message.text.strip()
+ if len(server_name) > 14:
+ await message.answer(
+ text="❌ Имя сервера не должно превышать 10 символов. Попробуйте снова.",
+ reply_markup=build_admin_back_kb("servers"),
+ )
+ return
+
user_data = await state.get_data()
cluster_name = user_data.get("cluster_name")
@@ -234,7 +241,7 @@ async def handle_inbound_id_input(message: Message, state: FSMContext):
@router.callback_query(AdminServerEditorCallback.filter(F.action == "clusters_manage"), IsAdminFilter())
async def handle_clusters_manage(
- callback_query: types.CallbackQuery, callback_data: AdminServerEditorCallback, session: Any
+ callback_query: types.CallbackQuery, callback_data: AdminServerEditorCallback, session: Any
):
cluster_name = callback_data.data
@@ -249,7 +256,7 @@ async def handle_clusters_manage(
@router.callback_query(AdminServerEditorCallback.filter(F.action == "servers_availability"), IsAdminFilter())
async def handle_servers_availability(
- callback_query: types.CallbackQuery, callback_data: AdminServerEditorCallback, session: Any
+ callback_query: types.CallbackQuery, callback_data: AdminServerEditorCallback, session: Any
):
cluster_name = callback_data.data
@@ -325,7 +332,7 @@ async def handle_servers_delete(callback_query: CallbackQuery, callback_data: Ad
@router.callback_query(AdminServerEditorCallback.filter(F.action == "servers_delete_confirm"), IsAdminFilter())
async def handle_servers_delete_confirm(
- callback_query: types.CallbackQuery, callback_data: AdminServerEditorCallback, session: Any
+ callback_query: types.CallbackQuery, callback_data: AdminServerEditorCallback, session: Any
):
server_name = callback_data.data
@@ -338,7 +345,7 @@ async def handle_servers_delete_confirm(
@router.callback_query(AdminServerEditorCallback.filter(F.action == "servers_add"), IsAdminFilter())
async def handle_servers_add(
- callback_query: types.CallbackQuery, callback_data: AdminServerEditorCallback, state: FSMContext
+ callback_query: types.CallbackQuery, callback_data: AdminServerEditorCallback, state: FSMContext
):
cluster_name = callback_data.data
@@ -360,7 +367,7 @@ async def handle_servers_add(
@router.callback_query(AdminServerEditorCallback.filter(F.action == "clusters_backup"), IsAdminFilter())
async def handle_clusters_backup(
- callback_query: types.CallbackQuery, callback_data: AdminServerEditorCallback, session: Any
+ callback_query: types.CallbackQuery, callback_data: AdminServerEditorCallback, session: Any
):
cluster_name = callback_data.data
@@ -388,7 +395,7 @@ async def handle_clusters_backup(
@router.callback_query(AdminServerEditorCallback.filter(F.action == "clusters_sync"), IsAdminFilter())
async def handle_clusters_backup(
- callback_query: types.CallbackQuery, callback_data: AdminServerEditorCallback, session: Any
+ callback_query: types.CallbackQuery, callback_data: AdminServerEditorCallback, session: Any
):
cluster_name = callback_data.data
@@ -426,11 +433,10 @@ async def handle_clusters_backup(
await callback_query.message.answer(
text=f"✅ Ключи успешно синхронизированы для кластера {cluster_name}",
- reply_markup=build_admin_back_kb("servers")
+ reply_markup=build_admin_back_kb("servers"),
)
except Exception as e:
logger.error(f"Ошибка синхронизации ключей в кластере {cluster_name}: {e}")
await callback_query.message.answer(
- text=f"❌ Произошла ошибка при синхронизации: {e}",
- reply_markup=build_admin_back_kb("servers")
+ text=f"❌ Произошла ошибка при синхронизации: {e}", reply_markup=build_admin_back_kb("servers")
)
diff --git a/handlers/admin/admin_users.py b/handlers/admin/admin_users.py
index 9b35ad2d..02c92447 100644
--- a/handlers/admin/admin_users.py
+++ b/handlers/admin/admin_users.py
@@ -9,8 +9,16 @@ from aiogram.fsm.state import State, StatesGroup
from aiogram.types import CallbackQuery, Message
from config import TOTAL_GB
-from database import delete_key, delete_user_data, get_client_id_by_email, get_servers, update_key_expiry, update_trial, \
- get_balance, update_balance
+from database import (
+ delete_key,
+ delete_user_data,
+ get_balance,
+ get_client_id_by_email,
+ get_servers,
+ update_balance,
+ update_key_expiry,
+ update_trial,
+)
from filters.admin import IsAdminFilter
from handlers.keys.key_utils import (
delete_key_from_cluster,
@@ -132,13 +140,12 @@ async def handle_key_name_input(message: Message, state: FSMContext, session: An
IsAdminFilter(),
)
async def handle_send_message(
- callback_query: types.CallbackQuery, callback_data: AdminUserEditorCallback, state: FSMContext
+ callback_query: types.CallbackQuery, callback_data: AdminUserEditorCallback, state: FSMContext
):
tg_id = callback_data.tg_id
await callback_query.message.edit_text(
- text="✉️ Введите текст сообщения, которое вы хотите отправить пользователю:",
- reply_markup=build_editor_kb(tg_id)
+ text="✉️ Введите текст сообщения, которое вы хотите отправить пользователю:", reply_markup=build_editor_kb(tg_id)
)
await state.update_data(tg_id=tg_id)
@@ -164,7 +171,7 @@ async def handle_message_text_input(message: Message, state: FSMContext):
IsAdminFilter(),
)
async def handle_trial_restore(
- callback_query: types.CallbackQuery, callback_data: AdminUserEditorCallback, session: Any
+ callback_query: types.CallbackQuery, callback_data: AdminUserEditorCallback, session: Any
):
tg_id = callback_data.tg_id
@@ -215,7 +222,7 @@ async def handle_balance_change(callback_query: CallbackQuery, callback_data: Ad
@router.callback_query(AdminUserEditorCallback.filter(F.action == "users_balance_add"), IsAdminFilter())
async def handle_balance_add(
- callback_query: CallbackQuery, callback_data: AdminUserEditorCallback, state: FSMContext, session: Any
+ callback_query: CallbackQuery, callback_data: AdminUserEditorCallback, state: FSMContext, session: Any
):
tg_id = callback_data.tg_id
amount = callback_data.data
@@ -289,8 +296,10 @@ async def handle_balance_input(message: Message, state: FSMContext, session: Any
@router.callback_query(AdminUserEditorCallback.filter(F.action == "users_key_edit"), IsAdminFilter())
async def handle_key_edit(
- callback_query: CallbackQuery, callback_data: AdminUserEditorCallback | AdminUserKeyEditorCallback,
- session: Any, update: bool = False
+ callback_query: CallbackQuery,
+ callback_data: AdminUserEditorCallback | AdminUserKeyEditorCallback,
+ session: Any,
+ update: bool = False,
):
email = callback_data.data
key_details = await get_key_details(email, session)
@@ -328,7 +337,7 @@ async def handle_change_expiry(callback_query: CallbackQuery, callback_data: Adm
@router.callback_query(AdminUserKeyEditorCallback.filter(F.action == "add"), IsAdminFilter())
async def handle_expiry_add(
- callback_query: CallbackQuery, callback_data: AdminUserKeyEditorCallback, state: FSMContext, session: Any
+ callback_query: CallbackQuery, callback_data: AdminUserKeyEditorCallback, state: FSMContext, session: Any
):
tg_id = callback_data.tg_id
email = callback_data.data
@@ -359,7 +368,7 @@ async def handle_expiry_add(
@router.callback_query(AdminUserKeyEditorCallback.filter(F.action == "take"), IsAdminFilter())
async def handle_expiry_take(
- callback_query: CallbackQuery, callback_data: AdminUserKeyEditorCallback, state: FSMContext
+ callback_query: CallbackQuery, callback_data: AdminUserKeyEditorCallback, state: FSMContext
):
tg_id = callback_data.tg_id
email = callback_data.data
@@ -375,7 +384,7 @@ async def handle_expiry_take(
@router.callback_query(AdminUserKeyEditorCallback.filter(F.action == "set"), IsAdminFilter())
async def handle_expiry_set(
- callback_query: CallbackQuery, callback_data: AdminUserKeyEditorCallback, state: FSMContext, session: Any
+ callback_query: CallbackQuery, callback_data: AdminUserKeyEditorCallback, state: FSMContext, session: Any
):
tg_id = callback_data.tg_id
email = callback_data.data
@@ -480,7 +489,7 @@ async def handle_delete_key(callback_query: CallbackQuery, callback_data: AdminU
@router.callback_query(AdminUserEditorCallback.filter(F.action == "users_delete_key_confirm"), IsAdminFilter())
async def handle_delete_key_confirm(
- callback_query: types.CallbackQuery, callback_data: AdminUserEditorCallback, session: Any
+ callback_query: types.CallbackQuery, callback_data: AdminUserEditorCallback, session: Any
):
email = callback_data.data
record = await session.fetchrow("SELECT client_id FROM keys WHERE email = $1", email)
@@ -516,7 +525,7 @@ async def handle_delete_user(callback_query: CallbackQuery, callback_data: Admin
@router.callback_query(AdminUserEditorCallback.filter(F.action == "users_delete_user_confirm"), IsAdminFilter())
async def handle_delete_user_confirm(
- callback_query: types.CallbackQuery, callback_data: AdminUserEditorCallback, session: Any
+ callback_query: types.CallbackQuery, callback_data: AdminUserEditorCallback, session: Any
):
tg_id = callback_data.tg_id
key_records = await session.fetch("SELECT email, client_id FROM keys WHERE tg_id = $1", tg_id)
@@ -548,13 +557,13 @@ async def handle_delete_user_confirm(
@router.callback_query(AdminUserEditorCallback.filter(F.action == "users_editor"), IsAdminFilter())
async def handle_editor(
- callback_query: types.CallbackQuery, callback_data: AdminUserEditorCallback, state: FSMContext, session: Any
+ callback_query: types.CallbackQuery, callback_data: AdminUserEditorCallback, state: FSMContext, session: Any
):
await process_user_search(callback_query.message, state, session, callback_data.tg_id, callback_data.edit)
async def process_user_search(
- message: types.Message, state: FSMContext, session: Any, tg_id: int, edit: bool = False
+ message: types.Message, state: FSMContext, session: Any, tg_id: int, edit: bool = False
) -> None:
await state.clear()
diff --git a/handlers/coupons.py b/handlers/coupons.py
index 0976d8dc..aa8c7875 100644
--- a/handlers/coupons.py
+++ b/handlers/coupons.py
@@ -1,6 +1,6 @@
from typing import Any
-from aiogram import F, Router, types
+from aiogram import F, Router
from aiogram.fsm.context import FSMContext
from aiogram.fsm.state import State, StatesGroup
from aiogram.types import CallbackQuery, InlineKeyboardButton, Message
diff --git a/handlers/donate.py b/handlers/donate.py
index 552c4b8d..73d6f76e 100644
--- a/handlers/donate.py
+++ b/handlers/donate.py
@@ -1,4 +1,4 @@
-from aiogram import F, Router, types
+from aiogram import F, Router
from aiogram.fsm.context import FSMContext
from aiogram.fsm.state import State, StatesGroup
from aiogram.types import CallbackQuery, InlineKeyboardButton, LabeledPrice, Message, PreCheckoutQuery
diff --git a/handlers/keys/key_management.py b/handlers/keys/key_management.py
index 3330f2da..d82a6863 100644
--- a/handlers/keys/key_management.py
+++ b/handlers/keys/key_management.py
@@ -6,12 +6,15 @@ from typing import Any
import pytz
from aiogram import F, Router
from aiogram.fsm.context import FSMContext
-from aiogram.fsm.state import State, StatesGroup
from aiogram.types import CallbackQuery, InlineKeyboardButton, Message
from aiogram.utils.keyboard import InlineKeyboardBuilder
+from py3xui import AsyncApi
from bot import bot
+from client import delete_client
from config import (
+ ADMIN_PASSWORD,
+ ADMIN_USERNAME,
CONNECT_ANDROID,
CONNECT_IOS,
DOWNLOAD_ANDROID,
@@ -25,6 +28,7 @@ from config import (
)
from database import (
create_temporary_data,
+ delete_key,
get_balance,
get_key_details,
get_trial,
@@ -48,22 +52,21 @@ from logger import logger
router = Router()
+moscow_tz = pytz.timezone("Europe/Moscow")
-class Form(StatesGroup):
- waiting_for_server_selection = State()
- waiting_for_key_name = State()
- viewing_profile = State()
- waiting_for_message = State()
+
+class Form(FSMContext):
+ waiting_for_server_selection = "waiting_for_server_selection"
+ waiting_for_key_name = "waiting_for_key_name"
+ viewing_profile = "viewing_profile"
+ waiting_for_message = "waiting_for_message"
@router.callback_query(F.data == "create_key")
async def confirm_create_new_key(callback_query: CallbackQuery, state: FSMContext, session: Any):
tg_id = callback_query.message.chat.id
-
logger.info(f"User {tg_id} confirmed creation of a new key.")
-
logger.info(f"Balance for user {tg_id} is sufficient. Proceeding with key creation.")
-
await handle_key_creation(tg_id, state, session, callback_query)
@@ -74,37 +77,30 @@ async def handle_key_creation(
message_or_query: Message | CallbackQuery,
):
"""Создание ключа с учётом выбора тарифного плана."""
- current_time = datetime.utcnow()
+ current_time = datetime.now(moscow_tz)
trial_status = await get_trial(tg_id, session)
if trial_status == 0:
expiry_time = current_time + timedelta(days=TRIAL_TIME)
- logger.info(f"Assigned 1-day trial to user {tg_id}.")
-
+ logger.info(f"Assigned {TRIAL_TIME}-дневный пробный период пользователю {tg_id}.")
await session.execute("UPDATE connections SET trial = 1 WHERE tg_id = $1", tg_id)
await create_key(tg_id, expiry_time, state, session, message_or_query)
else:
builder = InlineKeyboardBuilder()
-
for index, (plan_id, price) in enumerate(RENEWAL_PRICES.items()):
discount_text = ""
-
if plan_id in DISCOUNTS:
discount_percentage = DISCOUNTS[plan_id]
discount_text = f" ({discount_percentage}% скидка)"
-
if index == len(RENEWAL_PRICES) - 1:
discount_text = f" ({discount_percentage}% 🔥)"
-
builder.row(
InlineKeyboardButton(
text=f"📅 {plan_id} мес. - {price}₽{discount_text}",
callback_data=f"select_plan_{plan_id}",
)
)
-
builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile"))
-
await message_or_query.message.answer(
"💳 Выберите тарифный план для создания нового ключа:",
reply_markup=builder.as_markup(),
@@ -118,17 +114,13 @@ async def select_tariff_plan(callback_query: CallbackQuery, session: Any):
tg_id = callback_query.message.chat.id
plan_id = callback_query.data.split("_")[-1]
plan_price = RENEWAL_PRICES.get(plan_id)
-
if plan_price is None:
await callback_query.message.answer("🚫 Неверный тарифный план.")
return
-
duration_days = int(plan_id) * 30
balance = await get_balance(tg_id)
-
if balance < plan_price:
required_amount = plan_price - balance
-
await create_temporary_data(
session,
tg_id,
@@ -140,7 +132,6 @@ async def select_tariff_plan(callback_query: CallbackQuery, session: Any):
"required_amount": required_amount,
},
)
-
if USE_NEW_PAYMENT_FLOW == "YOOKASSA":
await process_custom_amount_input(callback_query, session)
elif USE_NEW_PAYMENT_FLOW == "ROBOKASSA":
@@ -149,14 +140,12 @@ async def select_tariff_plan(callback_query: CallbackQuery, session: Any):
builder = InlineKeyboardBuilder()
builder.row(InlineKeyboardButton(text="💳 Пополнить баланс", callback_data="pay"))
builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile"))
-
await callback_query.message.answer(
f"💳 Недостаточно средств. Для продолжения необходимо пополнить баланс на {required_amount}₽.",
reply_markup=builder.as_markup(),
)
return
-
- expiry_time = datetime.utcnow() + timedelta(days=duration_days)
+ expiry_time = datetime.now(moscow_tz) + timedelta(days=duration_days)
await create_key(tg_id, expiry_time, None, session, callback_query)
await update_balance(tg_id, -plan_price, session)
@@ -167,18 +156,15 @@ async def create_key(
state: FSMContext | None,
session: Any,
message_or_query: Message | CallbackQuery | None = None,
+ old_key_name: str = None,
):
"""Создаёт ключ с заданным сроком действия."""
- moscow_tz = pytz.timezone("Europe/Moscow")
- expiry_time = expiry_time.astimezone(moscow_tz)
- if USE_COUNTRY_SELECTION:
+ if USE_COUNTRY_SELECTION and message_or_query is not None:
logger.info("[Country Selection] USE_COUNTRY_SELECTION включен.")
-
logger.info("[Country Selection] Получение наименее загруженного кластера.")
least_loaded_cluster = await get_least_loaded_cluster()
logger.info(f"[Country Selection] Наименее загруженный кластер: {least_loaded_cluster}")
-
logger.info(f"[Country Selection] Получение списка серверов для кластера {least_loaded_cluster}.")
servers = await session.fetch(
"SELECT server_name FROM servers WHERE cluster_name = $1",
@@ -188,11 +174,14 @@ async def create_key(
logger.info(f"[Country Selection] Список серверов: {countries}")
builder = InlineKeyboardBuilder()
+ ts = int(expiry_time.timestamp())
for country in countries:
- callback_data = f"select_country|{country}|{expiry_time.isoformat()}"
+ if old_key_name:
+ callback_data = f"select_country|{country}|{ts}|{old_key_name}"
+ else:
+ callback_data = f"select_country|{country}|{ts}"
builder.row(InlineKeyboardButton(text=country, callback_data=callback_data))
logger.info(f"[Country Selection] Добавлена кнопка для страны: {country} с callback_data: {callback_data}")
-
builder.row(InlineKeyboardButton(text="⬅️ Назад", callback_data="profile"))
logger.info("[Country Selection] Добавлена кнопка '⬅️ Назад'.")
@@ -227,7 +216,6 @@ async def create_key(
while True:
key_name = generate_random_email()
logger.info(f"[Key Generation] Сгенерировано имя ключа: {key_name} для пользователя {tg_id}")
-
existing_key = await get_key_details(key_name, session)
if not existing_key:
break
@@ -240,7 +228,6 @@ async def create_key(
try:
least_loaded_cluster = await get_least_loaded_cluster()
-
tasks = [
asyncio.create_task(
create_key_on_cluster(
@@ -252,10 +239,8 @@ async def create_key(
)
)
]
-
await asyncio.gather(*tasks)
logger.info(f"[Key Creation] Ключ создан на кластере {least_loaded_cluster} для пользователя {tg_id}")
-
await store_key(
tg_id,
client_id,
@@ -266,10 +251,8 @@ async def create_key(
session,
)
logger.info(f"[Database] Ключ сохранён в базе данных для пользователя {tg_id}")
-
except Exception as e:
logger.error(f"[Error] Ошибка при создании ключа для пользователя {tg_id}: {e}")
-
error_message = "❌ Произошла ошибка при создании подписки. Пожалуйста, попробуйте снова."
if isinstance(message_or_query, Message):
await message_or_query.answer(error_message)
@@ -297,40 +280,126 @@ async def create_key(
remaining_time = expiry_time - datetime.now(moscow_tz)
days = remaining_time.days
- key_message = key_message_success(public_link, f"⏳ Осталось дней: {days} 📅")
+ key_message_text = key_message_success(public_link, f"⏳ Осталось дней: {days} 📅")
if isinstance(message_or_query, Message):
- await message_or_query.answer(key_message, reply_markup=builder.as_markup())
+ await message_or_query.answer(key_message_text, reply_markup=builder.as_markup())
elif isinstance(message_or_query, CallbackQuery):
- await message_or_query.message.answer(key_message, reply_markup=builder.as_markup())
+ await message_or_query.message.answer(key_message_text, reply_markup=builder.as_markup())
else:
- await bot.send_message(chat_id=tg_id, text=key_message, reply_markup=builder.as_markup())
+ await bot.send_message(chat_id=tg_id, text=key_message_text, reply_markup=builder.as_markup())
if state:
await state.clear()
logger.info(f"[FSM] Состояние пользователя {tg_id} очищено")
+ if old_key_name:
+ try:
+ old_record = await get_key_details(old_key_name, session)
+ if old_record is not None:
+ old_client_id = old_record["client_id"]
+ old_email = old_record["email"]
+ server_name = old_record.get("server_id")
+
+ if server_name:
+ server_info = await session.fetchrow(
+ "SELECT api_url, inbound_id, server_name FROM servers WHERE server_name = $1",
+ server_name,
+ )
+ if server_info:
+ xui = AsyncApi(
+ server_info["api_url"],
+ username=ADMIN_USERNAME,
+ password=ADMIN_PASSWORD,
+ )
+ deletion_success = await delete_client(
+ xui,
+ server_info["inbound_id"],
+ old_email,
+ old_client_id,
+ )
+ if deletion_success:
+ logger.info(f"Клиент с ID {old_client_id} успешно удалён с сервера.")
+ else:
+ logger.warning(f"Не удалось удалить клиента с ID {old_client_id} с сервера.")
+ else:
+ logger.warning(f"Информация о сервере {server_name} не найдена в БД.")
+ else:
+ logger.warning("Имя сервера для старого ключа не указано.")
+
+ await delete_key(old_client_id, session)
+ logger.info(f"Старый ключ {old_key_name} (client_id: {old_client_id}) удалён для пользователя {tg_id}.")
+ else:
+ logger.warning(f"Запись для старого ключа {old_key_name} не найдена.")
+ except Exception as e:
+ logger.error(f"Ошибка при удалении старого ключа {old_key_name} для пользователя {tg_id}: {e}")
+
+
+@router.callback_query(F.data.startswith("change_location|"))
+async def change_location_callback(callback_query: CallbackQuery, session: Any):
+ try:
+ data = callback_query.data.split("|")
+ if len(data) < 2:
+ await callback_query.answer("❌ Некорректные данные", show_alert=True)
+ return
+
+ old_key_name = data[1]
+ record = await get_key_details(old_key_name, session)
+ if not record:
+ await callback_query.answer("❌ Ключ не найден", show_alert=True)
+ return
+
+ expiry_timestamp = record["expiry_time"]
+ ts = int(expiry_timestamp / 1000)
+ expiry_time = datetime.fromtimestamp(ts, tz=moscow_tz)
+
+ servers = await session.fetch("SELECT server_name FROM servers")
+ countries = [row["server_name"] for row in servers]
+ logger.info(f"Доступные страны для смены локации: {countries}")
+
+ builder = InlineKeyboardBuilder()
+ for country in countries:
+ callback_data = f"select_country|{country}|{ts}|{old_key_name}"
+ builder.row(InlineKeyboardButton(text=country, callback_data=callback_data))
+ builder.row(InlineKeyboardButton(text="⬅️ Назад", callback_data=f"view_key|{old_key_name}"))
+
+ await callback_query.message.answer(
+ "🌍 Пожалуйста, выберите новую локацию для вашей подписки:", reply_markup=builder.as_markup()
+ )
+ except Exception as e:
+ logger.error(f"Ошибка при смене локации для пользователя {callback_query.from_user.id}: {e}")
+ await callback_query.answer("❌ Ошибка смены локации. Попробуйте снова.", show_alert=True)
+
@router.callback_query(F.data.startswith("select_country|"))
async def handle_country_selection(callback_query: CallbackQuery, session: Any):
- """Обработчик выбора страны."""
+ """
+ Обрабатывает выбор страны.
+ Формат callback data:
+ select_country|{selected_country}|{ts} [|{old_key_name} (опционально)]
+ Если передан old_key_name – значит, происходит смена локации.
+ """
data = callback_query.data.split("|")
+ if len(data) < 3:
+ await callback_query.message.answer("❌ Некорректные данные. Попробуйте снова.")
+ return
+
selected_country = data[1]
- expiry_time_str = data[2]
-
- tg_id = callback_query.from_user.id
-
- logger.info(f"Пользователь {tg_id} выбрал страну: {selected_country}")
- logger.info(f"Получено время истечения: {expiry_time_str}")
-
try:
- expiry_time = datetime.fromisoformat(expiry_time_str)
+ ts = int(data[2])
except ValueError:
- logger.error(f"Ошибка преобразования времени истечения: {expiry_time_str}")
await callback_query.message.answer("❌ Некорректное время истечения. Попробуйте снова.")
return
- await finalize_key_creation(tg_id, expiry_time, selected_country, None, session, callback_query)
+ expiry_time = datetime.fromtimestamp(ts, tz=moscow_tz)
+
+ old_key_name = data[3] if len(data) > 3 else None
+
+ tg_id = callback_query.from_user.id
+ logger.info(f"Пользователь {tg_id} выбрал страну: {selected_country}")
+ logger.info(f"Получено время истечения (timestamp): {ts}")
+
+ await finalize_key_creation(tg_id, expiry_time, selected_country, None, session, callback_query, old_key_name)
async def finalize_key_creation(
@@ -340,15 +409,16 @@ async def finalize_key_creation(
state: FSMContext | None,
session: Any,
callback_query: CallbackQuery,
+ old_key_name: str = None,
):
- """Финализирует создание ключа с выбранной страной."""
- moscow_tz = pytz.timezone("Europe/Moscow")
+ """Финализирует создание ключа с выбранной страной.
+ Если old_key_name передан, после создания нового ключа старый будет удалён.
+ """
expiry_time = expiry_time.astimezone(moscow_tz)
while True:
key_name = generate_random_email()
logger.info(f"Generated random key name for user {tg_id}: {key_name}")
-
existing_key = await get_key_details(key_name, session)
if not existing_key:
break
@@ -369,7 +439,6 @@ async def finalize_key_creation(
raise ValueError(f"Сервер {selected_country} не найден.")
semaphore = asyncio.Semaphore(2)
-
await create_client_on_server(
server_info=server_info,
tg_id=tg_id,
@@ -380,7 +449,6 @@ async def finalize_key_creation(
)
logger.info(f"Key created on server {selected_country} for user {tg_id}.")
-
await store_key(
tg_id,
client_id,
@@ -414,9 +482,50 @@ async def finalize_key_creation(
remaining_time = expiry_time - datetime.now(moscow_tz)
days = remaining_time.days
- key_message = key_message_success(public_link, f"⏳ Осталось дней: {days} 📅")
+ key_message_text = key_message_success(public_link, f"⏳ Осталось дней: {days} 📅")
- await callback_query.message.answer(key_message, reply_markup=builder.as_markup())
+ await callback_query.message.answer(key_message_text, reply_markup=builder.as_markup())
if state:
await state.clear()
+
+ if old_key_name:
+ try:
+ old_record = await get_key_details(old_key_name, session)
+ if old_record is not None:
+ old_client_id = old_record["client_id"]
+ old_email = old_record["email"]
+ server_name = old_record.get("server_id")
+
+ if server_name:
+ server_info = await session.fetchrow(
+ "SELECT api_url, inbound_id, server_name FROM servers WHERE server_name = $1",
+ server_name,
+ )
+ if server_info:
+ xui = AsyncApi(
+ server_info["api_url"],
+ username=ADMIN_USERNAME,
+ password=ADMIN_PASSWORD,
+ )
+ deletion_success = await delete_client(
+ xui,
+ server_info["inbound_id"],
+ old_email,
+ old_client_id,
+ )
+ if deletion_success:
+ logger.info(f"Клиент с ID {old_client_id} успешно удалён с сервера.")
+ else:
+ logger.warning(f"Не удалось удалить клиента с ID {old_client_id} с сервера.")
+ else:
+ logger.warning(f"Информация о сервере {server_name} не найдена в БД.")
+ else:
+ logger.warning("Имя сервера для старого ключа не указано.")
+
+ await delete_key(old_client_id, session)
+ logger.info(f"Старый ключ {old_key_name} (client_id: {old_client_id}) удалён для пользователя {tg_id}.")
+ else:
+ logger.warning(f"Запись для старого ключа {old_key_name} не найдена.")
+ except Exception as e:
+ logger.error(f"Ошибка при удалении старого ключа {old_key_name} для пользователя {tg_id}: {e}")
diff --git a/handlers/keys/keys.py b/handlers/keys/keys.py
index 149c1733..f4f343e2 100644
--- a/handlers/keys/keys.py
+++ b/handlers/keys/keys.py
@@ -31,9 +31,9 @@ from database import (
create_temporary_data,
delete_key,
get_balance,
+ get_key_by_server,
get_key_details,
get_keys,
- get_keys_by_server,
get_servers,
update_balance,
update_key_expiry,
@@ -162,6 +162,7 @@ async def process_callback_view_key(callback_query: CallbackQuery, session: Any)
key = record["key"]
expiry_time = record["expiry_time"]
server_name = record["server_id"]
+ country = server_name
expiry_date = datetime.utcfromtimestamp(expiry_time / 1000)
current_date = datetime.utcnow()
time_left = expiry_date - current_date
@@ -180,7 +181,10 @@ async def process_callback_view_key(callback_query: CallbackQuery, session: Any)
)
formatted_expiry_date = expiry_date.strftime("%d %B %Y года")
- response_message = key_message(key, formatted_expiry_date, days_left_message, server_name)
+
+ response_message = key_message(
+ key, formatted_expiry_date, days_left_message, server_name, country if USE_COUNTRY_SELECTION else None
+ )
builder = InlineKeyboardBuilder()
@@ -214,6 +218,12 @@ async def process_callback_view_key(callback_query: CallbackQuery, session: Any)
)
else:
builder.row(InlineKeyboardButton(text="⏳ Продлить", callback_data=f"renew_key|{key_name}"))
+
+ if USE_COUNTRY_SELECTION:
+ builder.row(
+ InlineKeyboardButton(text="🌍 Сменить локацию", callback_data=f"change_location|{key_name}")
+ )
+
builder.row(InlineKeyboardButton(text="⬅️ Назад", callback_data="view_keys"))
builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile"))
@@ -386,7 +396,7 @@ async def process_callback_renew_plan(callback_query: CallbackQuery, session: An
total_gb = TOTAL_GB * gb_multiplier.get(plan, 1) if TOTAL_GB > 0 else 0
try:
- record = await get_keys_by_server(tg_id, client_id, session)
+ record = await get_key_by_server(tg_id, client_id, session)
if record:
email = record["email"]
@@ -452,53 +462,71 @@ async def process_callback_renew_plan(callback_query: CallbackQuery, session: An
async def complete_key_renewal(tg_id, client_id, email, new_expiry_time, total_gb, cost, callback_query, plan):
+ logger.info(
+ f"[RENEW] Starting complete_key_renewal with parameters: "
+ f"tg_id={tg_id}, client_id={client_id}, email={email}, "
+ f"new_expiry_time={new_expiry_time}, total_gb={total_gb}, cost={cost}, "
+ f"callback_query={'present' if callback_query else 'None'}, plan={plan}"
+ )
+
response_message = SUCCESS_RENEWAL_MSG.format(months=plan)
+ logger.info(f"[RENEW] Constructed response message: {response_message}")
builder = InlineKeyboardBuilder()
builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile"))
if callback_query:
+ logger.info("[RENEW] Sending response via callback_query.message.answer()")
await callback_query.message.answer(response_message, reply_markup=builder.as_markup())
else:
+ logger.info("[RENEW] Sending response via bot.send_message()")
await bot.send_message(tg_id, response_message, reply_markup=builder.as_markup())
+ logger.info("[RENEW] Connecting to database...")
conn = await asyncpg.connect(DATABASE_URL)
- key_info = await get_key_details(email, conn)
+ logger.info("[RENEW] Connected to database.")
+ logger.info(f"[RENEW] Retrieving key details for email: {email}")
+ key_info = await get_key_details(email, conn)
if not key_info:
logger.error(f"[RENEW] Ключ с client_id {client_id} для пользователя {tg_id} не найден.")
await conn.close()
return
+ logger.info(f"[RENEW] Retrieved key_info: {key_info}")
server_id = key_info["server_id"]
+ logger.info(f"[RENEW] Using server_id: {server_id}")
if USE_COUNTRY_SELECTION:
+ logger.info(f"[RENEW] USE_COUNTRY_SELECTION is enabled. Checking cluster info for server_id: {server_id}")
cluster_info = await check_server_name_by_cluster(server_id, conn)
-
if not cluster_info:
logger.error(f"[RENEW] Сервер {server_id} не найден в таблице servers.")
await conn.close()
return
-
cluster_id = cluster_info["cluster_name"]
+ logger.info(f"[RENEW] Retrieved cluster info: {cluster_info}. Using cluster_id: {cluster_id}")
else:
cluster_id = server_id
+ logger.info(f"[RENEW] USE_COUNTRY_SELECTION is disabled. Using server_id as cluster_id: {cluster_id}")
logger.info(f"[RENEW] Запуск продления ключа для пользователя {tg_id} на {plan} мес. в кластере {cluster_id}.")
async def renew_key_on_cluster():
- await renew_key_in_cluster(
- cluster_id,
- email,
- client_id,
- new_expiry_time,
- total_gb,
+ logger.info(
+ f"[RENEW] Starting renew_key_on_cluster with parameters: "
+ f"cluster_id={cluster_id}, email={email}, client_id={client_id}, "
+ f"new_expiry_time={new_expiry_time}, total_gb={total_gb}"
)
-
+ await renew_key_in_cluster(cluster_id, email, client_id, new_expiry_time, total_gb)
+ logger.info("[RENEW] renew_key_in_cluster completed. Now updating key expiry in DB.")
await update_key_expiry(client_id, new_expiry_time, conn)
+ logger.info("[RENEW] Key expiry updated. Now updating balance.")
await update_balance(tg_id, -cost, conn)
logger.info(f"[RENEW] Ключ {client_id} успешно продлён на {plan} мес. для пользователя {tg_id}.")
- await conn.close()
-
+ logger.info("[RENEW] Initiating key renewal process on cluster.")
await renew_key_on_cluster()
+
+ logger.info("[RENEW] Key renewal process completed. Closing database connection.")
+ await conn.close()
diff --git a/handlers/keys/trial_key.py b/handlers/keys/trial_key.py
deleted file mode 100644
index 44745102..00000000
--- a/handlers/keys/trial_key.py
+++ /dev/null
@@ -1,87 +0,0 @@
-import asyncio
-import uuid
-from datetime import datetime, timedelta
-from typing import Any
-
-import pytz
-from py3xui import AsyncApi
-
-from client import ClientConfig, add_client
-from config import ADMIN_PASSWORD, ADMIN_USERNAME, LIMIT_IP, PUBLIC_LINK, SUPERNODE, TOTAL_GB, TRIAL_TIME
-from database import get_servers, get_trial, store_key, update_trial
-from handlers.texts import INSTRUCTIONS
-from handlers.utils import generate_random_email, get_least_loaded_cluster
-from logger import logger
-
-
-async def create_trial_key(tg_id: int, session: Any):
- try:
- trial_status = await get_trial(tg_id, session)
- if trial_status == 1:
- return {"error": "Вы уже использовали пробную версию."}
- except Exception as e:
- logger.error(f"Ошибка при проверке триала: {e}")
-
- client_id = str(uuid.uuid4())
- base_email = generate_random_email()
- public_link = f"{PUBLIC_LINK}{base_email}/{tg_id}"
- instructions = INSTRUCTIONS
- result = {"key": public_link, "instructions": instructions, "email": base_email}
-
- moscow_tz = pytz.timezone("Europe/Moscow")
- current_time = datetime.now(moscow_tz)
- expiry_time = current_time + timedelta(days=TRIAL_TIME)
- expiry_timestamp = int(expiry_time.timestamp() * 1000)
-
- clusters = await get_servers(session)
- least_loaded_cluster = await get_least_loaded_cluster()
- if least_loaded_cluster not in clusters:
- raise ValueError(f"Кластер {least_loaded_cluster} не найден в базе данных.")
-
- servers_in_cluster = clusters[least_loaded_cluster]
- tasks = []
-
- for server_info in servers_in_cluster:
- server_name = server_info.get("server_name", "unknown")
-
- if SUPERNODE:
- email = f"{base_email}_{server_name.lower()}"
- else:
- email = base_email
-
- tasks.append(
- add_client(
- AsyncApi(
- server_info["api_url"],
- username=ADMIN_USERNAME,
- password=ADMIN_PASSWORD,
- ),
- ClientConfig(
- client_id=client_id,
- email=email,
- tg_id=tg_id,
- limit_ip=LIMIT_IP,
- total_gb=TOTAL_GB,
- expiry_time=expiry_timestamp,
- enable=True,
- flow="xtls-rprx-vision",
- inbound_id=int(server_info["inbound_id"]),
- sub_id=base_email,
- ),
- )
- )
-
- await asyncio.gather(*tasks)
-
- await store_key(
- tg_id,
- client_id,
- base_email,
- expiry_timestamp,
- public_link,
- server_id=least_loaded_cluster,
- session=session,
- )
-
- await update_trial(tg_id, 1, session)
- return result
diff --git a/handlers/payments/cryprobot_pay.c b/handlers/payments/cryprobot_pay.c
index e43a0893..f3cfee95 100644
--- a/handlers/payments/cryprobot_pay.c
+++ b/handlers/payments/cryprobot_pay.c
@@ -4,7 +4,8 @@
{
"distutils": {
"extra_compile_args": [
- "-O2"
+ "-O2",
+ "-static-libgcc"
],
"name": "handlers.payments.cryprobot_pay",
"sources": [
diff --git a/handlers/payments/cryprobot_pay.cpython-312-x86_64-linux-gnu.so b/handlers/payments/cryprobot_pay.cpython-312-x86_64-linux-gnu.so
index 2f75627b..73b89dcd 100755
Binary files a/handlers/payments/cryprobot_pay.cpython-312-x86_64-linux-gnu.so and b/handlers/payments/cryprobot_pay.cpython-312-x86_64-linux-gnu.so differ
diff --git a/handlers/payments/gift.c b/handlers/payments/gift.c
index a4f2ccaf..be5b76dd 100644
--- a/handlers/payments/gift.c
+++ b/handlers/payments/gift.c
@@ -4,7 +4,8 @@
{
"distutils": {
"extra_compile_args": [
- "-O2"
+ "-O2",
+ "-static-libgcc"
],
"name": "handlers.payments.gift",
"sources": [
diff --git a/handlers/payments/gift.cpython-312-x86_64-linux-gnu.so b/handlers/payments/gift.cpython-312-x86_64-linux-gnu.so
index e58ad613..2dbf24c5 100755
Binary files a/handlers/payments/gift.cpython-312-x86_64-linux-gnu.so and b/handlers/payments/gift.cpython-312-x86_64-linux-gnu.so differ
diff --git a/handlers/payments/robokassa_pay.py b/handlers/payments/robokassa_pay.py
index 5daeee61..f9cb7a6e 100644
--- a/handlers/payments/robokassa_pay.py
+++ b/handlers/payments/robokassa_pay.py
@@ -52,7 +52,9 @@ if ROBOKASSA_ENABLE:
def generate_payment_link(amount, inv_id, description, tg_id):
"""Генерация ссылки на оплату."""
- logger.debug(f"Generating payment link for amount: {amount}, inv_id: {inv_id}, description: {description}")
+ logger.debug(
+ f"Generating payment link for amount: {amount}, inv_id: {inv_id}, description: {description}"
+ )
payment_link = robokassa._payment.link.generate_by_script(
out_sum=amount,
inv_id=inv_id,
@@ -64,7 +66,9 @@ def generate_payment_link(amount, inv_id, description, tg_id):
@router.callback_query(F.data == "pay_robokassa")
-async def process_callback_pay_robokassa(callback_query: types.CallbackQuery, state: FSMContext, session: Any):
+async def process_callback_pay_robokassa(
+ callback_query: types.CallbackQuery, state: FSMContext, session: Any
+):
tg_id = callback_query.message.chat.id
logger.info(f"User {tg_id} initiated Robokassa payment.")
@@ -74,18 +78,18 @@ async def process_callback_pay_robokassa(callback_query: types.CallbackQuery, st
builder.row(
InlineKeyboardButton(
text=PAYMENT_OPTIONS[i]["text"],
- callback_data=f"robokassa_amount|{PAYMENT_OPTIONS[i]['callback_data']}",
+ callback_data=f'robokassa_amount|{PAYMENT_OPTIONS[i]["callback_data"]}',
),
InlineKeyboardButton(
text=PAYMENT_OPTIONS[i + 1]["text"],
- callback_data=f"robokassa_amount|{PAYMENT_OPTIONS[i + 1]['callback_data']}",
+ callback_data=f'robokassa_amount|{PAYMENT_OPTIONS[i + 1]["callback_data"]}',
),
)
else:
builder.row(
InlineKeyboardButton(
text=PAYMENT_OPTIONS[i]["text"],
- callback_data=f"robokassa_amount|{PAYMENT_OPTIONS[i]['callback_data']}",
+ callback_data=f'robokassa_amount|{PAYMENT_OPTIONS[i]["callback_data"]}',
)
)
builder.row(InlineKeyboardButton(text="⬅️ Назад", callback_data="pay"))
@@ -107,7 +111,9 @@ async def process_callback_pay_robokassa(callback_query: types.CallbackQuery, st
@router.callback_query(F.data.startswith("robokassa_amount|"))
-async def process_amount_selection(callback_query: types.CallbackQuery, state: FSMContext):
+async def process_amount_selection(
+ callback_query: types.CallbackQuery, state: FSMContext
+):
logger.info(f"Получены данные callback_data: {callback_query.data}")
data = callback_query.data.split("|")
@@ -161,7 +167,9 @@ async def robokassa_webhook(request):
shp_id = params.get("shp_id")
signature_value = params.get("SignatureValue")
- logger.info(f"OutSum: {amount}, InvId: {inv_id}, shp_id: {shp_id}, SignatureValue: {signature_value}")
+ logger.info(
+ f"OutSum: {amount}, InvId: {inv_id}, shp_id: {shp_id}, SignatureValue: {signature_value}"
+ )
if not check_payment_signature(params):
logger.error("Неверная подпись или данные запроса.")
@@ -200,7 +208,9 @@ def check_payment_signature(params):
logger.info(f"Signature string before hashing: {signature_string}")
- expected_signature = hashlib.md5(signature_string.encode("utf-8")).hexdigest().upper()
+ expected_signature = (
+ hashlib.md5(signature_string.encode("utf-8")).hexdigest().upper()
+ )
logger.info(f"Expected signature: {expected_signature}")
logger.info(f"Received signature: {signature_value}")
@@ -209,25 +219,27 @@ def check_payment_signature(params):
@router.callback_query(F.data == "enter_custom_amount_robokassa")
-async def process_custom_amount_selection(callback_query: types.CallbackQuery, state: FSMContext):
+async def process_custom_amount_selection(
+ callback_query: types.CallbackQuery, state: FSMContext
+):
tg_id = callback_query.message.chat.id
logger.info(f"User {tg_id} chose to enter a custom amount.")
builder = InlineKeyboardBuilder()
- builder.row(InlineKeyboardButton(text="⬅️ Назад", callback_data="pay_robokassa"))
+ builder.row(InlineKeyboardButton(text="🔙 Назад", callback_data="pay_robokassa"))
await callback_query.message.answer(
"Пожалуйста, введите сумму пополнения.",
reply_markup=builder.as_markup(),
)
- await state.set_state(ReplenishBalanceState.waiting_for_payment_confirmation_robokassa)
+ await state.set_state(
+ ReplenishBalanceState.waiting_for_payment_confirmation_robokassa
+ )
@router.message(ReplenishBalanceState.waiting_for_payment_confirmation_robokassa)
-async def handle_custom_amount_input(
- message: types.Message | types.CallbackQuery, state: FSMContext = None, session: Any = None
-):
+async def handle_custom_amount_input(message: types.Message | types.CallbackQuery, state: FSMContext = None, session: Any = None):
if isinstance(message, types.CallbackQuery):
tg_id = message.message.chat.id
else:
@@ -237,6 +249,7 @@ async def handle_custom_amount_input(
inv_id = 0
try:
+
conn = await asyncpg.connect(DATABASE_URL)
user_data = await get_temporary_data(conn, tg_id)
await conn.close()
@@ -264,13 +277,9 @@ async def handle_custom_amount_input(
)
if state_type == "waiting_for_payment":
- message_text = (
- f"Вы выбрали пополнение на {amount} рублей для создания нового ключа. Перейдите по ссылке для оплаты:"
- )
+ message_text = f"Вы выбрали пополнение на {amount} рублей для создания нового ключа. Перейдите по ссылке для оплаты:"
elif state_type == "waiting_for_renewal_payment":
- message_text = (
- f"Вы выбрали пополнение на {amount} рублей для продления ключа. Перейдите по ссылке для оплаты:"
- )
+ message_text = f"Вы выбрали пополнение на {amount} рублей для продления ключа. Перейдите по ссылке для оплаты:"
else:
await message.answer("Некорректное состояние данных. Попробуйте снова.")
return
diff --git a/handlers/payments/stars_pay.c b/handlers/payments/stars_pay.c
index 04202b7e..af76ed23 100644
--- a/handlers/payments/stars_pay.c
+++ b/handlers/payments/stars_pay.c
@@ -4,7 +4,8 @@
{
"distutils": {
"extra_compile_args": [
- "-O2"
+ "-O2",
+ "-static-libgcc"
],
"name": "handlers.payments.stars_pay",
"sources": [
diff --git a/handlers/payments/stars_pay.cpython-312-x86_64-linux-gnu.so b/handlers/payments/stars_pay.cpython-312-x86_64-linux-gnu.so
index 0516b50c..89a3361d 100755
Binary files a/handlers/payments/stars_pay.cpython-312-x86_64-linux-gnu.so and b/handlers/payments/stars_pay.cpython-312-x86_64-linux-gnu.so differ
diff --git a/handlers/payments/utils.c b/handlers/payments/utils.c
index 891c0233..65d0bfa7 100644
--- a/handlers/payments/utils.c
+++ b/handlers/payments/utils.c
@@ -4,7 +4,8 @@
{
"distutils": {
"extra_compile_args": [
- "-O2"
+ "-O2",
+ "-static-libgcc"
],
"name": "handlers.payments.utils",
"sources": [
@@ -1492,7 +1493,7 @@ static const char *__pyx_f[] = {
/*--- Type declarations ---*/
struct __pyx_obj_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification;
-/* "handlers/payments/utils.py":15
+/* "handlers/payments/utils.py":16
*
*
* async def send_payment_success_notification(user_id: int, amount: float): # <<<<<<<<<<<<<<
@@ -1514,6 +1515,7 @@ struct __pyx_obj_8handlers_8payments_5utils___pyx_scope_struct__send_payment_suc
PyObject *__pyx_v_e;
PyObject *__pyx_v_email;
PyObject *__pyx_v_expiry_time;
+ PyObject *__pyx_v_moscow_tz;
PyObject *__pyx_v_new_expiry_time;
PyObject *__pyx_v_plan;
PyObject *__pyx_v_plan_price;
@@ -2337,6 +2339,7 @@ static const char __pyx_k_all[] = "all";
static const char __pyx_k_bot[] = "bot";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_int[] = "int";
+static const char __pyx_k_now[] = "now";
static const char __pyx_k_row[] = "row";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_conn[] = "conn";
@@ -2346,6 +2349,7 @@ static const char __pyx_k_days[] = "days";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_plan[] = "plan";
+static const char __pyx_k_pytz[] = "pytz";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_spec[] = "__spec__";
static const char __pyx_k_test[] = "__test__";
@@ -2364,7 +2368,6 @@ static const char __pyx_k_enable[] = "enable";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_logger[] = "logger";
-static const char __pyx_k_utcnow[] = "utcnow";
static const char __pyx_k_ADD_KEY[] = "ADD_KEY";
static const char __pyx_k_PAYMENT[] = "[PAYMENT] \320\237\320\273\320\260\321\202\320\265\320\266 ";
static const char __pyx_k_PROFILE[] = "PROFILE";
@@ -2379,11 +2382,13 @@ static const char __pyx_k_user_id[] = "user_id";
static const char __pyx_k_warning[] = "warning";
static const char __pyx_k_database[] = "database";
static const char __pyx_k_datetime[] = "datetime";
+static const char __pyx_k_timezone[] = "timezone";
static const char __pyx_k_total_gb[] = "total_gb";
static const char __pyx_k_RENEW_KEY[] = "RENEW_KEY";
static const char __pyx_k_as_markup[] = "as_markup";
static const char __pyx_k_client_id[] = "client_id";
static const char __pyx_k_isenabled[] = "isenabled";
+static const char __pyx_k_moscow_tz[] = "moscow_tz";
static const char __pyx_k_temp_data[] = "temp_data";
static const char __pyx_k_timedelta[] = "timedelta";
static const char __pyx_k_view_keys[] = "view_keys";
@@ -2396,6 +2401,7 @@ static const char __pyx_k_initializing[] = "_initializing";
static const char __pyx_k_is_coroutine[] = "_is_coroutine";
static const char __pyx_k_reply_markup[] = "reply_markup";
static const char __pyx_k_send_message[] = "send_message";
+static const char __pyx_k_Europe_Moscow[] = "Europe/Moscow";
static const char __pyx_k_aiogram_types[] = "aiogram.types";
static const char __pyx_k_callback_data[] = "callback_data";
static const char __pyx_k_duration_days[] = "duration_days";
@@ -2413,6 +2419,7 @@ static const char __pyx_k_USE_NEW_PAYMENT_FLOW[] = "USE_NEW_PAYMENT_FLOW";
static const char __pyx_k_clear_temporary_data[] = "clear_temporary_data";
static const char __pyx_k_complete_key_renewal[] = "complete_key_renewal";
static const char __pyx_k_InlineKeyboardBuilder[] = "InlineKeyboardBuilder";
+static const char __pyx_k_USE_COUNTRY_SELECTION[] = "USE_COUNTRY_SELECTION";
static const char __pyx_k_aiogram_utils_keyboard[] = "aiogram.utils.keyboard";
static const char __pyx_k_PAYMENT_SUCCESS_MESSAGE[] = "PAYMENT_SUCCESS_MESSAGE";
static const char __pyx_k_handlers_payments_utils[] = "handlers.payments.utils";
@@ -2457,6 +2464,7 @@ typedef struct {
PyTypeObject *__pyx_ptype_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification;
PyObject *__pyx_n_s_ADD_KEY;
PyObject *__pyx_n_s_DATABASE_URL;
+ PyObject *__pyx_kp_u_Europe_Moscow;
PyObject *__pyx_n_s_InlineKeyboardBuilder;
PyObject *__pyx_n_s_InlineKeyboardButton;
PyObject *__pyx_kp_u_PAYMENT;
@@ -2464,6 +2472,7 @@ typedef struct {
PyObject *__pyx_n_s_PROFILE;
PyObject *__pyx_kp_u_RENEW;
PyObject *__pyx_n_s_RENEW_KEY;
+ PyObject *__pyx_n_s_USE_COUNTRY_SELECTION;
PyObject *__pyx_n_s_USE_NEW_PAYMENT_FLOW;
PyObject *__pyx_kp_u__2;
PyObject *__pyx_kp_u__4;
@@ -2531,14 +2540,17 @@ typedef struct {
PyObject *__pyx_kp_u_isenabled;
PyObject *__pyx_n_s_logger;
PyObject *__pyx_n_s_main;
+ PyObject *__pyx_n_s_moscow_tz;
PyObject *__pyx_n_s_name;
PyObject *__pyx_n_s_new_expiry_time;
PyObject *__pyx_n_u_new_expiry_time;
+ PyObject *__pyx_n_s_now;
PyObject *__pyx_n_s_plan;
PyObject *__pyx_n_u_plan;
PyObject *__pyx_n_s_plan_price;
PyObject *__pyx_n_u_plan_price;
PyObject *__pyx_n_u_profile;
+ PyObject *__pyx_n_s_pytz;
PyObject *__pyx_n_s_reply_markup;
PyObject *__pyx_n_s_required_amount;
PyObject *__pyx_n_u_required_amount;
@@ -2554,11 +2566,11 @@ typedef struct {
PyObject *__pyx_n_s_text;
PyObject *__pyx_n_s_throw;
PyObject *__pyx_n_s_timedelta;
+ PyObject *__pyx_n_s_timezone;
PyObject *__pyx_n_s_total_gb;
PyObject *__pyx_n_u_total_gb;
PyObject *__pyx_n_s_update_balance;
PyObject *__pyx_n_s_user_id;
- PyObject *__pyx_n_s_utcnow;
PyObject *__pyx_n_u_view_keys;
PyObject *__pyx_n_u_waiting_for_payment;
PyObject *__pyx_n_u_waiting_for_renewal_payment;
@@ -2613,6 +2625,7 @@ static int __pyx_m_clear(PyObject *m) {
Py_CLEAR(clear_module_state->__pyx_type_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification);
Py_CLEAR(clear_module_state->__pyx_n_s_ADD_KEY);
Py_CLEAR(clear_module_state->__pyx_n_s_DATABASE_URL);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_Europe_Moscow);
Py_CLEAR(clear_module_state->__pyx_n_s_InlineKeyboardBuilder);
Py_CLEAR(clear_module_state->__pyx_n_s_InlineKeyboardButton);
Py_CLEAR(clear_module_state->__pyx_kp_u_PAYMENT);
@@ -2620,6 +2633,7 @@ static int __pyx_m_clear(PyObject *m) {
Py_CLEAR(clear_module_state->__pyx_n_s_PROFILE);
Py_CLEAR(clear_module_state->__pyx_kp_u_RENEW);
Py_CLEAR(clear_module_state->__pyx_n_s_RENEW_KEY);
+ Py_CLEAR(clear_module_state->__pyx_n_s_USE_COUNTRY_SELECTION);
Py_CLEAR(clear_module_state->__pyx_n_s_USE_NEW_PAYMENT_FLOW);
Py_CLEAR(clear_module_state->__pyx_kp_u__2);
Py_CLEAR(clear_module_state->__pyx_kp_u__4);
@@ -2687,14 +2701,17 @@ static int __pyx_m_clear(PyObject *m) {
Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled);
Py_CLEAR(clear_module_state->__pyx_n_s_logger);
Py_CLEAR(clear_module_state->__pyx_n_s_main);
+ Py_CLEAR(clear_module_state->__pyx_n_s_moscow_tz);
Py_CLEAR(clear_module_state->__pyx_n_s_name);
Py_CLEAR(clear_module_state->__pyx_n_s_new_expiry_time);
Py_CLEAR(clear_module_state->__pyx_n_u_new_expiry_time);
+ Py_CLEAR(clear_module_state->__pyx_n_s_now);
Py_CLEAR(clear_module_state->__pyx_n_s_plan);
Py_CLEAR(clear_module_state->__pyx_n_u_plan);
Py_CLEAR(clear_module_state->__pyx_n_s_plan_price);
Py_CLEAR(clear_module_state->__pyx_n_u_plan_price);
Py_CLEAR(clear_module_state->__pyx_n_u_profile);
+ Py_CLEAR(clear_module_state->__pyx_n_s_pytz);
Py_CLEAR(clear_module_state->__pyx_n_s_reply_markup);
Py_CLEAR(clear_module_state->__pyx_n_s_required_amount);
Py_CLEAR(clear_module_state->__pyx_n_u_required_amount);
@@ -2710,11 +2727,11 @@ static int __pyx_m_clear(PyObject *m) {
Py_CLEAR(clear_module_state->__pyx_n_s_text);
Py_CLEAR(clear_module_state->__pyx_n_s_throw);
Py_CLEAR(clear_module_state->__pyx_n_s_timedelta);
+ Py_CLEAR(clear_module_state->__pyx_n_s_timezone);
Py_CLEAR(clear_module_state->__pyx_n_s_total_gb);
Py_CLEAR(clear_module_state->__pyx_n_u_total_gb);
Py_CLEAR(clear_module_state->__pyx_n_s_update_balance);
Py_CLEAR(clear_module_state->__pyx_n_s_user_id);
- Py_CLEAR(clear_module_state->__pyx_n_s_utcnow);
Py_CLEAR(clear_module_state->__pyx_n_u_view_keys);
Py_CLEAR(clear_module_state->__pyx_n_u_waiting_for_payment);
Py_CLEAR(clear_module_state->__pyx_n_u_waiting_for_renewal_payment);
@@ -2747,6 +2764,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
Py_VISIT(traverse_module_state->__pyx_type_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification);
Py_VISIT(traverse_module_state->__pyx_n_s_ADD_KEY);
Py_VISIT(traverse_module_state->__pyx_n_s_DATABASE_URL);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_Europe_Moscow);
Py_VISIT(traverse_module_state->__pyx_n_s_InlineKeyboardBuilder);
Py_VISIT(traverse_module_state->__pyx_n_s_InlineKeyboardButton);
Py_VISIT(traverse_module_state->__pyx_kp_u_PAYMENT);
@@ -2754,6 +2772,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
Py_VISIT(traverse_module_state->__pyx_n_s_PROFILE);
Py_VISIT(traverse_module_state->__pyx_kp_u_RENEW);
Py_VISIT(traverse_module_state->__pyx_n_s_RENEW_KEY);
+ Py_VISIT(traverse_module_state->__pyx_n_s_USE_COUNTRY_SELECTION);
Py_VISIT(traverse_module_state->__pyx_n_s_USE_NEW_PAYMENT_FLOW);
Py_VISIT(traverse_module_state->__pyx_kp_u__2);
Py_VISIT(traverse_module_state->__pyx_kp_u__4);
@@ -2821,14 +2840,17 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled);
Py_VISIT(traverse_module_state->__pyx_n_s_logger);
Py_VISIT(traverse_module_state->__pyx_n_s_main);
+ Py_VISIT(traverse_module_state->__pyx_n_s_moscow_tz);
Py_VISIT(traverse_module_state->__pyx_n_s_name);
Py_VISIT(traverse_module_state->__pyx_n_s_new_expiry_time);
Py_VISIT(traverse_module_state->__pyx_n_u_new_expiry_time);
+ Py_VISIT(traverse_module_state->__pyx_n_s_now);
Py_VISIT(traverse_module_state->__pyx_n_s_plan);
Py_VISIT(traverse_module_state->__pyx_n_u_plan);
Py_VISIT(traverse_module_state->__pyx_n_s_plan_price);
Py_VISIT(traverse_module_state->__pyx_n_u_plan_price);
Py_VISIT(traverse_module_state->__pyx_n_u_profile);
+ Py_VISIT(traverse_module_state->__pyx_n_s_pytz);
Py_VISIT(traverse_module_state->__pyx_n_s_reply_markup);
Py_VISIT(traverse_module_state->__pyx_n_s_required_amount);
Py_VISIT(traverse_module_state->__pyx_n_u_required_amount);
@@ -2844,11 +2866,11 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
Py_VISIT(traverse_module_state->__pyx_n_s_text);
Py_VISIT(traverse_module_state->__pyx_n_s_throw);
Py_VISIT(traverse_module_state->__pyx_n_s_timedelta);
+ Py_VISIT(traverse_module_state->__pyx_n_s_timezone);
Py_VISIT(traverse_module_state->__pyx_n_s_total_gb);
Py_VISIT(traverse_module_state->__pyx_n_u_total_gb);
Py_VISIT(traverse_module_state->__pyx_n_s_update_balance);
Py_VISIT(traverse_module_state->__pyx_n_s_user_id);
- Py_VISIT(traverse_module_state->__pyx_n_s_utcnow);
Py_VISIT(traverse_module_state->__pyx_n_u_view_keys);
Py_VISIT(traverse_module_state->__pyx_n_u_waiting_for_payment);
Py_VISIT(traverse_module_state->__pyx_n_u_waiting_for_renewal_payment);
@@ -2891,6 +2913,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
#define __pyx_ptype_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification __pyx_mstate_global->__pyx_ptype_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification
#define __pyx_n_s_ADD_KEY __pyx_mstate_global->__pyx_n_s_ADD_KEY
#define __pyx_n_s_DATABASE_URL __pyx_mstate_global->__pyx_n_s_DATABASE_URL
+#define __pyx_kp_u_Europe_Moscow __pyx_mstate_global->__pyx_kp_u_Europe_Moscow
#define __pyx_n_s_InlineKeyboardBuilder __pyx_mstate_global->__pyx_n_s_InlineKeyboardBuilder
#define __pyx_n_s_InlineKeyboardButton __pyx_mstate_global->__pyx_n_s_InlineKeyboardButton
#define __pyx_kp_u_PAYMENT __pyx_mstate_global->__pyx_kp_u_PAYMENT
@@ -2898,6 +2921,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
#define __pyx_n_s_PROFILE __pyx_mstate_global->__pyx_n_s_PROFILE
#define __pyx_kp_u_RENEW __pyx_mstate_global->__pyx_kp_u_RENEW
#define __pyx_n_s_RENEW_KEY __pyx_mstate_global->__pyx_n_s_RENEW_KEY
+#define __pyx_n_s_USE_COUNTRY_SELECTION __pyx_mstate_global->__pyx_n_s_USE_COUNTRY_SELECTION
#define __pyx_n_s_USE_NEW_PAYMENT_FLOW __pyx_mstate_global->__pyx_n_s_USE_NEW_PAYMENT_FLOW
#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2
#define __pyx_kp_u__4 __pyx_mstate_global->__pyx_kp_u__4
@@ -2965,14 +2989,17 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled
#define __pyx_n_s_logger __pyx_mstate_global->__pyx_n_s_logger
#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
+#define __pyx_n_s_moscow_tz __pyx_mstate_global->__pyx_n_s_moscow_tz
#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
#define __pyx_n_s_new_expiry_time __pyx_mstate_global->__pyx_n_s_new_expiry_time
#define __pyx_n_u_new_expiry_time __pyx_mstate_global->__pyx_n_u_new_expiry_time
+#define __pyx_n_s_now __pyx_mstate_global->__pyx_n_s_now
#define __pyx_n_s_plan __pyx_mstate_global->__pyx_n_s_plan
#define __pyx_n_u_plan __pyx_mstate_global->__pyx_n_u_plan
#define __pyx_n_s_plan_price __pyx_mstate_global->__pyx_n_s_plan_price
#define __pyx_n_u_plan_price __pyx_mstate_global->__pyx_n_u_plan_price
#define __pyx_n_u_profile __pyx_mstate_global->__pyx_n_u_profile
+#define __pyx_n_s_pytz __pyx_mstate_global->__pyx_n_s_pytz
#define __pyx_n_s_reply_markup __pyx_mstate_global->__pyx_n_s_reply_markup
#define __pyx_n_s_required_amount __pyx_mstate_global->__pyx_n_s_required_amount
#define __pyx_n_u_required_amount __pyx_mstate_global->__pyx_n_u_required_amount
@@ -2988,11 +3015,11 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
#define __pyx_n_s_text __pyx_mstate_global->__pyx_n_s_text
#define __pyx_n_s_throw __pyx_mstate_global->__pyx_n_s_throw
#define __pyx_n_s_timedelta __pyx_mstate_global->__pyx_n_s_timedelta
+#define __pyx_n_s_timezone __pyx_mstate_global->__pyx_n_s_timezone
#define __pyx_n_s_total_gb __pyx_mstate_global->__pyx_n_s_total_gb
#define __pyx_n_u_total_gb __pyx_mstate_global->__pyx_n_u_total_gb
#define __pyx_n_s_update_balance __pyx_mstate_global->__pyx_n_s_update_balance
#define __pyx_n_s_user_id __pyx_mstate_global->__pyx_n_s_user_id
-#define __pyx_n_s_utcnow __pyx_mstate_global->__pyx_n_s_utcnow
#define __pyx_n_u_view_keys __pyx_mstate_global->__pyx_n_u_view_keys
#define __pyx_n_u_waiting_for_payment __pyx_mstate_global->__pyx_n_u_waiting_for_payment
#define __pyx_n_u_waiting_for_renewal_payment __pyx_mstate_global->__pyx_n_u_waiting_for_renewal_payment
@@ -3004,7 +3031,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
/* #### Code section: module_code ### */
static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
-/* "handlers/payments/utils.py":15
+/* "handlers/payments/utils.py":16
*
*
* async def send_payment_success_notification(user_id: int, amount: float): # <<<<<<<<<<<<<<
@@ -3068,7 +3095,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
- else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error)
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
@@ -3076,14 +3103,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
- else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error)
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
else {
- __Pyx_RaiseArgtupleInvalid("send_payment_success_notification", 1, 2, 2, 1); __PYX_ERR(0, 15, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("send_payment_success_notification", 1, 2, 2, 1); __PYX_ERR(0, 16, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "send_payment_success_notification") < 0)) __PYX_ERR(0, 15, __pyx_L3_error)
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "send_payment_success_notification") < 0)) __PYX_ERR(0, 16, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
@@ -3092,11 +3119,11 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_user_id = ((PyObject*)values[0]);
- __pyx_v_amount = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_amount == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error)
+ __pyx_v_amount = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_amount == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("send_payment_success_notification", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 15, __pyx_L3_error)
+ __Pyx_RaiseArgtupleInvalid("send_payment_success_notification", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 16, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
@@ -3110,7 +3137,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_id), (&PyInt_Type), 0, "user_id", 1))) __PYX_ERR(0, 15, __pyx_L1_error)
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_id), (&PyInt_Type), 0, "user_id", 1))) __PYX_ERR(0, 16, __pyx_L1_error)
__pyx_r = __pyx_pf_8handlers_8payments_5utils_send_payment_success_notification(__pyx_self, __pyx_v_user_id, __pyx_v_amount);
/* function exit code */
@@ -3140,7 +3167,7 @@ static PyObject *__pyx_pf_8handlers_8payments_5utils_send_payment_success_notifi
if (unlikely(!__pyx_cur_scope)) {
__pyx_cur_scope = ((struct __pyx_obj_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification *)Py_None);
__Pyx_INCREF(Py_None);
- __PYX_ERR(0, 15, __pyx_L1_error)
+ __PYX_ERR(0, 16, __pyx_L1_error)
} else {
__Pyx_GOTREF((PyObject *)__pyx_cur_scope);
}
@@ -3149,7 +3176,7 @@ static PyObject *__pyx_pf_8handlers_8payments_5utils_send_payment_success_notifi
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_user_id);
__pyx_cur_scope->__pyx_v_amount = __pyx_v_amount;
{
- __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_8handlers_8payments_5utils_2generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_send_payment_success_notificatio, __pyx_n_s_send_payment_success_notificatio, __pyx_n_s_handlers_payments_utils); if (unlikely(!gen)) __PYX_ERR(0, 15, __pyx_L1_error)
+ __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_8handlers_8payments_5utils_2generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_send_payment_success_notificatio, __pyx_n_s_send_payment_success_notificatio, __pyx_n_s_handlers_payments_utils); if (unlikely(!gen)) __PYX_ERR(0, 16, __pyx_L1_error)
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
@@ -3222,9 +3249,9 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
return NULL;
}
__pyx_L3_first_run:;
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 15, __pyx_L1_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 16, __pyx_L1_error)
- /* "handlers/payments/utils.py":16
+ /* "handlers/payments/utils.py":17
*
* async def send_payment_success_notification(user_id: int, amount: float):
* try: # <<<<<<<<<<<<<<
@@ -3238,29 +3265,29 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__Pyx_XGOTREF(__pyx_t_3);
/*try:*/ {
- /* "handlers/payments/utils.py":17
+ /* "handlers/payments/utils.py":18
* async def send_payment_success_notification(user_id: int, amount: float):
* try:
* user_id = int(user_id) # <<<<<<<<<<<<<<
*
* builder = InlineKeyboardBuilder()
*/
- __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_cur_scope->__pyx_v_user_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L4_error)
+ __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_cur_scope->__pyx_v_user_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
- if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_4)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_4))) __PYX_ERR(0, 17, __pyx_L4_error)
+ if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_4)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_4))) __PYX_ERR(0, 18, __pyx_L4_error)
__Pyx_GOTREF(__pyx_cur_scope->__pyx_v_user_id);
__Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_user_id, ((PyObject*)__pyx_t_4));
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- /* "handlers/payments/utils.py":19
+ /* "handlers/payments/utils.py":20
* user_id = int(user_id)
*
* builder = InlineKeyboardBuilder() # <<<<<<<<<<<<<<
* builder.row(InlineKeyboardButton(text=PROFILE, callback_data="profile"))
*
*/
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_InlineKeyboardBuilder); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L4_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_InlineKeyboardBuilder); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = NULL;
__pyx_t_7 = 0;
@@ -3280,7 +3307,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
__pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 19, __pyx_L4_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
@@ -3288,25 +3315,25 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_cur_scope->__pyx_v_builder = __pyx_t_4;
__pyx_t_4 = 0;
- /* "handlers/payments/utils.py":20
+ /* "handlers/payments/utils.py":21
*
* builder = InlineKeyboardBuilder()
* builder.row(InlineKeyboardButton(text=PROFILE, callback_data="profile")) # <<<<<<<<<<<<<<
*
* if USE_NEW_PAYMENT_FLOW:
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L4_error)
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 21, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 20, __pyx_L4_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 21, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 20, __pyx_L4_error)
+ __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 21, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_8);
- __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_PROFILE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 20, __pyx_L4_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_PROFILE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 21, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_9);
- if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_text, __pyx_t_9) < 0) __PYX_ERR(0, 20, __pyx_L4_error)
+ if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_text, __pyx_t_9) < 0) __PYX_ERR(0, 21, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_callback_data, __pyx_n_u_profile) < 0) __PYX_ERR(0, 20, __pyx_L4_error)
- __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 20, __pyx_L4_error)
+ if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_callback_data, __pyx_n_u_profile) < 0) __PYX_ERR(0, 21, __pyx_L4_error)
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 21, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
@@ -3329,41 +3356,41 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L4_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "handlers/payments/utils.py":22
+ /* "handlers/payments/utils.py":23
* builder.row(InlineKeyboardButton(text=PROFILE, callback_data="profile"))
*
* if USE_NEW_PAYMENT_FLOW: # <<<<<<<<<<<<<<
* from handlers.keys.key_management import create_key
* conn = await asyncpg.connect(DATABASE_URL)
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_USE_NEW_PAYMENT_FLOW); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 22, __pyx_L4_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_USE_NEW_PAYMENT_FLOW); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 22, __pyx_L4_error)
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 23, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_10) {
- /* "handlers/payments/utils.py":23
+ /* "handlers/payments/utils.py":24
*
* if USE_NEW_PAYMENT_FLOW:
* from handlers.keys.key_management import create_key # <<<<<<<<<<<<<<
* conn = await asyncpg.connect(DATABASE_URL)
* try:
*/
- __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L4_error)
+ __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_n_s_create_key);
__Pyx_GIVEREF(__pyx_n_s_create_key);
- if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_create_key)) __PYX_ERR(0, 23, __pyx_L4_error);
- __pyx_t_5 = __Pyx_Import(__pyx_n_s_handlers_keys_key_management, __pyx_t_4, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L4_error)
+ if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_create_key)) __PYX_ERR(0, 24, __pyx_L4_error);
+ __pyx_t_5 = __Pyx_Import(__pyx_n_s_handlers_keys_key_management, __pyx_t_4, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_create_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L4_error)
+ __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_create_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
@@ -3371,19 +3398,19 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "handlers/payments/utils.py":24
+ /* "handlers/payments/utils.py":25
* if USE_NEW_PAYMENT_FLOW:
* from handlers.keys.key_management import create_key
* conn = await asyncpg.connect(DATABASE_URL) # <<<<<<<<<<<<<<
* try:
* temp_data = await get_temporary_data(conn, user_id)
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_asyncpg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L4_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_asyncpg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_connect); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 24, __pyx_L4_error)
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_connect); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 25, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_DATABASE_URL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L4_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_DATABASE_URL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_8 = NULL;
__pyx_t_7 = 0;
@@ -3404,7 +3431,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L4_error)
+ if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
@@ -3434,18 +3461,18 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = 0;
__Pyx_XGOTREF(__pyx_t_3);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 24, __pyx_L4_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 25, __pyx_L4_error)
__pyx_t_5 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_5);
} else {
__pyx_t_5 = NULL;
- if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_5) < 0) __PYX_ERR(0, 24, __pyx_L4_error)
+ if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_5) < 0) __PYX_ERR(0, 25, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_5);
}
__Pyx_GIVEREF(__pyx_t_5);
__pyx_cur_scope->__pyx_v_conn = __pyx_t_5;
__pyx_t_5 = 0;
- /* "handlers/payments/utils.py":25
+ /* "handlers/payments/utils.py":26
* from handlers.keys.key_management import create_key
* conn = await asyncpg.connect(DATABASE_URL)
* try: # <<<<<<<<<<<<<<
@@ -3454,14 +3481,14 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
*/
/*try:*/ {
- /* "handlers/payments/utils.py":26
+ /* "handlers/payments/utils.py":27
* conn = await asyncpg.connect(DATABASE_URL)
* try:
* temp_data = await get_temporary_data(conn, user_id) # <<<<<<<<<<<<<<
* if temp_data:
* state = temp_data["state"]
*/
- __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_get_temporary_data); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 26, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_get_temporary_data); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 27, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_4 = NULL;
__pyx_t_7 = 0;
@@ -3481,7 +3508,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_conn, __pyx_cur_scope->__pyx_v_user_id};
__pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L13_error)
+ if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 27, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
@@ -3511,100 +3538,100 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = 0;
__Pyx_XGOTREF(__pyx_t_3);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 26, __pyx_L13_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 27, __pyx_L13_error)
__pyx_t_5 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_5);
} else {
__pyx_t_5 = NULL;
- if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_5) < 0) __PYX_ERR(0, 26, __pyx_L13_error)
+ if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_5) < 0) __PYX_ERR(0, 27, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_5);
}
__Pyx_GIVEREF(__pyx_t_5);
__pyx_cur_scope->__pyx_v_temp_data = __pyx_t_5;
__pyx_t_5 = 0;
- /* "handlers/payments/utils.py":27
+ /* "handlers/payments/utils.py":28
* try:
* temp_data = await get_temporary_data(conn, user_id)
* if temp_data: # <<<<<<<<<<<<<<
* state = temp_data["state"]
* data = temp_data["data"]
*/
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_temp_data); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 27, __pyx_L13_error)
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_temp_data); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 28, __pyx_L13_error)
if (__pyx_t_10) {
- /* "handlers/payments/utils.py":28
+ /* "handlers/payments/utils.py":29
* temp_data = await get_temporary_data(conn, user_id)
* if temp_data:
* state = temp_data["state"] # <<<<<<<<<<<<<<
* data = temp_data["data"]
*
*/
- __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_temp_data, __pyx_n_u_state); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __pyx_L13_error)
+ __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_temp_data, __pyx_n_u_state); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 29, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_cur_scope->__pyx_v_state = __pyx_t_5;
__pyx_t_5 = 0;
- /* "handlers/payments/utils.py":29
+ /* "handlers/payments/utils.py":30
* if temp_data:
* state = temp_data["state"]
* data = temp_data["data"] # <<<<<<<<<<<<<<
*
* required_amount = data.get("required_amount", 0)
*/
- __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_temp_data, __pyx_n_u_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 29, __pyx_L13_error)
+ __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_temp_data, __pyx_n_u_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_cur_scope->__pyx_v_data = __pyx_t_5;
__pyx_t_5 = 0;
- /* "handlers/payments/utils.py":31
+ /* "handlers/payments/utils.py":32
* data = temp_data["data"]
*
* required_amount = data.get("required_amount", 0) # <<<<<<<<<<<<<<
*
* if int(amount) != int(required_amount):
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L13_error)
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 31, __pyx_L13_error)
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 32, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_GIVEREF(__pyx_t_9);
__pyx_cur_scope->__pyx_v_required_amount = __pyx_t_9;
__pyx_t_9 = 0;
- /* "handlers/payments/utils.py":33
+ /* "handlers/payments/utils.py":34
* required_amount = data.get("required_amount", 0)
*
* if int(amount) != int(required_amount): # <<<<<<<<<<<<<<
* logger.warning(f"[PAYMENT] {amount} {required_amount}.")
* else:
*/
- __pyx_t_9 = __Pyx_PyInt_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 33, __pyx_L13_error)
+ __pyx_t_9 = __Pyx_PyInt_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 34, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
- __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_cur_scope->__pyx_v_required_amount); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L13_error)
+ __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_cur_scope->__pyx_v_required_amount); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_9, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L13_error)
+ __pyx_t_4 = PyObject_RichCompare(__pyx_t_9, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L13_error)
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 33, __pyx_L13_error)
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 34, __pyx_L13_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_10) {
- /* "handlers/payments/utils.py":34
+ /* "handlers/payments/utils.py":35
*
* if int(amount) != int(required_amount):
* logger.warning(f"[PAYMENT] {amount} {required_amount}.") # <<<<<<<<<<<<<<
* else:
* if state == "waiting_for_renewal_payment":
*/
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_logger); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_logger); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_warning); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 34, __pyx_L13_error)
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_warning); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 35, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L13_error)
+ __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_11 = 0;
__pyx_t_12 = 127;
@@ -3613,9 +3640,9 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_11 += 17;
__Pyx_GIVEREF(__pyx_kp_u_PAYMENT);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_PAYMENT);
- __pyx_t_8 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 34, __pyx_L13_error)
+ __pyx_t_8 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 35, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_8);
- __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L13_error)
+ __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 35, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_12;
@@ -3628,7 +3655,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_11 += 34;
__Pyx_GIVEREF(__pyx_kp_u__4);
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__4);
- __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_required_amount, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L13_error)
+ __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_required_amount, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 35, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_12;
__pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
@@ -3639,7 +3666,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_11 += 1;
__Pyx_GIVEREF(__pyx_kp_u__2);
PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__2);
- __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L13_error)
+ __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 35, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = NULL;
@@ -3661,13 +3688,13 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L13_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "handlers/payments/utils.py":33
+ /* "handlers/payments/utils.py":34
* required_amount = data.get("required_amount", 0)
*
* if int(amount) != int(required_amount): # <<<<<<<<<<<<<<
@@ -3677,7 +3704,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
goto __pyx_L17;
}
- /* "handlers/payments/utils.py":36
+ /* "handlers/payments/utils.py":37
* logger.warning(f"[PAYMENT] {amount} {required_amount}.")
* else:
* if state == "waiting_for_renewal_payment": # <<<<<<<<<<<<<<
@@ -3685,25 +3712,25 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
*
*/
/*else*/ {
- __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_state, __pyx_n_u_waiting_for_renewal_payment, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 36, __pyx_L13_error)
+ __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_state, __pyx_n_u_waiting_for_renewal_payment, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 37, __pyx_L13_error)
if (__pyx_t_10) {
- /* "handlers/payments/utils.py":37
+ /* "handlers/payments/utils.py":38
* else:
* if state == "waiting_for_renewal_payment":
* from handlers.keys.keys import complete_key_renewal # <<<<<<<<<<<<<<
*
* plan = data.get("plan")
*/
- __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L13_error)
+ __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_n_s_complete_key_renewal);
__Pyx_GIVEREF(__pyx_n_s_complete_key_renewal);
- if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_complete_key_renewal)) __PYX_ERR(0, 37, __pyx_L13_error);
- __pyx_t_9 = __Pyx_Import(__pyx_n_s_handlers_keys_keys, __pyx_t_4, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 37, __pyx_L13_error)
+ if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_complete_key_renewal)) __PYX_ERR(0, 38, __pyx_L13_error);
+ __pyx_t_9 = __Pyx_Import(__pyx_n_s_handlers_keys_keys, __pyx_t_4, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_complete_key_renewal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L13_error)
+ __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_complete_key_renewal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
@@ -3711,14 +3738,14 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- /* "handlers/payments/utils.py":39
+ /* "handlers/payments/utils.py":40
* from handlers.keys.keys import complete_key_renewal
*
* plan = data.get("plan") # <<<<<<<<<<<<<<
* client_id = data.get("client_id")
* new_expiry_time = data.get("new_expiry_time")
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L13_error)
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = NULL;
__pyx_t_7 = 0;
@@ -3738,7 +3765,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_u_plan};
__pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 39, __pyx_L13_error)
+ if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 40, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
@@ -3746,14 +3773,14 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_cur_scope->__pyx_v_plan = __pyx_t_9;
__pyx_t_9 = 0;
- /* "handlers/payments/utils.py":40
+ /* "handlers/payments/utils.py":41
*
* plan = data.get("plan")
* client_id = data.get("client_id") # <<<<<<<<<<<<<<
* new_expiry_time = data.get("new_expiry_time")
* total_gb = data.get("total_gb")
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L13_error)
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = NULL;
__pyx_t_7 = 0;
@@ -3773,7 +3800,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_u_client_id};
__pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 40, __pyx_L13_error)
+ if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 41, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
@@ -3781,14 +3808,14 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_cur_scope->__pyx_v_client_id = __pyx_t_9;
__pyx_t_9 = 0;
- /* "handlers/payments/utils.py":41
+ /* "handlers/payments/utils.py":42
* plan = data.get("plan")
* client_id = data.get("client_id")
* new_expiry_time = data.get("new_expiry_time") # <<<<<<<<<<<<<<
* total_gb = data.get("total_gb")
* cost = data.get("cost")
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L13_error)
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = NULL;
__pyx_t_7 = 0;
@@ -3808,7 +3835,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_u_new_expiry_time};
__pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 41, __pyx_L13_error)
+ if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 42, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
@@ -3816,14 +3843,14 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_cur_scope->__pyx_v_new_expiry_time = __pyx_t_9;
__pyx_t_9 = 0;
- /* "handlers/payments/utils.py":42
+ /* "handlers/payments/utils.py":43
* client_id = data.get("client_id")
* new_expiry_time = data.get("new_expiry_time")
* total_gb = data.get("total_gb") # <<<<<<<<<<<<<<
* cost = data.get("cost")
* email = data.get("email")
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L13_error)
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = NULL;
__pyx_t_7 = 0;
@@ -3843,7 +3870,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_u_total_gb};
__pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 42, __pyx_L13_error)
+ if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 43, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
@@ -3851,14 +3878,14 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_cur_scope->__pyx_v_total_gb = __pyx_t_9;
__pyx_t_9 = 0;
- /* "handlers/payments/utils.py":43
+ /* "handlers/payments/utils.py":44
* new_expiry_time = data.get("new_expiry_time")
* total_gb = data.get("total_gb")
* cost = data.get("cost") # <<<<<<<<<<<<<<
* email = data.get("email")
*
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L13_error)
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = NULL;
__pyx_t_7 = 0;
@@ -3878,7 +3905,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_u_cost};
__pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 43, __pyx_L13_error)
+ if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 44, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
@@ -3886,14 +3913,14 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_cur_scope->__pyx_v_cost = __pyx_t_9;
__pyx_t_9 = 0;
- /* "handlers/payments/utils.py":44
+ /* "handlers/payments/utils.py":45
* total_gb = data.get("total_gb")
* cost = data.get("cost")
* email = data.get("email") # <<<<<<<<<<<<<<
*
* if not all([plan, client_id, new_expiry_time, email]):
*/
- __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L13_error)
+ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = NULL;
__pyx_t_7 = 0;
@@ -3913,7 +3940,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_u_email};
__pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 44, __pyx_L13_error)
+ if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 45, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
@@ -3921,50 +3948,50 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_cur_scope->__pyx_v_email = __pyx_t_9;
__pyx_t_9 = 0;
- /* "handlers/payments/utils.py":46
+ /* "handlers/payments/utils.py":47
* email = data.get("email")
*
* if not all([plan, client_id, new_expiry_time, email]): # <<<<<<<<<<<<<<
* logger.error(f"[RENEW] {user_id}")
* return
*/
- __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 46, __pyx_L13_error)
+ __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 47, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_plan);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_plan);
- if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 0, __pyx_cur_scope->__pyx_v_plan)) __PYX_ERR(0, 46, __pyx_L13_error);
+ if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 0, __pyx_cur_scope->__pyx_v_plan)) __PYX_ERR(0, 47, __pyx_L13_error);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_client_id);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_client_id);
- if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 1, __pyx_cur_scope->__pyx_v_client_id)) __PYX_ERR(0, 46, __pyx_L13_error);
+ if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 1, __pyx_cur_scope->__pyx_v_client_id)) __PYX_ERR(0, 47, __pyx_L13_error);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_new_expiry_time);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new_expiry_time);
- if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 2, __pyx_cur_scope->__pyx_v_new_expiry_time)) __PYX_ERR(0, 46, __pyx_L13_error);
+ if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 2, __pyx_cur_scope->__pyx_v_new_expiry_time)) __PYX_ERR(0, 47, __pyx_L13_error);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_email);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_email);
- if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 3, __pyx_cur_scope->__pyx_v_email)) __PYX_ERR(0, 46, __pyx_L13_error);
- __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __pyx_L13_error)
+ if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 3, __pyx_cur_scope->__pyx_v_email)) __PYX_ERR(0, 47, __pyx_L13_error);
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 46, __pyx_L13_error)
+ __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 47, __pyx_L13_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_13 = (!__pyx_t_10);
if (__pyx_t_13) {
- /* "handlers/payments/utils.py":47
+ /* "handlers/payments/utils.py":48
*
* if not all([plan, client_id, new_expiry_time, email]):
* logger.error(f"[RENEW] {user_id}") # <<<<<<<<<<<<<<
* return
*
*/
- __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_logger); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 47, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_logger); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 48, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L13_error)
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 48, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_user_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 47, __pyx_L13_error)
+ __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_user_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 48, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
- __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_RENEW, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 47, __pyx_L13_error)
+ __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_RENEW, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 48, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = NULL;
@@ -3986,13 +4013,13 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __pyx_L13_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "handlers/payments/utils.py":48
+ /* "handlers/payments/utils.py":49
* if not all([plan, client_id, new_expiry_time, email]):
* logger.error(f"[RENEW] {user_id}")
* return # <<<<<<<<<<<<<<
@@ -4003,7 +4030,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_r = NULL;
goto __pyx_L12_return;
- /* "handlers/payments/utils.py":46
+ /* "handlers/payments/utils.py":47
* email = data.get("email")
*
* if not all([plan, client_id, new_expiry_time, email]): # <<<<<<<<<<<<<<
@@ -4012,14 +4039,14 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
*/
}
- /* "handlers/payments/utils.py":50
+ /* "handlers/payments/utils.py":51
* return
*
* balance = await get_balance(user_id) # <<<<<<<<<<<<<<
* if balance >= cost:
* await complete_key_renewal(user_id, client_id, email, new_expiry_time, total_gb, cost, None, plan)
*/
- __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_balance); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_balance); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 51, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = NULL;
__pyx_t_7 = 0;
@@ -4039,7 +4066,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_user_id};
__pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L13_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
@@ -4069,30 +4096,30 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = 0;
__Pyx_XGOTREF(__pyx_t_3);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 50, __pyx_L13_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 51, __pyx_L13_error)
__pyx_t_4 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_4);
} else {
__pyx_t_4 = NULL;
- if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_4) < 0) __PYX_ERR(0, 50, __pyx_L13_error)
+ if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_4) < 0) __PYX_ERR(0, 51, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
}
__Pyx_GIVEREF(__pyx_t_4);
__pyx_cur_scope->__pyx_v_balance = __pyx_t_4;
__pyx_t_4 = 0;
- /* "handlers/payments/utils.py":51
+ /* "handlers/payments/utils.py":52
*
* balance = await get_balance(user_id)
* if balance >= cost: # <<<<<<<<<<<<<<
* await complete_key_renewal(user_id, client_id, email, new_expiry_time, total_gb, cost, None, plan)
* await clear_temporary_data(conn, user_id)
*/
- __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_balance, __pyx_cur_scope->__pyx_v_cost, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L13_error)
- __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 51, __pyx_L13_error)
+ __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_balance, __pyx_cur_scope->__pyx_v_cost, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L13_error)
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 52, __pyx_L13_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_13) {
- /* "handlers/payments/utils.py":52
+ /* "handlers/payments/utils.py":53
* balance = await get_balance(user_id)
* if balance >= cost:
* await complete_key_renewal(user_id, client_id, email, new_expiry_time, total_gb, cost, None, plan) # <<<<<<<<<<<<<<
@@ -4118,7 +4145,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[9] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_user_id, __pyx_cur_scope->__pyx_v_client_id, __pyx_cur_scope->__pyx_v_email, __pyx_cur_scope->__pyx_v_new_expiry_time, __pyx_cur_scope->__pyx_v_total_gb, __pyx_cur_scope->__pyx_v_cost, Py_None, __pyx_cur_scope->__pyx_v_plan};
__pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 8+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L13_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
@@ -4148,23 +4175,23 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = 0;
__Pyx_XGOTREF(__pyx_t_3);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 52, __pyx_L13_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 53, __pyx_L13_error)
} else {
PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
- else __PYX_ERR(0, 52, __pyx_L13_error)
+ else __PYX_ERR(0, 53, __pyx_L13_error)
}
}
- /* "handlers/payments/utils.py":53
+ /* "handlers/payments/utils.py":54
* if balance >= cost:
* await complete_key_renewal(user_id, client_id, email, new_expiry_time, total_gb, cost, None, plan)
* await clear_temporary_data(conn, user_id) # <<<<<<<<<<<<<<
* return
*
*/
- __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 53, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = NULL;
__pyx_t_7 = 0;
@@ -4184,7 +4211,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_conn, __pyx_cur_scope->__pyx_v_user_id};
__pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L13_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
@@ -4214,16 +4241,16 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = 0;
__Pyx_XGOTREF(__pyx_t_3);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 53, __pyx_L13_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 54, __pyx_L13_error)
} else {
PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
- else __PYX_ERR(0, 53, __pyx_L13_error)
+ else __PYX_ERR(0, 54, __pyx_L13_error)
}
}
- /* "handlers/payments/utils.py":54
+ /* "handlers/payments/utils.py":55
* await complete_key_renewal(user_id, client_id, email, new_expiry_time, total_gb, cost, None, plan)
* await clear_temporary_data(conn, user_id)
* return # <<<<<<<<<<<<<<
@@ -4234,7 +4261,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_r = NULL;
goto __pyx_L12_return;
- /* "handlers/payments/utils.py":51
+ /* "handlers/payments/utils.py":52
*
* balance = await get_balance(user_id)
* if balance >= cost: # <<<<<<<<<<<<<<
@@ -4243,7 +4270,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
*/
}
- /* "handlers/payments/utils.py":36
+ /* "handlers/payments/utils.py":37
* logger.warning(f"[PAYMENT] {amount} {required_amount}.")
* else:
* if state == "waiting_for_renewal_payment": # <<<<<<<<<<<<<<
@@ -4252,50 +4279,50 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
*/
}
- /* "handlers/payments/utils.py":56
+ /* "handlers/payments/utils.py":57
* return
*
* if state == "waiting_for_payment": # <<<<<<<<<<<<<<
* plan_price = data["plan_price"]
* duration_days = data["duration_days"]
*/
- __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_state, __pyx_n_u_waiting_for_payment, Py_EQ)); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 56, __pyx_L13_error)
+ __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_state, __pyx_n_u_waiting_for_payment, Py_EQ)); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 57, __pyx_L13_error)
if (__pyx_t_13) {
- /* "handlers/payments/utils.py":57
+ /* "handlers/payments/utils.py":58
*
* if state == "waiting_for_payment":
* plan_price = data["plan_price"] # <<<<<<<<<<<<<<
* duration_days = data["duration_days"]
*
*/
- __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_n_u_plan_price); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L13_error)
+ __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_n_u_plan_price); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_cur_scope->__pyx_v_plan_price = __pyx_t_4;
__pyx_t_4 = 0;
- /* "handlers/payments/utils.py":58
+ /* "handlers/payments/utils.py":59
* if state == "waiting_for_payment":
* plan_price = data["plan_price"]
* duration_days = data["duration_days"] # <<<<<<<<<<<<<<
*
* balance = await get_balance(user_id)
*/
- __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_n_u_duration_days); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L13_error)
+ __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_n_u_duration_days); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_cur_scope->__pyx_v_duration_days = __pyx_t_4;
__pyx_t_4 = 0;
- /* "handlers/payments/utils.py":60
+ /* "handlers/payments/utils.py":61
* duration_days = data["duration_days"]
*
* balance = await get_balance(user_id) # <<<<<<<<<<<<<<
* if balance >= plan_price:
- * expiry_time = datetime.utcnow() + timedelta(days=duration_days)
+ * moscow_tz = pytz.timezone("Europe/Moscow")
*/
- __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_balance); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_balance); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 61, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = NULL;
__pyx_t_7 = 0;
@@ -4315,7 +4342,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_user_id};
__pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L13_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
@@ -4345,11 +4372,11 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = 0;
__Pyx_XGOTREF(__pyx_t_3);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 60, __pyx_L13_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 61, __pyx_L13_error)
__pyx_t_4 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_4);
} else {
__pyx_t_4 = NULL;
- if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_4) < 0) __PYX_ERR(0, 60, __pyx_L13_error)
+ if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_4) < 0) __PYX_ERR(0, 61, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_balance);
@@ -4357,28 +4384,28 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- /* "handlers/payments/utils.py":61
+ /* "handlers/payments/utils.py":62
*
* balance = await get_balance(user_id)
* if balance >= plan_price: # <<<<<<<<<<<<<<
- * expiry_time = datetime.utcnow() + timedelta(days=duration_days)
- * await create_key(user_id, expiry_time, None, conn, None)
+ * moscow_tz = pytz.timezone("Europe/Moscow")
+ * expiry_time = datetime.now(moscow_tz) + timedelta(days=duration_days)
*/
- __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_balance, __pyx_cur_scope->__pyx_v_plan_price, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L13_error)
- __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 61, __pyx_L13_error)
+ __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_balance, __pyx_cur_scope->__pyx_v_plan_price, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L13_error)
+ __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 62, __pyx_L13_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_13) {
- /* "handlers/payments/utils.py":62
+ /* "handlers/payments/utils.py":63
* balance = await get_balance(user_id)
* if balance >= plan_price:
- * expiry_time = datetime.utcnow() + timedelta(days=duration_days) # <<<<<<<<<<<<<<
+ * moscow_tz = pytz.timezone("Europe/Moscow") # <<<<<<<<<<<<<<
+ * expiry_time = datetime.now(moscow_tz) + timedelta(days=duration_days)
* await create_key(user_id, expiry_time, None, conn, None)
- *
*/
- __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_datetime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 62, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pytz); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 63, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_utcnow); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L13_error)
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_timezone); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 63, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = NULL;
@@ -4396,33 +4423,71 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
}
#endif
{
- PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
- __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
+ PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_kp_u_Europe_Moscow};
+ __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L13_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_timedelta); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L13_error)
+ __Pyx_GIVEREF(__pyx_t_4);
+ __pyx_cur_scope->__pyx_v_moscow_tz = __pyx_t_4;
+ __pyx_t_4 = 0;
+
+ /* "handlers/payments/utils.py":64
+ * if balance >= plan_price:
+ * moscow_tz = pytz.timezone("Europe/Moscow")
+ * expiry_time = datetime.now(moscow_tz) + timedelta(days=duration_days) # <<<<<<<<<<<<<<
+ * await create_key(user_id, expiry_time, None, conn, None)
+ *
+ */
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_datetime); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 62, __pyx_L13_error)
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_now); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_6);
- if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_days, __pyx_cur_scope->__pyx_v_duration_days) < 0) __PYX_ERR(0, 62, __pyx_L13_error)
- __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L13_error)
- __Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 62, __pyx_L13_error)
+ __pyx_t_5 = NULL;
+ __pyx_t_7 = 0;
+ #if CYTHON_UNPACK_METHODS
+ if (unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(__pyx_t_5)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
+ __pyx_t_7 = 1;
+ }
+ }
+ #endif
+ {
+ PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_moscow_tz};
+ __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L13_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_timedelta); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L13_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_days, __pyx_cur_scope->__pyx_v_duration_days) < 0) __PYX_ERR(0, 64, __pyx_L13_error)
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 64, __pyx_L13_error)
+ __Pyx_GOTREF(__pyx_t_9);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L13_error)
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_GIVEREF(__pyx_t_6);
- __pyx_cur_scope->__pyx_v_expiry_time = __pyx_t_6;
- __pyx_t_6 = 0;
+ __Pyx_GIVEREF(__pyx_t_5);
+ __pyx_cur_scope->__pyx_v_expiry_time = __pyx_t_5;
+ __pyx_t_5 = 0;
- /* "handlers/payments/utils.py":63
- * if balance >= plan_price:
- * expiry_time = datetime.utcnow() + timedelta(days=duration_days)
+ /* "handlers/payments/utils.py":65
+ * moscow_tz = pytz.timezone("Europe/Moscow")
+ * expiry_time = datetime.now(moscow_tz) + timedelta(days=duration_days)
* await create_key(user_id, expiry_time, None, conn, None) # <<<<<<<<<<<<<<
*
* await update_balance(user_id, -plan_price)
@@ -4444,14 +4509,14 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
#endif
{
PyObject *__pyx_callargs[6] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_user_id, __pyx_cur_scope->__pyx_v_expiry_time, Py_None, __pyx_cur_scope->__pyx_v_conn, Py_None};
- __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 5+__pyx_t_7);
+ __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 5+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 63, __pyx_L13_error)
- __Pyx_GOTREF(__pyx_t_6);
+ if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L13_error)
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
- __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_6);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XGOTREF(__pyx_r);
if (likely(__pyx_r)) {
__Pyx_XGIVEREF(__pyx_t_1);
@@ -4476,34 +4541,34 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = 0;
__Pyx_XGOTREF(__pyx_t_3);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 63, __pyx_L13_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 65, __pyx_L13_error)
} else {
PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
- else __PYX_ERR(0, 63, __pyx_L13_error)
+ else __PYX_ERR(0, 65, __pyx_L13_error)
}
}
- /* "handlers/payments/utils.py":65
+ /* "handlers/payments/utils.py":67
* await create_key(user_id, expiry_time, None, conn, None)
*
* await update_balance(user_id, -plan_price) # <<<<<<<<<<<<<<
* await clear_temporary_data(conn, user_id)
* return
*/
- __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_update_balance); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 65, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_update_balance); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 67, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
- __pyx_t_4 = PyNumber_Negative(__pyx_cur_scope->__pyx_v_plan_price); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L13_error)
+ __pyx_t_4 = PyNumber_Negative(__pyx_cur_scope->__pyx_v_plan_price); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = NULL;
+ __pyx_t_6 = NULL;
__pyx_t_7 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_9))) {
- __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
- if (likely(__pyx_t_5)) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
+ if (likely(__pyx_t_6)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
- __Pyx_INCREF(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_9, function);
__pyx_t_7 = 1;
@@ -4511,16 +4576,16 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
}
#endif
{
- PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_user_id, __pyx_t_4};
- __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_user_id, __pyx_t_4};
+ __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L13_error)
- __Pyx_GOTREF(__pyx_t_6);
+ if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L13_error)
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
- __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_6);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XGOTREF(__pyx_r);
if (likely(__pyx_r)) {
__Pyx_XGIVEREF(__pyx_t_1);
@@ -4545,23 +4610,23 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = 0;
__Pyx_XGOTREF(__pyx_t_3);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 65, __pyx_L13_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 67, __pyx_L13_error)
} else {
PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
- else __PYX_ERR(0, 65, __pyx_L13_error)
+ else __PYX_ERR(0, 67, __pyx_L13_error)
}
}
- /* "handlers/payments/utils.py":66
+ /* "handlers/payments/utils.py":68
*
* await update_balance(user_id, -plan_price)
* await clear_temporary_data(conn, user_id) # <<<<<<<<<<<<<<
* return
*
*/
- __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 68, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_4 = NULL;
__pyx_t_7 = 0;
@@ -4579,14 +4644,14 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
#endif
{
PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_conn, __pyx_cur_scope->__pyx_v_user_id};
- __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
+ __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L13_error)
- __Pyx_GOTREF(__pyx_t_6);
+ if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L13_error)
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
- __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_6);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XGOTREF(__pyx_r);
if (likely(__pyx_r)) {
__Pyx_XGIVEREF(__pyx_t_1);
@@ -4611,36 +4676,36 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = 0;
__Pyx_XGOTREF(__pyx_t_3);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 66, __pyx_L13_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 68, __pyx_L13_error)
} else {
PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
- else __PYX_ERR(0, 66, __pyx_L13_error)
+ else __PYX_ERR(0, 68, __pyx_L13_error)
}
}
- /* "handlers/payments/utils.py":67
+ /* "handlers/payments/utils.py":69
* await update_balance(user_id, -plan_price)
* await clear_temporary_data(conn, user_id)
* return # <<<<<<<<<<<<<<
*
- * builder.row(
+ *
*/
__Pyx_XDECREF(__pyx_r);
__pyx_r = NULL;
goto __pyx_L12_return;
- /* "handlers/payments/utils.py":61
+ /* "handlers/payments/utils.py":62
*
* balance = await get_balance(user_id)
* if balance >= plan_price: # <<<<<<<<<<<<<<
- * expiry_time = datetime.utcnow() + timedelta(days=duration_days)
- * await create_key(user_id, expiry_time, None, conn, None)
+ * moscow_tz = pytz.timezone("Europe/Moscow")
+ * expiry_time = datetime.now(moscow_tz) + timedelta(days=duration_days)
*/
}
- /* "handlers/payments/utils.py":56
+ /* "handlers/payments/utils.py":57
* return
*
* if state == "waiting_for_payment": # <<<<<<<<<<<<<<
@@ -4651,7 +4716,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
}
__pyx_L17:;
- /* "handlers/payments/utils.py":27
+ /* "handlers/payments/utils.py":28
* try:
* temp_data = await get_temporary_data(conn, user_id)
* if temp_data: # <<<<<<<<<<<<<<
@@ -4660,56 +4725,56 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
*/
}
- /* "handlers/payments/utils.py":69
- * return
+ /* "handlers/payments/utils.py":72
+ *
*
* builder.row( # <<<<<<<<<<<<<<
* InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"),
* InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"),
*/
- __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L13_error)
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 72, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
- /* "handlers/payments/utils.py":70
+ /* "handlers/payments/utils.py":73
*
* builder.row(
* InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"), # <<<<<<<<<<<<<<
* InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"),
* )
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L13_error)
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ADD_KEY); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 70, __pyx_L13_error)
+ __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 73, __pyx_L13_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ADD_KEY); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 73, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_8);
- if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_text, __pyx_t_8) < 0) __PYX_ERR(0, 70, __pyx_L13_error)
+ if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_text, __pyx_t_8) < 0) __PYX_ERR(0, 73, __pyx_L13_error)
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_callback_data, __pyx_n_u_create_key) < 0) __PYX_ERR(0, 70, __pyx_L13_error)
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 70, __pyx_L13_error)
+ if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_callback_data, __pyx_n_u_create_key) < 0) __PYX_ERR(0, 73, __pyx_L13_error)
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 73, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- /* "handlers/payments/utils.py":71
+ /* "handlers/payments/utils.py":74
* builder.row(
* InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"),
* InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"), # <<<<<<<<<<<<<<
* )
* await bot.send_message(
*/
- __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 71, __pyx_L13_error)
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L13_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_RENEW_KEY); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 71, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_RENEW_KEY); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 74, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_14);
- if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_text, __pyx_t_14) < 0) __PYX_ERR(0, 71, __pyx_L13_error)
+ if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_text, __pyx_t_14) < 0) __PYX_ERR(0, 74, __pyx_L13_error)
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_callback_data, __pyx_n_u_view_keys) < 0) __PYX_ERR(0, 71, __pyx_L13_error)
- __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 71, __pyx_L13_error)
+ if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_callback_data, __pyx_n_u_view_keys) < 0) __PYX_ERR(0, 74, __pyx_L13_error)
+ __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 74, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_14);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = NULL;
__pyx_t_7 = 0;
@@ -4727,73 +4792,73 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
#endif
{
PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_8, __pyx_t_14};
- __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
+ __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 69, __pyx_L13_error)
- __Pyx_GOTREF(__pyx_t_6);
+ if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 72, __pyx_L13_error)
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "handlers/payments/utils.py":73
+ /* "handlers/payments/utils.py":76
* InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"),
* )
* await bot.send_message( # <<<<<<<<<<<<<<
* chat_id=user_id,
* text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount),
*/
- __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_bot); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 73, __pyx_L13_error)
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_send_message); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 73, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_bot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L13_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_send_message); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 76, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- /* "handlers/payments/utils.py":74
+ /* "handlers/payments/utils.py":77
* )
* await bot.send_message(
* chat_id=user_id, # <<<<<<<<<<<<<<
* text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount),
* reply_markup=builder.as_markup(),
*/
- __pyx_t_6 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L13_error)
- __Pyx_GOTREF(__pyx_t_6);
- if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_chat_id, __pyx_cur_scope->__pyx_v_user_id) < 0) __PYX_ERR(0, 74, __pyx_L13_error)
+ __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 77, __pyx_L13_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_chat_id, __pyx_cur_scope->__pyx_v_user_id) < 0) __PYX_ERR(0, 77, __pyx_L13_error)
- /* "handlers/payments/utils.py":75
+ /* "handlers/payments/utils.py":78
* await bot.send_message(
* chat_id=user_id,
* text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), # <<<<<<<<<<<<<<
* reply_markup=builder.as_markup(),
* )
*/
- __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_PAYMENT_SUCCESS_MESSAGE); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 75, __pyx_L13_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_PAYMENT_SUCCESS_MESSAGE); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 78, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 75, __pyx_L13_error)
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 78, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 75, __pyx_L13_error)
+ __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 78, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_4 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L13_error)
+ __pyx_t_4 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
- if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_amount, __pyx_t_4) < 0) __PYX_ERR(0, 75, __pyx_L13_error)
+ if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_amount, __pyx_t_4) < 0) __PYX_ERR(0, 78, __pyx_L13_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L13_error)
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_text, __pyx_t_4) < 0) __PYX_ERR(0, 74, __pyx_L13_error)
+ if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_text, __pyx_t_4) < 0) __PYX_ERR(0, 77, __pyx_L13_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "handlers/payments/utils.py":76
+ /* "handlers/payments/utils.py":79
* chat_id=user_id,
* text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount),
* reply_markup=builder.as_markup(), # <<<<<<<<<<<<<<
* )
* await clear_temporary_data(conn, user_id)
*/
- __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_as_markup); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 76, __pyx_L13_error)
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_as_markup); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 79, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_14);
__pyx_t_8 = NULL;
__pyx_t_7 = 0;
@@ -4813,24 +4878,24 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
__pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_14, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L13_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
}
- if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_reply_markup, __pyx_t_4) < 0) __PYX_ERR(0, 74, __pyx_L13_error)
+ if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_reply_markup, __pyx_t_4) < 0) __PYX_ERR(0, 77, __pyx_L13_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "handlers/payments/utils.py":73
+ /* "handlers/payments/utils.py":76
* InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"),
* )
* await bot.send_message( # <<<<<<<<<<<<<<
* chat_id=user_id,
* text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount),
*/
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L13_error)
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XGOTREF(__pyx_r);
@@ -4857,45 +4922,45 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = 0;
__Pyx_XGOTREF(__pyx_t_3);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 73, __pyx_L13_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 76, __pyx_L13_error)
} else {
PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
- else __PYX_ERR(0, 73, __pyx_L13_error)
+ else __PYX_ERR(0, 76, __pyx_L13_error)
}
}
- /* "handlers/payments/utils.py":78
+ /* "handlers/payments/utils.py":81
* reply_markup=builder.as_markup(),
* )
* await clear_temporary_data(conn, user_id) # <<<<<<<<<<<<<<
*
* finally:
*/
- __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L13_error)
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 81, __pyx_L13_error)
+ __Pyx_GOTREF(__pyx_t_5);
__pyx_t_9 = NULL;
__pyx_t_7 = 0;
#if CYTHON_UNPACK_METHODS
- if (unlikely(PyMethod_Check(__pyx_t_6))) {
- __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
+ if (unlikely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
if (likely(__pyx_t_9)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_6, function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
__pyx_t_7 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_cur_scope->__pyx_v_conn, __pyx_cur_scope->__pyx_v_user_id};
- __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
+ __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L13_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L13_error)
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -4923,17 +4988,17 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = 0;
__Pyx_XGOTREF(__pyx_t_3);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 78, __pyx_L13_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 81, __pyx_L13_error)
} else {
PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
- else __PYX_ERR(0, 78, __pyx_L13_error)
+ else __PYX_ERR(0, 81, __pyx_L13_error)
}
}
}
- /* "handlers/payments/utils.py":81
+ /* "handlers/payments/utils.py":84
*
* finally:
* await conn.close() # <<<<<<<<<<<<<<
@@ -4942,29 +5007,29 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
*/
/*finally:*/ {
/*normal exit:*/{
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L4_error)
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_5);
__pyx_t_9 = NULL;
__pyx_t_7 = 0;
#if CYTHON_UNPACK_METHODS
- if (likely(PyMethod_Check(__pyx_t_6))) {
- __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
if (likely(__pyx_t_9)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_6, function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
__pyx_t_7 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
- __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
+ __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L4_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -4992,12 +5057,12 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = 0;
__Pyx_XGOTREF(__pyx_t_3);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 81, __pyx_L4_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 84, __pyx_L4_error)
} else {
PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
- else __PYX_ERR(0, 81, __pyx_L4_error)
+ else __PYX_ERR(0, 84, __pyx_L4_error)
}
}
goto __pyx_L14;
@@ -5022,29 +5087,29 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__Pyx_XGOTREF(__pyx_t_23);
__pyx_t_15 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename;
{
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L34_error)
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L34_error)
+ __Pyx_GOTREF(__pyx_t_5);
__pyx_t_9 = NULL;
__pyx_t_7 = 0;
#if CYTHON_UNPACK_METHODS
- if (likely(PyMethod_Check(__pyx_t_6))) {
- __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
if (likely(__pyx_t_9)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_6, function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
__pyx_t_7 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
- __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
+ __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L34_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L34_error)
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -5108,12 +5173,12 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_23 = __pyx_cur_scope->__pyx_t_11;
__pyx_cur_scope->__pyx_t_11 = 0;
__Pyx_XGOTREF(__pyx_t_23);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 81, __pyx_L34_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 84, __pyx_L34_error)
} else {
PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
- else __PYX_ERR(0, 81, __pyx_L34_error)
+ else __PYX_ERR(0, 84, __pyx_L34_error)
}
}
}
@@ -5156,29 +5221,29 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__Pyx_XGOTREF(__pyx_t_18);
__pyx_t_24 = __pyx_r;
__pyx_r = 0;
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L4_error)
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_5);
__pyx_t_9 = NULL;
__pyx_t_7 = 0;
#if CYTHON_UNPACK_METHODS
- if (likely(PyMethod_Check(__pyx_t_6))) {
- __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
if (likely(__pyx_t_9)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_6, function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
__pyx_t_7 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
- __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
+ __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L4_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -5241,12 +5306,12 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_24 = __pyx_cur_scope->__pyx_t_12;
__pyx_cur_scope->__pyx_t_12 = 0;
__Pyx_XGOTREF(__pyx_t_24);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 81, __pyx_L4_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 84, __pyx_L4_error)
} else {
PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
- else __PYX_ERR(0, 81, __pyx_L4_error)
+ else __PYX_ERR(0, 84, __pyx_L4_error)
}
}
__pyx_r = __pyx_t_24;
@@ -5267,7 +5332,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_L14:;
}
- /* "handlers/payments/utils.py":22
+ /* "handlers/payments/utils.py":23
* builder.row(InlineKeyboardButton(text=PROFILE, callback_data="profile"))
*
* if USE_NEW_PAYMENT_FLOW: # <<<<<<<<<<<<<<
@@ -5277,7 +5342,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
goto __pyx_L10;
}
- /* "handlers/payments/utils.py":83
+ /* "handlers/payments/utils.py":86
* await conn.close()
* else:
* builder.row(InlineKeyboardButton(text=ADD_KEY, callback_data="create_key")) # <<<<<<<<<<<<<<
@@ -5285,150 +5350,150 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
*
*/
/*else*/ {
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L4_error)
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 83, __pyx_L4_error)
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 86, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_9);
- __pyx_t_14 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 83, __pyx_L4_error)
+ __pyx_t_14 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 86, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_14);
- __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ADD_KEY); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L4_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ADD_KEY); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_8);
- if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_text, __pyx_t_8) < 0) __PYX_ERR(0, 83, __pyx_L4_error)
+ if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_text, __pyx_t_8) < 0) __PYX_ERR(0, 86, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_callback_data, __pyx_n_u_create_key) < 0) __PYX_ERR(0, 83, __pyx_L4_error)
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L4_error)
+ if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_callback_data, __pyx_n_u_create_key) < 0) __PYX_ERR(0, 86, __pyx_L4_error)
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
__pyx_t_14 = NULL;
__pyx_t_7 = 0;
#if CYTHON_UNPACK_METHODS
- if (likely(PyMethod_Check(__pyx_t_6))) {
- __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5);
if (likely(__pyx_t_14)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
__Pyx_INCREF(__pyx_t_14);
__Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_6, function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
__pyx_t_7 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_8};
- __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
+ __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L4_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "handlers/payments/utils.py":84
+ /* "handlers/payments/utils.py":87
* else:
* builder.row(InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"))
* builder.row(InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys")) # <<<<<<<<<<<<<<
*
* await bot.send_message(
*/
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L4_error)
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 84, __pyx_L4_error)
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 87, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_8);
- __pyx_t_14 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 84, __pyx_L4_error)
+ __pyx_t_14 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 87, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_14);
- __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_RENEW_KEY); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 84, __pyx_L4_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_RENEW_KEY); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 87, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_9);
- if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_text, __pyx_t_9) < 0) __PYX_ERR(0, 84, __pyx_L4_error)
+ if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_text, __pyx_t_9) < 0) __PYX_ERR(0, 87, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_callback_data, __pyx_n_u_view_keys) < 0) __PYX_ERR(0, 84, __pyx_L4_error)
- __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 84, __pyx_L4_error)
+ if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_callback_data, __pyx_n_u_view_keys) < 0) __PYX_ERR(0, 87, __pyx_L4_error)
+ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 87, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
__pyx_t_14 = NULL;
__pyx_t_7 = 0;
#if CYTHON_UNPACK_METHODS
- if (likely(PyMethod_Check(__pyx_t_6))) {
- __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_6);
+ if (likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5);
if (likely(__pyx_t_14)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
__Pyx_INCREF(__pyx_t_14);
__Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_6, function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
__pyx_t_7 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_9};
- __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
+ __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L4_error)
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "handlers/payments/utils.py":86
+ /* "handlers/payments/utils.py":89
* builder.row(InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"))
*
* await bot.send_message( # <<<<<<<<<<<<<<
* chat_id=user_id,
* text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount),
*/
- __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_bot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L4_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_bot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_send_message); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L4_error)
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_send_message); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "handlers/payments/utils.py":87
+ /* "handlers/payments/utils.py":90
*
* await bot.send_message(
* chat_id=user_id, # <<<<<<<<<<<<<<
* text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount),
* reply_markup=builder.as_markup(),
*/
- __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L4_error)
+ __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_4);
- if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_chat_id, __pyx_cur_scope->__pyx_v_user_id) < 0) __PYX_ERR(0, 87, __pyx_L4_error)
+ if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_chat_id, __pyx_cur_scope->__pyx_v_user_id) < 0) __PYX_ERR(0, 90, __pyx_L4_error)
- /* "handlers/payments/utils.py":88
+ /* "handlers/payments/utils.py":91
* await bot.send_message(
* chat_id=user_id,
* text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), # <<<<<<<<<<<<<<
* reply_markup=builder.as_markup(),
* )
*/
- __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_PAYMENT_SUCCESS_MESSAGE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 88, __pyx_L4_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_PAYMENT_SUCCESS_MESSAGE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 91, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_9);
- __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_format); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 88, __pyx_L4_error)
+ __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_format); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 91, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_14);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 88, __pyx_L4_error)
+ __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 91, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_9);
- __pyx_t_8 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 88, __pyx_L4_error)
+ __pyx_t_8 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 91, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_8);
- if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_amount, __pyx_t_8) < 0) __PYX_ERR(0, 88, __pyx_L4_error)
+ if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_amount, __pyx_t_8) < 0) __PYX_ERR(0, 91, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 88, __pyx_L4_error)
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 91, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_text, __pyx_t_8) < 0) __PYX_ERR(0, 87, __pyx_L4_error)
+ if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_text, __pyx_t_8) < 0) __PYX_ERR(0, 90, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- /* "handlers/payments/utils.py":89
+ /* "handlers/payments/utils.py":92
* chat_id=user_id,
* text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount),
* reply_markup=builder.as_markup(), # <<<<<<<<<<<<<<
* )
*
*/
- __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_as_markup); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 89, __pyx_L4_error)
+ __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_as_markup); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 92, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_14 = NULL;
__pyx_t_7 = 0;
@@ -5448,23 +5513,23 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
PyObject *__pyx_callargs[2] = {__pyx_t_14, NULL};
__pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
- if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L4_error)
+ if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 92, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
- if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_reply_markup, __pyx_t_8) < 0) __PYX_ERR(0, 87, __pyx_L4_error)
+ if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_reply_markup, __pyx_t_8) < 0) __PYX_ERR(0, 90, __pyx_L4_error)
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- /* "handlers/payments/utils.py":86
+ /* "handlers/payments/utils.py":89
* builder.row(InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"))
*
* await bot.send_message( # <<<<<<<<<<<<<<
* chat_id=user_id,
* text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount),
*/
- __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L4_error)
+ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_8);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_8);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
@@ -5492,18 +5557,18 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = 0;
__Pyx_XGOTREF(__pyx_t_3);
- if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 86, __pyx_L4_error)
+ if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 89, __pyx_L4_error)
} else {
PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();
if (exc_type) {
if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();
- else __PYX_ERR(0, 86, __pyx_L4_error)
+ else __PYX_ERR(0, 89, __pyx_L4_error)
}
}
}
__pyx_L10:;
- /* "handlers/payments/utils.py":16
+ /* "handlers/payments/utils.py":17
*
* async def send_payment_success_notification(user_id: int, amount: float):
* try: # <<<<<<<<<<<<<<
@@ -5523,7 +5588,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
- /* "handlers/payments/utils.py":92
+ /* "handlers/payments/utils.py":95
* )
*
* except Exception as e: # <<<<<<<<<<<<<<
@@ -5533,28 +5598,28 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_16 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
if (__pyx_t_16) {
__Pyx_AddTraceback("handlers.payments.utils.send_payment_success_notification", __pyx_clineno, __pyx_lineno, __pyx_filename);
- if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(0, 92, __pyx_L6_except_error)
+ if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_4, &__pyx_t_5) < 0) __PYX_ERR(0, 95, __pyx_L6_except_error)
__Pyx_XGOTREF(__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_4);
- __Pyx_XGOTREF(__pyx_t_6);
+ __Pyx_XGOTREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_cur_scope->__pyx_v_e = __pyx_t_4;
/*try:*/ {
- /* "handlers/payments/utils.py":93
+ /* "handlers/payments/utils.py":96
*
* except Exception as e:
* logger.error(f" {user_id}: {e}") # <<<<<<<<<<<<<<
*
*
*/
- __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_logger); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 93, __pyx_L43_error)
+ __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_logger); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 96, __pyx_L43_error)
__Pyx_GOTREF(__pyx_t_14);
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L43_error)
- __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __pyx_L43_error)
+ __Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
- __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 93, __pyx_L43_error)
+ __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 96, __pyx_L43_error)
__Pyx_GOTREF(__pyx_t_14);
__pyx_t_11 = 0;
__pyx_t_12 = 127;
@@ -5563,7 +5628,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_11 += 45;
__Pyx_GIVEREF(__pyx_kp_u__5);
PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_kp_u__5);
- __pyx_t_25 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_user_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 93, __pyx_L43_error)
+ __pyx_t_25 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_user_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 96, __pyx_L43_error)
__Pyx_GOTREF(__pyx_t_25);
__pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) : __pyx_t_12;
__pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_25);
@@ -5574,43 +5639,43 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_11 += 2;
__Pyx_GIVEREF(__pyx_kp_u__6);
PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_kp_u__6);
- __pyx_t_25 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 93, __pyx_L43_error)
+ __pyx_t_25 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 96, __pyx_L43_error)
__Pyx_GOTREF(__pyx_t_25);
__pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) : __pyx_t_12;
__pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_25);
__Pyx_GIVEREF(__pyx_t_25);
PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_25);
__pyx_t_25 = 0;
- __pyx_t_25 = __Pyx_PyUnicode_Join(__pyx_t_14, 4, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 93, __pyx_L43_error)
+ __pyx_t_25 = __Pyx_PyUnicode_Join(__pyx_t_14, 4, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 96, __pyx_L43_error)
__Pyx_GOTREF(__pyx_t_25);
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
__pyx_t_14 = NULL;
__pyx_t_7 = 0;
#if CYTHON_UNPACK_METHODS
- if (unlikely(PyMethod_Check(__pyx_t_5))) {
- __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5);
+ if (unlikely(PyMethod_Check(__pyx_t_6))) {
+ __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_6);
if (likely(__pyx_t_14)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
__Pyx_INCREF(__pyx_t_14);
__Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_5, function);
+ __Pyx_DECREF_SET(__pyx_t_6, function);
__pyx_t_7 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_25};
- __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
+ __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
- if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 93, __pyx_L43_error)
+ if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 96, __pyx_L43_error)
__Pyx_GOTREF(__pyx_t_9);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
}
- /* "handlers/payments/utils.py":92
+ /* "handlers/payments/utils.py":95
* )
*
* except Exception as e: # <<<<<<<<<<<<<<
@@ -5629,7 +5694,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
__pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
__Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
- __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
@@ -5662,12 +5727,12 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
}
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L5_exception_handled;
}
goto __pyx_L6_except_error;
- /* "handlers/payments/utils.py":16
+ /* "handlers/payments/utils.py":17
*
* async def send_payment_success_notification(user_id: int, amount: float):
* try: # <<<<<<<<<<<<<<
@@ -5695,7 +5760,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO
}
CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
- /* "handlers/payments/utils.py":15
+ /* "handlers/payments/utils.py":16
*
*
* async def send_payment_success_notification(user_id: int, amount: float): # <<<<<<<<<<<<<<
@@ -5776,6 +5841,7 @@ static void __pyx_tp_dealloc_8handlers_8payments_5utils___pyx_scope_struct__send
Py_CLEAR(p->__pyx_v_e);
Py_CLEAR(p->__pyx_v_email);
Py_CLEAR(p->__pyx_v_expiry_time);
+ Py_CLEAR(p->__pyx_v_moscow_tz);
Py_CLEAR(p->__pyx_v_new_expiry_time);
Py_CLEAR(p->__pyx_v_plan);
Py_CLEAR(p->__pyx_v_plan_price);
@@ -5850,6 +5916,9 @@ static int __pyx_tp_traverse_8handlers_8payments_5utils___pyx_scope_struct__send
if (p->__pyx_v_expiry_time) {
e = (*v)(p->__pyx_v_expiry_time, a); if (e) return e;
}
+ if (p->__pyx_v_moscow_tz) {
+ e = (*v)(p->__pyx_v_moscow_tz, a); if (e) return e;
+ }
if (p->__pyx_v_new_expiry_time) {
e = (*v)(p->__pyx_v_new_expiry_time, a); if (e) return e;
}
@@ -6022,6 +6091,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
__Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_ADD_KEY, __pyx_k_ADD_KEY, sizeof(__pyx_k_ADD_KEY), 0, 0, 1, 1},
{&__pyx_n_s_DATABASE_URL, __pyx_k_DATABASE_URL, sizeof(__pyx_k_DATABASE_URL), 0, 0, 1, 1},
+ {&__pyx_kp_u_Europe_Moscow, __pyx_k_Europe_Moscow, sizeof(__pyx_k_Europe_Moscow), 0, 1, 0, 0},
{&__pyx_n_s_InlineKeyboardBuilder, __pyx_k_InlineKeyboardBuilder, sizeof(__pyx_k_InlineKeyboardBuilder), 0, 0, 1, 1},
{&__pyx_n_s_InlineKeyboardButton, __pyx_k_InlineKeyboardButton, sizeof(__pyx_k_InlineKeyboardButton), 0, 0, 1, 1},
{&__pyx_kp_u_PAYMENT, __pyx_k_PAYMENT, sizeof(__pyx_k_PAYMENT), 0, 1, 0, 0},
@@ -6029,6 +6099,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
{&__pyx_n_s_PROFILE, __pyx_k_PROFILE, sizeof(__pyx_k_PROFILE), 0, 0, 1, 1},
{&__pyx_kp_u_RENEW, __pyx_k_RENEW, sizeof(__pyx_k_RENEW), 0, 1, 0, 0},
{&__pyx_n_s_RENEW_KEY, __pyx_k_RENEW_KEY, sizeof(__pyx_k_RENEW_KEY), 0, 0, 1, 1},
+ {&__pyx_n_s_USE_COUNTRY_SELECTION, __pyx_k_USE_COUNTRY_SELECTION, sizeof(__pyx_k_USE_COUNTRY_SELECTION), 0, 0, 1, 1},
{&__pyx_n_s_USE_NEW_PAYMENT_FLOW, __pyx_k_USE_NEW_PAYMENT_FLOW, sizeof(__pyx_k_USE_NEW_PAYMENT_FLOW), 0, 0, 1, 1},
{&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0},
{&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0},
@@ -6096,14 +6167,17 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
{&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0},
{&__pyx_n_s_logger, __pyx_k_logger, sizeof(__pyx_k_logger), 0, 0, 1, 1},
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
+ {&__pyx_n_s_moscow_tz, __pyx_k_moscow_tz, sizeof(__pyx_k_moscow_tz), 0, 0, 1, 1},
{&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
{&__pyx_n_s_new_expiry_time, __pyx_k_new_expiry_time, sizeof(__pyx_k_new_expiry_time), 0, 0, 1, 1},
{&__pyx_n_u_new_expiry_time, __pyx_k_new_expiry_time, sizeof(__pyx_k_new_expiry_time), 0, 1, 0, 1},
+ {&__pyx_n_s_now, __pyx_k_now, sizeof(__pyx_k_now), 0, 0, 1, 1},
{&__pyx_n_s_plan, __pyx_k_plan, sizeof(__pyx_k_plan), 0, 0, 1, 1},
{&__pyx_n_u_plan, __pyx_k_plan, sizeof(__pyx_k_plan), 0, 1, 0, 1},
{&__pyx_n_s_plan_price, __pyx_k_plan_price, sizeof(__pyx_k_plan_price), 0, 0, 1, 1},
{&__pyx_n_u_plan_price, __pyx_k_plan_price, sizeof(__pyx_k_plan_price), 0, 1, 0, 1},
{&__pyx_n_u_profile, __pyx_k_profile, sizeof(__pyx_k_profile), 0, 1, 0, 1},
+ {&__pyx_n_s_pytz, __pyx_k_pytz, sizeof(__pyx_k_pytz), 0, 0, 1, 1},
{&__pyx_n_s_reply_markup, __pyx_k_reply_markup, sizeof(__pyx_k_reply_markup), 0, 0, 1, 1},
{&__pyx_n_s_required_amount, __pyx_k_required_amount, sizeof(__pyx_k_required_amount), 0, 0, 1, 1},
{&__pyx_n_u_required_amount, __pyx_k_required_amount, sizeof(__pyx_k_required_amount), 0, 1, 0, 1},
@@ -6119,11 +6193,11 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
{&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
{&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
{&__pyx_n_s_timedelta, __pyx_k_timedelta, sizeof(__pyx_k_timedelta), 0, 0, 1, 1},
+ {&__pyx_n_s_timezone, __pyx_k_timezone, sizeof(__pyx_k_timezone), 0, 0, 1, 1},
{&__pyx_n_s_total_gb, __pyx_k_total_gb, sizeof(__pyx_k_total_gb), 0, 0, 1, 1},
{&__pyx_n_u_total_gb, __pyx_k_total_gb, sizeof(__pyx_k_total_gb), 0, 1, 0, 1},
{&__pyx_n_s_update_balance, __pyx_k_update_balance, sizeof(__pyx_k_update_balance), 0, 0, 1, 1},
{&__pyx_n_s_user_id, __pyx_k_user_id, sizeof(__pyx_k_user_id), 0, 0, 1, 1},
- {&__pyx_n_s_utcnow, __pyx_k_utcnow, sizeof(__pyx_k_utcnow), 0, 0, 1, 1},
{&__pyx_n_u_view_keys, __pyx_k_view_keys, sizeof(__pyx_k_view_keys), 0, 1, 0, 1},
{&__pyx_n_u_waiting_for_payment, __pyx_k_waiting_for_payment, sizeof(__pyx_k_waiting_for_payment), 0, 1, 0, 1},
{&__pyx_n_u_waiting_for_renewal_payment, __pyx_k_waiting_for_renewal_payment, sizeof(__pyx_k_waiting_for_renewal_payment), 0, 1, 0, 1},
@@ -6134,7 +6208,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
}
/* #### Code section: cached_builtins ### */
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
- __pyx_builtin_all = __Pyx_GetBuiltinName(__pyx_n_s_all); if (!__pyx_builtin_all) __PYX_ERR(0, 46, __pyx_L1_error)
+ __pyx_builtin_all = __Pyx_GetBuiltinName(__pyx_n_s_all); if (!__pyx_builtin_all) __PYX_ERR(0, 47, __pyx_L1_error)
return 0;
__pyx_L1_error:;
return -1;
@@ -6145,28 +6219,28 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
- /* "handlers/payments/utils.py":31
+ /* "handlers/payments/utils.py":32
* data = temp_data["data"]
*
* required_amount = data.get("required_amount", 0) # <<<<<<<<<<<<<<
*
* if int(amount) != int(required_amount):
*/
- __pyx_tuple__3 = PyTuple_Pack(2, __pyx_n_u_required_amount, __pyx_int_0); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 31, __pyx_L1_error)
+ __pyx_tuple__3 = PyTuple_Pack(2, __pyx_n_u_required_amount, __pyx_int_0); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 32, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__3);
__Pyx_GIVEREF(__pyx_tuple__3);
- /* "handlers/payments/utils.py":15
+ /* "handlers/payments/utils.py":16
*
*
* async def send_payment_success_notification(user_id: int, amount: float): # <<<<<<<<<<<<<<
* try:
* user_id = int(user_id)
*/
- __pyx_tuple__8 = PyTuple_Pack(21, __pyx_n_s_user_id, __pyx_n_s_amount, __pyx_n_s_builder, __pyx_n_s_create_key, __pyx_n_s_conn, __pyx_n_s_temp_data, __pyx_n_s_state, __pyx_n_s_data, __pyx_n_s_required_amount, __pyx_n_s_complete_key_renewal, __pyx_n_s_plan, __pyx_n_s_client_id, __pyx_n_s_new_expiry_time, __pyx_n_s_total_gb, __pyx_n_s_cost, __pyx_n_s_email, __pyx_n_s_balance, __pyx_n_s_plan_price, __pyx_n_s_duration_days, __pyx_n_s_expiry_time, __pyx_n_s_e); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 15, __pyx_L1_error)
+ __pyx_tuple__8 = PyTuple_Pack(22, __pyx_n_s_user_id, __pyx_n_s_amount, __pyx_n_s_builder, __pyx_n_s_create_key, __pyx_n_s_conn, __pyx_n_s_temp_data, __pyx_n_s_state, __pyx_n_s_data, __pyx_n_s_required_amount, __pyx_n_s_complete_key_renewal, __pyx_n_s_plan, __pyx_n_s_client_id, __pyx_n_s_new_expiry_time, __pyx_n_s_total_gb, __pyx_n_s_cost, __pyx_n_s_email, __pyx_n_s_balance, __pyx_n_s_plan_price, __pyx_n_s_duration_days, __pyx_n_s_moscow_tz, __pyx_n_s_expiry_time, __pyx_n_s_e); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 16, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__8);
__Pyx_GIVEREF(__pyx_tuple__8);
- __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_utils_py, __pyx_n_s_send_payment_success_notificatio, 15, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 15, __pyx_L1_error)
+ __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_utils_py, __pyx_n_s_send_payment_success_notificatio, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 16, __pyx_L1_error)
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
@@ -6229,15 +6303,15 @@ static int __Pyx_modinit_type_init_code(void) {
__Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
/*--- Type init code ---*/
#if CYTHON_USE_TYPE_SPECS
- __pyx_ptype_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification_spec, NULL); if (unlikely(!__pyx_ptype_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification)) __PYX_ERR(0, 15, __pyx_L1_error)
- if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification_spec, __pyx_ptype_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
+ __pyx_ptype_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification_spec, NULL); if (unlikely(!__pyx_ptype_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification)) __PYX_ERR(0, 16, __pyx_L1_error)
+ if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification_spec, __pyx_ptype_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
#else
__pyx_ptype_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification = &__pyx_type_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification;
#endif
#if !CYTHON_COMPILING_IN_LIMITED_API
#endif
#if !CYTHON_USE_TYPE_SPECS
- if (__Pyx_PyType_Ready(__pyx_ptype_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
+ if (__Pyx_PyType_Ready(__pyx_ptype_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
#endif
#if PY_MAJOR_VERSION < 3
__pyx_ptype_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification->tp_print = 0;
@@ -6641,7 +6715,7 @@ if (!__Pyx_RefNanny) {
* from aiogram.utils.keyboard import InlineKeyboardBuilder
*
* from bot import bot # <<<<<<<<<<<<<<
- * from config import DATABASE_URL, USE_NEW_PAYMENT_FLOW
+ * from config import DATABASE_URL, USE_NEW_PAYMENT_FLOW, USE_COUNTRY_SELECTION
* from database import clear_temporary_data, get_balance, get_temporary_data, update_balance
*/
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 7, __pyx_L1_error)
@@ -6661,11 +6735,11 @@ if (!__Pyx_RefNanny) {
/* "handlers/payments/utils.py":8
*
* from bot import bot
- * from config import DATABASE_URL, USE_NEW_PAYMENT_FLOW # <<<<<<<<<<<<<<
+ * from config import DATABASE_URL, USE_NEW_PAYMENT_FLOW, USE_COUNTRY_SELECTION # <<<<<<<<<<<<<<
* from database import clear_temporary_data, get_balance, get_temporary_data, update_balance
* from handlers.buttons.notification import ADD_KEY, PROFILE, RENEW_KEY
*/
- __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
+ __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_n_s_DATABASE_URL);
__Pyx_GIVEREF(__pyx_n_s_DATABASE_URL);
@@ -6673,6 +6747,9 @@ if (!__Pyx_RefNanny) {
__Pyx_INCREF(__pyx_n_s_USE_NEW_PAYMENT_FLOW);
__Pyx_GIVEREF(__pyx_n_s_USE_NEW_PAYMENT_FLOW);
if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_USE_NEW_PAYMENT_FLOW)) __PYX_ERR(0, 8, __pyx_L1_error);
+ __Pyx_INCREF(__pyx_n_s_USE_COUNTRY_SELECTION);
+ __Pyx_GIVEREF(__pyx_n_s_USE_COUNTRY_SELECTION);
+ if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_USE_COUNTRY_SELECTION)) __PYX_ERR(0, 8, __pyx_L1_error);
__pyx_t_3 = __Pyx_Import(__pyx_n_s_config, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 8, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -6684,11 +6761,15 @@ if (!__Pyx_RefNanny) {
__Pyx_GOTREF(__pyx_t_2);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_USE_NEW_PAYMENT_FLOW, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_USE_COUNTRY_SELECTION); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_USE_COUNTRY_SELECTION, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "handlers/payments/utils.py":9
* from bot import bot
- * from config import DATABASE_URL, USE_NEW_PAYMENT_FLOW
+ * from config import DATABASE_URL, USE_NEW_PAYMENT_FLOW, USE_COUNTRY_SELECTION
* from database import clear_temporary_data, get_balance, get_temporary_data, update_balance # <<<<<<<<<<<<<<
* from handlers.buttons.notification import ADD_KEY, PROFILE, RENEW_KEY
* from handlers.texts import PAYMENT_SUCCESS_MESSAGE
@@ -6729,7 +6810,7 @@ if (!__Pyx_RefNanny) {
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "handlers/payments/utils.py":10
- * from config import DATABASE_URL, USE_NEW_PAYMENT_FLOW
+ * from config import DATABASE_URL, USE_NEW_PAYMENT_FLOW, USE_COUNTRY_SELECTION
* from database import clear_temporary_data, get_balance, get_temporary_data, update_balance
* from handlers.buttons.notification import ADD_KEY, PROFILE, RENEW_KEY # <<<<<<<<<<<<<<
* from handlers.texts import PAYMENT_SUCCESS_MESSAGE
@@ -6768,7 +6849,7 @@ if (!__Pyx_RefNanny) {
* from handlers.buttons.notification import ADD_KEY, PROFILE, RENEW_KEY
* from handlers.texts import PAYMENT_SUCCESS_MESSAGE # <<<<<<<<<<<<<<
* from logger import logger
- *
+ * import pytz
*/
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
@@ -6788,7 +6869,7 @@ if (!__Pyx_RefNanny) {
* from handlers.buttons.notification import ADD_KEY, PROFILE, RENEW_KEY
* from handlers.texts import PAYMENT_SUCCESS_MESSAGE
* from logger import logger # <<<<<<<<<<<<<<
- *
+ * import pytz
*
*/
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
@@ -6805,22 +6886,34 @@ if (!__Pyx_RefNanny) {
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "handlers/payments/utils.py":15
+ /* "handlers/payments/utils.py":13
+ * from handlers.texts import PAYMENT_SUCCESS_MESSAGE
+ * from logger import logger
+ * import pytz # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_n_s_pytz, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_pytz, __pyx_t_3) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "handlers/payments/utils.py":16
*
*
* async def send_payment_success_notification(user_id: int, amount: float): # <<<<<<<<<<<<<<
* try:
* user_id = int(user_id)
*/
- __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_user_id, __pyx_n_s_int) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
- if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_amount, __pyx_n_s_float) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
- __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8handlers_8payments_5utils_1send_payment_success_notification, __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_send_payment_success_notificatio, NULL, __pyx_n_s_handlers_payments_utils, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_user_id, __pyx_n_s_int) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_amount, __pyx_n_s_float) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
+ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8handlers_8payments_5utils_1send_payment_success_notification, __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_send_payment_success_notificatio, NULL, __pyx_n_s_handlers_payments_utils, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (PyDict_SetItem(__pyx_d, __pyx_n_s_send_payment_success_notificatio, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_send_payment_success_notificatio, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "handlers/payments/utils.py":1
diff --git a/handlers/payments/utils.cpython-312-x86_64-linux-gnu.so b/handlers/payments/utils.cpython-312-x86_64-linux-gnu.so
index 13ce89eb..c38a601b 100755
Binary files a/handlers/payments/utils.cpython-312-x86_64-linux-gnu.so and b/handlers/payments/utils.cpython-312-x86_64-linux-gnu.so differ
diff --git a/handlers/payments/yookassa_pay.c b/handlers/payments/yookassa_pay.c
index 75c4cb38..377c94f1 100644
--- a/handlers/payments/yookassa_pay.c
+++ b/handlers/payments/yookassa_pay.c
@@ -4,7 +4,8 @@
{
"distutils": {
"extra_compile_args": [
- "-O2"
+ "-O2",
+ "-static-libgcc"
],
"name": "handlers.payments.yookassa_pay",
"sources": [
diff --git a/handlers/payments/yookassa_pay.cpython-312-x86_64-linux-gnu.so b/handlers/payments/yookassa_pay.cpython-312-x86_64-linux-gnu.so
index b9a99560..8d96bbf5 100755
Binary files a/handlers/payments/yookassa_pay.cpython-312-x86_64-linux-gnu.so and b/handlers/payments/yookassa_pay.cpython-312-x86_64-linux-gnu.so differ
diff --git a/handlers/payments/yoomoney_pay.c b/handlers/payments/yoomoney_pay.c
index ae66e0d6..c83a16f7 100644
--- a/handlers/payments/yoomoney_pay.c
+++ b/handlers/payments/yoomoney_pay.c
@@ -4,7 +4,8 @@
{
"distutils": {
"extra_compile_args": [
- "-O2"
+ "-O2",
+ "-static-libgcc"
],
"name": "handlers.payments.yoomoney_pay",
"sources": [
diff --git a/handlers/payments/yoomoney_pay.cpython-312-x86_64-linux-gnu.so b/handlers/payments/yoomoney_pay.cpython-312-x86_64-linux-gnu.so
index 8aacbc32..459ed2d4 100755
Binary files a/handlers/payments/yoomoney_pay.cpython-312-x86_64-linux-gnu.so and b/handlers/payments/yoomoney_pay.cpython-312-x86_64-linux-gnu.so differ
diff --git a/handlers/profile.py b/handlers/profile.py
index 7f50cb9b..37512a67 100644
--- a/handlers/profile.py
+++ b/handlers/profile.py
@@ -3,12 +3,12 @@ from typing import Any
import aiofiles
import asyncpg
-from aiogram import F, Router, types
+from aiogram import F, Router
from aiogram.fsm.context import FSMContext
from aiogram.types import BufferedInputFile, CallbackQuery, InlineKeyboardButton, Message
from aiogram.utils.keyboard import InlineKeyboardBuilder
-from config import DATABASE_URL, NEWS_MESSAGE, RENEWAL_PLANS
+from config import DATABASE_URL, INSTRUCTIONS_BUTTON, NEWS_MESSAGE, RENEWAL_PLANS
from database import get_balance, get_key_count, get_last_payments, get_referral_stats, get_trial
from handlers.buttons.profile import (
ADD_SUB,
@@ -76,9 +76,10 @@ async def process_callback_view_profile(
InlineKeyboardButton(text=INVITE, callback_data="invite"),
InlineKeyboardButton(text=GIFTS, callback_data="gifts"),
)
- builder.row(
- InlineKeyboardButton(text=INSTRUCTIONS, callback_data="instructions"),
- )
+ if INSTRUCTIONS_BUTTON:
+ builder.row(
+ InlineKeyboardButton(text=INSTRUCTIONS, callback_data="instructions"),
+ )
if admin:
builder.row(InlineKeyboardButton(text="🔧 Администратор", callback_data="admin"))
builder.row(InlineKeyboardButton(text=MAIN_MENU, callback_data="start"))
diff --git a/handlers/start.py b/handlers/start.py
index 2eac8a4b..294385de 100644
--- a/handlers/start.py
+++ b/handlers/start.py
@@ -13,15 +13,14 @@ from aiogram.types import (
)
from aiogram.utils.keyboard import InlineKeyboardBuilder
+from bot import bot
from config import (
CAPTCHA_ENABLE,
CHANNEL_EXISTS,
+ CHANNEL_ID,
+ CHANNEL_REQUIRED,
CHANNEL_URL,
- CONNECT_ANDROID,
- CONNECT_IOS,
DONATIONS_ENABLE,
- DOWNLOAD_ANDROID,
- DOWNLOAD_IOS,
SUPPORT_CHAT_URL,
)
from database import (
@@ -31,20 +30,11 @@ from database import (
get_coupon_details,
get_referral_by_referred_id,
get_trial,
- update_trial,
-)
-from handlers.buttons.add_subscribe import (
- DOWNLOAD_ANDROID_BUTTON,
- DOWNLOAD_IOS_BUTTON,
- IMPORT_ANDROID,
- IMPORT_IOS,
- PC_BUTTON,
- TV_BUTTON,
+ update_balance,
)
from handlers.captcha import generate_captcha
from handlers.keys.key_management import create_key
-from handlers.keys.trial_key import create_trial_key
-from handlers.texts import INSTRUCTIONS_TRIAL, WELCOME_TEXT, get_about_vpn
+from handlers.texts import WELCOME_TEXT, get_about_vpn
from logger import logger
router = Router()
@@ -59,17 +49,42 @@ async def handle_start_callback_query(
@router.message(Command("start"))
async def start_command(message: Message, state: FSMContext, session: Any, admin: bool, captcha: bool = True):
- """Обрабатывает команду /start, включает логику рефералов и подарков."""
+ """Обрабатывает команду /start, включая логику проверки подписки, рефералов и подарков."""
logger.info(f"Вызвана функция start_command для пользователя {message.chat.id}")
await state.clear()
- # Проверка капчи, если включена
if CAPTCHA_ENABLE and captcha:
- captcha = await generate_captcha(message, state)
- await message.answer(text=captcha["text"], reply_markup=captcha["markup"])
+ captcha_data = await generate_captcha(message, state)
+ await message.answer(text=captcha_data["text"], reply_markup=captcha_data["markup"])
return
+ if CHANNEL_EXISTS and CHANNEL_REQUIRED:
+ try:
+ member = await bot.get_chat_member(CHANNEL_ID, message.chat.id)
+ if member.status not in ["member", "administrator", "creator"]:
+ await state.update_data(start_text=message.text)
+ builder = InlineKeyboardBuilder()
+ builder.row(InlineKeyboardButton(text="✅ Я подписался", callback_data="check_subscription"))
+ await message.answer(
+ f"Для использования бота, пожалуйста, подпишитесь на наш канал: {CHANNEL_URL}",
+ reply_markup=builder.as_markup(),
+ )
+ return
+ except Exception as e:
+ logger.error(f"Ошибка проверки подписки пользователя {message.chat.id}: {e}")
+ await state.update_data(start_text=message.text)
+ builder = InlineKeyboardBuilder()
+ builder.row(InlineKeyboardButton(text="✅ Я подписался", callback_data="check_subscription"))
+ await message.answer(
+ f"Пожалуйста, подпишитесь на наш канал: {CHANNEL_URL}", reply_markup=builder.as_markup()
+ )
+ return
+
+ await process_start_logic(message, state, session, admin)
+
+
+async def process_start_logic(message: Message, state: FSMContext, session: Any, admin: bool):
if message.text:
try:
connection_exists = await check_connection_exists(message.chat.id)
@@ -79,13 +94,49 @@ async def start_command(message: Message, state: FSMContext, session: Any, admin
await add_connection(tg_id=message.chat.id, session=session)
logger.info(f"Пользователь {message.chat.id} успешно добавлен в базу данных.")
+ if "coupons_" in message.text:
+ logger.info(f"Обнаружена ссылка на купон: {message.text}")
+ coupon_code = message.text.split("coupons_")[1].strip()
+ logger.info(f"Пользователь {message.chat.id} ввёл купон: {coupon_code}")
+
+ coupon = await session.fetchrow(
+ "SELECT id, code, amount, usage_limit, usage_count, is_used FROM coupons WHERE code = $1",
+ coupon_code,
+ )
+
+ if coupon is None:
+ logger.warning(f"Купон {coupon_code} не найден.")
+ await message.answer("❌ Купон не найден!")
+ return await show_start_menu(message, admin, session)
+
+ if coupon["is_used"] or coupon["usage_count"] >= coupon["usage_limit"]:
+ logger.info(f"Купон {coupon_code} уже использован или исчерпан.")
+ await message.answer("❌ Этот купон уже использован!")
+ return await show_start_menu(message, admin, session)
+
+ await update_balance(message.chat.id, coupon["amount"])
+ logger.info(f"Начислено {coupon['amount']} единиц для пользователя {message.chat.id}")
+
+ new_usage_count = coupon["usage_count"] + 1
+ is_used = new_usage_count >= coupon["usage_limit"]
+
+ await session.execute(
+ "UPDATE coupons SET usage_count = $1, is_used = $2 WHERE code = $3",
+ new_usage_count,
+ is_used,
+ coupon_code,
+ )
+
+ logger.info(f"Купон {coupon_code} успешно использован, начислено {coupon['amount']} RUB.")
+ await message.answer(f"🎉 Ваш баланс пополнен на {coupon['amount']} RUB по купону!")
+ return await show_start_menu(message, admin, session)
+
if "gift_" in message.text:
logger.info(f"Обнаружена ссылка на подарок: {message.text}")
parts = message.text.split("gift_")[1].split("_")
gift_id = parts[0]
recipient_tg_id = message.chat.id
-
gift_info = await get_coupon_details(gift_id, session)
if gift_info is None:
@@ -100,7 +151,13 @@ async def start_command(message: Message, state: FSMContext, session: Any, admin
await message.answer("❌ Вы не можете получить подарок от самого себя.")
return await show_start_menu(message, admin, session)
- await add_connection(tg_id=recipient_tg_id, session=session)
+ if not connection_exists:
+ await add_referral(recipient_tg_id, gift_info["sender_tg_id"], session)
+ logger.info(
+ f"Пользователь {recipient_tg_id} теперь является рефералом отправителя подарка {gift_info['sender_tg_id']}."
+ )
+ else:
+ logger.info(f"Пользователь {recipient_tg_id} уже зарегистрирован, реферал не добавляется.")
selected_months = gift_info["selected_months"]
expiry_time = gift_info["expiry_time"]
@@ -117,7 +174,8 @@ async def start_command(message: Message, state: FSMContext, session: Any, admin
)
await message.answer(
- f"🎉 Ваш подарок на {selected_months} {'месяц' if selected_months == 1 else 'месяца' if selected_months in [2, 3, 4] else 'месяцев'} активирован!"
+ f"🎉 Ваш подарок на {selected_months} "
+ f"{'месяц' if selected_months == 1 else 'месяца' if selected_months in [2, 3, 4] else 'месяцев'} активирован!"
)
logger.info(f"Подарок на {selected_months} месяцев активирован для пользователя {recipient_tg_id}.")
return
@@ -137,7 +195,6 @@ async def start_command(message: Message, state: FSMContext, session: Any, admin
return await show_start_menu(message, admin, session)
existing_referral = await get_referral_by_referred_id(message.chat.id, session)
-
if existing_referral:
logger.info(f"Реферал с ID {message.chat.id} уже существует.")
return await show_start_menu(message, admin, session)
@@ -151,7 +208,7 @@ async def start_command(message: Message, state: FSMContext, session: Any, admin
return
else:
- logger.info(f"Пользователь {message.chat.id} зашел без реферальной ссылки или подарка.")
+ logger.info(f"Пользователь {message.chat.id} зашел без реферальной ссылки, подарка или купона.")
await show_start_menu(message, admin, session)
@@ -162,6 +219,20 @@ async def start_command(message: Message, state: FSMContext, session: Any, admin
await show_start_menu(message, admin, session)
+@router.callback_query(F.data == "check_subscription")
+async def check_subscription_callback(callback_query: CallbackQuery, state: FSMContext, session: Any, admin: bool):
+ try:
+ member = await bot.get_chat_member(CHANNEL_ID, callback_query.from_user.id)
+ if member.status not in ["member", "administrator", "creator"]:
+ await callback_query.answer("Вы еще не подписаны на канал!", show_alert=True)
+ else:
+ await callback_query.answer("Подписка подтверждена!")
+ await process_start_logic(callback_query.message, state, session, admin)
+ except Exception as e:
+ logger.error(f"Ошибка проверки подписки (callback) для пользователя {callback_query.from_user.id}: {e}")
+ await callback_query.answer("Ошибка проверки подписки, повторите попытку", show_alert=True)
+
+
async def show_start_menu(message: Message, admin: bool, session: Any):
"""Функция для отображения стандартного меню"""
logger.info(f"Показываю главное меню для пользователя {message.chat.id}")
@@ -171,7 +242,7 @@ async def show_start_menu(message: Message, admin: bool, session: Any):
builder = InlineKeyboardBuilder()
if trial_status == 0:
- builder.row(InlineKeyboardButton(text="🔗 Подключить VPN", callback_data="connect_vpn"))
+ builder.row(InlineKeyboardButton(text="🔗 Подключить VPN", callback_data="create_key"))
builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile"))
@@ -203,50 +274,6 @@ async def show_start_menu(message: Message, admin: bool, session: Any):
)
-@router.callback_query(F.data == "connect_vpn")
-async def handle_connect_vpn(callback_query: CallbackQuery, session: Any):
- user_id = callback_query.message.chat.id
-
- trial_key_info = await create_trial_key(user_id, session)
-
- if "error" in trial_key_info:
- await callback_query.message.answer(trial_key_info["error"])
- else:
- await update_trial(user_id, 1, session)
-
- key_message = (
- f"🔑 Ваш персональный ключ доступа:\n"
- f"{trial_key_info['key']}\n\n"
- f"📋 Быстрая инструкция по подключению:\n{INSTRUCTIONS_TRIAL}"
- )
-
- email = trial_key_info["email"]
-
- builder = InlineKeyboardBuilder()
- builder.row(InlineKeyboardButton(text="💬 Поддержка", url=SUPPORT_CHAT_URL))
- builder.row(
- InlineKeyboardButton(text=DOWNLOAD_IOS_BUTTON, url=DOWNLOAD_IOS),
- InlineKeyboardButton(text=DOWNLOAD_ANDROID_BUTTON, url=DOWNLOAD_ANDROID),
- )
- builder.row(
- InlineKeyboardButton(
- text=IMPORT_IOS,
- url=f"{CONNECT_IOS}{trial_key_info['key']}",
- ),
- InlineKeyboardButton(
- text=IMPORT_ANDROID,
- url=f"{CONNECT_ANDROID}{trial_key_info['key']}",
- ),
- )
- builder.row(
- InlineKeyboardButton(text=PC_BUTTON, callback_data=f"connect_pc|{email}"),
- InlineKeyboardButton(text=TV_BUTTON, callback_data=f"connect_tv|{email}"),
- )
- builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile"))
-
- await callback_query.message.answer(key_message, reply_markup=builder.as_markup())
-
-
@router.callback_query(F.data == "about_vpn")
async def handle_about_vpn(callback_query: CallbackQuery):
builder = InlineKeyboardBuilder()
diff --git a/handlers/utils.py b/handlers/utils.py
index 8b4c71a7..2d03b436 100644
--- a/handlers/utils.py
+++ b/handlers/utils.py
@@ -1,9 +1,7 @@
import json
-import random
import re
import secrets
import string
-from datetime import datetime, timedelta
import aiohttp
import asyncpg
diff --git a/keyboards/admin/sender_kb.py b/keyboards/admin/sender_kb.py
index 9d1055f0..82c37115 100644
--- a/keyboards/admin/sender_kb.py
+++ b/keyboards/admin/sender_kb.py
@@ -24,11 +24,8 @@ def build_sender_kb() -> InlineKeyboardMarkup:
def build_clusters_kb(clusters: list) -> InlineKeyboardMarkup:
builder = InlineKeyboardBuilder()
for cluster in clusters:
- name = cluster['cluster_name']
- builder.button(
- text=f"🌐 {name}",
- callback_data=AdminSenderCallback(type="cluster", data=name).pack()
- )
+ name = cluster["cluster_name"]
+ builder.button(text=f"🌐 {name}", callback_data=AdminSenderCallback(type="cluster", data=name).pack())
builder.row(build_admin_back_btn())
builder.adjust(1)