minor bug fixes and improvements

This commit is contained in:
Vladless
2025-03-21 09:26:30 +03:00
parent af497f644a
commit d3e502ce43
9 changed files with 1384 additions and 1255 deletions
+1
View File
@@ -226,6 +226,7 @@ async def toggle_client(xui: py3xui.AsyncApi, inbound_id: int, email: str, clien
logger.warning(f"Клиент с email {email} и ID {client_id} не найден.")
return False
client.sub_id = email
client.enable = enable
client.id = client_id
client.flow = "xtls-rprx-vision"
+2 -7
View File
@@ -2,11 +2,6 @@ PAY = "Пополнить"
PAY_2 = "Оплатить"
BACK = "⬅️ Назад"
CUSTOM_SUM = "💰 Ввести свою сумму"
CUSTOM_SUM_ANSWER = "Пожалуйста, введите сумму пополнения."
PROFILE = "👤 Личный кабинет"
KEY_CREATION_PAYMENT_MESSAGE = (
"Вы выбрали пополнение на {amount} рублей для создания нового ключа. Перейдите по ссылке для оплаты:"
)
KEY_RENEWAL_PAYMENT_MESSAGE = (
"Вы выбрали пополнение на {amount} рублей для продления ключа. Перейдите по ссылке для оплаты:"
)
DEFAULT_PAYMENT_MESSAGE = "Вы выбрали пополнение на {amount} рублей. Перейдите по ссылке для оплаты:"
DEFAULT_PAYMENT_MESSAGE = "Вы выбрали пополнение на {amount} рублей. Перейдите по ссылке для оплаты:"
+144 -82
View File
@@ -1,6 +1,7 @@
import asyncio
import locale
import os
import time
from datetime import datetime, timedelta
from typing import Any
@@ -53,7 +54,7 @@ from handlers.keys.key_utils import (
delete_key_from_cluster,
renew_key_in_cluster,
update_subscription,
toggle_client_on_cluster
toggle_client_on_cluster,
)
from handlers.payments.robokassa_pay import handle_custom_amount_input
from handlers.payments.yookassa_pay import process_custom_amount_input
@@ -142,79 +143,123 @@ async def process_callback_view_key(callback_query: CallbackQuery, session: Any)
try:
record = await get_key_details(key_name, session)
if record:
key = record["key"]
expiry_time = record["expiry_time"]
server_name = record["server_id"]
is_frozen = record["is_frozen"]
country = server_name
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 = "<b>🕒 Статус подписки:</b>\n🔴 Истекла\nОсталось часов: 0\nОсталось минут: 0"
else:
total_seconds = int(time_left.total_seconds())
days = total_seconds // 86400
hours = (total_seconds % 86400) // 3600
minutes = (total_seconds % 3600) // 60
days_left_message = f"Осталось: <b>{days}</b> дней, <b>{hours}</b> часов, <b>{minutes}</b> минут"
if is_frozen:
response_message = (
"Подписка заморожена.\n"
"Дата истечения будет обновлена после разморозки."
)
formatted_expiry_date = expiry_date.strftime("%d %B %Y года")
response_message = key_message(
key, formatted_expiry_date, days_left_message, server_name, country if USE_COUNTRY_SELECTION else None
)
builder = InlineKeyboardBuilder()
if not key.startswith(PUBLIC_LINK) or ENABLE_UPDATE_SUBSCRIPTION_BUTTON:
builder = InlineKeyboardBuilder()
builder.row(
InlineKeyboardButton(
text="🔄 Обновить подписку",
callback_data=f"update_subscription|{key_name}",
text="🟢 Разморозить подписку",
callback_data=f"unfreeze_subscription|{key_name}",
)
)
builder.row(InlineKeyboardButton(text="⬅️ Назад", callback_data="view_keys"))
builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile"))
if CONNECT_PHONE_BUTTON:
builder.row(
InlineKeyboardButton(text="📱 Подключить телефон", callback_data=f"connect_phone|{key_name}")
keyboard = builder.as_markup()
image_path = os.path.join("img", "pic_view.jpg")
if not os.path.isfile(image_path):
await callback_query.message.answer("Файл изображения не найден.")
return
await edit_or_send_message(
target_message=callback_query.message,
text=response_message,
reply_markup=keyboard,
media_path=image_path,
)
else:
builder.row(
InlineKeyboardButton(text=DOWNLOAD_IOS_BUTTON, url=DOWNLOAD_IOS),
InlineKeyboardButton(text=DOWNLOAD_ANDROID_BUTTON, url=DOWNLOAD_ANDROID),
)
builder.row(
InlineKeyboardButton(text=IMPORT_IOS, url=f"{CONNECT_IOS}{key}"),
InlineKeyboardButton(text=IMPORT_ANDROID, url=f"{CONNECT_ANDROID}{key}"),
key = record["key"]
expiry_time = record["expiry_time"]
server_name = record["server_id"]
country = server_name
expiry_date = datetime.utcfromtimestamp(expiry_time / 1000)
current_date = datetime.utcnow()
time_left = expiry_date - current_date
if time_left.total_seconds() <= 0:
days_left_message = (
"<b>🕒 Статус подписки:</b>\n🔴 Истекла\nОсталось часов: 0\nОсталось минут: 0"
)
else:
total_seconds = int(time_left.total_seconds())
days = total_seconds // 86400
hours = (total_seconds % 86400) // 3600
minutes = (total_seconds % 3600) // 60
days_left_message = (
f"Осталось: <b>{days}</b> дней, <b>{hours}</b> часов, <b>{minutes}</b> минут"
)
formatted_expiry_date = expiry_date.strftime("%d %B %Y года")
response_message = key_message(
key,
formatted_expiry_date,
days_left_message,
server_name,
country if USE_COUNTRY_SELECTION else None,
)
builder.row(
InlineKeyboardButton(text=PC_BUTTON, callback_data=f"connect_pc|{key_name}"),
InlineKeyboardButton(text=TV_BUTTON, callback_data=f"connect_tv|{key_name}"),
)
builder = InlineKeyboardBuilder()
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}"))
if USE_COUNTRY_SELECTION:
builder.row(
InlineKeyboardButton(text="🌍 Сменить локацию", callback_data=f"change_location|{key_name}")
)
if TOGGLE_CLIENT:
if is_frozen:
if not key.startswith(PUBLIC_LINK) or ENABLE_UPDATE_SUBSCRIPTION_BUTTON:
builder.row(
InlineKeyboardButton(
text="🟢 Разморозить подписку",
callback_data=f"unfreeze_subscription|{key_name}",
text="🔄 Обновить подписку",
callback_data=f"update_subscription|{key_name}",
)
)
if CONNECT_PHONE_BUTTON:
builder.row(
InlineKeyboardButton(
text="📱 Подключить телефон",
callback_data=f"connect_phone|{key_name}",
)
)
else:
builder.row(
InlineKeyboardButton(text=DOWNLOAD_IOS_BUTTON, url=DOWNLOAD_IOS),
InlineKeyboardButton(text=DOWNLOAD_ANDROID_BUTTON, url=DOWNLOAD_ANDROID),
)
builder.row(
InlineKeyboardButton(text=IMPORT_IOS, url=f"{CONNECT_IOS}{key}"),
InlineKeyboardButton(text=IMPORT_ANDROID, url=f"{CONNECT_ANDROID}{key}"),
)
builder.row(
InlineKeyboardButton(text=PC_BUTTON, callback_data=f"connect_pc|{key_name}"),
InlineKeyboardButton(text=TV_BUTTON, callback_data=f"connect_tv|{key_name}"),
)
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}"
)
)
if USE_COUNTRY_SELECTION:
builder.row(
InlineKeyboardButton(
text="🌍 Сменить локацию",
callback_data=f"change_location|{key_name}"
)
)
if TOGGLE_CLIENT:
builder.row(
InlineKeyboardButton(
text="🛑 Заморозить подписку",
@@ -222,23 +267,22 @@ async def process_callback_view_key(callback_query: CallbackQuery, session: Any)
)
)
builder.row(InlineKeyboardButton(text="⬅️ Назад", callback_data="view_keys"))
builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile"))
builder.row(InlineKeyboardButton(text="⬅️ Назад", callback_data="view_keys"))
builder.row(InlineKeyboardButton(text="👤 Личный кабинет", callback_data="profile"))
keyboard = builder.as_markup()
image_path = os.path.join("img", "pic_view.jpg")
keyboard = builder.as_markup()
image_path = os.path.join("img", "pic_view.jpg")
if not os.path.isfile(image_path):
await callback_query.message.answer("Файл изображения не найден.")
return
if not os.path.isfile(image_path):
await callback_query.message.answer("Файл изображения не найден.")
return
await edit_or_send_message(
target_message=callback_query.message,
text=response_message,
reply_markup=keyboard,
media_path=image_path,
)
await edit_or_send_message(
target_message=callback_query.message,
text=response_message,
reply_markup=keyboard,
media_path=image_path,
)
else:
await callback_query.message.answer(text="<b>Информация о подписке не найдена.</b>")
except Exception as e:
@@ -279,8 +323,7 @@ async def process_callback_unfreeze_subscription(callback_query: CallbackQuery,
@router.callback_query(F.data.startswith("unfreeze_subscription_confirm|"))
async def process_callback_unfreeze_subscription_confirm(callback_query: CallbackQuery, session: Any):
"""
Размораживает (включает) подписку без SQLAlchemy.
Параметр 'session' предполагается, что это asyncpg.Connection или аналог.
Размораживает (включает) подписку.
"""
tg_id = callback_query.message.chat.id
key_name = callback_query.data.split("|")[1]
@@ -296,19 +339,33 @@ async def process_callback_unfreeze_subscription_confirm(callback_query: Callbac
cluster_id = record["server_id"]
result = await toggle_client_on_cluster(cluster_id, email, client_id, enable=True)
if result["status"] == "success":
update_result = await session.execute(
now_ms = int(time.time() * 1000)
leftover = record["expiry_time"]
if leftover < 0:
leftover = 0
new_expiry_time = now_ms + leftover
await session.execute(
"""
UPDATE keys
SET is_frozen = FALSE
WHERE tg_id = $1
AND client_id = $2
SET expiry_time = $1,
is_frozen = FALSE
WHERE tg_id = $2
AND client_id = $3
""",
new_expiry_time,
record["tg_id"],
client_id
)
await renew_key_in_cluster(
cluster_id=cluster_id,
email=email,
client_id=client_id,
new_expiry_time=new_expiry_time,
total_gb=TOTAL_GB
)
text_ok = (
"✅ Подписка успешно включена.\n\n"
"Теперь трафик и время подписки будут расходоваться."
@@ -345,8 +402,6 @@ async def process_callback_unfreeze_subscription_confirm(callback_query: Callbac
async def process_callback_freeze_subscription(callback_query: CallbackQuery, session: Any):
"""
Показывает пользователю диалог подтверждения заморозки (отключения) подписки.
session здесь всё равно прокидывается, но в этой функции он не нужен,
т.к. мы пока ничего не читаем/не пишем в БД, а только задаём вопрос пользователю.
"""
tg_id = callback_query.message.chat.id
key_name = callback_query.data.split("|")[1]
@@ -397,13 +452,20 @@ async def process_callback_freeze_subscription_confirm(callback_query: CallbackQ
result = await toggle_client_on_cluster(cluster_id, email, client_id, enable=False)
if result["status"] == "success":
now_ms = int(time.time() * 1000)
time_left = record["expiry_time"] - now_ms
if time_left < 0:
time_left = 0
update_result = await session.execute(
"""
UPDATE keys
SET is_frozen = TRUE
WHERE tg_id = $1
AND client_id = $2
SET expiry_time = $1,
is_frozen = TRUE
WHERE tg_id = $2
AND client_id = $3
""",
time_left,
record["tg_id"],
client_id
)
@@ -66,6 +66,7 @@ async def periodic_notifications(bot: Bot):
try:
keys = await get_all_keys(session=conn)
keys = [k for k in keys if not k["is_frozen"]]
except Exception as e:
logger.error(f"Ошибка при получении ключей: {e}")
keys = []
File diff suppressed because it is too large Load Diff
+62 -19
View File
@@ -2670,6 +2670,7 @@ static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_request[] = "request";
static const char __pyx_k_session[] = "session";
static const char __pyx_k_user_id[] = "user_id";
static const char __pyx_k_web_app[] = "web_app";
static const char __pyx_k_Response[] = "Response";
static const char __pyx_k_amount_2[] = ", amount: ";
static const char __pyx_k_currency[] = "currency";
@@ -2688,6 +2689,7 @@ static const char __pyx_k_sha1_hash[] = "sha1_hash";
static const char __pyx_k_Account_ID[] = "Account ID: ";
static const char __pyx_k_FSMContext[] = "FSMContext";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_WebAppInfo[] = "WebAppInfo";
static const char __pyx_k_account_id[] = "account_id";
static const char __pyx_k_amount_str[] = "amount_str";
static const char __pyx_k_startswith[] = "startswith";
@@ -2832,6 +2834,7 @@ typedef struct {
PyObject *__pyx_n_s_State;
PyObject *__pyx_n_s_StatesGroup;
PyObject *__pyx_n_s_ValueError;
PyObject *__pyx_n_s_WebAppInfo;
PyObject *__pyx_kp_u_Webhook_event_received;
PyObject *__pyx_n_s_YOOKASSA_HASH;
PyObject *__pyx_n_s_YOOMONEY_ENABLE;
@@ -2989,6 +2992,7 @@ typedef struct {
PyObject *__pyx_n_s_waiting_for_payment_confirmation;
PyObject *__pyx_n_s_web;
PyObject *__pyx_kp_s_web_Request;
PyObject *__pyx_n_s_web_app;
PyObject *__pyx_n_u_withdraw_amount;
PyObject *__pyx_n_u_yoomoney;
PyObject *__pyx_n_u_yoomoney_2;
@@ -3081,6 +3085,7 @@ static int __pyx_m_clear(PyObject *m) {
Py_CLEAR(clear_module_state->__pyx_n_s_State);
Py_CLEAR(clear_module_state->__pyx_n_s_StatesGroup);
Py_CLEAR(clear_module_state->__pyx_n_s_ValueError);
Py_CLEAR(clear_module_state->__pyx_n_s_WebAppInfo);
Py_CLEAR(clear_module_state->__pyx_kp_u_Webhook_event_received);
Py_CLEAR(clear_module_state->__pyx_n_s_YOOKASSA_HASH);
Py_CLEAR(clear_module_state->__pyx_n_s_YOOMONEY_ENABLE);
@@ -3238,6 +3243,7 @@ static int __pyx_m_clear(PyObject *m) {
Py_CLEAR(clear_module_state->__pyx_n_s_waiting_for_payment_confirmation);
Py_CLEAR(clear_module_state->__pyx_n_s_web);
Py_CLEAR(clear_module_state->__pyx_kp_s_web_Request);
Py_CLEAR(clear_module_state->__pyx_n_s_web_app);
Py_CLEAR(clear_module_state->__pyx_n_u_withdraw_amount);
Py_CLEAR(clear_module_state->__pyx_n_u_yoomoney);
Py_CLEAR(clear_module_state->__pyx_n_u_yoomoney_2);
@@ -3308,6 +3314,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
Py_VISIT(traverse_module_state->__pyx_n_s_State);
Py_VISIT(traverse_module_state->__pyx_n_s_StatesGroup);
Py_VISIT(traverse_module_state->__pyx_n_s_ValueError);
Py_VISIT(traverse_module_state->__pyx_n_s_WebAppInfo);
Py_VISIT(traverse_module_state->__pyx_kp_u_Webhook_event_received);
Py_VISIT(traverse_module_state->__pyx_n_s_YOOKASSA_HASH);
Py_VISIT(traverse_module_state->__pyx_n_s_YOOMONEY_ENABLE);
@@ -3465,6 +3472,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
Py_VISIT(traverse_module_state->__pyx_n_s_waiting_for_payment_confirmation);
Py_VISIT(traverse_module_state->__pyx_n_s_web);
Py_VISIT(traverse_module_state->__pyx_kp_s_web_Request);
Py_VISIT(traverse_module_state->__pyx_n_s_web_app);
Py_VISIT(traverse_module_state->__pyx_n_u_withdraw_amount);
Py_VISIT(traverse_module_state->__pyx_n_u_yoomoney);
Py_VISIT(traverse_module_state->__pyx_n_u_yoomoney_2);
@@ -3545,6 +3553,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
#define __pyx_n_s_State __pyx_mstate_global->__pyx_n_s_State
#define __pyx_n_s_StatesGroup __pyx_mstate_global->__pyx_n_s_StatesGroup
#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError
#define __pyx_n_s_WebAppInfo __pyx_mstate_global->__pyx_n_s_WebAppInfo
#define __pyx_kp_u_Webhook_event_received __pyx_mstate_global->__pyx_kp_u_Webhook_event_received
#define __pyx_n_s_YOOKASSA_HASH __pyx_mstate_global->__pyx_n_s_YOOKASSA_HASH
#define __pyx_n_s_YOOMONEY_ENABLE __pyx_mstate_global->__pyx_n_s_YOOMONEY_ENABLE
@@ -3702,6 +3711,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
#define __pyx_n_s_waiting_for_payment_confirmation __pyx_mstate_global->__pyx_n_s_waiting_for_payment_confirmation
#define __pyx_n_s_web __pyx_mstate_global->__pyx_n_s_web
#define __pyx_kp_s_web_Request __pyx_mstate_global->__pyx_kp_s_web_Request
#define __pyx_n_s_web_app __pyx_mstate_global->__pyx_n_s_web_app
#define __pyx_n_u_withdraw_amount __pyx_mstate_global->__pyx_n_u_withdraw_amount
#define __pyx_n_u_yoomoney __pyx_mstate_global->__pyx_n_u_yoomoney
#define __pyx_n_u_yoomoney_2 __pyx_mstate_global->__pyx_n_u_yoomoney_2
@@ -4877,6 +4887,7 @@ static PyObject *__pyx_gb_8handlers_8payments_12yoomoney_pay_5generator1(__pyx_C
Py_UCS4 __pyx_t_12;
PyObject *__pyx_t_13 = NULL;
PyObject *__pyx_t_14 = NULL;
PyObject *__pyx_t_15 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -5130,26 +5141,36 @@ static PyObject *__pyx_gb_8handlers_8payments_12yoomoney_pay_5generator1(__pyx_C
__pyx_t_9 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 130, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_text, __pyx_n_u__8) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_url, __pyx_cur_scope->__pyx_v_payment_url) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
__pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 130, __pyx_L1_error)
__Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_WebAppInfo); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 130, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_13);
__pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 130, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_14);
if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_url, __pyx_cur_scope->__pyx_v_payment_url) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
__pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 130, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_web_app, __pyx_t_15) < 0) __PYX_ERR(0, 130, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 130, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 130, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_GIVEREF(__pyx_t_13);
if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_13)) __PYX_ERR(0, 130, __pyx_L1_error);
__pyx_t_13 = 0;
__Pyx_GIVEREF(__pyx_t_15);
if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_15)) __PYX_ERR(0, 130, __pyx_L1_error);
__pyx_t_15 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 131, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_13);
__Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 131, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_10 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 131, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_text, __pyx_kp_u__4) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_callback_data, __pyx_n_u_pay) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
__pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 131, __pyx_L1_error)
__pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 131, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_14);
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = PyList_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 131, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
@@ -5257,6 +5278,7 @@ static PyObject *__pyx_gb_8handlers_8payments_12yoomoney_pay_5generator1(__pyx_C
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_13);
__Pyx_XDECREF(__pyx_t_14);
__Pyx_XDECREF(__pyx_t_15);
__Pyx_AddTraceback("process_amount_selection", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r); __pyx_r = 0;
@@ -7037,6 +7059,7 @@ static PyObject *__pyx_gb_8handlers_8payments_12yoomoney_pay_14generator4(__pyx_
Py_UCS4 __pyx_t_8;
PyObject *__pyx_t_9 = NULL;
PyObject *__pyx_t_10 = NULL;
PyObject *__pyx_t_11 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
@@ -7302,26 +7325,36 @@ static PyObject *__pyx_gb_8handlers_8payments_12yoomoney_pay_14generator4(__pyx_
__pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_text, __pyx_n_u__8) < 0) __PYX_ERR(0, 212, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_url, __pyx_cur_scope->__pyx_v_payment_url) < 0) __PYX_ERR(0, 212, __pyx_L1_error)
__pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 212, __pyx_L1_error)
__Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_WebAppInfo); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 212, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 212, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_url, __pyx_cur_scope->__pyx_v_payment_url) < 0) __PYX_ERR(0, 212, __pyx_L1_error)
__pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 212, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_web_app, __pyx_t_11) < 0) __PYX_ERR(0, 212, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 212, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_9);
if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_9)) __PYX_ERR(0, 212, __pyx_L1_error);
__pyx_t_9 = 0;
__Pyx_GIVEREF(__pyx_t_11);
if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_11)) __PYX_ERR(0, 212, __pyx_L1_error);
__pyx_t_11 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 213, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 213, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 213, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_text, __pyx_kp_u__4) < 0) __PYX_ERR(0, 213, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_callback_data, __pyx_n_u_pay) < 0) __PYX_ERR(0, 213, __pyx_L1_error)
__pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 213, __pyx_L1_error)
__pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 213, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 213, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
@@ -7476,6 +7509,7 @@ static PyObject *__pyx_gb_8handlers_8payments_12yoomoney_pay_14generator4(__pyx_
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_AddTraceback("process_custom_amount_input", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r); __pyx_r = 0;
@@ -8473,6 +8507,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
{&__pyx_n_s_State, __pyx_k_State, sizeof(__pyx_k_State), 0, 0, 1, 1},
{&__pyx_n_s_StatesGroup, __pyx_k_StatesGroup, sizeof(__pyx_k_StatesGroup), 0, 0, 1, 1},
{&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
{&__pyx_n_s_WebAppInfo, __pyx_k_WebAppInfo, sizeof(__pyx_k_WebAppInfo), 0, 0, 1, 1},
{&__pyx_kp_u_Webhook_event_received, __pyx_k_Webhook_event_received, sizeof(__pyx_k_Webhook_event_received), 0, 1, 0, 0},
{&__pyx_n_s_YOOKASSA_HASH, __pyx_k_YOOKASSA_HASH, sizeof(__pyx_k_YOOKASSA_HASH), 0, 0, 1, 1},
{&__pyx_n_s_YOOMONEY_ENABLE, __pyx_k_YOOMONEY_ENABLE, sizeof(__pyx_k_YOOMONEY_ENABLE), 0, 0, 1, 1},
@@ -8630,6 +8665,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
{&__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_s_web, __pyx_k_web, sizeof(__pyx_k_web), 0, 0, 1, 1},
{&__pyx_kp_s_web_Request, __pyx_k_web_Request, sizeof(__pyx_k_web_Request), 0, 0, 1, 0},
{&__pyx_n_s_web_app, __pyx_k_web_app, sizeof(__pyx_k_web_app), 0, 0, 1, 1},
{&__pyx_n_u_withdraw_amount, __pyx_k_withdraw_amount, sizeof(__pyx_k_withdraw_amount), 0, 1, 0, 1},
{&__pyx_n_u_yoomoney, __pyx_k_yoomoney, sizeof(__pyx_k_yoomoney), 0, 1, 0, 1},
{&__pyx_n_u_yoomoney_2, __pyx_k_yoomoney_2, sizeof(__pyx_k_yoomoney_2), 0, 1, 0, 1},
@@ -9243,7 +9279,7 @@ if (!__Pyx_RefNanny) {
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
__pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_n_s_InlineKeyboardButton);
__Pyx_GIVEREF(__pyx_n_s_InlineKeyboardButton);
@@ -9251,6 +9287,9 @@ if (!__Pyx_RefNanny) {
__Pyx_INCREF(__pyx_n_s_InlineKeyboardMarkup);
__Pyx_GIVEREF(__pyx_n_s_InlineKeyboardMarkup);
if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_InlineKeyboardMarkup)) __PYX_ERR(0, 7, __pyx_L1_error);
__Pyx_INCREF(__pyx_n_s_WebAppInfo);
__Pyx_GIVEREF(__pyx_n_s_WebAppInfo);
if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_WebAppInfo)) __PYX_ERR(0, 7, __pyx_L1_error);
__pyx_t_3 = __Pyx_Import(__pyx_n_s_aiogram_types, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 7, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
@@ -9262,6 +9301,10 @@ if (!__Pyx_RefNanny) {
__Pyx_GOTREF(__pyx_t_2);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_InlineKeyboardMarkup, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_WebAppInfo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_WebAppInfo, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 8, __pyx_L1_error)
+1 -1
View File
File diff suppressed because one or more lines are too long