diff --git a/backup.py b/backup.py index 329d7a22..c6811fa7 100644 --- a/backup.py +++ b/backup.py @@ -3,8 +3,8 @@ import subprocess from datetime import datetime from aiogram.types import BufferedInputFile -from config import ADMIN_ID, BACK_DIR, DB_NAME, DB_PASSWORD, DB_USER +from config import ADMIN_ID, BACK_DIR, DB_NAME, DB_PASSWORD, DB_USER from logger import logger diff --git a/bot.py b/bot.py index ee0ce957..715fb7b2 100644 --- a/bot.py +++ b/bot.py @@ -5,8 +5,8 @@ from aiogram.client.default import DefaultBotProperties from aiogram.enums import ParseMode from aiogram.fsm.storage.memory import MemoryStorage from aiogram.types import ErrorEvent -from config import API_TOKEN +from config import API_TOKEN from logger import logger from middlewares.admin import AdminMiddleware from middlewares.database import DatabaseMiddleware diff --git a/client.py b/client.py index 3b9336d0..816bbcf6 100644 --- a/client.py +++ b/client.py @@ -1,6 +1,6 @@ import py3xui -from config import LIMIT_IP +from config import LIMIT_IP from logger import logger diff --git a/database.py b/database.py index 9deff30d..c7caa99e 100644 --- a/database.py +++ b/database.py @@ -3,8 +3,8 @@ from datetime import datetime from typing import Any import asyncpg -from config import DATABASE_URL, REFERRAL_BONUS_PERCENTAGES +from config import DATABASE_URL, REFERRAL_BONUS_PERCENTAGES from logger import logger diff --git a/filters/admin.py b/filters/admin.py index a5d7c387..95328eaa 100644 --- a/filters/admin.py +++ b/filters/admin.py @@ -1,5 +1,6 @@ from aiogram.filters import BaseFilter from aiogram.types import Message + from config import ADMIN_ID diff --git a/handlers/admin/admin_panel.py b/handlers/admin/admin_panel.py index 7e3ba8a1..d6548d6c 100644 --- a/handlers/admin/admin_panel.py +++ b/handlers/admin/admin_panel.py @@ -10,10 +10,10 @@ from aiogram.fsm.context import FSMContext from aiogram.fsm.state import State, StatesGroup from aiogram.types import BufferedInputFile, CallbackQuery, InlineKeyboardButton from aiogram.utils.keyboard import InlineKeyboardBuilder -from config import DATABASE_URL from backup import backup_database from bot import bot +from config import DATABASE_URL from database import delete_user_data from filters.admin import IsAdminFilter from logger import logger @@ -37,7 +37,7 @@ async def handle_admin_callback_query(callback_query: CallbackQuery, state: FSMC async def handle_admin_message(message: types.Message, state: FSMContext): await state.clear() - BOT_VERSION = "4.0.0-preAlpha(9)" + BOT_VERSION = "4.0.0-preAlpha(14)" builder = InlineKeyboardBuilder() builder.row( diff --git a/handlers/admin/admin_servers.py b/handlers/admin/admin_servers.py index a2ee4ed4..973cbdf1 100644 --- a/handlers/admin/admin_servers.py +++ b/handlers/admin/admin_servers.py @@ -6,10 +6,10 @@ from aiogram.fsm.context import FSMContext from aiogram.fsm.state import State, StatesGroup from aiogram.types import InlineKeyboardButton from aiogram.utils.keyboard import InlineKeyboardBuilder -from config import ADMIN_PASSWORD, ADMIN_USERNAME, DATABASE_URL from py3xui import AsyncApi from backup import create_backup_and_send_to_admins +from config import ADMIN_PASSWORD, ADMIN_USERNAME, DATABASE_URL from database import check_unique_server_name, get_servers_from_db from filters.admin import IsAdminFilter from handlers.keys.key_utils import create_key_on_cluster @@ -378,22 +378,19 @@ async def sync_cluster_handler(callback_query: types.CallbackQuery): ) return - tasks = [] - for key in keys_to_sync: - tasks.append( - asyncio.create_task( - create_key_on_cluster( - cluster_name, - key["tg_id"], - key["client_id"], - key["email"], - key["expiry_time"], - ) + try: + await create_key_on_cluster( + cluster_name, + key["tg_id"], + key["client_id"], + key["email"], + key["expiry_time"], ) - ) + await asyncio.sleep(0.2) + except Exception as e: + logger.error(f"Ошибка при добавлении ключа {key['client_id']} в кластер {cluster_name}: {e}") - await asyncio.gather(*tasks) await callback_query.message.answer( f"✅ Ключи успешно синхронизированы для кластера {cluster_name}.", reply_markup=InlineKeyboardBuilder() diff --git a/handlers/admin/admin_user_editor.py b/handlers/admin/admin_user_editor.py index da18697e..8651d3ab 100644 --- a/handlers/admin/admin_user_editor.py +++ b/handlers/admin/admin_user_editor.py @@ -7,8 +7,8 @@ from aiogram.fsm.context import FSMContext from aiogram.fsm.state import State, StatesGroup from aiogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup from aiogram.utils.keyboard import InlineKeyboardBuilder -from config import TOTAL_GB +from config import TOTAL_GB from database import ( delete_user_data, get_client_id_by_email, diff --git a/handlers/buttons/add_subscribe.py b/handlers/buttons/add_subscribe.py index 64d3fcca..1a7c4790 100644 --- a/handlers/buttons/add_subscribe.py +++ b/handlers/buttons/add_subscribe.py @@ -1,6 +1,6 @@ -DOWNLOAD_IOS_BUTTON = "🍏 Скачать для iOS" -DOWNLOAD_ANDROID_BUTTON = "🤖 Скачать для Android" -IMPORT_IOS = "🍏 Подключить на iOS" -IMPORT_ANDROID = "🤖 Подключить на Android" +DOWNLOAD_IOS_BUTTON = "🍏 Скачать iOS" +DOWNLOAD_ANDROID_BUTTON = "🤖 Скачать Android" +IMPORT_IOS = "🍏 Подключить" +IMPORT_ANDROID = "🤖 Подключить" PC_BUTTON = "💻 Компьютеры" TV_BUTTON = "📺 Андроид TV" diff --git a/handlers/donate.py b/handlers/donate.py index 6a37edc8..ad460085 100644 --- a/handlers/donate.py +++ b/handlers/donate.py @@ -3,8 +3,8 @@ from aiogram.fsm.context import FSMContext from aiogram.fsm.state import State, StatesGroup from aiogram.types import InlineKeyboardButton, LabeledPrice, PreCheckoutQuery from aiogram.utils.keyboard import InlineKeyboardBuilder -from config import RUB_TO_XTR +from config import RUB_TO_XTR from logger import logger diff --git a/handlers/instructions/instructions.py b/handlers/instructions/instructions.py index ec10b117..215b1452 100644 --- a/handlers/instructions/instructions.py +++ b/handlers/instructions/instructions.py @@ -5,8 +5,8 @@ import asyncpg from aiogram import F, Router, types from aiogram.types import BufferedInputFile, InlineKeyboardButton from aiogram.utils.keyboard import InlineKeyboardBuilder -from config import CONNECT_MACOS, CONNECT_WINDOWS, DATABASE_URL, SUPPORT_CHAT_URL +from config import CONNECT_MACOS, CONNECT_WINDOWS, DATABASE_URL, SUPPORT_CHAT_URL from handlers.texts import ( CONNECT_TV_TEXT, INSTRUCTION_PC, diff --git a/handlers/keys/key_management.py b/handlers/keys/key_management.py index b9b88f10..4eab8f6b 100644 --- a/handlers/keys/key_management.py +++ b/handlers/keys/key_management.py @@ -8,6 +8,8 @@ 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 bot import bot from config import ( CONNECT_ANDROID, CONNECT_IOS, @@ -19,8 +21,6 @@ from config import ( TRIAL_TIME, USE_NEW_PAYMENT_FLOW, ) - -from bot import bot from database import ( get_balance, get_trial, @@ -37,6 +37,7 @@ from handlers.buttons.add_subscribe import ( TV_BUTTON, ) from handlers.keys.key_utils import create_key_on_cluster +from handlers.payments.robokassa_pay import handle_custom_amount_input from handlers.payments.yookassa_pay import process_custom_amount_input from handlers.texts import DISCOUNTS, key_message_success from handlers.utils import generate_random_email, get_least_loaded_cluster @@ -145,8 +146,10 @@ async def select_tariff_plan(callback_query: CallbackQuery, session: Any): if balance < plan_price: required_amount = plan_price - balance - if USE_NEW_PAYMENT_FLOW: + if USE_NEW_PAYMENT_FLOW == "YOOKASSA": await process_custom_amount_input(callback_query, session) + elif USE_NEW_PAYMENT_FLOW == "ROBOKASSA": + await handle_custom_amount_input(callback_query, session) else: builder = InlineKeyboardBuilder() builder.row( diff --git a/handlers/keys/key_utils.py b/handlers/keys/key_utils.py index 0e8f409f..6839cc08 100644 --- a/handlers/keys/key_utils.py +++ b/handlers/keys/key_utils.py @@ -1,9 +1,9 @@ import asyncio -from config import ADMIN_PASSWORD, ADMIN_USERNAME, LIMIT_IP, TOTAL_GB from py3xui import AsyncApi from client import add_client, delete_client, extend_client_key +from config import ADMIN_PASSWORD, ADMIN_USERNAME, LIMIT_IP, TOTAL_GB from database import get_servers_from_db from logger import logger diff --git a/handlers/keys/keys.py b/handlers/keys/keys.py index 4644b0e1..8a270a7d 100644 --- a/handlers/keys/keys.py +++ b/handlers/keys/keys.py @@ -7,21 +7,25 @@ from typing import Any from aiogram import F, Router, types from aiogram.types import BufferedInputFile, InlineKeyboardButton from aiogram.utils.keyboard import InlineKeyboardBuilder + +from bot import bot from config import ( CONNECT_ANDROID, CONNECT_IOS, DOWNLOAD_ANDROID, DOWNLOAD_IOS, + ENABLE_DELETE_KEY_BUTTON, ENABLE_UPDATE_SUBSCRIPTION_BUTTON, PUBLIC_LINK, RENEWAL_PLANS, TOTAL_GB, + USE_NEW_PAYMENT_FLOW, ) - from database import ( delete_key, get_balance, get_servers_from_db, + save_temporary_data, store_key, update_balance, update_key_expiry, @@ -40,9 +44,10 @@ from handlers.keys.key_utils import ( renew_key_in_cluster, update_key_on_cluster, ) +from handlers.payments.robokassa_pay import handle_custom_amount_input +from handlers.payments.yookassa_pay import process_custom_amount_input from handlers.texts import ( DISCOUNTS, - INSUFFICIENT_FUNDS_MSG, KEY_NOT_FOUND_MSG, PLAN_SELECTION_MSG, SUCCESS_RENEWAL_MSG, @@ -113,7 +118,7 @@ def build_keys_response(records): inline_keyboard = builder.as_markup() response_message = ( "🔑 Список ваших подписок\n\n" - "👇 Выберите подписку для управления или добавьте новую (например, для подключения нового устройства):" + "👇 Выберите подписку для управления или добавьте новую для подключения дополнительного устройства:" ) return inline_keyboard, response_message @@ -214,14 +219,22 @@ async def process_callback_view_key(callback_query: types.CallbackQuery, session ), ) - builder.row( - InlineKeyboardButton( - text="⏳ Продлить", callback_data=f"renew_key|{key_name}" - ), - InlineKeyboardButton( - text="❌ Удалить", callback_data=f"delete_key|{key_name}" - ), - ) + # ✅ Добавлена проверка флага ENABLE_DELETE_KEY_BUTTON + if ENABLE_DELETE_KEY_BUTTON: + builder.row( + InlineKeyboardButton( + text="⏳ Продлить", callback_data=f"renew_key|{key_name}" + ), + InlineKeyboardButton( + text="❌ Удалить", callback_data=f"delete_key|{key_name}" + ), + ) + else: + builder.row( + InlineKeyboardButton( + text="⏳ Продлить", callback_data=f"renew_key|{key_name}" + ) + ) builder.row( InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile") @@ -480,14 +493,9 @@ async def process_callback_confirm_delete( @router.callback_query(F.data.startswith("renew_plan|")) -async def process_callback_renew_plan( - callback_query: types.CallbackQuery, session: Any -): +async def process_callback_renew_plan(callback_query: types.CallbackQuery, session: Any): tg_id = callback_query.message.chat.id - plan, client_id = ( - callback_query.data.split("|")[1], - callback_query.data.split("|")[2], - ) + plan, client_id = callback_query.data.split("|")[1], callback_query.data.split("|")[2] days_to_extend = 30 * int(plan) gb_multiplier = {"1": 1, "3": 3, "6": 6, "12": 12} @@ -505,70 +513,95 @@ async def process_callback_renew_plan( current_time = datetime.utcnow().timestamp() * 1000 if expiry_time <= current_time: - new_expiry_time = int( - current_time + timedelta(days=days_to_extend).total_seconds() * 1000 - ) + new_expiry_time = int(current_time + timedelta(days=days_to_extend).total_seconds() * 1000) else: - new_expiry_time = int( - expiry_time + timedelta(days=days_to_extend).total_seconds() * 1000 - ) + new_expiry_time = int(expiry_time + timedelta(days=days_to_extend).total_seconds() * 1000) cost = RENEWAL_PLANS[plan]["price"] - balance = await get_balance(tg_id) + if balance < cost: - builder = InlineKeyboardBuilder() - builder.row( - InlineKeyboardButton(text="Пополнить баланс", callback_data="pay") - ) - builder.row( - InlineKeyboardButton( - text="👤 Личный кабинет", callback_data="profile" - ) + required_amount = cost - balance + + logger.info(f"[RENEW] Пользователю {tg_id} не хватает {required_amount}₽. Запуск доплаты через {USE_NEW_PAYMENT_FLOW}") + + await save_temporary_data( + session, + tg_id, + "waiting_for_renewal_payment", + { + "plan": plan, + "client_id": client_id, + "cost": cost, + "required_amount": required_amount, + "new_expiry_time": new_expiry_time, + "total_gb": total_gb, + "email": email, + }, ) - await callback_query.message.answer( - INSUFFICIENT_FUNDS_MSG, - reply_markup=builder.as_markup(), - ) + if USE_NEW_PAYMENT_FLOW == "YOOKASSA": + logger.info(f"[RENEW] Запуск оплаты через Юкассу для пользователя {tg_id}") + await process_custom_amount_input(callback_query, session) + elif USE_NEW_PAYMENT_FLOW == "ROBOKASSA": + logger.info(f"[RENEW] Запуск оплаты через Робокассу для пользователя {tg_id}") + await handle_custom_amount_input(callback_query, session) + else: + logger.info(f"[RENEW] Отправка сообщения о доплате пользователю {tg_id}") + 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 - response_message = SUCCESS_RENEWAL_MSG.format( - months=RENEWAL_PLANS[plan]["months"] - ) - builder = InlineKeyboardBuilder() - builder.row( - InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile") - ) - - await callback_query.message.answer( - response_message, reply_markup=builder.as_markup() - ) - - servers = await get_servers_from_db() - - async def renew_key_on_servers(): - tasks = [] - for cluster_id in servers: - task = asyncio.create_task( - renew_key_in_cluster( - cluster_id, - email, - client_id, - new_expiry_time, - total_gb, - ) - ) - tasks.append(task) - - await asyncio.gather(*tasks) - - await update_balance(tg_id, -cost) - await update_key_expiry(client_id, new_expiry_time) - - await renew_key_on_servers() + logger.info(f"[RENEW] Средств достаточно. Продление ключа для пользователя {tg_id}") + await complete_key_renewal(tg_id, client_id, email, new_expiry_time, total_gb, cost, callback_query, plan) else: await callback_query.message.answer(KEY_NOT_FOUND_MSG) + logger.error(f"[RENEW] Ключ с client_id={client_id} не найден.") except Exception as e: - logger.error(e) + logger.error(f"[RENEW] Ошибка при продлении ключа для пользователя {tg_id}: {e}") + + +async def complete_key_renewal(tg_id, client_id, email, new_expiry_time, total_gb, cost, callback_query, plan): + response_message = SUCCESS_RENEWAL_MSG.format(months=plan) + + builder = InlineKeyboardBuilder() + builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile")) + + if callback_query: + await callback_query.message.answer(response_message, reply_markup=builder.as_markup()) + else: + await bot.send_message(tg_id, response_message, reply_markup=builder.as_markup()) + + servers = await get_servers_from_db() + + logger.info(f"[RENEW] Запуск продления ключа для пользователя {tg_id} на {plan} мес. на всех серверах.") + + async def renew_key_on_servers(): + tasks = [] + for cluster_id in servers: + task = asyncio.create_task( + renew_key_in_cluster( + cluster_id, + email, + client_id, + new_expiry_time, + total_gb, + ) + ) + tasks.append(task) + + await asyncio.gather(*tasks) + + await update_balance(tg_id, -cost) + await update_key_expiry(client_id, new_expiry_time) + logger.info(f"[RENEW] Ключ {client_id} успешно продлён на {plan} мес. для пользователя {tg_id}.") + + await renew_key_on_servers() + diff --git a/handlers/keys/subscriptions.py b/handlers/keys/subscriptions.py index a8be7c15..619e1d49 100644 --- a/handlers/keys/subscriptions.py +++ b/handlers/keys/subscriptions.py @@ -1,11 +1,12 @@ +import asyncio import base64 from datetime import datetime import aiohttp import asyncpg from aiohttp import web -from config import DATABASE_URL, PROJECT_NAME, SUB_MESSAGE, TRANSITION_DATE_STR +from config import DATABASE_URL, PROJECT_NAME, SUB_MESSAGE, TRANSITION_DATE_STR from database import get_servers_from_db from logger import logger diff --git a/handlers/keys/trial_key.py b/handlers/keys/trial_key.py index ef9cc566..3f971ac1 100644 --- a/handlers/keys/trial_key.py +++ b/handlers/keys/trial_key.py @@ -4,6 +4,9 @@ from datetime import datetime, timedelta from typing import Any import pytz +from py3xui import AsyncApi + +from client import add_client from config import ( ADMIN_PASSWORD, ADMIN_USERNAME, @@ -12,9 +15,6 @@ from config import ( TOTAL_GB, TRIAL_TIME, ) -from py3xui import AsyncApi - -from client import add_client from database import get_servers_from_db, store_key, use_trial from handlers.texts import INSTRUCTIONS from handlers.utils import generate_random_email, get_least_loaded_cluster diff --git a/handlers/notifications.py b/handlers/notifications.py index 13b761a1..fb79f513 100644 --- a/handlers/notifications.py +++ b/handlers/notifications.py @@ -5,17 +5,19 @@ import asyncpg from aiogram import Bot, Router, types from aiogram.exceptions import TelegramForbiddenError from aiogram.utils.keyboard import InlineKeyboardBuilder +from py3xui import AsyncApi + from config import ( ADMIN_PASSWORD, ADMIN_USERNAME, + AUTO_DELETE_EXPIRED_KEYS, + AUTO_RENEW_KEYS, DATABASE_URL, DEV_MODE, RENEWAL_PLANS, TOTAL_GB, TRIAL_TIME, ) -from py3xui import AsyncApi - from database import ( add_blocked_user, add_notification, @@ -124,119 +126,60 @@ async def notify_10h_keys( logger.info(f"Найдено {len(records)} ключей для уведомления за 10 часов.") - async def process_record(record): - tg_id = record["tg_id"] - email = record["email"] - expiry_time = record["expiry_time"] + for record in records: + await process_10h_record(record, bot, conn) - expiry_date = datetime.utcfromtimestamp(expiry_time / 1000) - current_date = datetime.utcnow() - time_left = expiry_date - current_date - - if time_left.total_seconds() <= 0: - days_left_message = "Ключ истек" - elif time_left.days > 0: - days_left_message = f"{time_left.days}" - else: - hours_left = time_left.seconds // 3600 - days_left_message = f"{hours_left}" - - message = KEY_EXPIRY_10H.format( - email=email, - expiry_date=expiry_date.strftime("%Y-%m-%d %H:%M:%S"), - days_left_message=days_left_message, - price=RENEWAL_PLANS["1"]["price"], - ) - - balance = await get_balance(tg_id) - - if balance >= RENEWAL_PLANS["1"]["price"]: - try: - await update_balance(tg_id, -RENEWAL_PLANS["1"]["price"]) - new_expiry_time = int( - (datetime.utcnow() + timedelta(days=30)).timestamp() * 1000 - ) - await update_key_expiry(record["client_id"], new_expiry_time) - - servers = await get_servers_from_db() - - for cluster_id in servers: - await renew_key_in_cluster( - cluster_id, - email, - record["client_id"], - new_expiry_time, - TOTAL_GB, - ) - logger.info( - f"Ключ для пользователя {tg_id} успешно продлен в кластере {cluster_id}." - ) - - await conn.execute( - """ - UPDATE keys - SET notified = FALSE, notified_24h = FALSE - WHERE client_id = $1 - """, - record["client_id"], - ) - - keyboard = types.InlineKeyboardMarkup( - inline_keyboard=[ - [ - types.InlineKeyboardButton( - text="👤 Личный кабинет", callback_data="profile" - ) - ] - ] - ) - await bot.send_message(tg_id, text=KEY_RENEWED, reply_markup=keyboard) - logger.info( - f"Уведомление об успешном продлении отправлено клиенту {tg_id}." - ) - except TelegramForbiddenError: - logger.warning( - f"Бот заблокирован пользователем {tg_id}. Записываем в blocked_users." - ) - await add_blocked_user(tg_id, conn) - except Exception as e: - logger.error(f"Ошибка при продлении подписки для клиента {tg_id}: {e}") - else: - try: - keyboard = InlineKeyboardBuilder() - keyboard.button( - text="🔄 Продлить VPN", callback_data=f"renew_key|{email}" - ) - keyboard.button(text="💳 Пополнить баланс", callback_data="pay") - keyboard.button(text="👤 Личный кабинет", callback_data="profile") - keyboard.adjust(1) - - await bot.send_message( - tg_id, message, reply_markup=keyboard.as_markup() - ) - logger.info(f"Уведомление отправлено пользователю {tg_id}.") - - await conn.execute( - "UPDATE keys SET notified = TRUE WHERE client_id = $1", - record["client_id"], - ) - logger.info( - f"Обновлено поле notified для клиента {record['client_id']}." - ) - except TelegramForbiddenError: - logger.warning( - f"Бот заблокирован пользователем {tg_id}. Записываем в blocked_users." - ) - await add_blocked_user(tg_id, conn) - except Exception as e: - logger.debug( - f"Ошибка при отправке уведомления пользователю {tg_id}: {e}" - ) - - await asyncio.gather(*(process_record(record) for record in records)) logger.info("Обработка всех уведомлений за 10 часов завершена.") +async def process_10h_record(record, bot, conn): + tg_id = record["tg_id"] + email = record["email"] + expiry_time = record["expiry_time"] + + expiry_date = datetime.utcfromtimestamp(expiry_time / 1000) + current_date = datetime.utcnow() + time_left = expiry_date - current_date + + days_left_message = ( + "Ключ истек" if time_left.total_seconds() <= 0 else f"{time_left.days}" if time_left.days > 0 else f"{time_left.seconds // 3600}" + ) + + message = KEY_EXPIRY_10H.format( + email=email, + expiry_date=expiry_date.strftime("%Y-%m-%d %H:%M:%S"), + days_left_message=days_left_message, + price=RENEWAL_PLANS["1"]["price"], + ) + + balance = await get_balance(tg_id) + + if AUTO_RENEW_KEYS and balance >= RENEWAL_PLANS["1"]["price"]: + try: + await update_balance(tg_id, -RENEWAL_PLANS["1"]["price"]) + new_expiry_time = int((datetime.utcnow() + timedelta(days=30)).timestamp() * 1000) + await update_key_expiry(record["client_id"], new_expiry_time) + + servers = await get_servers_from_db() + for cluster_id in servers: + await renew_key_in_cluster(cluster_id, email, record["client_id"], new_expiry_time, TOTAL_GB) + logger.info(f"Ключ для пользователя {tg_id} успешно продлен в кластере {cluster_id}.") + + await conn.execute("UPDATE keys SET notified = TRUE WHERE client_id = $1", record["client_id"]) + + keyboard = types.InlineKeyboardMarkup( + inline_keyboard=[[types.InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile")]] + ) + + await bot.send_message(tg_id, text=KEY_RENEWED, reply_markup=keyboard) + logger.info(f"Уведомление об успешном продлении отправлено клиенту {tg_id}.") + + except Exception as e: + logger.error(f"Ошибка при продлении подписки для клиента {tg_id}: {e}") + else: + await send_renewal_notification(bot, tg_id, email, message, conn, record["client_id"], "notified") + + async def notify_24h_keys( bot: Bot, conn: asyncpg.Connection, @@ -256,127 +199,76 @@ async def notify_24h_keys( logger.info(f"Найдено {len(records_24h)} ключей для уведомления за 24 часа.") - async def process_record(record): - tg_id = record["tg_id"] - email = record["email"] - expiry_time = record["expiry_time"] + for record in records_24h: + await process_24h_record(record, bot, conn) - expiry_date = datetime.utcfromtimestamp(expiry_time / 1000) - current_date = datetime.utcnow() - time_left = expiry_date - current_date - - if time_left.total_seconds() <= 0: - days_left_message = "Ключ истек" - elif time_left.days > 0: - days_left_message = f"{time_left.days}" - else: - hours_left = time_left.seconds // 3600 - days_left_message = f"{hours_left}" - - message_24h = KEY_EXPIRY_24H.format( - email=email, - days_left_message=days_left_message, - expiry_date=expiry_date.strftime("%Y-%m-%d %H:%M:%S"), - ) - - balance = await get_balance(tg_id) - - if balance >= RENEWAL_PLANS["1"]["price"]: - try: - await update_balance(tg_id, -RENEWAL_PLANS["1"]["price"]) - new_expiry_time = int( - (datetime.utcnow() + timedelta(days=30)).timestamp() * 1000 - ) - await update_key_expiry(record["client_id"], new_expiry_time) - - servers = await get_servers_from_db() - - for cluster_id in servers: - await renew_key_in_cluster( - cluster_id, - email, - record["client_id"], - new_expiry_time, - TOTAL_GB, - ) - logger.info( - f"Ключ для пользователя {tg_id} успешно продлен в кластере {cluster_id}." - ) - - await conn.execute( - """ - UPDATE keys - SET notified_24h = FALSE, notified = FALSE - WHERE client_id = $1 - """, - record["client_id"], - ) - - keyboard = InlineKeyboardBuilder() - keyboard.row( - types.InlineKeyboardButton( - text="👤 Личный кабинет", callback_data="profile" - ) - ) - await bot.send_message( - tg_id, - text=KEY_RENEWED, - reply_markup=keyboard.as_markup(), - ) - logger.info( - f"Уведомление об успешном продлении отправлено клиенту {tg_id}." - ) - except TelegramForbiddenError: - logger.warning( - f"Бот заблокирован пользователем {tg_id}. Записываем в blocked_users." - ) - await add_blocked_user(tg_id, conn) - except Exception as e: - logger.error(f"Ошибка при продлении подписки для клиента {tg_id}: {e}") - else: - try: - builder = InlineKeyboardBuilder() - builder.row( - types.InlineKeyboardButton( - text="🔄 Продлить VPN", - callback_data=f"renew_key|{email}", - ) - ) - builder.row( - types.InlineKeyboardButton( - text="💳 Пополнить баланс", - callback_data="pay", - ) - ) - builder.row( - types.InlineKeyboardButton( - text="👤 Личный кабинет", - callback_data="profile", - ) - ) - keyboard = builder.as_markup() - await bot.send_message(tg_id, message_24h, reply_markup=keyboard) - logger.info(f"Уведомление за 24 часа отправлено пользователю {tg_id}.") - except TelegramForbiddenError: - logger.warning( - f"Бот заблокирован пользователем {tg_id}. Записываем в blocked_users." - ) - await add_blocked_user(tg_id, conn) - except Exception as e: - logger.error( - f"Ошибка при отправке уведомления за 24 часа пользователю {tg_id}: {e}" - ) - - await conn.execute( - "UPDATE keys SET notified_24h = TRUE WHERE client_id = $1", - record["client_id"], - ) - logger.info(f"Обновлено поле notified_24h для клиента {record['client_id']}.") - - await asyncio.gather(*(process_record(record) for record in records_24h)) logger.info("Обработка всех уведомлений за 24 часа завершена.") + +async def process_24h_record(record, bot, conn): + tg_id = record["tg_id"] + email = record["email"] + expiry_time = record["expiry_time"] + + expiry_date = datetime.utcfromtimestamp(expiry_time / 1000) + current_date = datetime.utcnow() + time_left = expiry_date - current_date + + days_left_message = ( + "Ключ истек" if time_left.total_seconds() <= 0 else f"{time_left.days}" if time_left.days > 0 else f"{time_left.seconds // 3600}" + ) + + message_24h = KEY_EXPIRY_24H.format( + email=email, + days_left_message=days_left_message, + expiry_date=expiry_date.strftime("%Y-%m-%d %H:%M:%S"), + ) + + balance = await get_balance(tg_id) + + if AUTO_RENEW_KEYS and balance >= RENEWAL_PLANS["1"]["price"]: + try: + await update_balance(tg_id, -RENEWAL_PLANS["1"]["price"]) + new_expiry_time = int((datetime.utcnow() + timedelta(days=30)).timestamp() * 1000) + await update_key_expiry(record["client_id"], new_expiry_time) + + servers = await get_servers_from_db() + for cluster_id in servers: + await renew_key_in_cluster(cluster_id, email, record["client_id"], new_expiry_time, TOTAL_GB) + logger.info(f"Ключ для пользователя {tg_id} успешно продлен в кластере {cluster_id}.") + + await conn.execute("UPDATE keys SET notified_24h = TRUE WHERE client_id = $1", record["client_id"]) + + keyboard = types.InlineKeyboardMarkup( + inline_keyboard=[[types.InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile")]] + ) + + await bot.send_message(tg_id, text=KEY_RENEWED, reply_markup=keyboard) + logger.info(f"Уведомление об успешном продлении отправлено клиенту {tg_id}.") + + except Exception as e: + logger.error(f"Ошибка при продлении подписки для клиента {tg_id}: {e}") + else: + await send_renewal_notification(bot, tg_id, email, message_24h, conn, record["client_id"], "notified_24h") + + +async def send_renewal_notification(bot, tg_id, email, message, conn, client_id, flag): + try: + keyboard = InlineKeyboardBuilder() + keyboard.row(types.InlineKeyboardButton(text="🔄 Продлить VPN", callback_data=f"renew_key|{email}")) + keyboard.row(types.InlineKeyboardButton(text="💳 Пополнить баланс", callback_data="pay")) + keyboard.row(types.InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile")) + + await bot.send_message(tg_id, message, reply_markup=keyboard.as_markup()) + logger.info(f"Уведомление отправлено пользователю {tg_id}.") + + await conn.execute(f"UPDATE keys SET {flag} = TRUE WHERE client_id = $1", client_id) + + except Exception as e: + logger.error(f"Ошибка при отправке уведомления пользователю {tg_id}: {e}") + + async def notify_inactive_trial_users(bot: Bot, conn: asyncpg.Connection): logger.info("Проверка пользователей, не активировавших пробный период...") @@ -461,9 +353,7 @@ async def handle_expired_keys(bot: Bot, conn: asyncpg.Connection, current_time: current_time, ) - logger.info( - f"Найдено {len(expiring_keys)} подписок, срок действия которых скоро истекает." - ) + logger.info(f"Найдено {len(expiring_keys)} подписок, срок действия которых скоро истекает.") for record in expiring_keys: try: @@ -499,22 +389,16 @@ async def process_key(record, bot, conn): ) try: - if balance >= RENEWAL_PLANS["1"]["price"]: + if AUTO_RENEW_KEYS and balance >= RENEWAL_PLANS["1"]["price"]: await update_balance(tg_id, -RENEWAL_PLANS["1"]["price"]) - new_expiry_time = int( - (datetime.utcnow() + timedelta(days=30)).timestamp() * 1000 - ) + new_expiry_time = int((datetime.utcnow() + timedelta(days=30)).timestamp() * 1000) await update_key_expiry(client_id, new_expiry_time) servers = await get_servers_from_db() for cluster_id in servers: - await renew_key_in_cluster( - cluster_id, email, client_id, new_expiry_time, TOTAL_GB - ) - logger.info( - f"Ключ для пользователя {tg_id} успешно продлен в кластере {cluster_id}." - ) + await renew_key_in_cluster(cluster_id, email, client_id, new_expiry_time, TOTAL_GB) + logger.info(f"Ключ для пользователя {tg_id} успешно продлен в кластере {cluster_id}.") await conn.execute( """ @@ -524,40 +408,27 @@ async def process_key(record, bot, conn): """, client_id, ) - logger.info( - f"Флаги notified и notified_24 сброшены для клиента с ID {client_id}." - ) - try: - await bot.send_message(tg_id, text=KEY_RENEWED, reply_markup=keyboard) - logger.info( - f"Уведомление об успешном продлении отправлено клиенту {tg_id}." - ) - except Exception as e: - logger.error(f"Ошибка при отправке уведомления клиенту {tg_id}: {e}") + logger.info(f"Флаги notified сброшены для клиента {client_id}.") + + await bot.send_message(tg_id, text=KEY_RENEWED, reply_markup=keyboard) + logger.info(f"Уведомление об успешном продлении отправлено клиенту {tg_id}.") else: - message_expired = "Ваша подписка истекла и была удалена. Получите новую через личный кабинет" + message_expired = "Ваша подписка истекла. Пополните баланс для продления." + await bot.send_message(tg_id, text=message_expired, reply_markup=keyboard) + logger.info(f"Уведомление об истечении подписки отправлено пользователю {tg_id}.") - try: - await bot.send_message( - tg_id, text=message_expired, reply_markup=keyboard - ) - logger.info( - f"Уведомление об истечении подписки и удалении ключа отправлено пользователю {tg_id}." - ) - except Exception as e: - logger.error( - f"Ошибка при отправке уведомления об истечении подписки пользователю {tg_id}: {e}" - ) + if AUTO_DELETE_EXPIRED_KEYS: + servers = await get_servers_from_db() - servers = await get_servers_from_db() + for cluster_id in servers: + await delete_key_from_cluster(cluster_id, email, client_id) + logger.info(f"Клиент {client_id} удален из кластера {cluster_id}.") - for cluster_id in servers: - await delete_key_from_cluster(cluster_id, email, client_id) - logger.info(f"Клиент {client_id} удален из кластера {cluster_id}.") - - await delete_key(client_id) - logger.info(f"Ключ для клиента с ID {client_id} удален из базы данных.") + await delete_key(client_id) + logger.info(f"Ключ {client_id} удалён из базы данных.") + else: + logger.info(f"Ключ {client_id} НЕ был удалён (AUTO_DELETE_EXPIRED_KEYS=False).") except Exception as e: logger.error(f"Ошибка при обработке ключа для клиента {tg_id}: {e}") diff --git a/handlers/pay.py b/handlers/pay.py index 2ebfa491..2b7c753c 100644 --- a/handlers/pay.py +++ b/handlers/pay.py @@ -1,6 +1,7 @@ from aiogram import F, Router from aiogram.types import CallbackQuery, InlineKeyboardButton from aiogram.utils.keyboard import InlineKeyboardBuilder + from config import ( CRYPTO_BOT_ENABLE, DONATIONS_ENABLE, diff --git a/handlers/payments/__init__.py b/handlers/payments/__init__.py index ba0f040b..e1ccb3fc 100644 --- a/handlers/payments/__init__.py +++ b/handlers/payments/__init__.py @@ -1,6 +1,7 @@ __all__ = ("router",) from aiogram import Router + from config import ( CRYPTO_BOT_ENABLE, ROBOKASSA_ENABLE, diff --git a/handlers/payments/robokassa_pay.py b/handlers/payments/robokassa_pay.py index 2c1de2e5..37aa3692 100644 --- a/handlers/payments/robokassa_pay.py +++ b/handlers/payments/robokassa_pay.py @@ -1,26 +1,29 @@ import hashlib from typing import Any +import asyncpg from aiogram import F, Router, types from aiogram.fsm.context import FSMContext from aiogram.fsm.state import State, StatesGroup from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkup from aiogram.utils.keyboard import InlineKeyboardBuilder from aiohttp import web +from robokassa import HashAlgorithm, Robokassa + from config import ( + DATABASE_URL, ROBOKASSA_ENABLE, ROBOKASSA_LOGIN, ROBOKASSA_PASSWORD1, ROBOKASSA_PASSWORD2, ROBOKASSA_TEST_MODE, ) -from robokassa import HashAlgorithm, Robokassa - from database import ( add_connection, add_payment, check_connection_exists, get_key_count, + get_temporary_data, update_balance, ) from handlers.payments.utils import send_payment_success_notification @@ -242,17 +245,31 @@ async def process_custom_amount_selection( @router.message(ReplenishBalanceState.waiting_for_payment_confirmation_robokassa) -async def handle_custom_amount_input(message: types.Message, state: FSMContext): - tg_id = message.chat.id - logger.info(f"User {tg_id} entered custom amount: {message.text}") +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: + tg_id = message.chat.id + + logger.info(f"User {tg_id} initiated payment through ROBOKASSA") inv_id = 0 try: - amount = int(message.text) - if amount <= 0: - raise ValueError("Сумма должна быть положительным числом.") - await state.update_data(amount=amount) + conn = await asyncpg.connect(DATABASE_URL) + user_data = await get_temporary_data(conn, tg_id) + await conn.close() + + if not user_data: + await message.answer("Данные для оплаты не найдены. Попробуйте снова.") + return + + state_type = user_data["state"] + amount = user_data["data"].get("required_amount", 0) + + if amount <= 0: + await message.answer("Недостаточная сумма для пополнения.") + return payment_url = generate_payment_link(amount, inv_id, "Пополнение баланса", tg_id) @@ -260,18 +277,38 @@ async def handle_custom_amount_input(message: types.Message, state: FSMContext): confirm_keyboard = InlineKeyboardMarkup( inline_keyboard=[ - [InlineKeyboardButton(text="Оплатить", url=payment_url)], + [InlineKeyboardButton(text="💳 Оплатить", url=payment_url)], [InlineKeyboardButton(text="⬅️ Назад", callback_data="pay_robokassa")], ] ) - await message.answer( - text=f"Вы выбрали пополнение на {amount} рублей. Для оплаты перейдите по ссылке ниже:", - reply_markup=confirm_keyboard, - ) - await state.clear() - except ValueError as e: - logger.error(f"Некорректная сумма от пользователя {tg_id}: {e}") - await message.answer( - text="Введите корректную сумму в рублях (целое положительное число)." - ) + if state_type == "waiting_for_payment": + message_text = f"Вы выбрали пополнение на {amount} рублей для создания нового ключа. Перейдите по ссылке для оплаты:" + elif state_type == "waiting_for_renewal_payment": + message_text = f"Вы выбрали пополнение на {amount} рублей для продления ключа. Перейдите по ссылке для оплаты:" + else: + await message.answer("Некорректное состояние данных. Попробуйте снова.") + return + + if isinstance(message, types.CallbackQuery): + await message.message.answer( + text=message_text, + reply_markup=confirm_keyboard, + ) + else: + await message.answer( + text=message_text, + reply_markup=confirm_keyboard, + ) + + if isinstance(state, FSMContext): + await state.clear() + + except Exception as e: + logger.error(f"Ошибка при создании платежа для пользователя {tg_id}: {e}") + error_message = "Произошла ошибка при создании платежа. Попробуйте позже." + + if isinstance(message, types.CallbackQuery): + await message.message.answer(error_message) + else: + await message.answer(error_message) diff --git a/handlers/payments/utils.c b/handlers/payments/utils.c index 8180484c..2222d43c 100644 --- a/handlers/payments/utils.c +++ b/handlers/payments/utils.c @@ -1497,20 +1497,29 @@ struct __pyx_obj_8handlers_8payments_5utils___pyx_scope_struct__send_payment_suc * * async def send_payment_success_notification(user_id: int, amount: float): # <<<<<<<<<<<<<< * try: - * builder = InlineKeyboardBuilder() + * user_id = int(user_id) */ struct __pyx_obj_8handlers_8payments_5utils___pyx_scope_struct__send_payment_success_notification { PyObject_HEAD double __pyx_v_amount; PyObject *__pyx_v_balance; PyObject *__pyx_v_builder; + PyObject *__pyx_v_client_id; + PyObject *__pyx_v_complete_key_renewal; PyObject *__pyx_v_conn; + PyObject *__pyx_v_cost; PyObject *__pyx_v_create_key; + PyObject *__pyx_v_data; PyObject *__pyx_v_duration_days; PyObject *__pyx_v_e; + PyObject *__pyx_v_email; PyObject *__pyx_v_expiry_time; + PyObject *__pyx_v_new_expiry_time; + PyObject *__pyx_v_plan; PyObject *__pyx_v_plan_price; + PyObject *__pyx_v_state; PyObject *__pyx_v_temp_data; + PyObject *__pyx_v_total_gb; PyObject *__pyx_v_user_id; PyObject *__pyx_t_0; PyObject *__pyx_t_1; @@ -1609,6 +1618,70 @@ struct __pyx_obj_8handlers_8payments_5utils___pyx_scope_struct__send_payment_suc #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + /* TupleAndListFromArray.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); @@ -1692,69 +1765,8 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues __Pyx__ArgTypeTest(obj, type, name, exact)) static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#if PY_VERSION_HEX >= 0x030C00A6 -#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) -#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) -#else -#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) -#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) -#endif -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) -#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS @@ -2029,14 +2041,6 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#endif - /* PyObjectFormatSimple.proto */ #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyObject_FormatSimple(s, f) (\ @@ -2059,6 +2063,14 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); PyObject_Format(s, f)) #endif +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + /* JoinPyUnicode.proto */ static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, Py_UCS4 max_char); @@ -2303,29 +2315,37 @@ int __pyx_module_is_main_handlers__payments__utils = 0; /* Implementation of "handlers.payments.utils" */ /* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_all; /* #### Code section: string_decls ### */ static const char __pyx_k_e[] = "e"; static const char __pyx_k__2[] = "."; -static const char __pyx_k__3[] = "\320\236\321\210\320\270\320\261\320\272\320\260 \320\277\321\200\320\270 \320\276\321\202\320\277\321\200\320\260\320\262\320\272\320\265 \321\203\320\262\320\265\320\264\320\276\320\274\320\273\320\265\320\275\320\270\321\217 \320\277\320\276\320\273\321\214\320\267\320\276\320\262\320\260\321\202\320\265\320\273\321\216 "; -static const char __pyx_k__4[] = ": "; -static const char __pyx_k__5[] = "*"; -static const char __pyx_k__7[] = "?"; +static const char __pyx_k__3[] = "\342\235\214 \320\235\320\265\320\264\320\276\321\201\321\202\320\260\321\202\320\276\321\207\320\275\320\276 \321\201\321\200\320\265\320\264\321\201\321\202\320\262 \320\264\320\273\321\217 \320\277\321\200\320\276\320\264\320\273\320\265\320\275\320\270\321\217 \320\272\320\273\321\216\321\207\320\260."; +static const char __pyx_k__4[] = "\320\236\321\210\320\270\320\261\320\272\320\260 \320\277\321\200\320\270 \320\276\321\202\320\277\321\200\320\260\320\262\320\272\320\265 \321\203\320\262\320\265\320\264\320\276\320\274\320\273\320\265\320\275\320\270\321\217 \320\277\320\276\320\273\321\214\320\267\320\276\320\262\320\260\321\202\320\265\320\273\321\216 "; +static const char __pyx_k__5[] = ": "; +static const char __pyx_k__6[] = "*"; +static const char __pyx_k__8[] = "?"; static const char __pyx_k_gc[] = "gc"; +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_row[] = "row"; static const char __pyx_k_args[] = "args"; static const char __pyx_k_conn[] = "conn"; +static const char __pyx_k_cost[] = "cost"; static const char __pyx_k_data[] = "data"; 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_send[] = "send"; static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_text[] = "text"; +static const char __pyx_k_RENEW[] = "[RENEW] \320\235\320\265\320\264\320\276\321\201\321\202\320\260\321\202\320\276\321\207\320\275\320\276 \320\264\320\260\320\275\320\275\321\213\321\205 \320\264\320\273\321\217 \320\277\321\200\320\276\320\264\320\273\320\265\320\275\320\270\321\217 \320\272\320\273\321\216\321\207\320\260 \321\203 \320\277\320\276\320\273\321\214\320\267\320\276\320\262\320\260\321\202\320\265\320\273\321\217 "; static const char __pyx_k_await[] = "__await__"; static const char __pyx_k_close[] = "close"; +static const char __pyx_k_email[] = "email"; static const char __pyx_k_error[] = "error"; static const char __pyx_k_float[] = "float"; static const char __pyx_k_state[] = "state"; @@ -2349,8 +2369,10 @@ static const char __pyx_k_profile[] = "profile"; static const char __pyx_k_user_id[] = "user_id"; static const char __pyx_k_database[] = "database"; static const char __pyx_k_datetime[] = "datetime"; +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_temp_data[] = "temp_data"; static const char __pyx_k_timedelta[] = "timedelta"; @@ -2369,18 +2391,22 @@ static const char __pyx_k_callback_data[] = "callback_data"; static const char __pyx_k_duration_days[] = "duration_days"; static const char __pyx_k_handlers_texts[] = "handlers.texts"; static const char __pyx_k_update_balance[] = "update_balance"; +static const char __pyx_k_new_expiry_time[] = "new_expiry_time"; static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_get_temporary_data[] = "get_temporary_data"; +static const char __pyx_k_handlers_keys_keys[] = "handlers.keys.keys"; static const char __pyx_k_waiting_for_payment[] = "waiting_for_payment"; static const char __pyx_k_InlineKeyboardButton[] = "InlineKeyboardButton"; 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_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"; static const char __pyx_k_handlers_payments_utils_py[] = "handlers/payments/utils.py"; +static const char __pyx_k_waiting_for_renewal_payment[] = "waiting_for_renewal_payment"; static const char __pyx_k_handlers_keys_key_management[] = "handlers.keys.key_management"; static const char __pyx_k_handlers_buttons_notification[] = "handlers.buttons.notification"; static const char __pyx_k_send_payment_success_notificatio[] = "send_payment_success_notification"; @@ -2424,15 +2450,18 @@ typedef struct { PyObject *__pyx_n_s_InlineKeyboardButton; PyObject *__pyx_n_s_PAYMENT_SUCCESS_MESSAGE; PyObject *__pyx_n_s_PROFILE; + PyObject *__pyx_kp_u_RENEW; PyObject *__pyx_n_s_RENEW_KEY; PyObject *__pyx_n_s_USE_NEW_PAYMENT_FLOW; PyObject *__pyx_kp_u__2; PyObject *__pyx_kp_u__3; PyObject *__pyx_kp_u__4; - PyObject *__pyx_n_s__5; - PyObject *__pyx_n_s__7; + PyObject *__pyx_kp_u__5; + PyObject *__pyx_n_s__6; + PyObject *__pyx_n_s__8; PyObject *__pyx_n_s_aiogram_types; PyObject *__pyx_n_s_aiogram_utils_keyboard; + PyObject *__pyx_n_s_all; PyObject *__pyx_n_s_amount; PyObject *__pyx_n_s_args; PyObject *__pyx_n_s_as_markup; @@ -2445,13 +2474,19 @@ typedef struct { PyObject *__pyx_n_s_callback_data; PyObject *__pyx_n_s_chat_id; PyObject *__pyx_n_s_clear_temporary_data; + PyObject *__pyx_n_s_client_id; + PyObject *__pyx_n_u_client_id; PyObject *__pyx_n_s_cline_in_traceback; PyObject *__pyx_n_s_close; + PyObject *__pyx_n_s_complete_key_renewal; PyObject *__pyx_n_s_config; PyObject *__pyx_n_s_conn; PyObject *__pyx_n_s_connect; + PyObject *__pyx_n_s_cost; + PyObject *__pyx_n_u_cost; PyObject *__pyx_n_s_create_key; PyObject *__pyx_n_u_create_key; + PyObject *__pyx_n_s_data; PyObject *__pyx_n_u_data; PyObject *__pyx_n_s_database; PyObject *__pyx_n_s_datetime; @@ -2460,16 +2495,20 @@ typedef struct { PyObject *__pyx_n_s_duration_days; PyObject *__pyx_n_u_duration_days; PyObject *__pyx_n_s_e; + PyObject *__pyx_n_s_email; + PyObject *__pyx_n_u_email; PyObject *__pyx_kp_u_enable; PyObject *__pyx_n_s_error; PyObject *__pyx_n_s_expiry_time; PyObject *__pyx_n_s_float; PyObject *__pyx_n_s_format; PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_get; PyObject *__pyx_n_s_get_balance; PyObject *__pyx_n_s_get_temporary_data; PyObject *__pyx_n_s_handlers_buttons_notification; PyObject *__pyx_n_s_handlers_keys_key_management; + PyObject *__pyx_n_s_handlers_keys_keys; PyObject *__pyx_n_s_handlers_payments_utils; PyObject *__pyx_kp_s_handlers_payments_utils_py; PyObject *__pyx_n_s_handlers_texts; @@ -2481,6 +2520,10 @@ typedef struct { PyObject *__pyx_n_s_logger; PyObject *__pyx_n_s_main; PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_new_expiry_time; + PyObject *__pyx_n_u_new_expiry_time; + 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; @@ -2490,19 +2533,23 @@ typedef struct { PyObject *__pyx_n_s_send_message; PyObject *__pyx_n_s_send_payment_success_notificatio; PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_state; PyObject *__pyx_n_u_state; PyObject *__pyx_n_s_temp_data; PyObject *__pyx_n_s_test; PyObject *__pyx_n_s_text; PyObject *__pyx_n_s_throw; PyObject *__pyx_n_s_timedelta; + 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; PyObject *__pyx_codeobj_; - PyObject *__pyx_tuple__6; + PyObject *__pyx_tuple__7; } __pyx_mstate; #if CYTHON_USE_MODULE_STATE @@ -2553,15 +2600,18 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_InlineKeyboardButton); Py_CLEAR(clear_module_state->__pyx_n_s_PAYMENT_SUCCESS_MESSAGE); 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_NEW_PAYMENT_FLOW); Py_CLEAR(clear_module_state->__pyx_kp_u__2); Py_CLEAR(clear_module_state->__pyx_kp_u__3); Py_CLEAR(clear_module_state->__pyx_kp_u__4); - Py_CLEAR(clear_module_state->__pyx_n_s__5); - Py_CLEAR(clear_module_state->__pyx_n_s__7); + Py_CLEAR(clear_module_state->__pyx_kp_u__5); + Py_CLEAR(clear_module_state->__pyx_n_s__6); + Py_CLEAR(clear_module_state->__pyx_n_s__8); Py_CLEAR(clear_module_state->__pyx_n_s_aiogram_types); Py_CLEAR(clear_module_state->__pyx_n_s_aiogram_utils_keyboard); + Py_CLEAR(clear_module_state->__pyx_n_s_all); Py_CLEAR(clear_module_state->__pyx_n_s_amount); Py_CLEAR(clear_module_state->__pyx_n_s_args); Py_CLEAR(clear_module_state->__pyx_n_s_as_markup); @@ -2574,13 +2624,19 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_callback_data); Py_CLEAR(clear_module_state->__pyx_n_s_chat_id); Py_CLEAR(clear_module_state->__pyx_n_s_clear_temporary_data); + Py_CLEAR(clear_module_state->__pyx_n_s_client_id); + Py_CLEAR(clear_module_state->__pyx_n_u_client_id); Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); Py_CLEAR(clear_module_state->__pyx_n_s_close); + Py_CLEAR(clear_module_state->__pyx_n_s_complete_key_renewal); Py_CLEAR(clear_module_state->__pyx_n_s_config); Py_CLEAR(clear_module_state->__pyx_n_s_conn); Py_CLEAR(clear_module_state->__pyx_n_s_connect); + Py_CLEAR(clear_module_state->__pyx_n_s_cost); + Py_CLEAR(clear_module_state->__pyx_n_u_cost); Py_CLEAR(clear_module_state->__pyx_n_s_create_key); Py_CLEAR(clear_module_state->__pyx_n_u_create_key); + Py_CLEAR(clear_module_state->__pyx_n_s_data); Py_CLEAR(clear_module_state->__pyx_n_u_data); Py_CLEAR(clear_module_state->__pyx_n_s_database); Py_CLEAR(clear_module_state->__pyx_n_s_datetime); @@ -2589,16 +2645,20 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_duration_days); Py_CLEAR(clear_module_state->__pyx_n_u_duration_days); Py_CLEAR(clear_module_state->__pyx_n_s_e); + Py_CLEAR(clear_module_state->__pyx_n_s_email); + Py_CLEAR(clear_module_state->__pyx_n_u_email); Py_CLEAR(clear_module_state->__pyx_kp_u_enable); Py_CLEAR(clear_module_state->__pyx_n_s_error); Py_CLEAR(clear_module_state->__pyx_n_s_expiry_time); Py_CLEAR(clear_module_state->__pyx_n_s_float); Py_CLEAR(clear_module_state->__pyx_n_s_format); Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_get); Py_CLEAR(clear_module_state->__pyx_n_s_get_balance); Py_CLEAR(clear_module_state->__pyx_n_s_get_temporary_data); Py_CLEAR(clear_module_state->__pyx_n_s_handlers_buttons_notification); Py_CLEAR(clear_module_state->__pyx_n_s_handlers_keys_key_management); + Py_CLEAR(clear_module_state->__pyx_n_s_handlers_keys_keys); Py_CLEAR(clear_module_state->__pyx_n_s_handlers_payments_utils); Py_CLEAR(clear_module_state->__pyx_kp_s_handlers_payments_utils_py); Py_CLEAR(clear_module_state->__pyx_n_s_handlers_texts); @@ -2610,6 +2670,10 @@ static int __pyx_m_clear(PyObject *m) { 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_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_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); @@ -2619,19 +2683,23 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_send_message); Py_CLEAR(clear_module_state->__pyx_n_s_send_payment_success_notificatio); Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_state); Py_CLEAR(clear_module_state->__pyx_n_u_state); Py_CLEAR(clear_module_state->__pyx_n_s_temp_data); Py_CLEAR(clear_module_state->__pyx_n_s_test); 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_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); Py_CLEAR(clear_module_state->__pyx_codeobj_); - Py_CLEAR(clear_module_state->__pyx_tuple__6); + Py_CLEAR(clear_module_state->__pyx_tuple__7); return 0; } #endif @@ -2660,15 +2728,18 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_InlineKeyboardButton); Py_VISIT(traverse_module_state->__pyx_n_s_PAYMENT_SUCCESS_MESSAGE); 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_NEW_PAYMENT_FLOW); Py_VISIT(traverse_module_state->__pyx_kp_u__2); Py_VISIT(traverse_module_state->__pyx_kp_u__3); Py_VISIT(traverse_module_state->__pyx_kp_u__4); - Py_VISIT(traverse_module_state->__pyx_n_s__5); - Py_VISIT(traverse_module_state->__pyx_n_s__7); + Py_VISIT(traverse_module_state->__pyx_kp_u__5); + Py_VISIT(traverse_module_state->__pyx_n_s__6); + Py_VISIT(traverse_module_state->__pyx_n_s__8); Py_VISIT(traverse_module_state->__pyx_n_s_aiogram_types); Py_VISIT(traverse_module_state->__pyx_n_s_aiogram_utils_keyboard); + Py_VISIT(traverse_module_state->__pyx_n_s_all); Py_VISIT(traverse_module_state->__pyx_n_s_amount); Py_VISIT(traverse_module_state->__pyx_n_s_args); Py_VISIT(traverse_module_state->__pyx_n_s_as_markup); @@ -2681,13 +2752,19 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_callback_data); Py_VISIT(traverse_module_state->__pyx_n_s_chat_id); Py_VISIT(traverse_module_state->__pyx_n_s_clear_temporary_data); + Py_VISIT(traverse_module_state->__pyx_n_s_client_id); + Py_VISIT(traverse_module_state->__pyx_n_u_client_id); Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); Py_VISIT(traverse_module_state->__pyx_n_s_close); + Py_VISIT(traverse_module_state->__pyx_n_s_complete_key_renewal); Py_VISIT(traverse_module_state->__pyx_n_s_config); Py_VISIT(traverse_module_state->__pyx_n_s_conn); Py_VISIT(traverse_module_state->__pyx_n_s_connect); + Py_VISIT(traverse_module_state->__pyx_n_s_cost); + Py_VISIT(traverse_module_state->__pyx_n_u_cost); Py_VISIT(traverse_module_state->__pyx_n_s_create_key); Py_VISIT(traverse_module_state->__pyx_n_u_create_key); + Py_VISIT(traverse_module_state->__pyx_n_s_data); Py_VISIT(traverse_module_state->__pyx_n_u_data); Py_VISIT(traverse_module_state->__pyx_n_s_database); Py_VISIT(traverse_module_state->__pyx_n_s_datetime); @@ -2696,16 +2773,20 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_duration_days); Py_VISIT(traverse_module_state->__pyx_n_u_duration_days); Py_VISIT(traverse_module_state->__pyx_n_s_e); + Py_VISIT(traverse_module_state->__pyx_n_s_email); + Py_VISIT(traverse_module_state->__pyx_n_u_email); Py_VISIT(traverse_module_state->__pyx_kp_u_enable); Py_VISIT(traverse_module_state->__pyx_n_s_error); Py_VISIT(traverse_module_state->__pyx_n_s_expiry_time); Py_VISIT(traverse_module_state->__pyx_n_s_float); Py_VISIT(traverse_module_state->__pyx_n_s_format); Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_get); Py_VISIT(traverse_module_state->__pyx_n_s_get_balance); Py_VISIT(traverse_module_state->__pyx_n_s_get_temporary_data); Py_VISIT(traverse_module_state->__pyx_n_s_handlers_buttons_notification); Py_VISIT(traverse_module_state->__pyx_n_s_handlers_keys_key_management); + Py_VISIT(traverse_module_state->__pyx_n_s_handlers_keys_keys); Py_VISIT(traverse_module_state->__pyx_n_s_handlers_payments_utils); Py_VISIT(traverse_module_state->__pyx_kp_s_handlers_payments_utils_py); Py_VISIT(traverse_module_state->__pyx_n_s_handlers_texts); @@ -2717,6 +2798,10 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { 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_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_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); @@ -2726,19 +2811,23 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_send_message); Py_VISIT(traverse_module_state->__pyx_n_s_send_payment_success_notificatio); Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_state); Py_VISIT(traverse_module_state->__pyx_n_u_state); Py_VISIT(traverse_module_state->__pyx_n_s_temp_data); Py_VISIT(traverse_module_state->__pyx_n_s_test); 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_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); Py_VISIT(traverse_module_state->__pyx_codeobj_); - Py_VISIT(traverse_module_state->__pyx_tuple__6); + Py_VISIT(traverse_module_state->__pyx_tuple__7); return 0; } #endif @@ -2777,15 +2866,18 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_InlineKeyboardButton __pyx_mstate_global->__pyx_n_s_InlineKeyboardButton #define __pyx_n_s_PAYMENT_SUCCESS_MESSAGE __pyx_mstate_global->__pyx_n_s_PAYMENT_SUCCESS_MESSAGE #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_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__3 __pyx_mstate_global->__pyx_kp_u__3 #define __pyx_kp_u__4 __pyx_mstate_global->__pyx_kp_u__4 -#define __pyx_n_s__5 __pyx_mstate_global->__pyx_n_s__5 -#define __pyx_n_s__7 __pyx_mstate_global->__pyx_n_s__7 +#define __pyx_kp_u__5 __pyx_mstate_global->__pyx_kp_u__5 +#define __pyx_n_s__6 __pyx_mstate_global->__pyx_n_s__6 +#define __pyx_n_s__8 __pyx_mstate_global->__pyx_n_s__8 #define __pyx_n_s_aiogram_types __pyx_mstate_global->__pyx_n_s_aiogram_types #define __pyx_n_s_aiogram_utils_keyboard __pyx_mstate_global->__pyx_n_s_aiogram_utils_keyboard +#define __pyx_n_s_all __pyx_mstate_global->__pyx_n_s_all #define __pyx_n_s_amount __pyx_mstate_global->__pyx_n_s_amount #define __pyx_n_s_args __pyx_mstate_global->__pyx_n_s_args #define __pyx_n_s_as_markup __pyx_mstate_global->__pyx_n_s_as_markup @@ -2798,13 +2890,19 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_callback_data __pyx_mstate_global->__pyx_n_s_callback_data #define __pyx_n_s_chat_id __pyx_mstate_global->__pyx_n_s_chat_id #define __pyx_n_s_clear_temporary_data __pyx_mstate_global->__pyx_n_s_clear_temporary_data +#define __pyx_n_s_client_id __pyx_mstate_global->__pyx_n_s_client_id +#define __pyx_n_u_client_id __pyx_mstate_global->__pyx_n_u_client_id #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback #define __pyx_n_s_close __pyx_mstate_global->__pyx_n_s_close +#define __pyx_n_s_complete_key_renewal __pyx_mstate_global->__pyx_n_s_complete_key_renewal #define __pyx_n_s_config __pyx_mstate_global->__pyx_n_s_config #define __pyx_n_s_conn __pyx_mstate_global->__pyx_n_s_conn #define __pyx_n_s_connect __pyx_mstate_global->__pyx_n_s_connect +#define __pyx_n_s_cost __pyx_mstate_global->__pyx_n_s_cost +#define __pyx_n_u_cost __pyx_mstate_global->__pyx_n_u_cost #define __pyx_n_s_create_key __pyx_mstate_global->__pyx_n_s_create_key #define __pyx_n_u_create_key __pyx_mstate_global->__pyx_n_u_create_key +#define __pyx_n_s_data __pyx_mstate_global->__pyx_n_s_data #define __pyx_n_u_data __pyx_mstate_global->__pyx_n_u_data #define __pyx_n_s_database __pyx_mstate_global->__pyx_n_s_database #define __pyx_n_s_datetime __pyx_mstate_global->__pyx_n_s_datetime @@ -2813,16 +2911,20 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_duration_days __pyx_mstate_global->__pyx_n_s_duration_days #define __pyx_n_u_duration_days __pyx_mstate_global->__pyx_n_u_duration_days #define __pyx_n_s_e __pyx_mstate_global->__pyx_n_s_e +#define __pyx_n_s_email __pyx_mstate_global->__pyx_n_s_email +#define __pyx_n_u_email __pyx_mstate_global->__pyx_n_u_email #define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable #define __pyx_n_s_error __pyx_mstate_global->__pyx_n_s_error #define __pyx_n_s_expiry_time __pyx_mstate_global->__pyx_n_s_expiry_time #define __pyx_n_s_float __pyx_mstate_global->__pyx_n_s_float #define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format #define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_get __pyx_mstate_global->__pyx_n_s_get #define __pyx_n_s_get_balance __pyx_mstate_global->__pyx_n_s_get_balance #define __pyx_n_s_get_temporary_data __pyx_mstate_global->__pyx_n_s_get_temporary_data #define __pyx_n_s_handlers_buttons_notification __pyx_mstate_global->__pyx_n_s_handlers_buttons_notification #define __pyx_n_s_handlers_keys_key_management __pyx_mstate_global->__pyx_n_s_handlers_keys_key_management +#define __pyx_n_s_handlers_keys_keys __pyx_mstate_global->__pyx_n_s_handlers_keys_keys #define __pyx_n_s_handlers_payments_utils __pyx_mstate_global->__pyx_n_s_handlers_payments_utils #define __pyx_kp_s_handlers_payments_utils_py __pyx_mstate_global->__pyx_kp_s_handlers_payments_utils_py #define __pyx_n_s_handlers_texts __pyx_mstate_global->__pyx_n_s_handlers_texts @@ -2834,6 +2936,10 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #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_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_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 @@ -2843,19 +2949,23 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_send_message __pyx_mstate_global->__pyx_n_s_send_message #define __pyx_n_s_send_payment_success_notificatio __pyx_mstate_global->__pyx_n_s_send_payment_success_notificatio #define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_state __pyx_mstate_global->__pyx_n_s_state #define __pyx_n_u_state __pyx_mstate_global->__pyx_n_u_state #define __pyx_n_s_temp_data __pyx_mstate_global->__pyx_n_s_temp_data #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test #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_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 #define __pyx_codeobj_ __pyx_mstate_global->__pyx_codeobj_ -#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6 +#define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7 /* #### 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 */ @@ -2864,7 +2974,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO * * async def send_payment_success_notification(user_id: int, amount: float): # <<<<<<<<<<<<<< * try: - * builder = InlineKeyboardBuilder() + * user_id = int(user_id) */ /* Python wrapper */ @@ -3063,12 +3173,16 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO case 4: goto __pyx_L21_resume_from_await; case 5: goto __pyx_L22_resume_from_await; case 6: goto __pyx_L23_resume_from_await; - case 7: goto __pyx_L24_resume_from_await; - case 8: goto __pyx_L25_resume_from_await; - case 9: goto __pyx_L26_resume_from_await; + case 7: goto __pyx_L25_resume_from_await; + case 8: goto __pyx_L27_resume_from_await; + case 9: goto __pyx_L28_resume_from_await; case 10: goto __pyx_L29_resume_from_await; case 11: goto __pyx_L30_resume_from_await; case 12: goto __pyx_L31_resume_from_await; + case 13: goto __pyx_L32_resume_from_await; + case 14: goto __pyx_L35_resume_from_await; + case 15: goto __pyx_L36_resume_from_await; + case 16: goto __pyx_L37_resume_from_await; default: /* CPython raises the right error here */ __Pyx_RefNannyFinishContext(); return NULL; @@ -3080,8 +3194,8 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO * * async def send_payment_success_notification(user_id: int, amount: float): * try: # <<<<<<<<<<<<<< - * builder = InlineKeyboardBuilder() - * builder.row( + * user_id = int(user_id) + * */ { __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); @@ -3093,11 +3207,26 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO /* "handlers/payments/utils.py":17 * async def send_payment_success_notification(user_id: int, amount: float): * try: - * builder = InlineKeyboardBuilder() # <<<<<<<<<<<<<< - * builder.row( - * InlineKeyboardButton(text=PROFILE, callback_data="profile") + * user_id = int(user_id) # <<<<<<<<<<<<<< + * + * builder = InlineKeyboardBuilder() */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_InlineKeyboardBuilder); if (unlikely(!__pyx_t_5)) __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, 17, __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) + __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 + * 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_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; __pyx_t_7 = 0; @@ -3117,7 +3246,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, 17, __pyx_L4_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 19, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } @@ -3125,33 +3254,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":18 - * try: - * builder = InlineKeyboardBuilder() - * builder.row( # <<<<<<<<<<<<<< - * InlineKeyboardButton(text=PROFILE, callback_data="profile") - * ) - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 18, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - - /* "handlers/payments/utils.py":19 - * builder = InlineKeyboardBuilder() - * builder.row( - * InlineKeyboardButton(text=PROFILE, callback_data="profile") # <<<<<<<<<<<<<< - * ) + /* "handlers/payments/utils.py":20 * + * builder = InlineKeyboardBuilder() + * builder.row(InlineKeyboardButton(text=PROFILE, callback_data="profile")) # <<<<<<<<<<<<<< + * + * if USE_NEW_PAYMENT_FLOW: */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 19, __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, 20, __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_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 19, __pyx_L4_error) + __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 20, __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, 19, __pyx_L4_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_PROFILE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 20, __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, 19, __pyx_L4_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_text, __pyx_t_9) < 0) __PYX_ERR(0, 20, __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, 19, __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, 19, __pyx_L4_error) + 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) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; @@ -3174,14 +3295,14 @@ 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, 18, __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; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "handlers/payments/utils.py":22 - * ) + * builder.row(InlineKeyboardButton(text=PROFILE, callback_data="profile")) * * if USE_NEW_PAYMENT_FLOW: # <<<<<<<<<<<<<< * from handlers.keys.key_management import create_key @@ -3295,7 +3416,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO * conn = await asyncpg.connect(DATABASE_URL) * try: # <<<<<<<<<<<<<< * temp_data = await get_temporary_data(conn, user_id) - * if temp_data and temp_data["state"] == "waiting_for_payment": + * if temp_data: */ /*try:*/ { @@ -3303,8 +3424,8 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO * conn = await asyncpg.connect(DATABASE_URL) * try: * temp_data = await get_temporary_data(conn, user_id) # <<<<<<<<<<<<<< - * if temp_data and temp_data["state"] == "waiting_for_payment": - * plan_price = temp_data["data"]["plan_price"] + * 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_GOTREF(__pyx_t_9); @@ -3370,169 +3491,403 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO /* "handlers/payments/utils.py":27 * try: * temp_data = await get_temporary_data(conn, user_id) - * if temp_data and temp_data["state"] == "waiting_for_payment": # <<<<<<<<<<<<<< - * plan_price = temp_data["data"]["plan_price"] - * duration_days = temp_data["data"]["duration_days"] + * if temp_data: # <<<<<<<<<<<<<< + * state = temp_data["state"] + * data = temp_data["data"] */ - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_temp_data); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 27, __pyx_L13_error) - if (__pyx_t_11) { - } else { - __pyx_t_10 = __pyx_t_11; - goto __pyx_L17_bool_binop_done; - } - __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, 27, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_11 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_n_u_waiting_for_payment, Py_EQ)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 27, __pyx_L13_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_10 = __pyx_t_11; - __pyx_L17_bool_binop_done:; + __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) if (__pyx_t_10) { /* "handlers/payments/utils.py":28 * temp_data = await get_temporary_data(conn, user_id) - * if temp_data and temp_data["state"] == "waiting_for_payment": - * plan_price = temp_data["data"]["plan_price"] # <<<<<<<<<<<<<< - * duration_days = temp_data["data"]["duration_days"] + * 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_data); 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, 28, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_plan_price); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 28, __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_plan_price = __pyx_t_9; - __pyx_t_9 = 0; + __Pyx_GIVEREF(__pyx_t_5); + __pyx_cur_scope->__pyx_v_state = __pyx_t_5; + __pyx_t_5 = 0; /* "handlers/payments/utils.py":29 - * if temp_data and temp_data["state"] == "waiting_for_payment": - * plan_price = temp_data["data"]["plan_price"] - * duration_days = temp_data["data"]["duration_days"] # <<<<<<<<<<<<<< + * if temp_data: + * state = temp_data["state"] + * data = temp_data["data"] # <<<<<<<<<<<<<< * - * balance = await get_balance(user_id) + * if state == "waiting_for_renewal_payment": */ - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_temp_data, __pyx_n_u_data); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 29, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_9, __pyx_n_u_duration_days); 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, 29, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GIVEREF(__pyx_t_5); - __pyx_cur_scope->__pyx_v_duration_days = __pyx_t_5; + __pyx_cur_scope->__pyx_v_data = __pyx_t_5; __pyx_t_5 = 0; /* "handlers/payments/utils.py":31 - * duration_days = temp_data["data"]["duration_days"] + * data = temp_data["data"] * - * balance = await get_balance(user_id) # <<<<<<<<<<<<<< - * if balance >= plan_price: - * await update_balance(user_id, -plan_price) - */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_get_balance); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 31, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = NULL; - __pyx_t_7 = 0; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_7 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_user_id}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __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_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XGOTREF(__pyx_r); - if (likely(__pyx_r)) { - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __Pyx_XGIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - __Pyx_Coroutine_ResetAndClearException(__pyx_generator); - /* return from generator, awaiting value */ - __pyx_generator->resume_label = 3; - return __pyx_r; - __pyx_L19_resume_from_await:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __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, 31, __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, 31, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_GIVEREF(__pyx_t_5); - __pyx_cur_scope->__pyx_v_balance = __pyx_t_5; - __pyx_t_5 = 0; - - /* "handlers/payments/utils.py":32 - * - * balance = await get_balance(user_id) - * if balance >= plan_price: # <<<<<<<<<<<<<< - * await update_balance(user_id, -plan_price) + * if state == "waiting_for_renewal_payment": # <<<<<<<<<<<<<< + * from handlers.keys.keys import complete_key_renewal * */ - __pyx_t_5 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_balance, __pyx_cur_scope->__pyx_v_plan_price, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L13_error) - __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 32, __pyx_L13_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __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, 31, __pyx_L13_error) if (__pyx_t_10) { - /* "handlers/payments/utils.py":33 - * balance = await get_balance(user_id) - * if balance >= plan_price: - * await update_balance(user_id, -plan_price) # <<<<<<<<<<<<<< + /* "handlers/payments/utils.py":32 * - * expiry_time = datetime.utcnow() + timedelta(days=duration_days) + * if state == "waiting_for_renewal_payment": + * from handlers.keys.keys import complete_key_renewal # <<<<<<<<<<<<<< + * + * plan = data.get("plan") */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_update_balance); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 33, __pyx_L13_error) + __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_n_s_complete_key_renewal); + __Pyx_GIVEREF(__pyx_n_s_complete_key_renewal); + if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_n_s_complete_key_renewal)) __PYX_ERR(0, 32, __pyx_L13_error); + __pyx_t_9 = __Pyx_Import(__pyx_n_s_handlers_keys_keys, __pyx_t_5, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 32, __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, 33, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_complete_key_renewal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_cur_scope->__pyx_v_complete_key_renewal = __pyx_t_5; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "handlers/payments/utils.py":34 + * 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_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_8); + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); + __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #endif { - PyObject *__pyx_callargs[3] = {__pyx_t_8, __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_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_n_u_plan}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 34, __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_plan = __pyx_t_9; + __pyx_t_9 = 0; + + /* "handlers/payments/utils.py":35 + * + * 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_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_n_u_client_id}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + 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_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_client_id = __pyx_t_9; + __pyx_t_9 = 0; + + /* "handlers/payments/utils.py":36 + * 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_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_n_u_new_expiry_time}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 36, __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_new_expiry_time = __pyx_t_9; + __pyx_t_9 = 0; + + /* "handlers/payments/utils.py":37 + * 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") # email + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 37, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_n_u_total_gb}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 37, __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_total_gb = __pyx_t_9; + __pyx_t_9 = 0; + + /* "handlers/payments/utils.py":38 + * new_expiry_time = data.get("new_expiry_time") + * total_gb = data.get("total_gb") + * cost = data.get("cost") # <<<<<<<<<<<<<< + * email = data.get("email") # email + * + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_n_u_cost}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __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_5); __pyx_t_5 = 0; + } + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_cost = __pyx_t_9; + __pyx_t_9 = 0; + + /* "handlers/payments/utils.py":39 + * total_gb = data.get("total_gb") + * cost = data.get("cost") + * email = data.get("email") # email # <<<<<<<<<<<<<< + * + * if not all([plan, client_id, new_expiry_time, email]): + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_n_u_email}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 39, __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_email = __pyx_t_9; + __pyx_t_9 = 0; + + /* "handlers/payments/utils.py":41 + * email = data.get("email") # 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, 41, __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, 41, __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, 41, __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, 41, __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, 41, __pyx_L13_error); + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 41, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_11 = (!__pyx_t_10); + if (__pyx_t_11) { + + /* "handlers/payments/utils.py":42 + * + * 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, 42, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); __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, 42, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_kp_u_RENEW, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 42, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_8}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "handlers/payments/utils.py":43 + * if not all([plan, client_id, new_expiry_time, email]): + * logger.error(f"[RENEW] {user_id}") + * return # <<<<<<<<<<<<<< + * + * balance = await get_balance(user_id) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = NULL; + goto __pyx_L12_return; + + /* "handlers/payments/utils.py":41 + * email = data.get("email") # email + * + * if not all([plan, client_id, new_expiry_time, email]): # <<<<<<<<<<<<<< + * logger.error(f"[RENEW] {user_id}") + * return + */ + } + + /* "handlers/payments/utils.py":45 + * 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_4, __pyx_n_s_get_balance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_cur_scope->__pyx_v_user_id}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -3548,9 +3903,9 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 4; + __pyx_generator->resume_label = 3; return __pyx_r; - __pyx_L21_resume_from_await:; + __pyx_L19_resume_from_await:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); @@ -3560,164 +3915,376 @@ 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, 33, __pyx_L13_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 45, __pyx_L13_error) + __pyx_t_5 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_5); } 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, 33, __pyx_L13_error) - } - } - - /* "handlers/payments/utils.py":35 - * await update_balance(user_id, -plan_price) - * - * expiry_time = datetime.utcnow() + timedelta(days=duration_days) # <<<<<<<<<<<<<< - * await create_key(user_id, expiry_time, None, conn, None) - * - */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_datetime); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 35, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_utcnow); 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_t_9 = NULL; - __pyx_t_7 = 0; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L13_error) + __pyx_t_5 = NULL; + if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_5) < 0) __PYX_ERR(0, 45, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_timedelta); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 35, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_days, __pyx_cur_scope->__pyx_v_duration_days) < 0) __PYX_ERR(0, 35, __pyx_L13_error) - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 35, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 35, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_cur_scope->__pyx_v_balance = __pyx_t_5; + __pyx_t_5 = 0; + + /* "handlers/payments/utils.py":46 + * + * 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_5 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_balance, __pyx_cur_scope->__pyx_v_cost, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L13_error) + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 46, __pyx_L13_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GIVEREF(__pyx_t_9); - __pyx_cur_scope->__pyx_v_expiry_time = __pyx_t_9; - __pyx_t_9 = 0; + if (__pyx_t_11) { - /* "handlers/payments/utils.py":36 - * - * expiry_time = datetime.utcnow() + timedelta(days=duration_days) - * await create_key(user_id, expiry_time, None, conn, None) # <<<<<<<<<<<<<< - * - * await clear_temporary_data(conn, user_id) + /* "handlers/payments/utils.py":47 + * 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) + * return */ - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_create_key); - __pyx_t_8 = __pyx_cur_scope->__pyx_v_create_key; __pyx_t_5 = NULL; - __pyx_t_7 = 0; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - __pyx_t_7 = 1; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_complete_key_renewal); + __pyx_t_4 = __pyx_cur_scope->__pyx_v_complete_key_renewal; __pyx_t_8 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; + } } + #endif + { + PyObject *__pyx_callargs[9] = {__pyx_t_8, __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_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 8+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 47, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 4; + return __pyx_r; + __pyx_L21_resume_from_await:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __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, 47, __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, 47, __pyx_L13_error) + } + } + + /* "handlers/payments/utils.py":48 + * 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 + * else: + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_cur_scope->__pyx_v_conn, __pyx_cur_scope->__pyx_v_user_id}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 48, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 5; + return __pyx_r; + __pyx_L22_resume_from_await:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __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, 48, __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, 48, __pyx_L13_error) + } + } + + /* "handlers/payments/utils.py":49 + * 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 # <<<<<<<<<<<<<< + * else: + * await bot.send_message( + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = NULL; + goto __pyx_L12_return; + + /* "handlers/payments/utils.py":46 + * + * 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) + */ } - #endif - { - PyObject *__pyx_callargs[6] = {__pyx_t_5, __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_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_7, 5+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 36, __pyx_L13_error) + + /* "handlers/payments/utils.py":51 + * return + * else: + * await bot.send_message( # <<<<<<<<<<<<<< + * chat_id=user_id, + * text=" .", + */ + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_bot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 51, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_send_message); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "handlers/payments/utils.py":52 + * else: + * await bot.send_message( + * chat_id=user_id, # <<<<<<<<<<<<<< + * text=" .", + * reply_markup=builder.as_markup(), + */ + __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 52, __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, 52, __pyx_L13_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_text, __pyx_kp_u__3) < 0) __PYX_ERR(0, 52, __pyx_L13_error) + + /* "handlers/payments/utils.py":54 + * chat_id=user_id, + * text=" .", + * reply_markup=builder.as_markup(), # <<<<<<<<<<<<<< + * ) + * return + */ + __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, 54, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_9); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XGOTREF(__pyx_r); - if (likely(__pyx_r)) { - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __Pyx_XGIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - __Pyx_Coroutine_ResetAndClearException(__pyx_generator); - /* return from generator, awaiting value */ - __pyx_generator->resume_label = 5; - return __pyx_r; - __pyx_L22_resume_from_await:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __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, 36, __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, 36, __pyx_L13_error) + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_9))) { + __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_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_7 = 1; + } } - } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 54, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_reply_markup, __pyx_t_8) < 0) __PYX_ERR(0, 52, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "handlers/payments/utils.py":38 - * await create_key(user_id, expiry_time, None, conn, None) + /* "handlers/payments/utils.py":51 + * return + * else: + * await bot.send_message( # <<<<<<<<<<<<<< + * chat_id=user_id, + * text=" .", + */ + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 51, __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_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 6; + return __pyx_r; + __pyx_L23_resume_from_await:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __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, 51, __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, 51, __pyx_L13_error) + } + } + + /* "handlers/payments/utils.py":56 + * reply_markup=builder.as_markup(), + * ) + * return # <<<<<<<<<<<<<< * - * await clear_temporary_data(conn, user_id) # <<<<<<<<<<<<<< - * return * */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 38, __pyx_L13_error) + __Pyx_XDECREF(__pyx_r); + __pyx_r = NULL; + goto __pyx_L12_return; + } + + /* "handlers/payments/utils.py":31 + * data = temp_data["data"] + * + * if state == "waiting_for_renewal_payment": # <<<<<<<<<<<<<< + * from handlers.keys.keys import complete_key_renewal + * + */ + } + + /* "handlers/payments/utils.py":59 + * + * + * if state == "waiting_for_payment": # <<<<<<<<<<<<<< + * plan_price = data["plan_price"] + * duration_days = data["duration_days"] + */ + __pyx_t_11 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_state, __pyx_n_u_waiting_for_payment, Py_EQ)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 59, __pyx_L13_error) + if (__pyx_t_11) { + + /* "handlers/payments/utils.py":60 + * + * if state == "waiting_for_payment": + * plan_price = data["plan_price"] # <<<<<<<<<<<<<< + * duration_days = data["duration_days"] + * + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_n_u_plan_price); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 60, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = NULL; + __Pyx_GIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_v_plan_price = __pyx_t_8; + __pyx_t_8 = 0; + + /* "handlers/payments/utils.py":61 + * if state == "waiting_for_payment": + * plan_price = data["plan_price"] + * duration_days = data["duration_days"] # <<<<<<<<<<<<<< + * + * balance = await get_balance(user_id) + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_n_u_duration_days); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 61, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_v_duration_days = __pyx_t_8; + __pyx_t_8 = 0; + + /* "handlers/payments/utils.py":63 + * duration_days = data["duration_days"] + * + * balance = await get_balance(user_id) # <<<<<<<<<<<<<< + * if balance >= plan_price: + * await update_balance(user_id, -plan_price) + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_get_balance); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 63, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_5); + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #endif { - PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_conn, __pyx_cur_scope->__pyx_v_user_id}; - __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_user_id}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 63, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_9); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { __Pyx_XGIVEREF(__pyx_t_1); @@ -3730,9 +4297,9 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 6; + __pyx_generator->resume_label = 7; return __pyx_r; - __pyx_L23_resume_from_await:; + __pyx_L25_resume_from_await:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); @@ -3742,363 +4309,626 @@ 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, 38, __pyx_L13_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 63, __pyx_L13_error) + __pyx_t_8 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_8); } 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, 38, __pyx_L13_error) - } + __pyx_t_8 = NULL; + if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_8) < 0) __PYX_ERR(0, 63, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); } + __Pyx_GIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_v_balance = __pyx_t_8; + __pyx_t_8 = 0; - /* "handlers/payments/utils.py":39 + /* "handlers/payments/utils.py":64 * - * 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":32 - * - * balance = await get_balance(user_id) - * if balance >= plan_price: # <<<<<<<<<<<<<< - * await update_balance(user_id, -plan_price) + * balance = await get_balance(user_id) + * if balance >= plan_price: # <<<<<<<<<<<<<< + * await update_balance(user_id, -plan_price) * */ - } - - /* "handlers/payments/utils.py":41 - * return - * - * builder.row( # <<<<<<<<<<<<<< - * InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"), - * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"), - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 41, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_8); - - /* "handlers/payments/utils.py":42 - * - * builder.row( - * InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"), # <<<<<<<<<<<<<< - * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"), - * ) - */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_RENEW_KEY); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_text, __pyx_t_6) < 0) __PYX_ERR(0, 42, __pyx_L13_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_callback_data, __pyx_n_u_view_keys) < 0) __PYX_ERR(0, 42, __pyx_L13_error) - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "handlers/payments/utils.py":43 - * builder.row( - * InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"), - * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"), # <<<<<<<<<<<<<< - * ) - * - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_ADD_KEY); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 43, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_text, __pyx_t_12) < 0) __PYX_ERR(0, 43, __pyx_L13_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_callback_data, __pyx_n_u_create_key) < 0) __PYX_ERR(0, 43, __pyx_L13_error) - __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 43, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - __pyx_t_7 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - __pyx_t_7 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_t_12}; - __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 41, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_balance, __pyx_cur_scope->__pyx_v_plan_price, Py_GE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 64, __pyx_L13_error) + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 64, __pyx_L13_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_11) { - /* "handlers/payments/utils.py":46 - * ) + /* "handlers/payments/utils.py":65 + * balance = await get_balance(user_id) + * if balance >= plan_price: + * await update_balance(user_id, -plan_price) # <<<<<<<<<<<<<< * - * await bot.send_message( # <<<<<<<<<<<<<< - * chat_id=user_id, - * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), + * expiry_time = datetime.utcnow() + timedelta(days=duration_days) */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_bot); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 46, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_send_message); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 46, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_update_balance); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __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_GOTREF(__pyx_t_4); + __pyx_t_9 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + 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_5); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(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_user_id, __pyx_t_4}; + __pyx_t_8 = __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; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 65, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 8; + return __pyx_r; + __pyx_L27_resume_from_await:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __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) + } 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) + } + } - /* "handlers/payments/utils.py":47 + /* "handlers/payments/utils.py":67 + * await update_balance(user_id, -plan_price) * - * await bot.send_message( - * chat_id=user_id, # <<<<<<<<<<<<<< - * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), - * reply_markup=builder.as_markup(), - */ - __pyx_t_9 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 47, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_chat_id, __pyx_cur_scope->__pyx_v_user_id) < 0) __PYX_ERR(0, 47, __pyx_L13_error) - - /* "handlers/payments/utils.py":48 - * await bot.send_message( - * chat_id=user_id, - * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), # <<<<<<<<<<<<<< - * reply_markup=builder.as_markup(), - * ) - */ - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_PAYMENT_SUCCESS_MESSAGE); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 48, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 48, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 48, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_5 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 48, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_amount, __pyx_t_5) < 0) __PYX_ERR(0, 48, __pyx_L13_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 48, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_text, __pyx_t_5) < 0) __PYX_ERR(0, 47, __pyx_L13_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "handlers/payments/utils.py":49 - * chat_id=user_id, - * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), - * reply_markup=builder.as_markup(), # <<<<<<<<<<<<<< - * ) + * expiry_time = datetime.utcnow() + 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, 67, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_utcnow); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 67, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_timedelta); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __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, 67, __pyx_L13_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 67, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GIVEREF(__pyx_t_5); + __pyx_cur_scope->__pyx_v_expiry_time = __pyx_t_5; + __pyx_t_5 = 0; + + /* "handlers/payments/utils.py":68 + * + * expiry_time = datetime.utcnow() + timedelta(days=duration_days) + * await create_key(user_id, expiry_time, None, conn, None) # <<<<<<<<<<<<<< + * + * await clear_temporary_data(conn, user_id) + */ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_create_key); + __pyx_t_9 = __pyx_cur_scope->__pyx_v_create_key; __pyx_t_8 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[6] = {__pyx_t_8, __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_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 5+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + 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_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 9; + return __pyx_r; + __pyx_L28_resume_from_await:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __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, 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, 68, __pyx_L13_error) + } + } + + /* "handlers/payments/utils.py":70 + * await create_key(user_id, expiry_time, None, conn, None) + * + * 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, 70, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_8, __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_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __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_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 10; + return __pyx_r; + __pyx_L29_resume_from_await:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __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, 70, __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, 70, __pyx_L13_error) + } + } + + /* "handlers/payments/utils.py":71 + * + * 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":64 + * + * balance = await get_balance(user_id) + * if balance >= plan_price: # <<<<<<<<<<<<<< + * await update_balance(user_id, -plan_price) * */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_as_markup); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 49, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); - __pyx_t_7 = 1; } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_reply_markup, __pyx_t_5) < 0) __PYX_ERR(0, 47, __pyx_L13_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "handlers/payments/utils.py":46 - * ) + /* "handlers/payments/utils.py":59 * - * await bot.send_message( # <<<<<<<<<<<<<< - * chat_id=user_id, - * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), - */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __Pyx_XGIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - __Pyx_Coroutine_ResetAndClearException(__pyx_generator); - /* return from generator, awaiting value */ - __pyx_generator->resume_label = 7; - return __pyx_r; - __pyx_L24_resume_from_await:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __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, 46, __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, 46, __pyx_L13_error) - } - } - - /* "handlers/payments/utils.py":52 - * ) * - * await clear_temporary_data(conn, user_id) # <<<<<<<<<<<<<< - * return - * finally: + * if state == "waiting_for_payment": # <<<<<<<<<<<<<< + * plan_price = data["plan_price"] + * duration_days = data["duration_days"] */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 52, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = NULL; - __pyx_t_7 = 0; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_7 = 1; - } } - #endif - { - PyObject *__pyx_callargs[3] = {__pyx_t_8, __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_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 52, __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_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XGOTREF(__pyx_r); - if (likely(__pyx_r)) { - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __Pyx_XGIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - __Pyx_Coroutine_ResetAndClearException(__pyx_generator); - /* return from generator, awaiting value */ - __pyx_generator->resume_label = 8; - return __pyx_r; - __pyx_L25_resume_from_await:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __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) - } 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) - } - } - - /* "handlers/payments/utils.py":53 - * - * await clear_temporary_data(conn, user_id) - * return # <<<<<<<<<<<<<< - * finally: - * await conn.close() - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = NULL; - goto __pyx_L12_return; /* "handlers/payments/utils.py":27 * try: * temp_data = await get_temporary_data(conn, user_id) - * if temp_data and temp_data["state"] == "waiting_for_payment": # <<<<<<<<<<<<<< - * plan_price = temp_data["data"]["plan_price"] - * duration_days = temp_data["data"]["duration_days"] + * if temp_data: # <<<<<<<<<<<<<< + * state = temp_data["state"] + * data = temp_data["data"] */ } + + /* "handlers/payments/utils.py":73 + * return + * + * builder.row( # <<<<<<<<<<<<<< + * InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"), + * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"), + */ + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 73, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + + /* "handlers/payments/utils.py":74 + * + * builder.row( + * InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"), # <<<<<<<<<<<<<< + * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"), + * ) + */ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 74, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __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_6, __pyx_n_s_RENEW_KEY); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_text, __pyx_t_6) < 0) __PYX_ERR(0, 74, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + 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_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "handlers/payments/utils.py":75 + * builder.row( + * InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"), + * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"), # <<<<<<<<<<<<<< + * ) + * await bot.send_message( + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 75, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_ADD_KEY); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 75, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_12); + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_text, __pyx_t_12) < 0) __PYX_ERR(0, 75, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_callback_data, __pyx_n_u_create_key) < 0) __PYX_ERR(0, 75, __pyx_L13_error) + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 75, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_t_6, __pyx_t_12}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "handlers/payments/utils.py":77 + * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"), + * ) + * await bot.send_message( # <<<<<<<<<<<<<< + * chat_id=user_id, + * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_bot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 77, __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, 77, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "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_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __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, 78, __pyx_L13_error) + + /* "handlers/payments/utils.py":79 + * await bot.send_message( + * chat_id=user_id, + * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), # <<<<<<<<<<<<<< + * reply_markup=builder.as_markup(), + * ) + */ + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_PAYMENT_SUCCESS_MESSAGE); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 79, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 79, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 79, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_8 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 79, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_amount, __pyx_t_8) < 0) __PYX_ERR(0, 79, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 79, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_text, __pyx_t_8) < 0) __PYX_ERR(0, 78, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "handlers/payments/utils.py":80 + * 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_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_as_markup); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 80, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_12))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_12); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_12, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 80, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_reply_markup, __pyx_t_8) < 0) __PYX_ERR(0, 78, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "handlers/payments/utils.py":77 + * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"), + * ) + * await bot.send_message( # <<<<<<<<<<<<<< + * chat_id=user_id, + * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), + */ + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 77, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 11; + return __pyx_r; + __pyx_L30_resume_from_await:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __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, 77, __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, 77, __pyx_L13_error) + } + } + + /* "handlers/payments/utils.py":82 + * reply_markup=builder.as_markup(), + * ) + * await clear_temporary_data(conn, user_id) # <<<<<<<<<<<<<< + * + * finally: + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __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_5))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(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_8 = __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_8)) __PYX_ERR(0, 82, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 12; + return __pyx_r; + __pyx_L31_resume_from_await:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __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, 82, __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, 82, __pyx_L13_error) + } + } } - /* "handlers/payments/utils.py":55 - * return + /* "handlers/payments/utils.py":85 + * * finally: * await conn.close() # <<<<<<<<<<<<<< - * - * builder.row( + * else: + * builder.row(InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys")) */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 55, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = NULL; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __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_9))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_8); + 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_5); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); + __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL}; + __pyx_t_8 = __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_8)) __PYX_ERR(0, 85, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { __Pyx_XGIVEREF(__pyx_t_1); @@ -4111,9 +4941,9 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 9; + __pyx_generator->resume_label = 13; return __pyx_r; - __pyx_L26_resume_from_await:; + __pyx_L32_resume_from_await:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); @@ -4123,12 +4953,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, 55, __pyx_L4_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 85, __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, 55, __pyx_L4_error) + else __PYX_ERR(0, 85, __pyx_L4_error) } } goto __pyx_L14; @@ -4153,32 +4983,32 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __Pyx_XGOTREF(__pyx_t_21); __pyx_t_13 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename; { - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 55, __pyx_L28_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = NULL; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __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_9))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_8); + 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_5); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); + __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L28_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL}; + __pyx_t_8 = __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_8)) __PYX_ERR(0, 85, __pyx_L34_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { __Pyx_XGIVEREF(__pyx_t_1); @@ -4206,9 +5036,9 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 10; + __pyx_generator->resume_label = 14; return __pyx_r; - __pyx_L29_resume_from_await:; + __pyx_L35_resume_from_await:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); @@ -4239,12 +5069,12 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __pyx_t_21 = __pyx_cur_scope->__pyx_t_11; __pyx_cur_scope->__pyx_t_11 = 0; __Pyx_XGOTREF(__pyx_t_21); - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 55, __pyx_L28_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 85, __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, 55, __pyx_L28_error) + else __PYX_ERR(0, 85, __pyx_L34_error) } } } @@ -4261,7 +5091,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_lineno = __pyx_t_13; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15; goto __pyx_L4_error; - __pyx_L28_error:; + __pyx_L34_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); @@ -4287,32 +5117,32 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __Pyx_XGOTREF(__pyx_t_16); __pyx_t_22 = __pyx_r; __pyx_r = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 55, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = NULL; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __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_9))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_8); + 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_5); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); + __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL}; + __pyx_t_8 = __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_8)) __PYX_ERR(0, 85, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { __Pyx_XGIVEREF(__pyx_t_1); @@ -4339,9 +5169,9 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 11; + __pyx_generator->resume_label = 15; return __pyx_r; - __pyx_L30_resume_from_await:; + __pyx_L36_resume_from_await:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); @@ -4372,12 +5202,12 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __pyx_t_22 = __pyx_cur_scope->__pyx_t_12; __pyx_cur_scope->__pyx_t_12 = 0; __Pyx_XGOTREF(__pyx_t_22); - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 55, __pyx_L4_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 85, __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, 55, __pyx_L4_error) + else __PYX_ERR(0, 85, __pyx_L4_error) } } __pyx_r = __pyx_t_22; @@ -4399,259 +5229,247 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO } /* "handlers/payments/utils.py":22 - * ) + * 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) */ + goto __pyx_L10; } - /* "handlers/payments/utils.py":57 + /* "handlers/payments/utils.py":87 * await conn.close() + * else: + * builder.row(InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys")) # <<<<<<<<<<<<<< + * builder.row(InlineKeyboardButton(text=ADD_KEY, callback_data="create_key")) * - * builder.row( # <<<<<<<<<<<<<< - * 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, 57, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_9); - - /* "handlers/payments/utils.py":58 - * - * builder.row( - * InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys") # <<<<<<<<<<<<<< - * ) - * builder.row( - */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 58, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 58, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_RENEW_KEY); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 58, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_text, __pyx_t_6) < 0) __PYX_ERR(0, 58, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_callback_data, __pyx_n_u_view_keys) < 0) __PYX_ERR(0, 58, __pyx_L4_error) - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 58, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - __pyx_t_7 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_7 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_6}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L4_error) + /*else*/ { + __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_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "handlers/payments/utils.py":60 - * InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys") - * ) - * builder.row( # <<<<<<<<<<<<<< - * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key") - * ) - */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_9); - - /* "handlers/payments/utils.py":61 - * ) - * builder.row( - * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key") # <<<<<<<<<<<<<< - * ) - * await bot.send_message( - */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 61, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_12 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 61, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ADD_KEY); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 61, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_text, __pyx_t_8) < 0) __PYX_ERR(0, 61, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_callback_data, __pyx_n_u_create_key) < 0) __PYX_ERR(0, 61, __pyx_L4_error) - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 61, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - __pyx_t_7 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_7 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_8}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "handlers/payments/utils.py":63 - * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key") - * ) - * await bot.send_message( # <<<<<<<<<<<<<< - * chat_id=user_id, - * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), - */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_bot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 63, __pyx_L4_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, 63, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "handlers/payments/utils.py":64 - * ) - * await bot.send_message( - * chat_id=user_id, # <<<<<<<<<<<<<< - * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), - * reply_markup=builder.as_markup(), - */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L4_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, 64, __pyx_L4_error) - - /* "handlers/payments/utils.py":65 - * await bot.send_message( - * chat_id=user_id, - * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), # <<<<<<<<<<<<<< - * reply_markup=builder.as_markup(), - * ) - */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PAYMENT_SUCCESS_MESSAGE); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 65, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_format); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 65, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 65, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_amount, __pyx_t_6) < 0) __PYX_ERR(0, 65, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_text, __pyx_t_6) < 0) __PYX_ERR(0, 64, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "handlers/payments/utils.py":66 - * chat_id=user_id, - * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), - * reply_markup=builder.as_markup(), # <<<<<<<<<<<<<< - * ) - * - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_as_markup); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 66, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = NULL; - __pyx_t_7 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - __pyx_t_7 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL}; - __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L4_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 87, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_12 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 87, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_RENEW_KEY); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_text, __pyx_t_6) < 0) __PYX_ERR(0, 87, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_callback_data, __pyx_n_u_view_keys) < 0) __PYX_ERR(0, 87, __pyx_L4_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_6}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 87, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_reply_markup, __pyx_t_6) < 0) __PYX_ERR(0, 64, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "handlers/payments/utils.py":63 - * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key") - * ) - * await bot.send_message( # <<<<<<<<<<<<<< - * chat_id=user_id, - * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), + /* "handlers/payments/utils.py":88 + * else: + * builder.row(InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys")) + * builder.row(InlineKeyboardButton(text=ADD_KEY, callback_data="create_key")) # <<<<<<<<<<<<<< + * + * await bot.send_message( */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 63, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XGOTREF(__pyx_r); - if (likely(__pyx_r)) { - __Pyx_XGIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; - __Pyx_XGIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __Pyx_XGIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - __Pyx_Coroutine_ResetAndClearException(__pyx_generator); - /* return from generator, awaiting value */ - __pyx_generator->resume_label = 12; - return __pyx_r; - __pyx_L31_resume_from_await:; - __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; - __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - __pyx_cur_scope->__pyx_t_1 = 0; - __Pyx_XGOTREF(__pyx_t_2); - __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_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, 63, __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, 88, __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, 88, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_12 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 88, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_ADD_KEY); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 88, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_text, __pyx_t_9) < 0) __PYX_ERR(0, 88, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_callback_data, __pyx_n_u_create_key) < 0) __PYX_ERR(0, 88, __pyx_L4_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 88, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_9}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 88, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "handlers/payments/utils.py":90 + * builder.row(InlineKeyboardButton(text=ADD_KEY, callback_data="create_key")) + * + * await bot.send_message( # <<<<<<<<<<<<<< + * chat_id=user_id, + * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), + */ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_bot); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 90, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_send_message); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "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_t_8 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 91, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_chat_id, __pyx_cur_scope->__pyx_v_user_id) < 0) __PYX_ERR(0, 91, __pyx_L4_error) + + /* "handlers/payments/utils.py":92 + * 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, 92, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_format); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 92, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 92, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_6 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_amount, __pyx_t_6) < 0) __PYX_ERR(0, 92, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_text, __pyx_t_6) < 0) __PYX_ERR(0, 91, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "handlers/payments/utils.py":93 + * 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, 93, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_12 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 93, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_reply_markup, __pyx_t_6) < 0) __PYX_ERR(0, 91, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "handlers/payments/utils.py":90 + * builder.row(InlineKeyboardButton(text=ADD_KEY, callback_data="create_key")) + * + * await bot.send_message( # <<<<<<<<<<<<<< + * chat_id=user_id, + * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), + */ + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 90, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __Pyx_XGIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 16; + return __pyx_r; + __pyx_L37_resume_from_await:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = 0; + __Pyx_XGOTREF(__pyx_t_2); + __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, 90, __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, 90, __pyx_L4_error) + } } } + __pyx_L10:; /* "handlers/payments/utils.py":16 * * async def send_payment_success_notification(user_id: int, amount: float): * try: # <<<<<<<<<<<<<< - * builder = InlineKeyboardBuilder() - * builder.row( + * user_id = int(user_id) + * */ } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4666,8 +5484,8 @@ 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":69 - * ) + /* "handlers/payments/utils.py":96 + * ) * * except Exception as e: # <<<<<<<<<<<<<< * logger.error(f" {user_id}: {e}") @@ -4675,53 +5493,53 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_14) { __Pyx_AddTraceback("handlers.payments.utils.send_payment_success_notification", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_9) < 0) __PYX_ERR(0, 69, __pyx_L6_except_error) + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_8, &__pyx_t_5) < 0) __PYX_ERR(0, 96, __pyx_L6_except_error) __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_cur_scope->__pyx_v_e = __pyx_t_5; + __Pyx_INCREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_v_e = __pyx_t_8; /*try:*/ { - /* "handlers/payments/utils.py":70 + /* "handlers/payments/utils.py":97 * * except Exception as e: * logger.error(f" {user_id}: {e}") # <<<<<<<<<<<<<< */ - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_logger); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 70, __pyx_L37_error) + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_logger); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 97, __pyx_L43_error) __Pyx_GOTREF(__pyx_t_12); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L37_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L43_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 70, __pyx_L37_error) + __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 97, __pyx_L43_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_23 = 0; __pyx_t_24 = 127; - __Pyx_INCREF(__pyx_kp_u__3); + __Pyx_INCREF(__pyx_kp_u__4); __pyx_t_24 = (65535 > __pyx_t_24) ? 65535 : __pyx_t_24; __pyx_t_23 += 45; - __Pyx_GIVEREF(__pyx_kp_u__3); - PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_kp_u__3); - __pyx_t_25 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_user_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 70, __pyx_L37_error) + __Pyx_GIVEREF(__pyx_kp_u__4); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_kp_u__4); + __pyx_t_25 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_user_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 97, __pyx_L43_error) __Pyx_GOTREF(__pyx_t_25); __pyx_t_24 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) > __pyx_t_24) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) : __pyx_t_24; __pyx_t_23 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_25); __Pyx_GIVEREF(__pyx_t_25); PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_25); __pyx_t_25 = 0; - __Pyx_INCREF(__pyx_kp_u__4); + __Pyx_INCREF(__pyx_kp_u__5); __pyx_t_23 += 2; - __Pyx_GIVEREF(__pyx_kp_u__4); - PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_kp_u__4); - __pyx_t_25 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 70, __pyx_L37_error) + __Pyx_GIVEREF(__pyx_kp_u__5); + PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_kp_u__5); + __pyx_t_25 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 97, __pyx_L43_error) __Pyx_GOTREF(__pyx_t_25); __pyx_t_24 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) > __pyx_t_24) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) : __pyx_t_24; __pyx_t_23 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_25); __Pyx_GIVEREF(__pyx_t_25); PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_25); __pyx_t_25 = 0; - __pyx_t_25 = __Pyx_PyUnicode_Join(__pyx_t_12, 4, __pyx_t_23, __pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 70, __pyx_L37_error) + __pyx_t_25 = __Pyx_PyUnicode_Join(__pyx_t_12, 4, __pyx_t_23, __pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 97, __pyx_L43_error) __Pyx_GOTREF(__pyx_t_25); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = NULL; @@ -4740,18 +5558,18 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO #endif { PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_25}; - __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 70, __pyx_L37_error) - __Pyx_GOTREF(__pyx_t_8); + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } - /* "handlers/payments/utils.py":69 - * ) + /* "handlers/payments/utils.py":96 + * ) * * except Exception as e: # <<<<<<<<<<<<<< * logger.error(f" {user_id}: {e}") @@ -4760,16 +5578,16 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO /*normal exit:*/{ __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_e); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_e); __pyx_cur_scope->__pyx_v_e = 0; - goto __pyx_L38; + goto __pyx_L44; } - __pyx_L37_error:; + __pyx_L43_error:; /*exception exit:*/{ __Pyx_PyThreadState_assign __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18) < 0)) __Pyx_ErrFetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18); __Pyx_XGOTREF(__pyx_t_16); @@ -4797,11 +5615,11 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_26; goto __pyx_L6_except_error; } - __pyx_L38:; + __pyx_L44:; } __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L5_exception_handled; } goto __pyx_L6_except_error; @@ -4810,8 +5628,8 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO * * async def send_payment_success_notification(user_id: int, amount: float): * try: # <<<<<<<<<<<<<< - * builder = InlineKeyboardBuilder() - * builder.row( + * user_id = int(user_id) + * */ __pyx_L6_except_error:; __Pyx_XGIVEREF(__pyx_t_1); @@ -4839,7 +5657,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO * * async def send_payment_success_notification(user_id: int, amount: float): # <<<<<<<<<<<<<< * try: - * builder = InlineKeyboardBuilder() + * user_id = int(user_id) */ /* function exit code */ @@ -4905,13 +5723,22 @@ static void __pyx_tp_dealloc_8handlers_8payments_5utils___pyx_scope_struct__send PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_balance); Py_CLEAR(p->__pyx_v_builder); + Py_CLEAR(p->__pyx_v_client_id); + Py_CLEAR(p->__pyx_v_complete_key_renewal); Py_CLEAR(p->__pyx_v_conn); + Py_CLEAR(p->__pyx_v_cost); Py_CLEAR(p->__pyx_v_create_key); + Py_CLEAR(p->__pyx_v_data); Py_CLEAR(p->__pyx_v_duration_days); Py_CLEAR(p->__pyx_v_e); + Py_CLEAR(p->__pyx_v_email); Py_CLEAR(p->__pyx_v_expiry_time); + Py_CLEAR(p->__pyx_v_new_expiry_time); + Py_CLEAR(p->__pyx_v_plan); Py_CLEAR(p->__pyx_v_plan_price); + Py_CLEAR(p->__pyx_v_state); Py_CLEAR(p->__pyx_v_temp_data); + Py_CLEAR(p->__pyx_v_total_gb); Py_CLEAR(p->__pyx_v_user_id); Py_CLEAR(p->__pyx_t_0); Py_CLEAR(p->__pyx_t_1); @@ -4949,27 +5776,54 @@ static int __pyx_tp_traverse_8handlers_8payments_5utils___pyx_scope_struct__send if (p->__pyx_v_builder) { e = (*v)(p->__pyx_v_builder, a); if (e) return e; } + if (p->__pyx_v_client_id) { + e = (*v)(p->__pyx_v_client_id, a); if (e) return e; + } + if (p->__pyx_v_complete_key_renewal) { + e = (*v)(p->__pyx_v_complete_key_renewal, a); if (e) return e; + } if (p->__pyx_v_conn) { e = (*v)(p->__pyx_v_conn, a); if (e) return e; } + if (p->__pyx_v_cost) { + e = (*v)(p->__pyx_v_cost, a); if (e) return e; + } if (p->__pyx_v_create_key) { e = (*v)(p->__pyx_v_create_key, a); if (e) return e; } + if (p->__pyx_v_data) { + e = (*v)(p->__pyx_v_data, a); if (e) return e; + } if (p->__pyx_v_duration_days) { e = (*v)(p->__pyx_v_duration_days, a); if (e) return e; } if (p->__pyx_v_e) { e = (*v)(p->__pyx_v_e, a); if (e) return e; } + if (p->__pyx_v_email) { + e = (*v)(p->__pyx_v_email, a); if (e) return e; + } if (p->__pyx_v_expiry_time) { e = (*v)(p->__pyx_v_expiry_time, 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; + } + if (p->__pyx_v_plan) { + e = (*v)(p->__pyx_v_plan, a); if (e) return e; + } if (p->__pyx_v_plan_price) { e = (*v)(p->__pyx_v_plan_price, a); if (e) return e; } + if (p->__pyx_v_state) { + e = (*v)(p->__pyx_v_state, a); if (e) return e; + } if (p->__pyx_v_temp_data) { e = (*v)(p->__pyx_v_temp_data, a); if (e) return e; } + if (p->__pyx_v_total_gb) { + e = (*v)(p->__pyx_v_total_gb, a); if (e) return e; + } if (p->__pyx_t_0) { e = (*v)(p->__pyx_t_0, a); if (e) return e; } @@ -5125,15 +5979,18 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_InlineKeyboardButton, __pyx_k_InlineKeyboardButton, sizeof(__pyx_k_InlineKeyboardButton), 0, 0, 1, 1}, {&__pyx_n_s_PAYMENT_SUCCESS_MESSAGE, __pyx_k_PAYMENT_SUCCESS_MESSAGE, sizeof(__pyx_k_PAYMENT_SUCCESS_MESSAGE), 0, 0, 1, 1}, {&__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_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__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0}, {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0}, - {&__pyx_n_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 1}, - {&__pyx_n_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 1}, + {&__pyx_kp_u__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 1, 0, 0}, + {&__pyx_n_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 1}, + {&__pyx_n_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 1}, {&__pyx_n_s_aiogram_types, __pyx_k_aiogram_types, sizeof(__pyx_k_aiogram_types), 0, 0, 1, 1}, {&__pyx_n_s_aiogram_utils_keyboard, __pyx_k_aiogram_utils_keyboard, sizeof(__pyx_k_aiogram_utils_keyboard), 0, 0, 1, 1}, + {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1}, {&__pyx_n_s_amount, __pyx_k_amount, sizeof(__pyx_k_amount), 0, 0, 1, 1}, {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, {&__pyx_n_s_as_markup, __pyx_k_as_markup, sizeof(__pyx_k_as_markup), 0, 0, 1, 1}, @@ -5146,13 +6003,19 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_callback_data, __pyx_k_callback_data, sizeof(__pyx_k_callback_data), 0, 0, 1, 1}, {&__pyx_n_s_chat_id, __pyx_k_chat_id, sizeof(__pyx_k_chat_id), 0, 0, 1, 1}, {&__pyx_n_s_clear_temporary_data, __pyx_k_clear_temporary_data, sizeof(__pyx_k_clear_temporary_data), 0, 0, 1, 1}, + {&__pyx_n_s_client_id, __pyx_k_client_id, sizeof(__pyx_k_client_id), 0, 0, 1, 1}, + {&__pyx_n_u_client_id, __pyx_k_client_id, sizeof(__pyx_k_client_id), 0, 1, 0, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, + {&__pyx_n_s_complete_key_renewal, __pyx_k_complete_key_renewal, sizeof(__pyx_k_complete_key_renewal), 0, 0, 1, 1}, {&__pyx_n_s_config, __pyx_k_config, sizeof(__pyx_k_config), 0, 0, 1, 1}, {&__pyx_n_s_conn, __pyx_k_conn, sizeof(__pyx_k_conn), 0, 0, 1, 1}, {&__pyx_n_s_connect, __pyx_k_connect, sizeof(__pyx_k_connect), 0, 0, 1, 1}, + {&__pyx_n_s_cost, __pyx_k_cost, sizeof(__pyx_k_cost), 0, 0, 1, 1}, + {&__pyx_n_u_cost, __pyx_k_cost, sizeof(__pyx_k_cost), 0, 1, 0, 1}, {&__pyx_n_s_create_key, __pyx_k_create_key, sizeof(__pyx_k_create_key), 0, 0, 1, 1}, {&__pyx_n_u_create_key, __pyx_k_create_key, sizeof(__pyx_k_create_key), 0, 1, 0, 1}, + {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, {&__pyx_n_u_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 1, 0, 1}, {&__pyx_n_s_database, __pyx_k_database, sizeof(__pyx_k_database), 0, 0, 1, 1}, {&__pyx_n_s_datetime, __pyx_k_datetime, sizeof(__pyx_k_datetime), 0, 0, 1, 1}, @@ -5161,16 +6024,20 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_duration_days, __pyx_k_duration_days, sizeof(__pyx_k_duration_days), 0, 0, 1, 1}, {&__pyx_n_u_duration_days, __pyx_k_duration_days, sizeof(__pyx_k_duration_days), 0, 1, 0, 1}, {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1}, + {&__pyx_n_s_email, __pyx_k_email, sizeof(__pyx_k_email), 0, 0, 1, 1}, + {&__pyx_n_u_email, __pyx_k_email, sizeof(__pyx_k_email), 0, 1, 0, 1}, {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, {&__pyx_n_s_expiry_time, __pyx_k_expiry_time, sizeof(__pyx_k_expiry_time), 0, 0, 1, 1}, {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1}, {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, {&__pyx_n_s_get_balance, __pyx_k_get_balance, sizeof(__pyx_k_get_balance), 0, 0, 1, 1}, {&__pyx_n_s_get_temporary_data, __pyx_k_get_temporary_data, sizeof(__pyx_k_get_temporary_data), 0, 0, 1, 1}, {&__pyx_n_s_handlers_buttons_notification, __pyx_k_handlers_buttons_notification, sizeof(__pyx_k_handlers_buttons_notification), 0, 0, 1, 1}, {&__pyx_n_s_handlers_keys_key_management, __pyx_k_handlers_keys_key_management, sizeof(__pyx_k_handlers_keys_key_management), 0, 0, 1, 1}, + {&__pyx_n_s_handlers_keys_keys, __pyx_k_handlers_keys_keys, sizeof(__pyx_k_handlers_keys_keys), 0, 0, 1, 1}, {&__pyx_n_s_handlers_payments_utils, __pyx_k_handlers_payments_utils, sizeof(__pyx_k_handlers_payments_utils), 0, 0, 1, 1}, {&__pyx_kp_s_handlers_payments_utils_py, __pyx_k_handlers_payments_utils_py, sizeof(__pyx_k_handlers_payments_utils_py), 0, 0, 1, 0}, {&__pyx_n_s_handlers_texts, __pyx_k_handlers_texts, sizeof(__pyx_k_handlers_texts), 0, 0, 1, 1}, @@ -5182,6 +6049,10 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__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_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_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}, @@ -5191,24 +6062,31 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_send_message, __pyx_k_send_message, sizeof(__pyx_k_send_message), 0, 0, 1, 1}, {&__pyx_n_s_send_payment_success_notificatio, __pyx_k_send_payment_success_notificatio, sizeof(__pyx_k_send_payment_success_notificatio), 0, 0, 1, 1}, {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1}, {&__pyx_n_u_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 1, 0, 1}, {&__pyx_n_s_temp_data, __pyx_k_temp_data, sizeof(__pyx_k_temp_data), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__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_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}, {0, 0, 0, 0, 0, 0, 0} }; return __Pyx_InitStrings(__pyx_string_tab); } /* #### 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, 41, __pyx_L1_error) return 0; + __pyx_L1_error:; + return -1; } /* #### Code section: cached_constants ### */ @@ -5221,12 +6099,12 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * async def send_payment_success_notification(user_id: int, amount: float): # <<<<<<<<<<<<<< * try: - * builder = InlineKeyboardBuilder() + * user_id = int(user_id) */ - __pyx_tuple__6 = PyTuple_Pack(11, __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_plan_price, __pyx_n_s_duration_days, __pyx_n_s_balance, __pyx_n_s_expiry_time, __pyx_n_s_e); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __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_tuple__7 = PyTuple_Pack(20, __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_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__7)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __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_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -5869,7 +6747,7 @@ if (!__Pyx_RefNanny) { * * async def send_payment_success_notification(user_id: int, amount: float): # <<<<<<<<<<<<<< * try: - * builder = InlineKeyboardBuilder() + * 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_GOTREF(__pyx_t_3); @@ -5961,6 +6839,165 @@ end: } #endif +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + /* TupleAndListFromArray */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { @@ -6409,164 +7446,16 @@ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *nam return 0; } -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i= 0x030C00A6 - PyObject *current_exception = tstate->current_exception; - if (unlikely(!current_exception)) return 0; - exc_type = (PyObject*) Py_TYPE(current_exception); - if (exc_type == err) return 1; -#else - exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; -#endif - #if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(exc_type); - #endif - if (unlikely(PyTuple_Check(err))) { - result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - } else { - result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); - } - #if CYTHON_AVOID_BORROWED_REFS - Py_DECREF(exc_type); - #endif - return result; -} -#endif - -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject *tmp_value; - assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); - if (value) { - #if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) - #endif - PyException_SetTraceback(value, tb); - } - tmp_value = tstate->current_exception; - tstate->current_exception = value; - Py_XDECREF(tmp_value); - Py_XDECREF(type); - Py_XDECREF(tb); -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#endif -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { -#if PY_VERSION_HEX >= 0x030C00A6 - PyObject* exc_value; - exc_value = tstate->current_exception; - tstate->current_exception = 0; - *value = exc_value; - *type = NULL; - *tb = NULL; - if (exc_value) { - *type = (PyObject*) Py_TYPE(exc_value); - Py_INCREF(*type); - #if CYTHON_COMPILING_IN_CPYTHON - *tb = ((PyBaseExceptionObject*) exc_value)->traceback; - Py_XINCREF(*tb); - #else - *tb = PyException_GetTraceback(exc_value); - #endif - } -#else - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#endif -} -#endif - -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#endif - -/* PyObjectGetAttrStrNoError */ -#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 -static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); -} -#endif -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 - (void) PyObject_GetOptionalAttr(obj, attr_name, &result); - return result; -#else -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); - } - return result; -#endif -} - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); - if (unlikely(!result) && !PyErr_Occurred()) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} /* PyDictVersioning */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS @@ -9587,7 +10476,7 @@ static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject * #endif static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { #if PY_MAJOR_VERSION < 3 - PyObject *module, *from_list, *star = __pyx_n_s__5; + PyObject *module, *from_list, *star = __pyx_n_s__6; CYTHON_UNUSED_VAR(parts_tuple); from_list = PyList_New(1); if (unlikely(!from_list)) @@ -11038,7 +11927,7 @@ __Pyx_PyType_GetName(PyTypeObject* tp) if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { PyErr_Clear(); Py_XDECREF(name); - name = __Pyx_NewRef(__pyx_n_s__7); + name = __Pyx_NewRef(__pyx_n_s__8); } return name; } 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 06f2adbd..f32899ff 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 8979d396..89e94d2a 100644 --- a/handlers/payments/yookassa_pay.c +++ b/handlers/payments/yookassa_pay.c @@ -1599,8 +1599,10 @@ struct __pyx_obj_8handlers_8payments_12yookassa_pay___pyx_scope_struct_4_process PyObject *__pyx_v_conn; PyObject *__pyx_v_e; PyObject *__pyx_v_payment; + PyObject *__pyx_v_payment_message; PyObject *__pyx_v_payment_url; PyObject *__pyx_v_session; + PyObject *__pyx_v_state_type; PyObject *__pyx_v_tg_id; PyObject *__pyx_v_user_data; PyObject *__pyx_t_0; @@ -1616,7 +1618,7 @@ struct __pyx_obj_8handlers_8payments_12yookassa_pay___pyx_scope_struct_4_process }; -/* "handlers/payments/yookassa_pay.py":332 +/* "handlers/payments/yookassa_pay.py":346 * * * async def _send_message(callback_query: types.CallbackQuery | types.Message, text: str, reply_markup=None): # <<<<<<<<<<<<<< @@ -2384,6 +2386,9 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); PyLong_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj)) #endif +/* RaiseUnboundLocalError.proto */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); + /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ @@ -2705,14 +2710,16 @@ static const char __pyx_k__23[] = "\320\224\320\260\320\275\320\275\321\213\320\ static const char __pyx_k__25[] = "\320\235\320\265\320\272\320\276\321\200\321\200\320\265\320\272\321\202\320\275\320\260\321\217 \321\201\321\203\320\274\320\274\320\260. \320\237\320\276\320\266\320\260\320\273\321\203\320\271\321\201\321\202\320\260, \320\262\320\262\320\265\320\264\320\270\321\202\320\265 \321\201\321\203\320\274\320\274\321\203 \320\265\321\211\320\265 \321\200\320\260\320\267."; static const char __pyx_k__26[] = "\320\235\320\265\320\272\320\276\321\200\321\200\320\265\320\272\321\202\320\275\321\213\320\271 \320\267\320\260\320\277\321\200\320\276\321\201."; static const char __pyx_k__27[] = "\320\241\321\203\320\274\320\274\320\260 \320\264\320\276\320\273\320\266\320\275\320\260 \320\261\321\213\321\202\321\214 \320\261\320\276\320\273\321\214\321\210\320\265 \320\275\321\203\320\273\321\217."; -static const char __pyx_k__28[] = "\320\236\320\277\320\273\320\260\321\202\320\270\321\202\321\214"; -static const char __pyx_k__29[] = "\360\237\221\244 \320\233\320\270\321\207\320\275\321\213\320\271 \320\272\320\260\320\261\320\270\320\275\320\265\321\202"; -static const char __pyx_k__30[] = " \321\200\321\203\320\261\320\273\320\265\320\271. \320\237\320\265\321\200\320\265\320\271\320\264\320\270\321\202\320\265 \320\277\320\276 \321\201\321\201\321\213\320\273\320\272\320\265 \320\264\320\273\321\217 \320\276\320\277\320\273\320\260\321\202\321\213."; -static const char __pyx_k__31[] = "\320\236\321\210\320\270\320\261\320\272\320\260 \320\277\321\200\320\270 \321\201\320\276\320\267\320\264\320\260\320\275\320\270\320\270 \320\277\320\273\320\260\321\202\320\265\320\266\320\260: "; -static const char __pyx_k__32[] = "\320\237\321\200\320\276\320\270\320\267\320\276\321\210\320\273\320\260 \320\276\321\210\320\270\320\261\320\272\320\260 \320\277\321\200\320\270 \321\201\320\276\320\267\320\264\320\260\320\275\320\270\320\270 \320\277\320\273\320\260\321\202\320\265\320\266\320\260."; -static const char __pyx_k__34[] = "*"; -static const char __pyx_k__35[] = "."; -static const char __pyx_k__44[] = "?"; +static const char __pyx_k__28[] = " \321\200\321\203\320\261\320\273\320\265\320\271 \320\264\320\273\321\217 \321\201\320\276\320\267\320\264\320\260\320\275\320\270\321\217 \320\275\320\276\320\262\320\276\320\263\320\276 \320\272\320\273\321\216\321\207\320\260. \320\237\320\265\321\200\320\265\320\271\320\264\320\270\321\202\320\265 \320\277\320\276 \321\201\321\201\321\213\320\273\320\272\320\265 \320\264\320\273\321\217 \320\276\320\277\320\273\320\260\321\202\321\213:"; +static const char __pyx_k__29[] = " \321\200\321\203\320\261\320\273\320\265\320\271 \320\264\320\273\321\217 \320\277\321\200\320\276\320\264\320\273\320\265\320\275\320\270\321\217 \320\272\320\273\321\216\321\207\320\260. \320\237\320\265\321\200\320\265\320\271\320\264\320\270\321\202\320\265 \320\277\320\276 \321\201\321\201\321\213\320\273\320\272\320\265 \320\264\320\273\321\217 \320\276\320\277\320\273\320\260\321\202\321\213:"; +static const char __pyx_k__30[] = " \321\200\321\203\320\261\320\273\320\265\320\271. \320\237\320\265\321\200\320\265\320\271\320\264\320\270\321\202\320\265 \320\277\320\276 \321\201\321\201\321\213\320\273\320\272\320\265 \320\264\320\273\321\217 \320\276\320\277\320\273\320\260\321\202\321\213:"; +static const char __pyx_k__31[] = "\320\236\320\277\320\273\320\260\321\202\320\270\321\202\321\214"; +static const char __pyx_k__32[] = "\360\237\221\244 \320\233\320\270\321\207\320\275\321\213\320\271 \320\272\320\260\320\261\320\270\320\275\320\265\321\202"; +static const char __pyx_k__33[] = "\320\236\321\210\320\270\320\261\320\272\320\260 \320\277\321\200\320\270 \321\201\320\276\320\267\320\264\320\260\320\275\320\270\320\270 \320\277\320\273\320\260\321\202\320\265\320\266\320\260: "; +static const char __pyx_k__34[] = "\320\237\321\200\320\276\320\270\320\267\320\276\321\210\320\273\320\260 \320\276\321\210\320\270\320\261\320\272\320\260 \320\277\321\200\320\270 \321\201\320\276\320\267\320\264\320\260\320\275\320\270\320\270 \320\277\320\273\320\260\321\202\320\265\320\266\320\260."; +static const char __pyx_k__36[] = "*"; +static const char __pyx_k__37[] = "."; +static const char __pyx_k__46[] = "?"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_get[] = "get"; static const char __pyx_k_pay[] = "pay"; @@ -2825,6 +2832,7 @@ static const char __pyx_k_payment_id[] = "payment_id"; static const char __pyx_k_return_url[] = "return_url"; static const char __pyx_k_secret_key[] = "secret_key"; static const char __pyx_k_startswith[] = "startswith"; +static const char __pyx_k_state_type[] = "state_type"; static const char __pyx_k_yookassa_2[] = "yookassa"; static const char __pyx_k_79000000000[] = "79000000000"; static const char __pyx_k_MAIN_SECRET[] = "MAIN_SECRET"; @@ -2868,6 +2876,7 @@ static const char __pyx_k_user_id_amount[] = "\320\236\321\210\320\270\320\261\3 static const char __pyx_k_PAYMENT_OPTIONS[] = "PAYMENT_OPTIONS"; static const char __pyx_k_YOOKASSA_ENABLE[] = "YOOKASSA_ENABLE"; static const char __pyx_k_inline_keyboard[] = "inline_keyboard"; +static const char __pyx_k_payment_message[] = "payment_message"; static const char __pyx_k_payment_subject[] = "payment_subject"; static const char __pyx_k_required_amount[] = "required_amount"; static const char __pyx_k_yookassa_amount[] = "yookassa_amount|"; @@ -2898,6 +2907,7 @@ static const char __pyx_k_choosing_amount_yookassa[] = "choosing_amount_yookassa static const char __pyx_k_process_amount_selection[] = "process_amount_selection"; static const char __pyx_k_process_custom_amount_input[] = "process_custom_amount_input"; static const char __pyx_k_process_enter_custom_amount[] = "process_enter_custom_amount"; +static const char __pyx_k_waiting_for_renewal_payment[] = "waiting_for_renewal_payment"; static const char __pyx_k_enter_custom_amount_yookassa[] = "enter_custom_amount_yookassa"; static const char __pyx_k_Payment_succeeded_for_user_id[] = "Payment succeeded for user_id: "; static const char __pyx_k_process_callback_pay_yookassa[] = "process_callback_pay_yookassa"; @@ -3012,16 +3022,18 @@ typedef struct { PyObject *__pyx_kp_u__25; PyObject *__pyx_kp_u__26; PyObject *__pyx_kp_u__27; - PyObject *__pyx_n_u__28; + PyObject *__pyx_kp_u__28; PyObject *__pyx_kp_u__29; PyObject *__pyx_kp_u__3; PyObject *__pyx_kp_u__30; - PyObject *__pyx_kp_u__31; + PyObject *__pyx_n_u__31; PyObject *__pyx_kp_u__32; - PyObject *__pyx_n_s__34; - PyObject *__pyx_kp_u__35; + PyObject *__pyx_kp_u__33; + PyObject *__pyx_kp_u__34; + PyObject *__pyx_n_s__36; + PyObject *__pyx_kp_u__37; PyObject *__pyx_kp_u__4; - PyObject *__pyx_n_s__44; + PyObject *__pyx_n_s__46; PyObject *__pyx_kp_u__5; PyObject *__pyx_kp_u__7; PyObject *__pyx_kp_u__9; @@ -3129,6 +3141,7 @@ typedef struct { PyObject *__pyx_n_s_payment; PyObject *__pyx_n_u_payment; PyObject *__pyx_n_s_payment_id; + PyObject *__pyx_n_s_payment_message; PyObject *__pyx_n_u_payment_mode; PyObject *__pyx_n_s_payment_object; PyObject *__pyx_n_u_payment_subject; @@ -3165,6 +3178,7 @@ typedef struct { PyObject *__pyx_n_s_startswith; PyObject *__pyx_n_s_state; PyObject *__pyx_n_u_state; + PyObject *__pyx_n_s_state_type; PyObject *__pyx_n_s_status; PyObject *__pyx_n_u_status; PyObject *__pyx_n_s_str; @@ -3195,6 +3209,7 @@ typedef struct { PyObject *__pyx_n_u_vat_code; PyObject *__pyx_n_u_waiting_for_payment; PyObject *__pyx_n_s_waiting_for_payment_confirmation; + PyObject *__pyx_n_u_waiting_for_renewal_payment; PyObject *__pyx_n_s_warning; PyObject *__pyx_n_s_web; PyObject *__pyx_n_u_yookassa; @@ -3213,19 +3228,19 @@ typedef struct { PyObject *__pyx_tuple__8; PyObject *__pyx_tuple__21; PyObject *__pyx_tuple__24; - PyObject *__pyx_tuple__36; - PyObject *__pyx_tuple__37; PyObject *__pyx_tuple__38; PyObject *__pyx_tuple__39; PyObject *__pyx_tuple__40; PyObject *__pyx_tuple__41; PyObject *__pyx_tuple__42; PyObject *__pyx_tuple__43; + PyObject *__pyx_tuple__44; + PyObject *__pyx_tuple__45; PyObject *__pyx_codeobj__6; PyObject *__pyx_codeobj__15; PyObject *__pyx_codeobj__18; PyObject *__pyx_codeobj__22; - PyObject *__pyx_codeobj__33; + PyObject *__pyx_codeobj__35; } __pyx_mstate; #if CYTHON_USE_MODULE_STATE @@ -3331,16 +3346,18 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_kp_u__25); Py_CLEAR(clear_module_state->__pyx_kp_u__26); Py_CLEAR(clear_module_state->__pyx_kp_u__27); - Py_CLEAR(clear_module_state->__pyx_n_u__28); + Py_CLEAR(clear_module_state->__pyx_kp_u__28); Py_CLEAR(clear_module_state->__pyx_kp_u__29); Py_CLEAR(clear_module_state->__pyx_kp_u__3); Py_CLEAR(clear_module_state->__pyx_kp_u__30); - Py_CLEAR(clear_module_state->__pyx_kp_u__31); + Py_CLEAR(clear_module_state->__pyx_n_u__31); Py_CLEAR(clear_module_state->__pyx_kp_u__32); - Py_CLEAR(clear_module_state->__pyx_n_s__34); - Py_CLEAR(clear_module_state->__pyx_kp_u__35); + Py_CLEAR(clear_module_state->__pyx_kp_u__33); + Py_CLEAR(clear_module_state->__pyx_kp_u__34); + Py_CLEAR(clear_module_state->__pyx_n_s__36); + Py_CLEAR(clear_module_state->__pyx_kp_u__37); Py_CLEAR(clear_module_state->__pyx_kp_u__4); - Py_CLEAR(clear_module_state->__pyx_n_s__44); + Py_CLEAR(clear_module_state->__pyx_n_s__46); Py_CLEAR(clear_module_state->__pyx_kp_u__5); Py_CLEAR(clear_module_state->__pyx_kp_u__7); Py_CLEAR(clear_module_state->__pyx_kp_u__9); @@ -3448,6 +3465,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_payment); Py_CLEAR(clear_module_state->__pyx_n_u_payment); Py_CLEAR(clear_module_state->__pyx_n_s_payment_id); + Py_CLEAR(clear_module_state->__pyx_n_s_payment_message); Py_CLEAR(clear_module_state->__pyx_n_u_payment_mode); Py_CLEAR(clear_module_state->__pyx_n_s_payment_object); Py_CLEAR(clear_module_state->__pyx_n_u_payment_subject); @@ -3484,6 +3502,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_startswith); Py_CLEAR(clear_module_state->__pyx_n_s_state); Py_CLEAR(clear_module_state->__pyx_n_u_state); + Py_CLEAR(clear_module_state->__pyx_n_s_state_type); Py_CLEAR(clear_module_state->__pyx_n_s_status); Py_CLEAR(clear_module_state->__pyx_n_u_status); Py_CLEAR(clear_module_state->__pyx_n_s_str); @@ -3514,6 +3533,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_u_vat_code); Py_CLEAR(clear_module_state->__pyx_n_u_waiting_for_payment); Py_CLEAR(clear_module_state->__pyx_n_s_waiting_for_payment_confirmation); + Py_CLEAR(clear_module_state->__pyx_n_u_waiting_for_renewal_payment); Py_CLEAR(clear_module_state->__pyx_n_s_warning); Py_CLEAR(clear_module_state->__pyx_n_s_web); Py_CLEAR(clear_module_state->__pyx_n_u_yookassa); @@ -3532,19 +3552,19 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_tuple__8); Py_CLEAR(clear_module_state->__pyx_tuple__21); Py_CLEAR(clear_module_state->__pyx_tuple__24); - Py_CLEAR(clear_module_state->__pyx_tuple__36); - Py_CLEAR(clear_module_state->__pyx_tuple__37); Py_CLEAR(clear_module_state->__pyx_tuple__38); Py_CLEAR(clear_module_state->__pyx_tuple__39); Py_CLEAR(clear_module_state->__pyx_tuple__40); Py_CLEAR(clear_module_state->__pyx_tuple__41); Py_CLEAR(clear_module_state->__pyx_tuple__42); Py_CLEAR(clear_module_state->__pyx_tuple__43); + Py_CLEAR(clear_module_state->__pyx_tuple__44); + Py_CLEAR(clear_module_state->__pyx_tuple__45); Py_CLEAR(clear_module_state->__pyx_codeobj__6); Py_CLEAR(clear_module_state->__pyx_codeobj__15); Py_CLEAR(clear_module_state->__pyx_codeobj__18); Py_CLEAR(clear_module_state->__pyx_codeobj__22); - Py_CLEAR(clear_module_state->__pyx_codeobj__33); + Py_CLEAR(clear_module_state->__pyx_codeobj__35); return 0; } #endif @@ -3628,16 +3648,18 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_kp_u__25); Py_VISIT(traverse_module_state->__pyx_kp_u__26); Py_VISIT(traverse_module_state->__pyx_kp_u__27); - Py_VISIT(traverse_module_state->__pyx_n_u__28); + Py_VISIT(traverse_module_state->__pyx_kp_u__28); Py_VISIT(traverse_module_state->__pyx_kp_u__29); Py_VISIT(traverse_module_state->__pyx_kp_u__3); Py_VISIT(traverse_module_state->__pyx_kp_u__30); - Py_VISIT(traverse_module_state->__pyx_kp_u__31); + Py_VISIT(traverse_module_state->__pyx_n_u__31); Py_VISIT(traverse_module_state->__pyx_kp_u__32); - Py_VISIT(traverse_module_state->__pyx_n_s__34); - Py_VISIT(traverse_module_state->__pyx_kp_u__35); + Py_VISIT(traverse_module_state->__pyx_kp_u__33); + Py_VISIT(traverse_module_state->__pyx_kp_u__34); + Py_VISIT(traverse_module_state->__pyx_n_s__36); + Py_VISIT(traverse_module_state->__pyx_kp_u__37); Py_VISIT(traverse_module_state->__pyx_kp_u__4); - Py_VISIT(traverse_module_state->__pyx_n_s__44); + Py_VISIT(traverse_module_state->__pyx_n_s__46); Py_VISIT(traverse_module_state->__pyx_kp_u__5); Py_VISIT(traverse_module_state->__pyx_kp_u__7); Py_VISIT(traverse_module_state->__pyx_kp_u__9); @@ -3745,6 +3767,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_payment); Py_VISIT(traverse_module_state->__pyx_n_u_payment); Py_VISIT(traverse_module_state->__pyx_n_s_payment_id); + Py_VISIT(traverse_module_state->__pyx_n_s_payment_message); Py_VISIT(traverse_module_state->__pyx_n_u_payment_mode); Py_VISIT(traverse_module_state->__pyx_n_s_payment_object); Py_VISIT(traverse_module_state->__pyx_n_u_payment_subject); @@ -3781,6 +3804,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_startswith); Py_VISIT(traverse_module_state->__pyx_n_s_state); Py_VISIT(traverse_module_state->__pyx_n_u_state); + Py_VISIT(traverse_module_state->__pyx_n_s_state_type); Py_VISIT(traverse_module_state->__pyx_n_s_status); Py_VISIT(traverse_module_state->__pyx_n_u_status); Py_VISIT(traverse_module_state->__pyx_n_s_str); @@ -3811,6 +3835,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_u_vat_code); Py_VISIT(traverse_module_state->__pyx_n_u_waiting_for_payment); Py_VISIT(traverse_module_state->__pyx_n_s_waiting_for_payment_confirmation); + Py_VISIT(traverse_module_state->__pyx_n_u_waiting_for_renewal_payment); Py_VISIT(traverse_module_state->__pyx_n_s_warning); Py_VISIT(traverse_module_state->__pyx_n_s_web); Py_VISIT(traverse_module_state->__pyx_n_u_yookassa); @@ -3829,19 +3854,19 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_tuple__8); Py_VISIT(traverse_module_state->__pyx_tuple__21); Py_VISIT(traverse_module_state->__pyx_tuple__24); - Py_VISIT(traverse_module_state->__pyx_tuple__36); - Py_VISIT(traverse_module_state->__pyx_tuple__37); Py_VISIT(traverse_module_state->__pyx_tuple__38); Py_VISIT(traverse_module_state->__pyx_tuple__39); Py_VISIT(traverse_module_state->__pyx_tuple__40); Py_VISIT(traverse_module_state->__pyx_tuple__41); Py_VISIT(traverse_module_state->__pyx_tuple__42); Py_VISIT(traverse_module_state->__pyx_tuple__43); + Py_VISIT(traverse_module_state->__pyx_tuple__44); + Py_VISIT(traverse_module_state->__pyx_tuple__45); Py_VISIT(traverse_module_state->__pyx_codeobj__6); Py_VISIT(traverse_module_state->__pyx_codeobj__15); Py_VISIT(traverse_module_state->__pyx_codeobj__18); Py_VISIT(traverse_module_state->__pyx_codeobj__22); - Py_VISIT(traverse_module_state->__pyx_codeobj__33); + Py_VISIT(traverse_module_state->__pyx_codeobj__35); return 0; } #endif @@ -3935,16 +3960,18 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_kp_u__25 __pyx_mstate_global->__pyx_kp_u__25 #define __pyx_kp_u__26 __pyx_mstate_global->__pyx_kp_u__26 #define __pyx_kp_u__27 __pyx_mstate_global->__pyx_kp_u__27 -#define __pyx_n_u__28 __pyx_mstate_global->__pyx_n_u__28 +#define __pyx_kp_u__28 __pyx_mstate_global->__pyx_kp_u__28 #define __pyx_kp_u__29 __pyx_mstate_global->__pyx_kp_u__29 #define __pyx_kp_u__3 __pyx_mstate_global->__pyx_kp_u__3 #define __pyx_kp_u__30 __pyx_mstate_global->__pyx_kp_u__30 -#define __pyx_kp_u__31 __pyx_mstate_global->__pyx_kp_u__31 +#define __pyx_n_u__31 __pyx_mstate_global->__pyx_n_u__31 #define __pyx_kp_u__32 __pyx_mstate_global->__pyx_kp_u__32 -#define __pyx_n_s__34 __pyx_mstate_global->__pyx_n_s__34 -#define __pyx_kp_u__35 __pyx_mstate_global->__pyx_kp_u__35 +#define __pyx_kp_u__33 __pyx_mstate_global->__pyx_kp_u__33 +#define __pyx_kp_u__34 __pyx_mstate_global->__pyx_kp_u__34 +#define __pyx_n_s__36 __pyx_mstate_global->__pyx_n_s__36 +#define __pyx_kp_u__37 __pyx_mstate_global->__pyx_kp_u__37 #define __pyx_kp_u__4 __pyx_mstate_global->__pyx_kp_u__4 -#define __pyx_n_s__44 __pyx_mstate_global->__pyx_n_s__44 +#define __pyx_n_s__46 __pyx_mstate_global->__pyx_n_s__46 #define __pyx_kp_u__5 __pyx_mstate_global->__pyx_kp_u__5 #define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7 #define __pyx_kp_u__9 __pyx_mstate_global->__pyx_kp_u__9 @@ -4052,6 +4079,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_payment __pyx_mstate_global->__pyx_n_s_payment #define __pyx_n_u_payment __pyx_mstate_global->__pyx_n_u_payment #define __pyx_n_s_payment_id __pyx_mstate_global->__pyx_n_s_payment_id +#define __pyx_n_s_payment_message __pyx_mstate_global->__pyx_n_s_payment_message #define __pyx_n_u_payment_mode __pyx_mstate_global->__pyx_n_u_payment_mode #define __pyx_n_s_payment_object __pyx_mstate_global->__pyx_n_s_payment_object #define __pyx_n_u_payment_subject __pyx_mstate_global->__pyx_n_u_payment_subject @@ -4088,6 +4116,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_startswith __pyx_mstate_global->__pyx_n_s_startswith #define __pyx_n_s_state __pyx_mstate_global->__pyx_n_s_state #define __pyx_n_u_state __pyx_mstate_global->__pyx_n_u_state +#define __pyx_n_s_state_type __pyx_mstate_global->__pyx_n_s_state_type #define __pyx_n_s_status __pyx_mstate_global->__pyx_n_s_status #define __pyx_n_u_status __pyx_mstate_global->__pyx_n_u_status #define __pyx_n_s_str __pyx_mstate_global->__pyx_n_s_str @@ -4118,6 +4147,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_u_vat_code __pyx_mstate_global->__pyx_n_u_vat_code #define __pyx_n_u_waiting_for_payment __pyx_mstate_global->__pyx_n_u_waiting_for_payment #define __pyx_n_s_waiting_for_payment_confirmation __pyx_mstate_global->__pyx_n_s_waiting_for_payment_confirmation +#define __pyx_n_u_waiting_for_renewal_payment __pyx_mstate_global->__pyx_n_u_waiting_for_renewal_payment #define __pyx_n_s_warning __pyx_mstate_global->__pyx_n_s_warning #define __pyx_n_s_web __pyx_mstate_global->__pyx_n_s_web #define __pyx_n_u_yookassa __pyx_mstate_global->__pyx_n_u_yookassa @@ -4136,19 +4166,19 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 #define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21 #define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24 -#define __pyx_tuple__36 __pyx_mstate_global->__pyx_tuple__36 -#define __pyx_tuple__37 __pyx_mstate_global->__pyx_tuple__37 #define __pyx_tuple__38 __pyx_mstate_global->__pyx_tuple__38 #define __pyx_tuple__39 __pyx_mstate_global->__pyx_tuple__39 #define __pyx_tuple__40 __pyx_mstate_global->__pyx_tuple__40 #define __pyx_tuple__41 __pyx_mstate_global->__pyx_tuple__41 #define __pyx_tuple__42 __pyx_mstate_global->__pyx_tuple__42 #define __pyx_tuple__43 __pyx_mstate_global->__pyx_tuple__43 +#define __pyx_tuple__44 __pyx_mstate_global->__pyx_tuple__44 +#define __pyx_tuple__45 __pyx_mstate_global->__pyx_tuple__45 #define __pyx_codeobj__6 __pyx_mstate_global->__pyx_codeobj__6 #define __pyx_codeobj__15 __pyx_mstate_global->__pyx_codeobj__15 #define __pyx_codeobj__18 __pyx_mstate_global->__pyx_codeobj__18 #define __pyx_codeobj__22 __pyx_mstate_global->__pyx_codeobj__22 -#define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33 +#define __pyx_codeobj__35 __pyx_mstate_global->__pyx_codeobj__35 /* #### Code section: module_code ### */ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ @@ -8706,26 +8736,25 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ unsigned int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - Py_ssize_t __pyx_t_15; - Py_UCS4 __pyx_t_16; - PyObject *__pyx_t_17 = NULL; + Py_ssize_t __pyx_t_14; + Py_UCS4 __pyx_t_15; + PyObject *__pyx_t_16 = NULL; + int __pyx_t_17; int __pyx_t_18; - int __pyx_t_19; - char const *__pyx_t_20; + char const *__pyx_t_19; + PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; PyObject *__pyx_t_22 = NULL; PyObject *__pyx_t_23 = NULL; PyObject *__pyx_t_24 = NULL; PyObject *__pyx_t_25 = NULL; - PyObject *__pyx_t_26 = NULL; - char const *__pyx_t_27; + char const *__pyx_t_26; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -8735,16 +8764,17 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L4_resume_from_await; case 2: goto __pyx_L9_resume_from_await; - case 3: goto __pyx_L13_resume_from_await; + case 3: goto __pyx_L11_resume_from_await; case 4: goto __pyx_L15_resume_from_await; - case 5: goto __pyx_L16_resume_from_await; + case 5: goto __pyx_L17_resume_from_await; case 6: goto __pyx_L18_resume_from_await; - case 7: goto __pyx_L26_resume_from_await; - case 8: goto __pyx_L27_resume_from_await; - case 9: goto __pyx_L35_resume_from_await; - case 10: goto __pyx_L40_resume_from_await; + case 7: goto __pyx_L20_resume_from_await; + case 8: goto __pyx_L29_resume_from_await; + case 9: goto __pyx_L30_resume_from_await; + case 10: goto __pyx_L38_resume_from_await; case 11: goto __pyx_L43_resume_from_await; - case 12: goto __pyx_L44_resume_from_await; + case 12: goto __pyx_L46_resume_from_await; + case 13: goto __pyx_L47_resume_from_await; default: /* CPython raises the right error here */ __Pyx_RefNannyFinishContext(); return NULL; @@ -8859,7 +8889,7 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ * tg_id = callback_query.message.chat.id * * user_data = await get_temporary_data(conn, tg_id) # <<<<<<<<<<<<<< - * if not user_data or user_data["state"] != "waiting_for_payment": + * if not user_data: * await callback_query.message.answer(" . .") */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_get_temporary_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L6_error) @@ -8911,28 +8941,17 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ /* "handlers/payments/yookassa_pay.py":252 * * user_data = await get_temporary_data(conn, tg_id) - * if not user_data or user_data["state"] != "waiting_for_payment": # <<<<<<<<<<<<<< + * if not user_data: # <<<<<<<<<<<<<< * await callback_query.message.answer(" . .") * return */ - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_user_data); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 252, __pyx_L6_error) - __pyx_t_8 = (!__pyx_t_7); - if (!__pyx_t_8) { - } else { - __pyx_t_6 = __pyx_t_8; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_user_data, __pyx_n_u_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 252, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_waiting_for_payment, Py_NE)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 252, __pyx_L6_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __pyx_t_8; - __pyx_L11_bool_binop_done:; - if (__pyx_t_6) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_user_data); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 252, __pyx_L6_error) + __pyx_t_7 = (!__pyx_t_6); + if (__pyx_t_7) { /* "handlers/payments/yookassa_pay.py":253 * user_data = await get_temporary_data(conn, tg_id) - * if not user_data or user_data["state"] != "waiting_for_payment": + * if not user_data: * await callback_query.message.answer(" . .") # <<<<<<<<<<<<<< * return * @@ -8974,7 +8993,7 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ /* return from generator, awaiting value */ __pyx_generator->resume_label = 3; return __pyx_r; - __pyx_L13_resume_from_await:; + __pyx_L11_resume_from_await:; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 253, __pyx_L6_error) } else { PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); @@ -8985,7 +9004,116 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ } /* "handlers/payments/yookassa_pay.py":254 - * if not user_data or user_data["state"] != "waiting_for_payment": + * if not user_data: + * await callback_query.message.answer(" . .") + * return # <<<<<<<<<<<<<< + * + * state_type = user_data["state"] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = NULL; + goto __pyx_L5_return; + + /* "handlers/payments/yookassa_pay.py":252 + * + * user_data = await get_temporary_data(conn, tg_id) + * if not user_data: # <<<<<<<<<<<<<< + * await callback_query.message.answer(" . .") + * return + */ + } + + /* "handlers/payments/yookassa_pay.py":256 + * return + * + * state_type = user_data["state"] # <<<<<<<<<<<<<< + * + * if state_type not in ["waiting_for_payment", "waiting_for_renewal_payment"]: + */ + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_user_data, __pyx_n_u_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_v_state_type = __pyx_t_3; + __pyx_t_3 = 0; + + /* "handlers/payments/yookassa_pay.py":258 + * state_type = user_data["state"] + * + * if state_type not in ["waiting_for_payment", "waiting_for_renewal_payment"]: # <<<<<<<<<<<<<< + * await callback_query.message.answer(" . .") + * return + */ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_state_type); + __pyx_t_3 = __pyx_cur_scope->__pyx_v_state_type; + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_waiting_for_payment, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 258, __pyx_L6_error) + if (__pyx_t_6) { + } else { + __pyx_t_7 = __pyx_t_6; + goto __pyx_L13_bool_binop_done; + } + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_waiting_for_renewal_payment, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 258, __pyx_L6_error) + __pyx_t_7 = __pyx_t_6; + __pyx_L13_bool_binop_done:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __pyx_t_7; + if (__pyx_t_6) { + + /* "handlers/payments/yookassa_pay.py":259 + * + * if state_type not in ["waiting_for_payment", "waiting_for_renewal_payment"]: + * await callback_query.message.answer(" . .") # <<<<<<<<<<<<<< + * return + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_callback_query, __pyx_n_s_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_answer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_5 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u__23}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_r); + if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + __Pyx_Coroutine_ResetAndClearException(__pyx_generator); + /* return from generator, awaiting value */ + __pyx_generator->resume_label = 4; + return __pyx_r; + __pyx_L15_resume_from_await:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 259, __pyx_L6_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, 259, __pyx_L6_error) + } + } + + /* "handlers/payments/yookassa_pay.py":260 + * if state_type not in ["waiting_for_payment", "waiting_for_renewal_payment"]: * await callback_query.message.answer(" . .") * return # <<<<<<<<<<<<<< * @@ -8995,30 +9123,30 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ __pyx_r = NULL; goto __pyx_L5_return; - /* "handlers/payments/yookassa_pay.py":252 + /* "handlers/payments/yookassa_pay.py":258 + * state_type = user_data["state"] * - * user_data = await get_temporary_data(conn, tg_id) - * if not user_data or user_data["state"] != "waiting_for_payment": # <<<<<<<<<<<<<< + * if state_type not in ["waiting_for_payment", "waiting_for_renewal_payment"]: # <<<<<<<<<<<<<< * await callback_query.message.answer(" . .") * return */ } - /* "handlers/payments/yookassa_pay.py":256 + /* "handlers/payments/yookassa_pay.py":262 * return * * amount = user_data["data"].get("required_amount", 0) # <<<<<<<<<<<<<< + * * elif isinstance(callback_query, types.Message): - * tg_id = callback_query.chat.id */ - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_user_data, __pyx_n_u_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L6_error) + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_user_data, __pyx_n_u_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 256, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L6_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_3); __pyx_cur_scope->__pyx_v_amount = __pyx_t_3; __pyx_t_3 = 0; @@ -9033,103 +9161,103 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ goto __pyx_L8; } - /* "handlers/payments/yookassa_pay.py":257 - * + /* "handlers/payments/yookassa_pay.py":264 * amount = user_data["data"].get("required_amount", 0) + * * elif isinstance(callback_query, types.Message): # <<<<<<<<<<<<<< * tg_id = callback_query.chat.id * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L6_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Message); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = PyObject_IsInstance(__pyx_cur_scope->__pyx_v_callback_query, __pyx_t_2); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 257, __pyx_L6_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = PyObject_IsInstance(__pyx_cur_scope->__pyx_v_callback_query, __pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 264, __pyx_L6_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { - /* "handlers/payments/yookassa_pay.py":258 - * amount = user_data["data"].get("required_amount", 0) + /* "handlers/payments/yookassa_pay.py":265 + * * elif isinstance(callback_query, types.Message): * tg_id = callback_query.chat.id # <<<<<<<<<<<<<< * * if callback_query.text.isdigit(): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_callback_query, __pyx_n_s_chat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __pyx_L6_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_callback_query, __pyx_n_s_chat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_3); __pyx_cur_scope->__pyx_v_tg_id = __pyx_t_3; __pyx_t_3 = 0; - /* "handlers/payments/yookassa_pay.py":260 + /* "handlers/payments/yookassa_pay.py":267 * tg_id = callback_query.chat.id * * if callback_query.text.isdigit(): # <<<<<<<<<<<<<< * amount = int(callback_query.text) * else: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_callback_query, __pyx_n_s_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isdigit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L6_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_callback_query, __pyx_n_s_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_isdigit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; - __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L6_error) + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 260, __pyx_L6_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 267, __pyx_L6_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { - /* "handlers/payments/yookassa_pay.py":261 + /* "handlers/payments/yookassa_pay.py":268 * * if callback_query.text.isdigit(): * amount = int(callback_query.text) # <<<<<<<<<<<<<< * else: * await _send_message(callback_query, " . , .") */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_callback_query, __pyx_n_s_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 261, __pyx_L6_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_callback_query, __pyx_n_s_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_amount = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_amount = __pyx_t_2; + __pyx_t_2 = 0; - /* "handlers/payments/yookassa_pay.py":260 + /* "handlers/payments/yookassa_pay.py":267 * tg_id = callback_query.chat.id * * if callback_query.text.isdigit(): # <<<<<<<<<<<<<< * amount = int(callback_query.text) * else: */ - goto __pyx_L14; + goto __pyx_L16; } - /* "handlers/payments/yookassa_pay.py":263 + /* "handlers/payments/yookassa_pay.py":270 * amount = int(callback_query.text) * else: * await _send_message(callback_query, " . , .") # <<<<<<<<<<<<<< @@ -9137,16 +9265,16 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ * else: */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_send_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L6_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_send_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = NULL; + __pyx_t_1 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; @@ -9154,34 +9282,34 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ } #endif { - PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_callback_query, __pyx_kp_u__25}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_1); + PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_cur_scope->__pyx_v_callback_query, __pyx_kp_u__25}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 4; + __pyx_generator->resume_label = 5; return __pyx_r; - __pyx_L15_resume_from_await:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 263, __pyx_L6_error) + __pyx_L17_resume_from_await:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 270, __pyx_L6_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, 263, __pyx_L6_error) + else __PYX_ERR(0, 270, __pyx_L6_error) } } - /* "handlers/payments/yookassa_pay.py":264 + /* "handlers/payments/yookassa_pay.py":271 * else: * await _send_message(callback_query, " . , .") * return # <<<<<<<<<<<<<< @@ -9192,11 +9320,11 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ __pyx_r = NULL; goto __pyx_L5_return; } - __pyx_L14:; + __pyx_L16:; - /* "handlers/payments/yookassa_pay.py":257 - * + /* "handlers/payments/yookassa_pay.py":264 * amount = user_data["data"].get("required_amount", 0) + * * elif isinstance(callback_query, types.Message): # <<<<<<<<<<<<<< * tg_id = callback_query.chat.id * @@ -9204,7 +9332,7 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ goto __pyx_L8; } - /* "handlers/payments/yookassa_pay.py":266 + /* "handlers/payments/yookassa_pay.py":273 * return * else: * await _send_message(callback_query, " .") # <<<<<<<<<<<<<< @@ -9212,16 +9340,16 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ * */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_send_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L6_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_send_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = NULL; + __pyx_t_1 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; @@ -9229,34 +9357,34 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ } #endif { - PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_callback_query, __pyx_kp_u__26}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_1); + PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_cur_scope->__pyx_v_callback_query, __pyx_kp_u__26}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 273, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 5; + __pyx_generator->resume_label = 6; return __pyx_r; - __pyx_L16_resume_from_await:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 266, __pyx_L6_error) + __pyx_L18_resume_from_await:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 273, __pyx_L6_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, 266, __pyx_L6_error) + else __PYX_ERR(0, 273, __pyx_L6_error) } } - /* "handlers/payments/yookassa_pay.py":267 + /* "handlers/payments/yookassa_pay.py":274 * else: * await _send_message(callback_query, " .") * return # <<<<<<<<<<<<<< @@ -9269,35 +9397,35 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ } __pyx_L8:; - /* "handlers/payments/yookassa_pay.py":269 + /* "handlers/payments/yookassa_pay.py":276 * return * * if amount <= 0: # <<<<<<<<<<<<<< * await _send_message(callback_query, " .") * return */ - __pyx_t_1 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_amount, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L6_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 269, __pyx_L6_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_amount, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L6_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 276, __pyx_L6_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_6) { - /* "handlers/payments/yookassa_pay.py":270 + /* "handlers/payments/yookassa_pay.py":277 * * if amount <= 0: * await _send_message(callback_query, " .") # <<<<<<<<<<<<<< * return * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_send_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L6_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_send_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = NULL; + __pyx_t_1 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; @@ -9305,34 +9433,34 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ } #endif { - PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_callback_query, __pyx_kp_u__27}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_1); + PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_cur_scope->__pyx_v_callback_query, __pyx_kp_u__27}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 277, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 6; + __pyx_generator->resume_label = 7; return __pyx_r; - __pyx_L18_resume_from_await:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 270, __pyx_L6_error) + __pyx_L20_resume_from_await:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 277, __pyx_L6_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, 270, __pyx_L6_error) + else __PYX_ERR(0, 277, __pyx_L6_error) } } - /* "handlers/payments/yookassa_pay.py":271 + /* "handlers/payments/yookassa_pay.py":278 * if amount <= 0: * await _send_message(callback_query, " .") * return # <<<<<<<<<<<<<< @@ -9343,7 +9471,7 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ __pyx_r = NULL; goto __pyx_L5_return; - /* "handlers/payments/yookassa_pay.py":269 + /* "handlers/payments/yookassa_pay.py":276 * return * * if amount <= 0: # <<<<<<<<<<<<<< @@ -9352,7 +9480,7 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ */ } - /* "handlers/payments/yookassa_pay.py":273 + /* "handlers/payments/yookassa_pay.py":280 * return * * try: # <<<<<<<<<<<<<< @@ -9360,252 +9488,252 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ * { */ { - __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); /*try:*/ { - /* "handlers/payments/yookassa_pay.py":274 + /* "handlers/payments/yookassa_pay.py":281 * * try: * payment = Payment.create( # <<<<<<<<<<<<<< * { * "amount": {"value": str(amount), "currency": "RUB"}, */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Payment); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L19_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Payment); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_create); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_create); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "handlers/payments/yookassa_pay.py":276 + /* "handlers/payments/yookassa_pay.py":283 * payment = Payment.create( * { * "amount": {"value": str(amount), "currency": "RUB"}, # <<<<<<<<<<<<<< * "confirmation": { * "type": "redirect", */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L19_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 283, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 276, __pyx_L19_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 283, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __Pyx_PyObject_Unicode(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 276, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_value, __pyx_t_12) < 0) __PYX_ERR(0, 276, __pyx_L19_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_currency, __pyx_n_u_RUB) < 0) __PYX_ERR(0, 276, __pyx_L19_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_amount, __pyx_t_4) < 0) __PYX_ERR(0, 276, __pyx_L19_error) + __pyx_t_11 = __Pyx_PyObject_Unicode(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 283, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_11); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_value, __pyx_t_11) < 0) __PYX_ERR(0, 283, __pyx_L21_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_currency, __pyx_n_u_RUB) < 0) __PYX_ERR(0, 283, __pyx_L21_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_amount, __pyx_t_4) < 0) __PYX_ERR(0, 283, __pyx_L21_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "handlers/payments/yookassa_pay.py":278 + /* "handlers/payments/yookassa_pay.py":285 * "amount": {"value": str(amount), "currency": "RUB"}, * "confirmation": { * "type": "redirect", # <<<<<<<<<<<<<< * "return_url": f"{REDIRECT_LINK}", * }, */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 278, __pyx_L19_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_type, __pyx_n_u_redirect) < 0) __PYX_ERR(0, 278, __pyx_L19_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_type, __pyx_n_u_redirect) < 0) __PYX_ERR(0, 285, __pyx_L21_error) - /* "handlers/payments/yookassa_pay.py":279 + /* "handlers/payments/yookassa_pay.py":286 * "confirmation": { * "type": "redirect", * "return_url": f"{REDIRECT_LINK}", # <<<<<<<<<<<<<< * }, * "capture": True, */ - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_REDIRECT_LINK); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 279, __pyx_L19_error) + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_REDIRECT_LINK); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 286, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_11, __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 286, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_t_12, __pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 279, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_return_url, __pyx_t_12) < 0) __PYX_ERR(0, 285, __pyx_L21_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_return_url, __pyx_t_13) < 0) __PYX_ERR(0, 278, __pyx_L19_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_confirmation, __pyx_t_4) < 0) __PYX_ERR(0, 276, __pyx_L19_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_confirmation, __pyx_t_4) < 0) __PYX_ERR(0, 283, __pyx_L21_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "handlers/payments/yookassa_pay.py":281 + /* "handlers/payments/yookassa_pay.py":288 * "return_url": f"{REDIRECT_LINK}", * }, * "capture": True, # <<<<<<<<<<<<<< * "description": f" {tg_id}", * "receipt": { */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_capture, Py_True) < 0) __PYX_ERR(0, 276, __pyx_L19_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_capture, Py_True) < 0) __PYX_ERR(0, 283, __pyx_L21_error) - /* "handlers/payments/yookassa_pay.py":282 + /* "handlers/payments/yookassa_pay.py":289 * }, * "capture": True, * "description": f" {tg_id}", # <<<<<<<<<<<<<< * "receipt": { * "customer": { */ - __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_tg_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L19_error) + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_tg_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 289, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_13 = __Pyx_PyUnicode_Concat(__pyx_kp_u__10, __pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 282, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_kp_u__10, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 289, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_description, __pyx_t_13) < 0) __PYX_ERR(0, 276, __pyx_L19_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_description, __pyx_t_12) < 0) __PYX_ERR(0, 283, __pyx_L21_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "handlers/payments/yookassa_pay.py":284 + /* "handlers/payments/yookassa_pay.py":291 * "description": f" {tg_id}", * "receipt": { * "customer": { # <<<<<<<<<<<<<< * "full_name": callback_query.from_user.full_name, * "email": f"{tg_id}@{EMAIL}", */ - __pyx_t_13 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 284, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_12 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 291, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_12); - /* "handlers/payments/yookassa_pay.py":285 + /* "handlers/payments/yookassa_pay.py":292 * "receipt": { * "customer": { * "full_name": callback_query.from_user.full_name, # <<<<<<<<<<<<<< * "email": f"{tg_id}@{EMAIL}", * "phone": "79000000000", */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L19_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_callback_query, __pyx_n_s_from_user); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 285, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_full_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 285, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_full_name, __pyx_t_14) < 0) __PYX_ERR(0, 285, __pyx_L19_error) - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_callback_query, __pyx_n_s_from_user); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 292, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_full_name); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 292, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_full_name, __pyx_t_13) < 0) __PYX_ERR(0, 292, __pyx_L21_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* "handlers/payments/yookassa_pay.py":286 + /* "handlers/payments/yookassa_pay.py":293 * "customer": { * "full_name": callback_query.from_user.full_name, * "email": f"{tg_id}@{EMAIL}", # <<<<<<<<<<<<<< * "phone": "79000000000", * }, */ - __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 286, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = 0; - __pyx_t_16 = 127; - __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_tg_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 286, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_16 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) > __pyx_t_16) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) : __pyx_t_16; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12); - __pyx_t_12 = 0; + __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 293, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = 0; + __pyx_t_15 = 127; + __pyx_t_11 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_tg_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 293, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) : __pyx_t_15; + __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); + __pyx_t_11 = 0; __Pyx_INCREF(__pyx_kp_u__9); - __pyx_t_15 += 1; + __pyx_t_14 += 1; __Pyx_GIVEREF(__pyx_kp_u__9); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_kp_u__9); - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_EMAIL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 286, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_17 = __Pyx_PyObject_FormatSimple(__pyx_t_12, __pyx_empty_unicode); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 286, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_16 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) > __pyx_t_16) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_17) : __pyx_t_16; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_17); - __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_17); - __pyx_t_17 = 0; - __pyx_t_17 = __Pyx_PyUnicode_Join(__pyx_t_14, 3, __pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 286, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_email, __pyx_t_17) < 0) __PYX_ERR(0, 285, __pyx_L19_error) - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_phone, __pyx_kp_u_79000000000) < 0) __PYX_ERR(0, 285, __pyx_L19_error) - if (PyDict_SetItem(__pyx_t_13, __pyx_n_u_customer, __pyx_t_4) < 0) __PYX_ERR(0, 284, __pyx_L19_error) + PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_kp_u__9); + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_EMAIL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 293, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_16 = __Pyx_PyObject_FormatSimple(__pyx_t_11, __pyx_empty_unicode); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 293, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_16) : __pyx_t_15; + __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_16); + __Pyx_GIVEREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_16); + __pyx_t_16 = 0; + __pyx_t_16 = __Pyx_PyUnicode_Join(__pyx_t_13, 3, __pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 293, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_email, __pyx_t_16) < 0) __PYX_ERR(0, 292, __pyx_L21_error) + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_phone, __pyx_kp_u_79000000000) < 0) __PYX_ERR(0, 292, __pyx_L21_error) + if (PyDict_SetItem(__pyx_t_12, __pyx_n_u_customer, __pyx_t_4) < 0) __PYX_ERR(0, 291, __pyx_L21_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "handlers/payments/yookassa_pay.py":291 + /* "handlers/payments/yookassa_pay.py":298 * "items": [ * { * "description": f" {tg_id}", # <<<<<<<<<<<<<< * "quantity": "1.00", * "amount": { */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L19_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_17 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_tg_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 291, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_14 = __Pyx_PyUnicode_Concat(__pyx_kp_u__10, __pyx_t_17); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 291, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_description, __pyx_t_14) < 0) __PYX_ERR(0, 291, __pyx_L19_error) - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_quantity, __pyx_kp_u_1_00) < 0) __PYX_ERR(0, 291, __pyx_L19_error) + __pyx_t_16 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_tg_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 298, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_13 = __Pyx_PyUnicode_Concat(__pyx_kp_u__10, __pyx_t_16); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 298, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_description, __pyx_t_13) < 0) __PYX_ERR(0, 298, __pyx_L21_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_quantity, __pyx_kp_u_1_00) < 0) __PYX_ERR(0, 298, __pyx_L21_error) - /* "handlers/payments/yookassa_pay.py":294 + /* "handlers/payments/yookassa_pay.py":301 * "quantity": "1.00", * "amount": { * "value": str(amount), # <<<<<<<<<<<<<< * "currency": "RUB", * }, */ - __pyx_t_14 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 294, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_17 = __Pyx_PyObject_Unicode(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_17); - if (PyDict_SetItem(__pyx_t_14, __pyx_n_u_value, __pyx_t_17) < 0) __PYX_ERR(0, 294, __pyx_L19_error) - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - if (PyDict_SetItem(__pyx_t_14, __pyx_n_u_currency, __pyx_n_u_RUB) < 0) __PYX_ERR(0, 294, __pyx_L19_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_amount, __pyx_t_14) < 0) __PYX_ERR(0, 291, __pyx_L19_error) - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_vat_code, __pyx_int_1) < 0) __PYX_ERR(0, 291, __pyx_L19_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_payment_subject, __pyx_n_u_payment) < 0) __PYX_ERR(0, 291, __pyx_L19_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_payment_mode, __pyx_n_u_full_payment) < 0) __PYX_ERR(0, 291, __pyx_L19_error) + __pyx_t_13 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 301, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_16 = __Pyx_PyObject_Unicode(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 301, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_16); + if (PyDict_SetItem(__pyx_t_13, __pyx_n_u_value, __pyx_t_16) < 0) __PYX_ERR(0, 301, __pyx_L21_error) + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (PyDict_SetItem(__pyx_t_13, __pyx_n_u_currency, __pyx_n_u_RUB) < 0) __PYX_ERR(0, 301, __pyx_L21_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_amount, __pyx_t_13) < 0) __PYX_ERR(0, 298, __pyx_L21_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_vat_code, __pyx_int_1) < 0) __PYX_ERR(0, 298, __pyx_L21_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_payment_subject, __pyx_n_u_payment) < 0) __PYX_ERR(0, 298, __pyx_L21_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_payment_mode, __pyx_n_u_full_payment) < 0) __PYX_ERR(0, 298, __pyx_L21_error) - /* "handlers/payments/yookassa_pay.py":289 + /* "handlers/payments/yookassa_pay.py":296 * "phone": "79000000000", * }, * "items": [ # <<<<<<<<<<<<<< * { * "description": f" {tg_id}", */ - __pyx_t_14 = PyList_New(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 289, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_13 = PyList_New(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 296, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_13); __Pyx_GIVEREF(__pyx_t_4); - if (__Pyx_PyList_SET_ITEM(__pyx_t_14, 0, __pyx_t_4)) __PYX_ERR(0, 289, __pyx_L19_error); + if (__Pyx_PyList_SET_ITEM(__pyx_t_13, 0, __pyx_t_4)) __PYX_ERR(0, 296, __pyx_L21_error); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_13, __pyx_n_u_items, __pyx_t_14) < 0) __PYX_ERR(0, 284, __pyx_L19_error) - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_receipt, __pyx_t_13) < 0) __PYX_ERR(0, 276, __pyx_L19_error) + if (PyDict_SetItem(__pyx_t_12, __pyx_n_u_items, __pyx_t_13) < 0) __PYX_ERR(0, 291, __pyx_L21_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_receipt, __pyx_t_12) < 0) __PYX_ERR(0, 283, __pyx_L21_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "handlers/payments/yookassa_pay.py":303 + /* "handlers/payments/yookassa_pay.py":310 * ], * }, * "metadata": {"user_id": tg_id}, # <<<<<<<<<<<<<< * }, * uuid.uuid4(), */ - __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 303, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_t_13, __pyx_n_u_user_id, __pyx_cur_scope->__pyx_v_tg_id) < 0) __PYX_ERR(0, 303, __pyx_L19_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_metadata, __pyx_t_13) < 0) __PYX_ERR(0, 276, __pyx_L19_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 310, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_12); + if (PyDict_SetItem(__pyx_t_12, __pyx_n_u_user_id, __pyx_cur_scope->__pyx_v_tg_id) < 0) __PYX_ERR(0, 310, __pyx_L21_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_metadata, __pyx_t_12) < 0) __PYX_ERR(0, 283, __pyx_L21_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "handlers/payments/yookassa_pay.py":305 + /* "handlers/payments/yookassa_pay.py":312 * "metadata": {"user_id": tg_id}, * }, * uuid.uuid4(), # <<<<<<<<<<<<<< * ) * */ - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_uuid); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 305, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_uuid4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L19_error) + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_uuid); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 312, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_uuid4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 312, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = NULL; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_14)) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_13)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_13); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; @@ -9613,295 +9741,420 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_14, NULL}; - __pyx_t_13 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 305, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_13); + PyObject *__pyx_callargs[2] = {__pyx_t_13, NULL}; + __pyx_t_12 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 312, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_5 = 1; } } #endif { - PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_3, __pyx_t_13}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_3, __pyx_t_12}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_GIVEREF(__pyx_t_1); - __pyx_cur_scope->__pyx_v_payment = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_payment = __pyx_t_2; + __pyx_t_2 = 0; - /* "handlers/payments/yookassa_pay.py":308 + /* "handlers/payments/yookassa_pay.py":315 * ) * * if payment["status"] == "pending": # <<<<<<<<<<<<<< * payment_url = payment["confirmation"]["confirmation_url"] * */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_payment, __pyx_n_u_status); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_pending, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 308, __pyx_L19_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_payment, __pyx_n_u_status); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_n_u_pending, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 315, __pyx_L21_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_6) { - /* "handlers/payments/yookassa_pay.py":309 + /* "handlers/payments/yookassa_pay.py":316 * * if payment["status"] == "pending": * payment_url = payment["confirmation"]["confirmation_url"] # <<<<<<<<<<<<<< * + * if state_type == "waiting_for_payment": + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_payment, __pyx_n_u_confirmation); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_u_confirmation_url); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_payment_url = __pyx_t_1; + __pyx_t_1 = 0; + + /* "handlers/payments/yookassa_pay.py":318 + * payment_url = payment["confirmation"]["confirmation_url"] + * + * if state_type == "waiting_for_payment": # <<<<<<<<<<<<<< + * payment_message = f" {amount} . :" + * elif state_type == "waiting_for_renewal_payment": + */ + if (unlikely(!__pyx_cur_scope->__pyx_v_state_type)) { __Pyx_RaiseUnboundLocalError("state_type"); __PYX_ERR(0, 318, __pyx_L21_error) } + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_state_type, __pyx_n_u_waiting_for_payment, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 318, __pyx_L21_error) + if (__pyx_t_6) { + + /* "handlers/payments/yookassa_pay.py":319 + * + * if state_type == "waiting_for_payment": + * payment_message = f" {amount} . :" # <<<<<<<<<<<<<< + * elif state_type == "waiting_for_renewal_payment": + * payment_message = f" {amount} . :" + */ + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_14 = 0; + __pyx_t_15 = 127; + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_t_15 = (65535 > __pyx_t_15) ? 65535 : __pyx_t_15; + __pyx_t_14 += 25; + __Pyx_GIVEREF(__pyx_kp_u__12); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__12); + __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_amount, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_15; + __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_kp_u__28); + __pyx_t_15 = (65535 > __pyx_t_15) ? 65535 : __pyx_t_15; + __pyx_t_14 += 66; + __Pyx_GIVEREF(__pyx_kp_u__28); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__28); + __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_payment_message = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "handlers/payments/yookassa_pay.py":318 + * payment_url = payment["confirmation"]["confirmation_url"] + * + * if state_type == "waiting_for_payment": # <<<<<<<<<<<<<< + * payment_message = f" {amount} . :" + * elif state_type == "waiting_for_renewal_payment": + */ + goto __pyx_L28; + } + + /* "handlers/payments/yookassa_pay.py":320 + * if state_type == "waiting_for_payment": + * payment_message = f" {amount} . :" + * elif state_type == "waiting_for_renewal_payment": # <<<<<<<<<<<<<< + * payment_message = f" {amount} . :" + * else: + */ + if (unlikely(!__pyx_cur_scope->__pyx_v_state_type)) { __Pyx_RaiseUnboundLocalError("state_type"); __PYX_ERR(0, 320, __pyx_L21_error) } + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_state_type, __pyx_n_u_waiting_for_renewal_payment, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 320, __pyx_L21_error) + if (__pyx_t_6) { + + /* "handlers/payments/yookassa_pay.py":321 + * payment_message = f" {amount} . :" + * elif state_type == "waiting_for_renewal_payment": + * payment_message = f" {amount} . :" # <<<<<<<<<<<<<< + * else: + * payment_message = f" {amount} . :" + */ + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_14 = 0; + __pyx_t_15 = 127; + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_t_15 = (65535 > __pyx_t_15) ? 65535 : __pyx_t_15; + __pyx_t_14 += 25; + __Pyx_GIVEREF(__pyx_kp_u__12); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u__12); + __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_amount, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_15; + __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_kp_u__29); + __pyx_t_15 = (65535 > __pyx_t_15) ? 65535 : __pyx_t_15; + __pyx_t_14 += 60; + __Pyx_GIVEREF(__pyx_kp_u__29); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__29); + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_payment_message = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "handlers/payments/yookassa_pay.py":320 + * if state_type == "waiting_for_payment": + * payment_message = f" {amount} . :" + * elif state_type == "waiting_for_renewal_payment": # <<<<<<<<<<<<<< + * payment_message = f" {amount} . :" + * else: + */ + goto __pyx_L28; + } + + /* "handlers/payments/yookassa_pay.py":323 + * payment_message = f" {amount} . :" + * else: + * payment_message = f" {amount} . :" # <<<<<<<<<<<<<< + * * confirm_keyboard = InlineKeyboardMarkup( */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_payment, __pyx_n_u_confirmation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_confirmation_url); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_payment_url = __pyx_t_2; - __pyx_t_2 = 0; + /*else*/ { + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_14 = 0; + __pyx_t_15 = 127; + __Pyx_INCREF(__pyx_kp_u__12); + __pyx_t_15 = (65535 > __pyx_t_15) ? 65535 : __pyx_t_15; + __pyx_t_14 += 25; + __Pyx_GIVEREF(__pyx_kp_u__12); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__12); + __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_amount, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_15; + __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_kp_u__30); + __pyx_t_15 = (65535 > __pyx_t_15) ? 65535 : __pyx_t_15; + __pyx_t_14 += 40; + __Pyx_GIVEREF(__pyx_kp_u__30); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__30); + __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_payment_message = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + } + __pyx_L28:; - /* "handlers/payments/yookassa_pay.py":311 - * payment_url = payment["confirmation"]["confirmation_url"] + /* "handlers/payments/yookassa_pay.py":325 + * payment_message = f" {amount} . :" * * confirm_keyboard = InlineKeyboardMarkup( # <<<<<<<<<<<<<< * inline_keyboard=[ * [InlineKeyboardButton(text="", url=payment_url)], */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_InlineKeyboardMarkup); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L19_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_InlineKeyboardMarkup); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_2); - /* "handlers/payments/yookassa_pay.py":312 + /* "handlers/payments/yookassa_pay.py":326 * * confirm_keyboard = InlineKeyboardMarkup( * inline_keyboard=[ # <<<<<<<<<<<<<< * [InlineKeyboardButton(text="", url=payment_url)], * [InlineKeyboardButton(text=" ", callback_data="profile")], */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L19_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_1); - /* "handlers/payments/yookassa_pay.py":313 + /* "handlers/payments/yookassa_pay.py":327 * confirm_keyboard = InlineKeyboardMarkup( * inline_keyboard=[ * [InlineKeyboardButton(text="", url=payment_url)], # <<<<<<<<<<<<<< * [InlineKeyboardButton(text=" ", callback_data="profile")], * ] */ - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 313, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L19_error) + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 327, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_text, __pyx_n_u__28) < 0) __PYX_ERR(0, 313, __pyx_L19_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_url, __pyx_cur_scope->__pyx_v_payment_url) < 0) __PYX_ERR(0, 313, __pyx_L19_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L19_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_text, __pyx_n_u__31) < 0) __PYX_ERR(0, 327, __pyx_L21_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_url, __pyx_cur_scope->__pyx_v_payment_url) < 0) __PYX_ERR(0, 327, __pyx_L21_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 327, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L19_error) + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); - if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 313, __pyx_L19_error); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 327, __pyx_L21_error); __pyx_t_4 = 0; - /* "handlers/payments/yookassa_pay.py":314 + /* "handlers/payments/yookassa_pay.py":328 * inline_keyboard=[ * [InlineKeyboardButton(text="", url=payment_url)], * [InlineKeyboardButton(text=" ", callback_data="profile")], # <<<<<<<<<<<<<< * ] * ) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 314, __pyx_L19_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_13 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 314, __pyx_L19_error) + __pyx_t_12 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 328, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_12); + if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_text, __pyx_kp_u__32) < 0) __PYX_ERR(0, 328, __pyx_L21_error) + if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_callback_data, __pyx_n_u_profile) < 0) __PYX_ERR(0, 328, __pyx_L21_error) + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 328, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_text, __pyx_kp_u__29) < 0) __PYX_ERR(0, 314, __pyx_L19_error) - if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_callback_data, __pyx_n_u_profile) < 0) __PYX_ERR(0, 314, __pyx_L19_error) - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 314, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyList_New(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 314, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_GIVEREF(__pyx_t_14); - if (__Pyx_PyList_SET_ITEM(__pyx_t_13, 0, __pyx_t_14)) __PYX_ERR(0, 314, __pyx_L19_error); - __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyList_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 328, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GIVEREF(__pyx_t_13); + if (__Pyx_PyList_SET_ITEM(__pyx_t_12, 0, __pyx_t_13)) __PYX_ERR(0, 328, __pyx_L21_error); + __pyx_t_13 = 0; - /* "handlers/payments/yookassa_pay.py":312 + /* "handlers/payments/yookassa_pay.py":326 * * confirm_keyboard = InlineKeyboardMarkup( * inline_keyboard=[ # <<<<<<<<<<<<<< * [InlineKeyboardButton(text="", url=payment_url)], * [InlineKeyboardButton(text=" ", callback_data="profile")], */ - __pyx_t_14 = PyList_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 312, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_13 = PyList_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 326, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_13); __Pyx_GIVEREF(__pyx_t_3); - if (__Pyx_PyList_SET_ITEM(__pyx_t_14, 0, __pyx_t_3)) __PYX_ERR(0, 312, __pyx_L19_error); - __Pyx_GIVEREF(__pyx_t_13); - if (__Pyx_PyList_SET_ITEM(__pyx_t_14, 1, __pyx_t_13)) __PYX_ERR(0, 312, __pyx_L19_error); + if (__Pyx_PyList_SET_ITEM(__pyx_t_13, 0, __pyx_t_3)) __PYX_ERR(0, 326, __pyx_L21_error); + __Pyx_GIVEREF(__pyx_t_12); + if (__Pyx_PyList_SET_ITEM(__pyx_t_13, 1, __pyx_t_12)) __PYX_ERR(0, 326, __pyx_L21_error); __pyx_t_3 = 0; - __pyx_t_13 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_inline_keyboard, __pyx_t_14) < 0) __PYX_ERR(0, 312, __pyx_L19_error) - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_inline_keyboard, __pyx_t_13) < 0) __PYX_ERR(0, 326, __pyx_L21_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* "handlers/payments/yookassa_pay.py":311 - * payment_url = payment["confirmation"]["confirmation_url"] + /* "handlers/payments/yookassa_pay.py":325 + * payment_message = f" {amount} . :" * * confirm_keyboard = InlineKeyboardMarkup( # <<<<<<<<<<<<<< * inline_keyboard=[ * [InlineKeyboardButton(text="", url=payment_url)], */ - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 311, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 325, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_14); - __pyx_cur_scope->__pyx_v_confirm_keyboard = __pyx_t_14; - __pyx_t_14 = 0; + __Pyx_GIVEREF(__pyx_t_13); + __pyx_cur_scope->__pyx_v_confirm_keyboard = __pyx_t_13; + __pyx_t_13 = 0; - /* "handlers/payments/yookassa_pay.py":318 + /* "handlers/payments/yookassa_pay.py":332 * ) * * await _send_message( # <<<<<<<<<<<<<< * callback_query, - * text=f" {amount} . .", + * text=payment_message, */ - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_send_message); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 318, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_14); + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_send_message); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 332, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_13); - /* "handlers/payments/yookassa_pay.py":319 + /* "handlers/payments/yookassa_pay.py":333 * * await _send_message( * callback_query, # <<<<<<<<<<<<<< - * text=f" {amount} . .", + * text=payment_message, * reply_markup=confirm_keyboard, */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L19_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_callback_query); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_callback_query); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_callback_query)) __PYX_ERR(0, 318, __pyx_L19_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_callback_query)) __PYX_ERR(0, 332, __pyx_L21_error); - /* "handlers/payments/yookassa_pay.py":320 + /* "handlers/payments/yookassa_pay.py":334 * await _send_message( * callback_query, - * text=f" {amount} . .", # <<<<<<<<<<<<<< + * text=payment_message, # <<<<<<<<<<<<<< * reply_markup=confirm_keyboard, * ) */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 320, __pyx_L19_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 320, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_15 = 0; - __pyx_t_16 = 127; - __Pyx_INCREF(__pyx_kp_u__12); - __pyx_t_16 = (65535 > __pyx_t_16) ? 65535 : __pyx_t_16; - __pyx_t_15 += 25; - __Pyx_GIVEREF(__pyx_kp_u__12); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_kp_u__12); - __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_amount, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 320, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_16 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_16) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_16; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_3); - __pyx_t_3 = 0; - __Pyx_INCREF(__pyx_kp_u__30); - __pyx_t_16 = (65535 > __pyx_t_16) ? 65535 : __pyx_t_16; - __pyx_t_15 += 40; - __Pyx_GIVEREF(__pyx_kp_u__30); - PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_kp_u__30); - __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_13, 3, __pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 320, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_text, __pyx_t_3) < 0) __PYX_ERR(0, 320, __pyx_L19_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_text, __pyx_cur_scope->__pyx_v_payment_message) < 0) __PYX_ERR(0, 334, __pyx_L21_error) - /* "handlers/payments/yookassa_pay.py":321 + /* "handlers/payments/yookassa_pay.py":335 * callback_query, - * text=f" {amount} . .", + * text=payment_message, * reply_markup=confirm_keyboard, # <<<<<<<<<<<<<< * ) * else: */ - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_reply_markup, __pyx_cur_scope->__pyx_v_confirm_keyboard) < 0) __PYX_ERR(0, 320, __pyx_L19_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_reply_markup, __pyx_cur_scope->__pyx_v_confirm_keyboard) < 0) __PYX_ERR(0, 334, __pyx_L21_error) - /* "handlers/payments/yookassa_pay.py":318 + /* "handlers/payments/yookassa_pay.py":332 * ) * * await _send_message( # <<<<<<<<<<<<<< * callback_query, - * text=f" {amount} . .", + * text=payment_message, */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 332, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_12); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_8; __Pyx_XGIVEREF(__pyx_t_9); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_9; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_9; __Pyx_XGIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_t_1 = __pyx_t_10; - __Pyx_XGIVEREF(__pyx_t_11); - __pyx_cur_scope->__pyx_t_2 = __pyx_t_11; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_10; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 7; + __pyx_generator->resume_label = 8; return __pyx_r; - __pyx_L26_resume_from_await:; - __pyx_t_9 = __pyx_cur_scope->__pyx_t_0; + __pyx_L29_resume_from_await:; + __pyx_t_8 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_10 = __pyx_cur_scope->__pyx_t_1; + __Pyx_XGOTREF(__pyx_t_8); + __pyx_t_9 = __pyx_cur_scope->__pyx_t_1; __pyx_cur_scope->__pyx_t_1 = 0; - __Pyx_XGOTREF(__pyx_t_10); - __pyx_t_11 = __pyx_cur_scope->__pyx_t_2; + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_10 = __pyx_cur_scope->__pyx_t_2; __pyx_cur_scope->__pyx_t_2 = 0; - __Pyx_XGOTREF(__pyx_t_11); - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 318, __pyx_L19_error) + __Pyx_XGOTREF(__pyx_t_10); + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 332, __pyx_L21_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, 318, __pyx_L19_error) + else __PYX_ERR(0, 332, __pyx_L21_error) } } - /* "handlers/payments/yookassa_pay.py":308 + /* "handlers/payments/yookassa_pay.py":315 * ) * * if payment["status"] == "pending": # <<<<<<<<<<<<<< * payment_url = payment["confirmation"]["confirmation_url"] * */ - goto __pyx_L25; + goto __pyx_L27; } - /* "handlers/payments/yookassa_pay.py":324 + /* "handlers/payments/yookassa_pay.py":338 * ) * else: * await _send_message(callback_query, " .") # <<<<<<<<<<<<<< @@ -9909,7 +10162,7 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ * logger.error(f" : {e}") */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_send_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L19_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_send_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; __pyx_t_5 = 0; @@ -9927,50 +10180,50 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ #endif { PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_cur_scope->__pyx_v_callback_query, __pyx_kp_u__14}; - __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); + __pyx_t_12 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_3); + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 338, __pyx_L21_error) + __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_12); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_8; __Pyx_XGIVEREF(__pyx_t_9); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_9; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_9; __Pyx_XGIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_t_1 = __pyx_t_10; - __Pyx_XGIVEREF(__pyx_t_11); - __pyx_cur_scope->__pyx_t_2 = __pyx_t_11; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_10; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 8; + __pyx_generator->resume_label = 9; return __pyx_r; - __pyx_L27_resume_from_await:; - __pyx_t_9 = __pyx_cur_scope->__pyx_t_0; + __pyx_L30_resume_from_await:; + __pyx_t_8 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_10 = __pyx_cur_scope->__pyx_t_1; + __Pyx_XGOTREF(__pyx_t_8); + __pyx_t_9 = __pyx_cur_scope->__pyx_t_1; __pyx_cur_scope->__pyx_t_1 = 0; - __Pyx_XGOTREF(__pyx_t_10); - __pyx_t_11 = __pyx_cur_scope->__pyx_t_2; + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_10 = __pyx_cur_scope->__pyx_t_2; __pyx_cur_scope->__pyx_t_2 = 0; - __Pyx_XGOTREF(__pyx_t_11); - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 324, __pyx_L19_error) + __Pyx_XGOTREF(__pyx_t_10); + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 338, __pyx_L21_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, 324, __pyx_L19_error) + else __PYX_ERR(0, 338, __pyx_L21_error) } } } - __pyx_L25:; + __pyx_L27:; - /* "handlers/payments/yookassa_pay.py":273 + /* "handlers/payments/yookassa_pay.py":280 * return * * try: # <<<<<<<<<<<<<< @@ -9978,32 +10231,32 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ * { */ } + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L24_try_end; - __pyx_L19_error:; + goto __pyx_L26_try_end; + __pyx_L21_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "handlers/payments/yookassa_pay.py":325 + /* "handlers/payments/yookassa_pay.py":339 * else: * await _send_message(callback_query, " .") * except Exception as e: # <<<<<<<<<<<<<< * logger.error(f" : {e}") * await _send_message(callback_query, " .") */ - __pyx_t_18 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_18) { + __pyx_t_17 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_17) { __Pyx_AddTraceback("handlers.payments.yookassa_pay.process_custom_amount_input", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 325, __pyx_L21_except_error) - __Pyx_XGOTREF(__pyx_t_3); + if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 339, __pyx_L23_except_error) + __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); @@ -10011,31 +10264,31 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ __pyx_cur_scope->__pyx_v_e = __pyx_t_2; /*try:*/ { - /* "handlers/payments/yookassa_pay.py":326 + /* "handlers/payments/yookassa_pay.py":340 * await _send_message(callback_query, " .") * except Exception as e: * logger.error(f" : {e}") # <<<<<<<<<<<<<< * await _send_message(callback_query, " .") * finally: */ - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_logger); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 326, __pyx_L33_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L33_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logger); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 340, __pyx_L36_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 326, __pyx_L33_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_17 = __Pyx_PyUnicode_Concat(__pyx_kp_u__31, __pyx_t_13); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 326, __pyx_L33_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = NULL; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyUnicode_Concat(__pyx_kp_u__33, __pyx_t_3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 340, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_13)) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; @@ -10043,33 +10296,33 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_17}; - __pyx_t_14 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 326, __pyx_L33_error) - __Pyx_GOTREF(__pyx_t_14); + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_16}; + __pyx_t_13 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 340, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* "handlers/payments/yookassa_pay.py":327 + /* "handlers/payments/yookassa_pay.py":341 * except Exception as e: * logger.error(f" : {e}") * await _send_message(callback_query, " .") # <<<<<<<<<<<<<< * finally: * await conn.close() */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_send_message); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 327, __pyx_L33_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_send_message); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 341, __pyx_L36_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_17 = NULL; + __pyx_t_16 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_17)) { + __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_16)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(__pyx_t_16); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; @@ -10077,65 +10330,65 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ } #endif { - PyObject *__pyx_callargs[3] = {__pyx_t_17, __pyx_cur_scope->__pyx_v_callback_query, __pyx_kp_u__32}; - __pyx_t_14 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 327, __pyx_L33_error) - __Pyx_GOTREF(__pyx_t_14); + PyObject *__pyx_callargs[3] = {__pyx_t_16, __pyx_cur_scope->__pyx_v_callback_query, __pyx_kp_u__34}; + __pyx_t_13 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 341, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_14); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_13); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { __Pyx_XGIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; __Pyx_XGIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; - __Pyx_XGIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; + __Pyx_XGIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_t_2 = __pyx_t_8; __Pyx_XGIVEREF(__pyx_t_9); __pyx_cur_scope->__pyx_t_3 = __pyx_t_9; __Pyx_XGIVEREF(__pyx_t_10); __pyx_cur_scope->__pyx_t_4 = __pyx_t_10; - __Pyx_XGIVEREF(__pyx_t_11); - __pyx_cur_scope->__pyx_t_5 = __pyx_t_11; + __Pyx_XGIVEREF(__pyx_t_12); + __pyx_cur_scope->__pyx_t_5 = __pyx_t_12; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_SwapException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 9; + __pyx_generator->resume_label = 10; return __pyx_r; - __pyx_L35_resume_from_await:; + __pyx_L38_resume_from_await:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; __pyx_cur_scope->__pyx_t_1 = 0; __Pyx_XGOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; + __pyx_t_8 = __pyx_cur_scope->__pyx_t_2; __pyx_cur_scope->__pyx_t_2 = 0; - __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_8); __pyx_t_9 = __pyx_cur_scope->__pyx_t_3; __pyx_cur_scope->__pyx_t_3 = 0; __Pyx_XGOTREF(__pyx_t_9); __pyx_t_10 = __pyx_cur_scope->__pyx_t_4; __pyx_cur_scope->__pyx_t_4 = 0; __Pyx_XGOTREF(__pyx_t_10); - __pyx_t_11 = __pyx_cur_scope->__pyx_t_5; + __pyx_t_12 = __pyx_cur_scope->__pyx_t_5; __pyx_cur_scope->__pyx_t_5 = 0; - __Pyx_XGOTREF(__pyx_t_11); - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 327, __pyx_L33_error) + __Pyx_XGOTREF(__pyx_t_12); + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 341, __pyx_L36_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, 327, __pyx_L33_error) + else __PYX_ERR(0, 341, __pyx_L36_error) } } } - /* "handlers/payments/yookassa_pay.py":325 + /* "handlers/payments/yookassa_pay.py":339 * else: * await _send_message(callback_query, " .") * except Exception as e: # <<<<<<<<<<<<<< @@ -10146,76 +10399,76 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ /*normal exit:*/{ __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_e); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_e); __pyx_cur_scope->__pyx_v_e = 0; - goto __pyx_L34; + goto __pyx_L37; } - __pyx_L33_error:; + __pyx_L36_error:; /*exception exit:*/{ __Pyx_PyThreadState_assign - __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23) < 0)) __Pyx_ErrFetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22) < 0)) __Pyx_ErrFetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22); + __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); __Pyx_XGOTREF(__pyx_t_22); __Pyx_XGOTREF(__pyx_t_23); __Pyx_XGOTREF(__pyx_t_24); __Pyx_XGOTREF(__pyx_t_25); - __Pyx_XGOTREF(__pyx_t_26); - __pyx_t_18 = __pyx_lineno; __pyx_t_19 = __pyx_clineno; __pyx_t_20 = __pyx_filename; + __pyx_t_17 = __pyx_lineno; __pyx_t_18 = __pyx_clineno; __pyx_t_19 = __pyx_filename; { __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_e); __Pyx_DECREF(__pyx_cur_scope->__pyx_v_e); __pyx_cur_scope->__pyx_v_e = 0; } if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_23); __Pyx_XGIVEREF(__pyx_t_24); __Pyx_XGIVEREF(__pyx_t_25); - __Pyx_XGIVEREF(__pyx_t_26); - __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26); + __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_24, __pyx_t_25); } + __Pyx_XGIVEREF(__pyx_t_20); __Pyx_XGIVEREF(__pyx_t_21); __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_ErrRestore(__pyx_t_21, __pyx_t_22, __pyx_t_23); - __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; - __pyx_lineno = __pyx_t_18; __pyx_clineno = __pyx_t_19; __pyx_filename = __pyx_t_20; - goto __pyx_L21_except_error; + __Pyx_ErrRestore(__pyx_t_20, __pyx_t_21, __pyx_t_22); + __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; + __pyx_lineno = __pyx_t_17; __pyx_clineno = __pyx_t_18; __pyx_filename = __pyx_t_19; + goto __pyx_L23_except_error; } - __pyx_L34:; + __pyx_L37:; } - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L20_exception_handled; + goto __pyx_L22_exception_handled; } - goto __pyx_L21_except_error; + goto __pyx_L23_except_error; - /* "handlers/payments/yookassa_pay.py":273 + /* "handlers/payments/yookassa_pay.py":280 * return * * try: # <<<<<<<<<<<<<< * payment = Payment.create( * { */ - __pyx_L21_except_error:; + __pyx_L23_except_error:; + __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); goto __pyx_L6_error; - __pyx_L20_exception_handled:; + __pyx_L22_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); - __pyx_L24_try_end:; + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + __pyx_L26_try_end:; } } - /* "handlers/payments/yookassa_pay.py":329 + /* "handlers/payments/yookassa_pay.py":343 * await _send_message(callback_query, " .") * finally: * await conn.close() # <<<<<<<<<<<<<< @@ -10224,16 +10477,16 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; + __pyx_t_12 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; @@ -10241,10 +10494,10 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } @@ -10256,15 +10509,15 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 10; + __pyx_generator->resume_label = 11; return __pyx_r; - __pyx_L40_resume_from_await:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 329, __pyx_L1_error) + __pyx_L43_resume_from_await:; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 343, __pyx_L1_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, 329, __pyx_L1_error) + else __PYX_ERR(0, 343, __pyx_L1_error) } } goto __pyx_L7; @@ -10272,35 +10525,35 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ __pyx_L6_error:; /*exception exit:*/{ __Pyx_PyThreadState_assign - __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; + __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_26, &__pyx_t_25, &__pyx_t_24); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_11); + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_25, &__pyx_t_24, &__pyx_t_23); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8); __Pyx_XGOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_26); + __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_25); __Pyx_XGOTREF(__pyx_t_24); - __pyx_t_19 = __pyx_lineno; __pyx_t_18 = __pyx_clineno; __pyx_t_27 = __pyx_filename; + __Pyx_XGOTREF(__pyx_t_23); + __pyx_t_18 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_26 = __pyx_filename; { - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L42_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L45_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; + __pyx_t_12 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; @@ -10308,10 +10561,10 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L42_error) + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L45_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } @@ -10319,107 +10572,107 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_8; __Pyx_XGIVEREF(__pyx_t_9); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_9; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_9; __Pyx_XGIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_t_1 = __pyx_t_10; - __Pyx_XGIVEREF(__pyx_t_11); - __pyx_cur_scope->__pyx_t_2 = __pyx_t_11; - __pyx_cur_scope->__pyx_t_6 = __pyx_t_18; - __pyx_cur_scope->__pyx_t_7 = __pyx_t_19; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_10; + __pyx_cur_scope->__pyx_t_6 = __pyx_t_17; + __pyx_cur_scope->__pyx_t_7 = __pyx_t_18; + __Pyx_XGIVEREF(__pyx_t_23); + __pyx_cur_scope->__pyx_t_3 = __pyx_t_23; __Pyx_XGIVEREF(__pyx_t_24); - __pyx_cur_scope->__pyx_t_3 = __pyx_t_24; + __pyx_cur_scope->__pyx_t_4 = __pyx_t_24; __Pyx_XGIVEREF(__pyx_t_25); - __pyx_cur_scope->__pyx_t_4 = __pyx_t_25; - __Pyx_XGIVEREF(__pyx_t_26); - __pyx_cur_scope->__pyx_t_5 = __pyx_t_26; - __pyx_cur_scope->__pyx_t_8 = __pyx_t_27; + __pyx_cur_scope->__pyx_t_5 = __pyx_t_25; + __pyx_cur_scope->__pyx_t_8 = __pyx_t_26; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 11; + __pyx_generator->resume_label = 12; return __pyx_r; - __pyx_L43_resume_from_await:; - __pyx_t_9 = __pyx_cur_scope->__pyx_t_0; + __pyx_L46_resume_from_await:; + __pyx_t_8 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_10 = __pyx_cur_scope->__pyx_t_1; + __Pyx_XGOTREF(__pyx_t_8); + __pyx_t_9 = __pyx_cur_scope->__pyx_t_1; __pyx_cur_scope->__pyx_t_1 = 0; - __Pyx_XGOTREF(__pyx_t_10); - __pyx_t_11 = __pyx_cur_scope->__pyx_t_2; + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_10 = __pyx_cur_scope->__pyx_t_2; __pyx_cur_scope->__pyx_t_2 = 0; - __Pyx_XGOTREF(__pyx_t_11); - __pyx_t_18 = __pyx_cur_scope->__pyx_t_6; - __pyx_t_19 = __pyx_cur_scope->__pyx_t_7; - __pyx_t_24 = __pyx_cur_scope->__pyx_t_3; + __Pyx_XGOTREF(__pyx_t_10); + __pyx_t_17 = __pyx_cur_scope->__pyx_t_6; + __pyx_t_18 = __pyx_cur_scope->__pyx_t_7; + __pyx_t_23 = __pyx_cur_scope->__pyx_t_3; __pyx_cur_scope->__pyx_t_3 = 0; - __Pyx_XGOTREF(__pyx_t_24); - __pyx_t_25 = __pyx_cur_scope->__pyx_t_4; + __Pyx_XGOTREF(__pyx_t_23); + __pyx_t_24 = __pyx_cur_scope->__pyx_t_4; __pyx_cur_scope->__pyx_t_4 = 0; - __Pyx_XGOTREF(__pyx_t_25); - __pyx_t_26 = __pyx_cur_scope->__pyx_t_5; + __Pyx_XGOTREF(__pyx_t_24); + __pyx_t_25 = __pyx_cur_scope->__pyx_t_5; __pyx_cur_scope->__pyx_t_5 = 0; - __Pyx_XGOTREF(__pyx_t_26); - __pyx_t_27 = __pyx_cur_scope->__pyx_t_8; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 329, __pyx_L42_error) + __Pyx_XGOTREF(__pyx_t_25); + __pyx_t_26 = __pyx_cur_scope->__pyx_t_8; + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 343, __pyx_L45_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, 329, __pyx_L42_error) + else __PYX_ERR(0, 343, __pyx_L45_error) } } } if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_26); __Pyx_XGIVEREF(__pyx_t_25); __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_ExceptionReset(__pyx_t_26, __pyx_t_25, __pyx_t_24); + __Pyx_XGIVEREF(__pyx_t_23); + __Pyx_ExceptionReset(__pyx_t_25, __pyx_t_24, __pyx_t_23); } - __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ErrRestore(__pyx_t_11, __pyx_t_10, __pyx_t_9); - __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; - __pyx_lineno = __pyx_t_19; __pyx_clineno = __pyx_t_18; __pyx_filename = __pyx_t_27; + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ErrRestore(__pyx_t_10, __pyx_t_9, __pyx_t_8); + __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; + __pyx_lineno = __pyx_t_18; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_26; goto __pyx_L1_error; - __pyx_L42_error:; + __pyx_L45_error:; if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_26); __Pyx_XGIVEREF(__pyx_t_25); __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_ExceptionReset(__pyx_t_26, __pyx_t_25, __pyx_t_24); + __Pyx_XGIVEREF(__pyx_t_23); + __Pyx_ExceptionReset(__pyx_t_25, __pyx_t_24, __pyx_t_23); } - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; goto __pyx_L1_error; } __pyx_L5_return: { __Pyx_PyThreadState_assign - __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26) < 0)) __Pyx_ErrFetch(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26); + __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25) < 0)) __Pyx_ErrFetch(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25); + __Pyx_XGOTREF(__pyx_t_23); __Pyx_XGOTREF(__pyx_t_24); __Pyx_XGOTREF(__pyx_t_25); - __Pyx_XGOTREF(__pyx_t_26); + __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __pyx_t_23 = __pyx_r; + __pyx_t_22 = __pyx_r; __pyx_r = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; + __pyx_t_12 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; @@ -10427,10 +10680,10 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + PyObject *__pyx_callargs[2] = {__pyx_t_12, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } @@ -10438,69 +10691,69 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { + __Pyx_XGIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_8; __Pyx_XGIVEREF(__pyx_t_9); - __pyx_cur_scope->__pyx_t_0 = __pyx_t_9; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_9; __Pyx_XGIVEREF(__pyx_t_10); - __pyx_cur_scope->__pyx_t_1 = __pyx_t_10; - __Pyx_XGIVEREF(__pyx_t_11); - __pyx_cur_scope->__pyx_t_2 = __pyx_t_11; + __pyx_cur_scope->__pyx_t_2 = __pyx_t_10; + __Pyx_XGIVEREF(__pyx_t_22); + __pyx_cur_scope->__pyx_t_3 = __pyx_t_22; __Pyx_XGIVEREF(__pyx_t_23); - __pyx_cur_scope->__pyx_t_3 = __pyx_t_23; + __pyx_cur_scope->__pyx_t_4 = __pyx_t_23; __Pyx_XGIVEREF(__pyx_t_24); - __pyx_cur_scope->__pyx_t_4 = __pyx_t_24; + __pyx_cur_scope->__pyx_t_5 = __pyx_t_24; __Pyx_XGIVEREF(__pyx_t_25); - __pyx_cur_scope->__pyx_t_5 = __pyx_t_25; - __Pyx_XGIVEREF(__pyx_t_26); - __pyx_cur_scope->__pyx_t_9 = __pyx_t_26; + __pyx_cur_scope->__pyx_t_9 = __pyx_t_25; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 12; + __pyx_generator->resume_label = 13; return __pyx_r; - __pyx_L44_resume_from_await:; - __pyx_t_9 = __pyx_cur_scope->__pyx_t_0; + __pyx_L47_resume_from_await:; + __pyx_t_8 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_10 = __pyx_cur_scope->__pyx_t_1; + __Pyx_XGOTREF(__pyx_t_8); + __pyx_t_9 = __pyx_cur_scope->__pyx_t_1; __pyx_cur_scope->__pyx_t_1 = 0; - __Pyx_XGOTREF(__pyx_t_10); - __pyx_t_11 = __pyx_cur_scope->__pyx_t_2; + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_10 = __pyx_cur_scope->__pyx_t_2; __pyx_cur_scope->__pyx_t_2 = 0; - __Pyx_XGOTREF(__pyx_t_11); - __pyx_t_23 = __pyx_cur_scope->__pyx_t_3; + __Pyx_XGOTREF(__pyx_t_10); + __pyx_t_22 = __pyx_cur_scope->__pyx_t_3; __pyx_cur_scope->__pyx_t_3 = 0; - __Pyx_XGOTREF(__pyx_t_23); - __pyx_t_24 = __pyx_cur_scope->__pyx_t_4; + __Pyx_XGOTREF(__pyx_t_22); + __pyx_t_23 = __pyx_cur_scope->__pyx_t_4; __pyx_cur_scope->__pyx_t_4 = 0; - __Pyx_XGOTREF(__pyx_t_24); - __pyx_t_25 = __pyx_cur_scope->__pyx_t_5; + __Pyx_XGOTREF(__pyx_t_23); + __pyx_t_24 = __pyx_cur_scope->__pyx_t_5; __pyx_cur_scope->__pyx_t_5 = 0; - __Pyx_XGOTREF(__pyx_t_25); - __pyx_t_26 = __pyx_cur_scope->__pyx_t_9; + __Pyx_XGOTREF(__pyx_t_24); + __pyx_t_25 = __pyx_cur_scope->__pyx_t_9; __pyx_cur_scope->__pyx_t_9 = 0; - __Pyx_XGOTREF(__pyx_t_26); - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 329, __pyx_L1_error) + __Pyx_XGOTREF(__pyx_t_25); + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 343, __pyx_L1_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, 329, __pyx_L1_error) + else __PYX_ERR(0, 343, __pyx_L1_error) } } - __pyx_r = __pyx_t_23; - __pyx_t_23 = 0; + __pyx_r = __pyx_t_22; + __pyx_t_22 = 0; if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); } + __Pyx_XGIVEREF(__pyx_t_23); __Pyx_XGIVEREF(__pyx_t_24); __Pyx_XGIVEREF(__pyx_t_25); - __Pyx_XGIVEREF(__pyx_t_26); - __Pyx_ErrRestore(__pyx_t_24, __pyx_t_25, __pyx_t_26); - __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; + __Pyx_ErrRestore(__pyx_t_23, __pyx_t_24, __pyx_t_25); + __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; goto __pyx_L0; } __pyx_L7:; @@ -10524,10 +10777,10 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_16); __Pyx_AddTraceback("process_custom_amount_input", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_r = 0; @@ -10541,7 +10794,7 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_14generator4(__pyx_ } static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_17generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "handlers/payments/yookassa_pay.py":332 +/* "handlers/payments/yookassa_pay.py":346 * * * async def _send_message(callback_query: types.CallbackQuery | types.Message, text: str, reply_markup=None): # <<<<<<<<<<<<<< @@ -10610,7 +10863,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 332, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 346, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -10618,21 +10871,21 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 332, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 346, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("_send_message", 0, 2, 3, 1); __PYX_ERR(0, 332, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_send_message", 0, 2, 3, 1); __PYX_ERR(0, 346, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reply_markup); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 332, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 346, __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_message") < 0)) __PYX_ERR(0, 332, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_send_message") < 0)) __PYX_ERR(0, 346, __pyx_L3_error) } } else { switch (__pyx_nargs) { @@ -10650,7 +10903,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_send_message", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 332, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("_send_message", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 346, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -10664,7 +10917,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_text), (&PyUnicode_Type), 0, "text", 1))) __PYX_ERR(0, 332, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_text), (&PyUnicode_Type), 0, "text", 1))) __PYX_ERR(0, 346, __pyx_L1_error) __pyx_r = __pyx_pf_8handlers_8payments_12yookassa_pay_15_send_message(__pyx_self, __pyx_v_callback_query, __pyx_v_text, __pyx_v_reply_markup); /* function exit code */ @@ -10694,7 +10947,7 @@ static PyObject *__pyx_pf_8handlers_8payments_12yookassa_pay_15_send_message(CYT if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 332, __pyx_L1_error) + __PYX_ERR(0, 346, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -10708,7 +10961,7 @@ static PyObject *__pyx_pf_8handlers_8payments_12yookassa_pay_15_send_message(CYT __Pyx_INCREF(__pyx_cur_scope->__pyx_v_reply_markup); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_reply_markup); { - __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_8handlers_8payments_12yookassa_pay_17generator5, __pyx_codeobj__33, (PyObject *) __pyx_cur_scope, __pyx_n_s_send_message, __pyx_n_s_send_message, __pyx_n_s_handlers_payments_yookassa_pay); if (unlikely(!gen)) __PYX_ERR(0, 332, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_8handlers_8payments_12yookassa_pay_17generator5, __pyx_codeobj__35, (PyObject *) __pyx_cur_scope, __pyx_n_s_send_message, __pyx_n_s_send_message, __pyx_n_s_handlers_payments_yookassa_pay); if (unlikely(!gen)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -10747,45 +11000,45 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_17generator5(__pyx_ return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 332, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 346, __pyx_L1_error) - /* "handlers/payments/yookassa_pay.py":334 + /* "handlers/payments/yookassa_pay.py":348 * async def _send_message(callback_query: types.CallbackQuery | types.Message, text: str, reply_markup=None): * """ .""" * if isinstance(callback_query, types.CallbackQuery): # <<<<<<<<<<<<<< * await callback_query.message.answer(text, reply_markup=reply_markup) * elif isinstance(callback_query, types.Message): */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_CallbackQuery); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_CallbackQuery); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = PyObject_IsInstance(__pyx_cur_scope->__pyx_v_callback_query, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_t_3 = PyObject_IsInstance(__pyx_cur_scope->__pyx_v_callback_query, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "handlers/payments/yookassa_pay.py":335 + /* "handlers/payments/yookassa_pay.py":349 * """ .""" * if isinstance(callback_query, types.CallbackQuery): * await callback_query.message.answer(text, reply_markup=reply_markup) # <<<<<<<<<<<<<< * elif isinstance(callback_query, types.Message): * await callback_query.answer(text, reply_markup=reply_markup) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_callback_query, __pyx_n_s_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 335, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_callback_query, __pyx_n_s_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_answer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_answer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 335, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_text); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_text); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_text)) __PYX_ERR(0, 335, __pyx_L1_error); - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 335, __pyx_L1_error) + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_text)) __PYX_ERR(0, 349, __pyx_L1_error); + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_reply_markup, __pyx_cur_scope->__pyx_v_reply_markup) < 0) __PYX_ERR(0, 335, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 335, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_reply_markup, __pyx_cur_scope->__pyx_v_reply_markup) < 0) __PYX_ERR(0, 349, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -10801,16 +11054,16 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_17generator5(__pyx_ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L5_resume_from_await:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 335, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 349, __pyx_L1_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, 335, __pyx_L1_error) + else __PYX_ERR(0, 349, __pyx_L1_error) } } - /* "handlers/payments/yookassa_pay.py":334 + /* "handlers/payments/yookassa_pay.py":348 * async def _send_message(callback_query: types.CallbackQuery | types.Message, text: str, reply_markup=None): * """ .""" * if isinstance(callback_query, types.CallbackQuery): # <<<<<<<<<<<<<< @@ -10820,37 +11073,37 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_17generator5(__pyx_ goto __pyx_L4; } - /* "handlers/payments/yookassa_pay.py":336 + /* "handlers/payments/yookassa_pay.py":350 * if isinstance(callback_query, types.CallbackQuery): * await callback_query.message.answer(text, reply_markup=reply_markup) * elif isinstance(callback_query, types.Message): # <<<<<<<<<<<<<< * await callback_query.answer(text, reply_markup=reply_markup) */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_types); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 336, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_types); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Message); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Message); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = PyObject_IsInstance(__pyx_cur_scope->__pyx_v_callback_query, __pyx_t_4); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 336, __pyx_L1_error) + __pyx_t_3 = PyObject_IsInstance(__pyx_cur_scope->__pyx_v_callback_query, __pyx_t_4); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_3) { - /* "handlers/payments/yookassa_pay.py":337 + /* "handlers/payments/yookassa_pay.py":351 * await callback_query.message.answer(text, reply_markup=reply_markup) * elif isinstance(callback_query, types.Message): * await callback_query.answer(text, reply_markup=reply_markup) # <<<<<<<<<<<<<< */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_callback_query, __pyx_n_s_answer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_callback_query, __pyx_n_s_answer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 351, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 351, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_text); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_text); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_text)) __PYX_ERR(0, 337, __pyx_L1_error); - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error) + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_text)) __PYX_ERR(0, 351, __pyx_L1_error); + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_reply_markup, __pyx_cur_scope->__pyx_v_reply_markup) < 0) __PYX_ERR(0, 337, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_reply_markup, __pyx_cur_scope->__pyx_v_reply_markup) < 0) __PYX_ERR(0, 351, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -10866,16 +11119,16 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_17generator5(__pyx_ __pyx_generator->resume_label = 2; return __pyx_r; __pyx_L6_resume_from_await:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 337, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 351, __pyx_L1_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, 337, __pyx_L1_error) + else __PYX_ERR(0, 351, __pyx_L1_error) } } - /* "handlers/payments/yookassa_pay.py":336 + /* "handlers/payments/yookassa_pay.py":350 * if isinstance(callback_query, types.CallbackQuery): * await callback_query.message.answer(text, reply_markup=reply_markup) * elif isinstance(callback_query, types.Message): # <<<<<<<<<<<<<< @@ -10885,7 +11138,7 @@ static PyObject *__pyx_gb_8handlers_8payments_12yookassa_pay_17generator5(__pyx_ __pyx_L4:; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "handlers/payments/yookassa_pay.py":332 + /* "handlers/payments/yookassa_pay.py":346 * * * async def _send_message(callback_query: types.CallbackQuery | types.Message, text: str, reply_markup=None): # <<<<<<<<<<<<<< @@ -11743,8 +11996,10 @@ static void __pyx_tp_dealloc_8handlers_8payments_12yookassa_pay___pyx_scope_stru Py_CLEAR(p->__pyx_v_conn); Py_CLEAR(p->__pyx_v_e); Py_CLEAR(p->__pyx_v_payment); + Py_CLEAR(p->__pyx_v_payment_message); Py_CLEAR(p->__pyx_v_payment_url); Py_CLEAR(p->__pyx_v_session); + Py_CLEAR(p->__pyx_v_state_type); Py_CLEAR(p->__pyx_v_tg_id); Py_CLEAR(p->__pyx_v_user_data); Py_CLEAR(p->__pyx_t_0); @@ -11798,6 +12053,9 @@ static int __pyx_tp_traverse_8handlers_8payments_12yookassa_pay___pyx_scope_stru if (p->__pyx_v_session) { e = (*v)(p->__pyx_v_session, a); if (e) return e; } + if (p->__pyx_v_state_type) { + e = (*v)(p->__pyx_v_state_type, a); if (e) return e; + } if (p->__pyx_v_tg_id) { e = (*v)(p->__pyx_v_tg_id, a); if (e) return e; } @@ -12164,16 +12422,18 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_kp_u__25, __pyx_k__25, sizeof(__pyx_k__25), 0, 1, 0, 0}, {&__pyx_kp_u__26, __pyx_k__26, sizeof(__pyx_k__26), 0, 1, 0, 0}, {&__pyx_kp_u__27, __pyx_k__27, sizeof(__pyx_k__27), 0, 1, 0, 0}, - {&__pyx_n_u__28, __pyx_k__28, sizeof(__pyx_k__28), 0, 1, 0, 1}, + {&__pyx_kp_u__28, __pyx_k__28, sizeof(__pyx_k__28), 0, 1, 0, 0}, {&__pyx_kp_u__29, __pyx_k__29, sizeof(__pyx_k__29), 0, 1, 0, 0}, {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0}, {&__pyx_kp_u__30, __pyx_k__30, sizeof(__pyx_k__30), 0, 1, 0, 0}, - {&__pyx_kp_u__31, __pyx_k__31, sizeof(__pyx_k__31), 0, 1, 0, 0}, + {&__pyx_n_u__31, __pyx_k__31, sizeof(__pyx_k__31), 0, 1, 0, 1}, {&__pyx_kp_u__32, __pyx_k__32, sizeof(__pyx_k__32), 0, 1, 0, 0}, - {&__pyx_n_s__34, __pyx_k__34, sizeof(__pyx_k__34), 0, 0, 1, 1}, - {&__pyx_kp_u__35, __pyx_k__35, sizeof(__pyx_k__35), 0, 1, 0, 0}, + {&__pyx_kp_u__33, __pyx_k__33, sizeof(__pyx_k__33), 0, 1, 0, 0}, + {&__pyx_kp_u__34, __pyx_k__34, sizeof(__pyx_k__34), 0, 1, 0, 0}, + {&__pyx_n_s__36, __pyx_k__36, sizeof(__pyx_k__36), 0, 0, 1, 1}, + {&__pyx_kp_u__37, __pyx_k__37, sizeof(__pyx_k__37), 0, 1, 0, 0}, {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0}, - {&__pyx_n_s__44, __pyx_k__44, sizeof(__pyx_k__44), 0, 0, 1, 1}, + {&__pyx_n_s__46, __pyx_k__46, sizeof(__pyx_k__46), 0, 0, 1, 1}, {&__pyx_kp_u__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 1, 0, 0}, {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0}, {&__pyx_kp_u__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 1, 0, 0}, @@ -12281,6 +12541,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_payment, __pyx_k_payment, sizeof(__pyx_k_payment), 0, 0, 1, 1}, {&__pyx_n_u_payment, __pyx_k_payment, sizeof(__pyx_k_payment), 0, 1, 0, 1}, {&__pyx_n_s_payment_id, __pyx_k_payment_id, sizeof(__pyx_k_payment_id), 0, 0, 1, 1}, + {&__pyx_n_s_payment_message, __pyx_k_payment_message, sizeof(__pyx_k_payment_message), 0, 0, 1, 1}, {&__pyx_n_u_payment_mode, __pyx_k_payment_mode, sizeof(__pyx_k_payment_mode), 0, 1, 0, 1}, {&__pyx_n_s_payment_object, __pyx_k_payment_object, sizeof(__pyx_k_payment_object), 0, 0, 1, 1}, {&__pyx_n_u_payment_subject, __pyx_k_payment_subject, sizeof(__pyx_k_payment_subject), 0, 1, 0, 1}, @@ -12317,6 +12578,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1}, {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1}, {&__pyx_n_u_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 1, 0, 1}, + {&__pyx_n_s_state_type, __pyx_k_state_type, sizeof(__pyx_k_state_type), 0, 0, 1, 1}, {&__pyx_n_s_status, __pyx_k_status, sizeof(__pyx_k_status), 0, 0, 1, 1}, {&__pyx_n_u_status, __pyx_k_status, sizeof(__pyx_k_status), 0, 1, 0, 1}, {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1}, @@ -12347,6 +12609,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_u_vat_code, __pyx_k_vat_code, sizeof(__pyx_k_vat_code), 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_s_waiting_for_payment_confirmation, __pyx_k_waiting_for_payment_confirmation, sizeof(__pyx_k_waiting_for_payment_confirmation), 0, 0, 1, 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}, {&__pyx_n_s_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 0, 0, 1, 1}, {&__pyx_n_s_web, __pyx_k_web, sizeof(__pyx_k_web), 0, 0, 1, 1}, {&__pyx_n_u_yookassa, __pyx_k_yookassa, sizeof(__pyx_k_yookassa), 0, 1, 0, 1}, @@ -12394,14 +12657,14 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); - /* "handlers/payments/yookassa_pay.py":256 + /* "handlers/payments/yookassa_pay.py":262 * return * * amount = user_data["data"].get("required_amount", 0) # <<<<<<<<<<<<<< + * * elif isinstance(callback_query, types.Message): - * tg_id = callback_query.chat.id */ - __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_u_required_amount, __pyx_int_0); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_u_required_amount, __pyx_int_0); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); @@ -12412,10 +12675,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * async def process_callback_pay_yookassa( * callback_query: types.CallbackQuery, state: FSMContext, session: Any */ - __pyx_tuple__36 = PyTuple_Pack(9, __pyx_n_s_callback_query, __pyx_n_s_state, __pyx_n_s_session, __pyx_n_s_expected_hash, __pyx_n_s_tg_id, __pyx_n_s_builder, __pyx_n_s_i, __pyx_n_s_key_count, __pyx_n_s_exists); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__36); - __Pyx_GIVEREF(__pyx_tuple__36); - __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_yookassa_pay_p, __pyx_n_s_process_callback_pay_yookassa, 52, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_tuple__38 = PyTuple_Pack(9, __pyx_n_s_callback_query, __pyx_n_s_state, __pyx_n_s_session, __pyx_n_s_expected_hash, __pyx_n_s_tg_id, __pyx_n_s_builder, __pyx_n_s_i, __pyx_n_s_key_count, __pyx_n_s_exists); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_yookassa_pay_p, __pyx_n_s_process_callback_pay_yookassa, 52, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 52, __pyx_L1_error) /* "handlers/payments/yookassa_pay.py":110 * @@ -12424,13 +12687,13 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * async def process_amount_selection( * callback_query: types.CallbackQuery, state: FSMContext */ - __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_u_yookassa_amount); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_tuple__38 = PyTuple_Pack(11, __pyx_n_s_callback_query, __pyx_n_s_state, __pyx_n_s_data, __pyx_n_s_amount_str, __pyx_n_s_amount, __pyx_n_s_customer_name, __pyx_n_s_customer_id, __pyx_n_s_customer_email, __pyx_n_s_payment, __pyx_n_s_payment_url, __pyx_n_s_confirm_keyboard); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__38); - __Pyx_GIVEREF(__pyx_tuple__38); - __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_yookassa_pay_p, __pyx_n_s_process_amount_selection, 110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_u_yookassa_amount); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_tuple__40 = PyTuple_Pack(11, __pyx_n_s_callback_query, __pyx_n_s_state, __pyx_n_s_data, __pyx_n_s_amount_str, __pyx_n_s_amount, __pyx_n_s_customer_name, __pyx_n_s_customer_id, __pyx_n_s_customer_email, __pyx_n_s_payment, __pyx_n_s_payment_url, __pyx_n_s_confirm_keyboard); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_yookassa_pay_p, __pyx_n_s_process_amount_selection, 110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 110, __pyx_L1_error) /* "handlers/payments/yookassa_pay.py":184 * @@ -12439,10 +12702,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * """ * Yookassa . */ - __pyx_tuple__39 = PyTuple_Pack(10, __pyx_n_s_request, __pyx_n_s_event, __pyx_n_s_payment_object, __pyx_n_s_payment_id, __pyx_n_s_payment, __pyx_n_s_user_id_str, __pyx_n_s_amount_str, __pyx_n_s_user_id, __pyx_n_s_amount, __pyx_n_s_e); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_yookassa_pay_p, __pyx_n_s_yookassa_webhook, 184, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_tuple__41 = PyTuple_Pack(10, __pyx_n_s_request, __pyx_n_s_event, __pyx_n_s_payment_object, __pyx_n_s_payment_id, __pyx_n_s_payment, __pyx_n_s_user_id_str, __pyx_n_s_amount_str, __pyx_n_s_user_id, __pyx_n_s_amount, __pyx_n_s_e); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_yookassa_pay_p, __pyx_n_s_yookassa_webhook, 184, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 184, __pyx_L1_error) /* "handlers/payments/yookassa_pay.py":228 * @@ -12451,10 +12714,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * async def process_enter_custom_amount( * callback_query: types.CallbackQuery, state: FSMContext */ - __pyx_tuple__40 = PyTuple_Pack(3, __pyx_n_s_callback_query, __pyx_n_s_state, __pyx_n_s_builder); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__40); - __Pyx_GIVEREF(__pyx_tuple__40); - __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_yookassa_pay_p, __pyx_n_s_process_enter_custom_amount, 228, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 228, __pyx_L1_error) + __pyx_tuple__42 = PyTuple_Pack(3, __pyx_n_s_callback_query, __pyx_n_s_state, __pyx_n_s_builder); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_yookassa_pay_p, __pyx_n_s_process_enter_custom_amount, 228, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 228, __pyx_L1_error) /* "handlers/payments/yookassa_pay.py":244 * @@ -12463,25 +12726,25 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * async def process_custom_amount_input(callback_query: types.CallbackQuery | types.Message, session: Any): * conn = await asyncpg.connect(DATABASE_URL) */ - __pyx_tuple__41 = PyTuple_Pack(10, __pyx_n_s_callback_query, __pyx_n_s_session, __pyx_n_s_conn, __pyx_n_s_tg_id, __pyx_n_s_user_data, __pyx_n_s_amount, __pyx_n_s_payment, __pyx_n_s_payment_url, __pyx_n_s_confirm_keyboard, __pyx_n_s_e); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_yookassa_pay_p, __pyx_n_s_process_custom_amount_input, 244, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 244, __pyx_L1_error) + __pyx_tuple__43 = PyTuple_Pack(12, __pyx_n_s_callback_query, __pyx_n_s_session, __pyx_n_s_conn, __pyx_n_s_tg_id, __pyx_n_s_user_data, __pyx_n_s_state_type, __pyx_n_s_amount, __pyx_n_s_payment, __pyx_n_s_payment_url, __pyx_n_s_payment_message, __pyx_n_s_confirm_keyboard, __pyx_n_s_e); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__43); + __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_yookassa_pay_p, __pyx_n_s_process_custom_amount_input, 244, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 244, __pyx_L1_error) - /* "handlers/payments/yookassa_pay.py":332 + /* "handlers/payments/yookassa_pay.py":346 * * * async def _send_message(callback_query: types.CallbackQuery | types.Message, text: str, reply_markup=None): # <<<<<<<<<<<<<< * """ .""" * if isinstance(callback_query, types.CallbackQuery): */ - __pyx_tuple__42 = PyTuple_Pack(3, __pyx_n_s_callback_query, __pyx_n_s_text, __pyx_n_s_reply_markup); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__42); - __Pyx_GIVEREF(__pyx_tuple__42); - __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_yookassa_pay_p, __pyx_n_s_send_message, 332, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 332, __pyx_L1_error) - __pyx_tuple__43 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_tuple__44 = PyTuple_Pack(3, __pyx_n_s_callback_query, __pyx_n_s_text, __pyx_n_s_reply_markup); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_yookassa_pay_p, __pyx_n_s_send_message, 346, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 346, __pyx_L1_error) + __pyx_tuple__45 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__45); + __Pyx_GIVEREF(__pyx_tuple__45); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -12645,15 +12908,15 @@ static int __Pyx_modinit_type_init_code(void) { } #endif #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message_spec, NULL); if (unlikely(!__pyx_ptype_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message)) __PYX_ERR(0, 332, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message_spec, __pyx_ptype_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message) < 0) __PYX_ERR(0, 332, __pyx_L1_error) + __pyx_ptype_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message_spec, NULL); if (unlikely(!__pyx_ptype_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message)) __PYX_ERR(0, 346, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message_spec, __pyx_ptype_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message) < 0) __PYX_ERR(0, 346, __pyx_L1_error) #else __pyx_ptype_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message = &__pyx_type_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message) < 0) __PYX_ERR(0, 332, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message) < 0) __PYX_ERR(0, 346, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 __pyx_ptype_8handlers_8payments_12yookassa_pay___pyx_scope_struct_5__send_message->tp_print = 0; @@ -13744,7 +14007,7 @@ if (!__Pyx_RefNanny) { __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_startswith); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) @@ -13852,23 +14115,23 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_process_custom_amount_input, __pyx_t_2) < 0) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "handlers/payments/yookassa_pay.py":332 + /* "handlers/payments/yookassa_pay.py":346 * * * async def _send_message(callback_query: types.CallbackQuery | types.Message, text: str, reply_markup=None): # <<<<<<<<<<<<<< * """ .""" * if isinstance(callback_query, types.CallbackQuery): */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_callback_query, __pyx_kp_s_types_CallbackQuery_types_Messag) < 0) __PYX_ERR(0, 332, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_text, __pyx_n_s_str) < 0) __PYX_ERR(0, 332, __pyx_L1_error) - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8handlers_8payments_12yookassa_pay_16_send_message, __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_send_message, NULL, __pyx_n_s_handlers_payments_yookassa_pay, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_callback_query, __pyx_kp_s_types_CallbackQuery_types_Messag) < 0) __PYX_ERR(0, 346, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_text, __pyx_n_s_str) < 0) __PYX_ERR(0, 346, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8handlers_8payments_12yookassa_pay_16_send_message, __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_send_message, NULL, __pyx_n_s_handlers_payments_yookassa_pay, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__43); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__45); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_send_message, __pyx_t_3) < 0) __PYX_ERR(0, 332, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_send_message, __pyx_t_3) < 0) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "handlers/payments/yookassa_pay.py":1 @@ -17743,6 +18006,11 @@ bad: return (double)-1; } +/* RaiseUnboundLocalError */ + static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + /* ArgTypeTest */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { @@ -18089,7 +18357,7 @@ static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject * #endif static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { #if PY_MAJOR_VERSION < 3 - PyObject *module, *from_list, *star = __pyx_n_s__34; + PyObject *module, *from_list, *star = __pyx_n_s__36; CYTHON_UNUSED_VAR(parts_tuple); from_list = PyList_New(1); if (unlikely(!from_list)) @@ -18152,7 +18420,7 @@ static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) if (unlikely(!module_name_str)) { goto modbad; } module_name = PyUnicode_FromString(module_name_str); if (unlikely(!module_name)) { goto modbad; } - module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__35); + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__37); if (unlikely(!module_dot)) { goto modbad; } full_name = PyUnicode_Concat(module_dot, name); if (unlikely(!full_name)) { goto modbad; } @@ -20017,7 +20285,7 @@ __Pyx_PyType_GetName(PyTypeObject* tp) if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { PyErr_Clear(); Py_XDECREF(name); - name = __Pyx_NewRef(__pyx_n_s__44); + name = __Pyx_NewRef(__pyx_n_s__46); } return name; } 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 fdce4603..4aa687b2 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/profile.py b/handlers/profile.py index cc327e53..dfd5fa23 100644 --- a/handlers/profile.py +++ b/handlers/profile.py @@ -1,13 +1,13 @@ import os +from typing import Any import asyncpg from aiogram import F, Router, types from aiogram.fsm.context import FSMContext from aiogram.types import BufferedInputFile, InlineKeyboardButton from aiogram.utils.keyboard import InlineKeyboardBuilder -from config import DATABASE_URL, NEWS_MESSAGE, RENEWAL_PLANS -from typing import Any +from config import DATABASE_URL, NEWS_MESSAGE, RENEWAL_PLANS from database import get_balance, get_key_count, get_referral_stats, get_trial from handlers.buttons.profile import ( ADD_SUB, @@ -56,7 +56,7 @@ async def process_callback_view_profile( ) if key_count == 0: - profile_message += "\n
🔧 Нажмите кнопку ➕ Устройство, чтобы настроить VPN-подключение
" + profile_message += "\n
🔧 Нажмите кнопку ➕ Подписка, чтобы настроить VPN-подключение
" else: profile_message += f"\n
 {NEWS_MESSAGE}
" @@ -138,16 +138,25 @@ async def balance_history_handler(callback_query: types.CallbackQuery, session: FROM payments WHERE tg_id = $1 ORDER BY created_at DESC + LIMIT 3 """ records = await session.fetch(query, callback_query.from_user.id) - history_text = "📊 История операций с балансом:\n\n" - for record in records: - amount = record['amount'] - payment_system = record['payment_system'] - status = record['status'] - date = record['created_at'].strftime('%Y-%m-%d %H:%M:%S') - history_text += f"Сумма: {amount}\nСпособ оплаты: {payment_system}\nСтатус: {status}\nДата: {date}\n\n" + if records: + history_text = "📊 Последние 3 операции с балансом:\n\n" + for record in records: + amount = record['amount'] + payment_system = record['payment_system'] + status = record['status'] + date = record['created_at'].strftime('%Y-%m-%d %H:%M:%S') + history_text += ( + f"Сумма: {amount}₽\n" + f"Способ оплаты: {payment_system}\n" + f"Статус: {status}\n" + f"Дата: {date}\n\n" + ) + else: + history_text = "❌ У вас пока нет операций с балансом." await callback_query.message.answer( history_text, @@ -155,6 +164,7 @@ async def balance_history_handler(callback_query: types.CallbackQuery, session: ) + @router.message(F.text == "/tariffs") @router.callback_query(F.data == "view_tariffs") async def view_tariffs_handler(callback_query: types.CallbackQuery): diff --git a/handlers/start.py b/handlers/start.py index 4a45e0dd..d9c9ead5 100644 --- a/handlers/start.py +++ b/handlers/start.py @@ -11,6 +11,7 @@ from aiogram.types import ( Message, ) from aiogram.utils.keyboard import InlineKeyboardBuilder + from config import ( CHANNEL_EXISTS, CHANNEL_URL, @@ -21,7 +22,6 @@ from config import ( DOWNLOAD_IOS, SUPPORT_CHAT_URL, ) - from database import ( add_connection, add_referral, @@ -200,17 +200,22 @@ async def show_start_menu(message: Message, admin: bool, session: Any): builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile")) - builder.row( - InlineKeyboardButton(text="📞 Поддержка", url=SUPPORT_CHAT_URL), - InlineKeyboardButton(text="📢 Канал", url=CHANNEL_URL), - ) + if CHANNEL_EXISTS: + builder.row( + InlineKeyboardButton(text="📞 Поддержка", url=SUPPORT_CHAT_URL), + InlineKeyboardButton(text="📢 Канал", url=CHANNEL_URL) + ) + else: + builder.row( + InlineKeyboardButton(text="📞 Поддержка", url=SUPPORT_CHAT_URL) + ) if admin: builder.row( InlineKeyboardButton(text="🔧 Администратор", callback_data="admin") ) - builder.row(InlineKeyboardButton(text="🌐 О нашем VPN", callback_data="about_vpn")) + builder.row(InlineKeyboardButton(text="🌐 О VPN", callback_data="about_vpn")) if os.path.isfile(image_path): with open(image_path, "rb") as image_from_buffer: diff --git a/handlers/utils.py b/handlers/utils.py index ea0a9c91..b190e158 100644 --- a/handlers/utils.py +++ b/handlers/utils.py @@ -4,9 +4,9 @@ import re import aiohttp import asyncpg -from config import DATABASE_URL from bot import bot +from config import DATABASE_URL from database import get_servers_from_db from logger import logger diff --git a/middlewares/admin.py b/middlewares/admin.py index 85819d32..bc21afe4 100644 --- a/middlewares/admin.py +++ b/middlewares/admin.py @@ -3,6 +3,7 @@ from typing import Any from aiogram import BaseMiddleware from aiogram.types import TelegramObject + from config import ADMIN_ID diff --git a/middlewares/database.py b/middlewares/database.py index c625fec3..c9bf6906 100644 --- a/middlewares/database.py +++ b/middlewares/database.py @@ -4,6 +4,7 @@ from typing import Any import asyncpg from aiogram import BaseMiddleware from aiogram.types import TelegramObject + from config import DATABASE_URL diff --git a/servers.py b/servers.py index 9b9efe2c..eacfc9e9 100644 --- a/servers.py +++ b/servers.py @@ -5,10 +5,10 @@ from datetime import datetime, timedelta import asyncpg from aiogram.types import InlineKeyboardButton from aiogram.utils.keyboard import InlineKeyboardBuilder -from config import ADMIN_ID, DATABASE_URL, PING_TIME from ping3 import ping from bot import bot +from config import ADMIN_ID, DATABASE_URL, PING_TIME from database import get_servers_from_db from logger import logger