diff --git a/handlers/keys/key_management.py b/handlers/keys/key_management.py index f6e0efc0..038e5440 100644 --- a/handlers/keys/key_management.py +++ b/handlers/keys/key_management.py @@ -133,21 +133,21 @@ async def select_tariff_plan(callback_query: CallbackQuery, session: Any): duration_days = int(plan_id) * 30 balance = await get_balance(tg_id) - await save_temporary_data( - session, - tg_id, - "waiting_for_payment", - { - "plan_id": plan_id, - "plan_price": plan_price, - "duration_days": duration_days, - "required_amount": max(0, plan_price - balance), - }, - ) - if balance < plan_price: required_amount = plan_price - balance + await save_temporary_data( + session, + tg_id, + "waiting_for_payment", + { + "plan_id": plan_id, + "plan_price": plan_price, + "duration_days": duration_days, + "required_amount": required_amount, + }, + ) + if USE_NEW_PAYMENT_FLOW == "YOOKASSA": await process_custom_amount_input(callback_query, session) elif USE_NEW_PAYMENT_FLOW == "ROBOKASSA": diff --git a/handlers/payments/robokassa_pay.py b/handlers/payments/robokassa_pay.py index 3ece9a3a..f9cb7a6e 100644 --- a/handlers/payments/robokassa_pay.py +++ b/handlers/payments/robokassa_pay.py @@ -305,4 +305,4 @@ async def handle_custom_amount_input(message: types.Message | types.CallbackQuer if isinstance(message, types.CallbackQuery): await message.message.answer(error_message) else: - await message.answer(error_message) + await message.answer(error_message) \ No newline at end of file diff --git a/handlers/payments/utils.c b/handlers/payments/utils.c index 15747ba3..891c0233 100644 --- a/handlers/payments/utils.c +++ b/handlers/payments/utils.c @@ -1517,6 +1517,7 @@ struct __pyx_obj_8handlers_8payments_5utils___pyx_scope_struct__send_payment_suc PyObject *__pyx_v_new_expiry_time; PyObject *__pyx_v_plan; PyObject *__pyx_v_plan_price; + PyObject *__pyx_v_required_amount; PyObject *__pyx_v_state; PyObject *__pyx_v_temp_data; PyObject *__pyx_v_total_gb; @@ -2041,6 +2042,13 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif +/* PyIntFromDouble.proto */ +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value); +#else +#define __Pyx_PyInt_FromDouble(value) PyLong_FromDouble(value) +#endif + /* PyObjectFormatSimple.proto */ #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyObject_FormatSimple(s, f) (\ @@ -2063,6 +2071,10 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); PyObject_Format(s, f)) #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); + /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) @@ -2071,10 +2083,6 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject 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); - /* pep479.proto */ static void __Pyx_Generator_Replace_StopIteration(int in_async_gen); @@ -2319,10 +2327,11 @@ 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__4[] = " \320\275\320\265 \321\201\320\276\320\276\321\202\320\262\320\265\321\202\321\201\321\202\320\262\321\203\320\265\321\202 \320\276\320\266\320\270\320\264\320\260\320\265\320\274\320\276\320\271 \321\201\321\203\320\274\320\274\320\265 "; +static const char __pyx_k__5[] = "\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__6[] = ": "; +static const char __pyx_k__7[] = "*"; +static const char __pyx_k__9[] = "?"; static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_all[] = "all"; static const char __pyx_k_bot[] = "bot"; @@ -2357,6 +2366,7 @@ static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_logger[] = "logger"; static const char __pyx_k_utcnow[] = "utcnow"; static const char __pyx_k_ADD_KEY[] = "ADD_KEY"; +static const char __pyx_k_PAYMENT[] = "[PAYMENT] \320\237\320\273\320\260\321\202\320\265\320\266 "; static const char __pyx_k_PROFILE[] = "PROFILE"; static const char __pyx_k_asyncpg[] = "asyncpg"; static const char __pyx_k_balance[] = "balance"; @@ -2366,6 +2376,7 @@ static const char __pyx_k_connect[] = "connect"; static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_profile[] = "profile"; static const char __pyx_k_user_id[] = "user_id"; +static const char __pyx_k_warning[] = "warning"; static const char __pyx_k_database[] = "database"; static const char __pyx_k_datetime[] = "datetime"; static const char __pyx_k_total_gb[] = "total_gb"; @@ -2391,6 +2402,7 @@ 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_required_amount[] = "required_amount"; 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"; @@ -2447,16 +2459,18 @@ typedef struct { PyObject *__pyx_n_s_DATABASE_URL; PyObject *__pyx_n_s_InlineKeyboardBuilder; PyObject *__pyx_n_s_InlineKeyboardButton; + PyObject *__pyx_kp_u_PAYMENT; 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_kp_u__5; + PyObject *__pyx_kp_u__6; PyObject *__pyx_n_s__7; + PyObject *__pyx_n_s__9; PyObject *__pyx_n_s_aiogram_types; PyObject *__pyx_n_s_aiogram_utils_keyboard; PyObject *__pyx_n_s_all; @@ -2526,6 +2540,8 @@ typedef struct { PyObject *__pyx_n_u_plan_price; PyObject *__pyx_n_u_profile; PyObject *__pyx_n_s_reply_markup; + PyObject *__pyx_n_s_required_amount; + PyObject *__pyx_n_u_required_amount; PyObject *__pyx_n_s_row; PyObject *__pyx_n_s_send; PyObject *__pyx_n_s_send_message; @@ -2546,8 +2562,11 @@ typedef struct { PyObject *__pyx_n_u_view_keys; PyObject *__pyx_n_u_waiting_for_payment; PyObject *__pyx_n_u_waiting_for_renewal_payment; + PyObject *__pyx_n_s_warning; + PyObject *__pyx_int_0; PyObject *__pyx_codeobj_; - PyObject *__pyx_tuple__6; + PyObject *__pyx_tuple__3; + PyObject *__pyx_tuple__8; } __pyx_mstate; #if CYTHON_USE_MODULE_STATE @@ -2596,16 +2615,18 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_DATABASE_URL); Py_CLEAR(clear_module_state->__pyx_n_s_InlineKeyboardBuilder); Py_CLEAR(clear_module_state->__pyx_n_s_InlineKeyboardButton); + Py_CLEAR(clear_module_state->__pyx_kp_u_PAYMENT); 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_kp_u__5); + Py_CLEAR(clear_module_state->__pyx_kp_u__6); Py_CLEAR(clear_module_state->__pyx_n_s__7); + Py_CLEAR(clear_module_state->__pyx_n_s__9); 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); @@ -2675,6 +2696,8 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_u_plan_price); Py_CLEAR(clear_module_state->__pyx_n_u_profile); Py_CLEAR(clear_module_state->__pyx_n_s_reply_markup); + Py_CLEAR(clear_module_state->__pyx_n_s_required_amount); + Py_CLEAR(clear_module_state->__pyx_n_u_required_amount); Py_CLEAR(clear_module_state->__pyx_n_s_row); Py_CLEAR(clear_module_state->__pyx_n_s_send); Py_CLEAR(clear_module_state->__pyx_n_s_send_message); @@ -2695,8 +2718,11 @@ static int __pyx_m_clear(PyObject *m) { 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_n_s_warning); + Py_CLEAR(clear_module_state->__pyx_int_0); Py_CLEAR(clear_module_state->__pyx_codeobj_); - Py_CLEAR(clear_module_state->__pyx_tuple__6); + Py_CLEAR(clear_module_state->__pyx_tuple__3); + Py_CLEAR(clear_module_state->__pyx_tuple__8); return 0; } #endif @@ -2723,16 +2749,18 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_DATABASE_URL); Py_VISIT(traverse_module_state->__pyx_n_s_InlineKeyboardBuilder); Py_VISIT(traverse_module_state->__pyx_n_s_InlineKeyboardButton); + Py_VISIT(traverse_module_state->__pyx_kp_u_PAYMENT); 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_kp_u__5); + Py_VISIT(traverse_module_state->__pyx_kp_u__6); Py_VISIT(traverse_module_state->__pyx_n_s__7); + Py_VISIT(traverse_module_state->__pyx_n_s__9); 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); @@ -2802,6 +2830,8 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_u_plan_price); Py_VISIT(traverse_module_state->__pyx_n_u_profile); Py_VISIT(traverse_module_state->__pyx_n_s_reply_markup); + Py_VISIT(traverse_module_state->__pyx_n_s_required_amount); + Py_VISIT(traverse_module_state->__pyx_n_u_required_amount); Py_VISIT(traverse_module_state->__pyx_n_s_row); Py_VISIT(traverse_module_state->__pyx_n_s_send); Py_VISIT(traverse_module_state->__pyx_n_s_send_message); @@ -2822,8 +2852,11 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { 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_n_s_warning); + Py_VISIT(traverse_module_state->__pyx_int_0); Py_VISIT(traverse_module_state->__pyx_codeobj_); - Py_VISIT(traverse_module_state->__pyx_tuple__6); + Py_VISIT(traverse_module_state->__pyx_tuple__3); + Py_VISIT(traverse_module_state->__pyx_tuple__8); return 0; } #endif @@ -2860,16 +2893,18 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_DATABASE_URL __pyx_mstate_global->__pyx_n_s_DATABASE_URL #define __pyx_n_s_InlineKeyboardBuilder __pyx_mstate_global->__pyx_n_s_InlineKeyboardBuilder #define __pyx_n_s_InlineKeyboardButton __pyx_mstate_global->__pyx_n_s_InlineKeyboardButton +#define __pyx_kp_u_PAYMENT __pyx_mstate_global->__pyx_kp_u_PAYMENT #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_kp_u__5 __pyx_mstate_global->__pyx_kp_u__5 +#define __pyx_kp_u__6 __pyx_mstate_global->__pyx_kp_u__6 #define __pyx_n_s__7 __pyx_mstate_global->__pyx_n_s__7 +#define __pyx_n_s__9 __pyx_mstate_global->__pyx_n_s__9 #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 @@ -2939,6 +2974,8 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_u_plan_price __pyx_mstate_global->__pyx_n_u_plan_price #define __pyx_n_u_profile __pyx_mstate_global->__pyx_n_u_profile #define __pyx_n_s_reply_markup __pyx_mstate_global->__pyx_n_s_reply_markup +#define __pyx_n_s_required_amount __pyx_mstate_global->__pyx_n_s_required_amount +#define __pyx_n_u_required_amount __pyx_mstate_global->__pyx_n_u_required_amount #define __pyx_n_s_row __pyx_mstate_global->__pyx_n_s_row #define __pyx_n_s_send __pyx_mstate_global->__pyx_n_s_send #define __pyx_n_s_send_message __pyx_mstate_global->__pyx_n_s_send_message @@ -2959,8 +2996,11 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #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_n_s_warning __pyx_mstate_global->__pyx_n_s_warning +#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 #define __pyx_codeobj_ __pyx_mstate_global->__pyx_codeobj_ -#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6 +#define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3 +#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 /* #### 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 */ @@ -3139,20 +3179,20 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; int __pyx_t_10; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; + Py_ssize_t __pyx_t_11; + Py_UCS4 __pyx_t_12; int __pyx_t_13; - int __pyx_t_14; - char const *__pyx_t_15; - PyObject *__pyx_t_16 = NULL; - PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_14 = NULL; + int __pyx_t_15; + int __pyx_t_16; + char const *__pyx_t_17; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; PyObject *__pyx_t_22 = NULL; - Py_ssize_t __pyx_t_23; - Py_UCS4 __pyx_t_24; + PyObject *__pyx_t_23 = NULL; + PyObject *__pyx_t_24 = NULL; PyObject *__pyx_t_25 = NULL; char const *__pyx_t_26; int __pyx_lineno = 0; @@ -3164,20 +3204,19 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L11_resume_from_await; case 2: goto __pyx_L15_resume_from_await; - case 3: goto __pyx_L19_resume_from_await; - 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_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; + case 3: goto __pyx_L20_resume_from_await; + case 4: goto __pyx_L22_resume_from_await; + case 5: goto __pyx_L23_resume_from_await; + case 6: goto __pyx_L25_resume_from_await; + case 7: goto __pyx_L27_resume_from_await; + case 8: goto __pyx_L28_resume_from_await; + case 9: goto __pyx_L29_resume_from_await; + case 10: goto __pyx_L30_resume_from_await; + case 11: goto __pyx_L31_resume_from_await; + case 12: goto __pyx_L32_resume_from_await; + case 13: goto __pyx_L35_resume_from_await; + case 14: goto __pyx_L36_resume_from_await; + case 15: goto __pyx_L37_resume_from_await; default: /* CPython raises the right error here */ __Pyx_RefNannyFinishContext(); return NULL; @@ -3511,7 +3550,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO * state = temp_data["state"] * data = temp_data["data"] # <<<<<<<<<<<<<< * - * if state == "waiting_for_renewal_payment": + * required_amount = data.get("required_amount", 0) */ __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_temp_data, __pyx_n_u_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 29, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_5); @@ -3522,300 +3561,173 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO /* "handlers/payments/utils.py":31 * data = temp_data["data"] * - * if state == "waiting_for_renewal_payment": # <<<<<<<<<<<<<< - * from handlers.keys.keys import complete_key_renewal + * required_amount = data.get("required_amount", 0) # <<<<<<<<<<<<<< * + * if int(amount) != int(required_amount): */ - __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) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 31, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_required_amount = __pyx_t_9; + __pyx_t_9 = 0; + + /* "handlers/payments/utils.py":33 + * required_amount = data.get("required_amount", 0) + * + * if int(amount) != int(required_amount): # <<<<<<<<<<<<<< + * logger.warning(f"[PAYMENT] {amount} {required_amount}.") + * else: + */ + __pyx_t_9 = __Pyx_PyInt_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 33, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_cur_scope->__pyx_v_required_amount); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_9, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 33, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_10) { - /* "handlers/payments/utils.py":32 - * - * if state == "waiting_for_renewal_payment": - * from handlers.keys.keys import complete_key_renewal # <<<<<<<<<<<<<< - * - * plan = data.get("plan") - */ - __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_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") + * if int(amount) != int(required_amount): + * logger.warning(f"[PAYMENT] {amount} {required_amount}.") # <<<<<<<<<<<<<< + * else: + * if state == "waiting_for_renewal_payment": */ - __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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_logger); 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 (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_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") - */ - __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") - * - */ - __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") # <<<<<<<<<<<<<< - * - * 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") - * - * 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_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_warning); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 34, __pyx_L13_error) __Pyx_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_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_11 = 0; + __pyx_t_12 = 127; + __Pyx_INCREF(__pyx_kp_u_PAYMENT); + __pyx_t_12 = (65535 > __pyx_t_12) ? 65535 : __pyx_t_12; + __pyx_t_11 += 17; + __Pyx_GIVEREF(__pyx_kp_u_PAYMENT); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_PAYMENT); + __pyx_t_8 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 34, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_12; + __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u__4); + __pyx_t_12 = (65535 > __pyx_t_12) ? 65535 : __pyx_t_12; + __pyx_t_11 += 34; + __Pyx_GIVEREF(__pyx_kp_u__4); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__4); + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_required_amount, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_12; + __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u__2); + __pyx_t_11 += 1; + __Pyx_GIVEREF(__pyx_kp_u__2); + PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__2); + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __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_9))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L13_error) __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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "handlers/payments/utils.py":33 + * required_amount = data.get("required_amount", 0) + * + * if int(amount) != int(required_amount): # <<<<<<<<<<<<<< + * logger.warning(f"[PAYMENT] {amount} {required_amount}.") + * else: + */ + goto __pyx_L17; + } + + /* "handlers/payments/utils.py":36 + * logger.warning(f"[PAYMENT] {amount} {required_amount}.") + * else: + * if state == "waiting_for_renewal_payment": # <<<<<<<<<<<<<< + * from handlers.keys.keys import complete_key_renewal + * + */ + /*else*/ { + __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_state, __pyx_n_u_waiting_for_renewal_payment, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 36, __pyx_L13_error) + if (__pyx_t_10) { + + /* "handlers/payments/utils.py":37 + * else: + * if state == "waiting_for_renewal_payment": + * from handlers.keys.keys import complete_key_renewal # <<<<<<<<<<<<<< + * + * plan = data.get("plan") + */ + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_n_s_complete_key_renewal); + __Pyx_GIVEREF(__pyx_n_s_complete_key_renewal); + if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_complete_key_renewal)) __PYX_ERR(0, 37, __pyx_L13_error); + __pyx_t_9 = __Pyx_Import(__pyx_n_s_handlers_keys_keys, __pyx_t_4, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 37, __pyx_L13_error) __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_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_complete_key_renewal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_complete_key_renewal = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; + + /* "handlers/payments/utils.py":39 + * from handlers.keys.keys import complete_key_renewal + * + * plan = data.get("plan") # <<<<<<<<<<<<<< + * client_id = data.get("client_id") + * new_expiry_time = data.get("new_expiry_time") + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = 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)) { + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_7 = 1; @@ -3823,198 +3735,69 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO } #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); + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_u_plan}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 39, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __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":43 - * if not all([plan, client_id, new_expiry_time, email]): - * logger.error(f"[RENEW] {user_id}") - * return # <<<<<<<<<<<<<< + /* "handlers/payments/utils.py":40 * - * balance = await get_balance(user_id) + * 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_XDECREF(__pyx_r); - __pyx_r = NULL; - goto __pyx_L12_return; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_u_client_id}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 40, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_client_id = __pyx_t_9; + __pyx_t_9 = 0; /* "handlers/payments/utils.py":41 - * email = data.get("email") - * - * if not all([plan, client_id, new_expiry_time, email]): # <<<<<<<<<<<<<< - * logger.error(f"[RENEW] {user_id}") - * return + * 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") */ - } - - /* "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; - __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, 45, __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, 45, __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":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; - if (__pyx_t_11) { - - /* "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_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_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = NULL; + __pyx_t_6 = 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)) { + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_7 = 1; @@ -4022,102 +3805,522 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO } #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); + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_u_new_expiry_time}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 41, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); __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) + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_new_expiry_time = __pyx_t_9; + __pyx_t_9 = 0; + + /* "handlers/payments/utils.py":42 + * client_id = data.get("client_id") + * new_expiry_time = data.get("new_expiry_time") + * total_gb = data.get("total_gb") # <<<<<<<<<<<<<< + * cost = data.get("cost") + * email = data.get("email") + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; } } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_u_total_gb}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 42, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_total_gb = __pyx_t_9; + __pyx_t_9 = 0; - /* "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 clear_temporary_data(conn, user_id) + /* "handlers/payments/utils.py":43 + * new_expiry_time = data.get("new_expiry_time") + * total_gb = data.get("total_gb") + * cost = data.get("cost") # <<<<<<<<<<<<<< + * email = data.get("email") + * */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = NULL; - goto __pyx_L12_return; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_u_cost}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 43, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_cost = __pyx_t_9; + __pyx_t_9 = 0; + + /* "handlers/payments/utils.py":44 + * total_gb = data.get("total_gb") + * cost = data.get("cost") + * email = data.get("email") # <<<<<<<<<<<<<< + * + * if not all([plan, client_id, new_expiry_time, email]): + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_data, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_u_email}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 44, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_GIVEREF(__pyx_t_9); + __pyx_cur_scope->__pyx_v_email = __pyx_t_9; + __pyx_t_9 = 0; /* "handlers/payments/utils.py":46 + * email = data.get("email") * - * 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) + * if not all([plan, client_id, new_expiry_time, email]): # <<<<<<<<<<<<<< + * logger.error(f"[RENEW] {user_id}") + * return */ - } - - /* "handlers/payments/utils.py":51 - * return - * else: - * await clear_temporary_data(conn, user_id) # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L13_error) + __pyx_t_9 = PyList_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 46, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_plan); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_plan); + if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 0, __pyx_cur_scope->__pyx_v_plan)) __PYX_ERR(0, 46, __pyx_L13_error); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_client_id); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_client_id); + if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 1, __pyx_cur_scope->__pyx_v_client_id)) __PYX_ERR(0, 46, __pyx_L13_error); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_new_expiry_time); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new_expiry_time); + if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 2, __pyx_cur_scope->__pyx_v_new_expiry_time)) __PYX_ERR(0, 46, __pyx_L13_error); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_email); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_email); + if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 3, __pyx_cur_scope->__pyx_v_email)) __PYX_ERR(0, 46, __pyx_L13_error); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 46, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_13 = (!__pyx_t_10); + if (__pyx_t_13) { + + /* "handlers/payments/utils.py":47 + * + * if not all([plan, client_id, new_expiry_time, email]): + * logger.error(f"[RENEW] {user_id}") # <<<<<<<<<<<<<< + * return + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_logger); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 47, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_user_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 47, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_RENEW, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 47, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __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_6))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "handlers/payments/utils.py":48 + * 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":46 + * email = data.get("email") + * + * if not all([plan, client_id, new_expiry_time, email]): # <<<<<<<<<<<<<< + * logger.error(f"[RENEW] {user_id}") + * return + */ + } + + /* "handlers/payments/utils.py":50 + * return + * + * balance = await get_balance(user_id) # <<<<<<<<<<<<<< + * if balance >= cost: + * await complete_key_renewal(user_id, client_id, email, new_expiry_time, total_gb, cost, None, plan) + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_balance); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = 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); + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_6, 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, 51, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_user_id}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_L20_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, 50, __pyx_L13_error) + __pyx_t_4 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_4 = NULL; + if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_4) < 0) __PYX_ERR(0, 50, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_balance = __pyx_t_4; + __pyx_t_4 = 0; + + /* "handlers/payments/utils.py":51 + * + * balance = await get_balance(user_id) + * if balance >= cost: # <<<<<<<<<<<<<< + * await complete_key_renewal(user_id, client_id, email, new_expiry_time, total_gb, cost, None, plan) + * await clear_temporary_data(conn, user_id) + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_balance, __pyx_cur_scope->__pyx_v_cost, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L13_error) + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 51, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_13) { + + /* "handlers/payments/utils.py":52 + * balance = await get_balance(user_id) + * if balance >= cost: + * await complete_key_renewal(user_id, client_id, email, new_expiry_time, total_gb, cost, None, plan) # <<<<<<<<<<<<<< + * await clear_temporary_data(conn, user_id) + * return + */ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_complete_key_renewal); + __pyx_t_6 = __pyx_cur_scope->__pyx_v_complete_key_renewal; __pyx_t_5 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[9] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_user_id, __pyx_cur_scope->__pyx_v_client_id, __pyx_cur_scope->__pyx_v_email, __pyx_cur_scope->__pyx_v_new_expiry_time, __pyx_cur_scope->__pyx_v_total_gb, __pyx_cur_scope->__pyx_v_cost, Py_None, __pyx_cur_scope->__pyx_v_plan}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 8+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_r); + 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_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, 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 + * if balance >= cost: + * await complete_key_renewal(user_id, client_id, email, new_expiry_time, total_gb, cost, None, plan) + * await clear_temporary_data(conn, user_id) # <<<<<<<<<<<<<< + * return + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 53, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_conn, __pyx_cur_scope->__pyx_v_user_id}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_r); + 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_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, 53, __pyx_L13_error) + } else { + PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear(); + else __PYX_ERR(0, 53, __pyx_L13_error) + } + } + + /* "handlers/payments/utils.py":54 + * 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 # <<<<<<<<<<<<<< + * + * if state == "waiting_for_payment": + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = NULL; + goto __pyx_L12_return; + + /* "handlers/payments/utils.py":51 + * + * 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) + */ + } + + /* "handlers/payments/utils.py":36 + * logger.warning(f"[PAYMENT] {amount} {required_amount}.") + * else: + * if state == "waiting_for_renewal_payment": # <<<<<<<<<<<<<< + * from handlers.keys.keys import complete_key_renewal + * + */ + } + + /* "handlers/payments/utils.py":56 + * return + * + * if state == "waiting_for_payment": # <<<<<<<<<<<<<< + * plan_price = data["plan_price"] + * duration_days = data["duration_days"] + */ + __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_state, __pyx_n_u_waiting_for_payment, Py_EQ)); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 56, __pyx_L13_error) + if (__pyx_t_13) { + + /* "handlers/payments/utils.py":57 + * + * if state == "waiting_for_payment": + * plan_price = data["plan_price"] # <<<<<<<<<<<<<< + * duration_days = data["duration_days"] + * + */ + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_n_u_plan_price); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_plan_price = __pyx_t_4; + __pyx_t_4 = 0; + + /* "handlers/payments/utils.py":58 + * if state == "waiting_for_payment": + * plan_price = data["plan_price"] + * duration_days = data["duration_days"] # <<<<<<<<<<<<<< + * + * balance = await get_balance(user_id) + */ + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_n_u_duration_days); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_duration_days = __pyx_t_4; + __pyx_t_4 = 0; + + /* "handlers/payments/utils.py":60 + * duration_days = data["duration_days"] + * + * balance = await get_balance(user_id) # <<<<<<<<<<<<<< + * if balance >= plan_price: + * expiry_time = datetime.utcnow() + timedelta(days=duration_days) + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_balance); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_user_id}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { __Pyx_XGIVEREF(__pyx_t_1); @@ -4132,7 +4335,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO /* return from generator, awaiting value */ __pyx_generator->resume_label = 6; 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); @@ -4142,421 +4345,311 @@ 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, 51, __pyx_L13_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 60, __pyx_L13_error) + __pyx_t_4 = __pyx_sent_value; __Pyx_INCREF(__pyx_t_4); } 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) - } + __pyx_t_4 = NULL; + if (__Pyx_PyGen_FetchStopIterationValue(&__pyx_t_4) < 0) __PYX_ERR(0, 60, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); } - } - - /* "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":54 - * - * - * 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, 54, __pyx_L13_error) - if (__pyx_t_11) { - - /* "handlers/payments/utils.py":55 - * - * if state == "waiting_for_payment": - * plan_price = data["plan_price"] # <<<<<<<<<<<<<< - * duration_days = data["duration_days"] - * - */ - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_n_u_plan_price); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_cur_scope->__pyx_v_plan_price = __pyx_t_5; - __pyx_t_5 = 0; - - /* "handlers/payments/utils.py":56 - * if state == "waiting_for_payment": - * plan_price = data["plan_price"] - * duration_days = data["duration_days"] # <<<<<<<<<<<<<< - * - * balance = await get_balance(user_id) - */ - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_data, __pyx_n_u_duration_days); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_cur_scope->__pyx_v_duration_days = __pyx_t_5; - __pyx_t_5 = 0; - - /* "handlers/payments/utils.py":58 - * duration_days = data["duration_days"] - * - * balance = await get_balance(user_id) # <<<<<<<<<<<<<< - * if balance >= plan_price: - * expiry_time = datetime.utcnow() + timedelta(days=duration_days) - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_get_balance); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __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, 58, __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 = 7; - 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, 58, __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, 58, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_balance); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_balance, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - - /* "handlers/payments/utils.py":59 - * - * balance = await get_balance(user_id) - * if balance >= plan_price: # <<<<<<<<<<<<<< - * expiry_time = datetime.utcnow() + timedelta(days=duration_days) - * await create_key(user_id, expiry_time, None, conn, None) - */ - __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, 59, __pyx_L13_error) - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 59, __pyx_L13_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_11) { - - /* "handlers/payments/utils.py":60 - * balance = await get_balance(user_id) - * if balance >= plan_price: - * expiry_time = datetime.utcnow() + timedelta(days=duration_days) # <<<<<<<<<<<<<< - * await create_key(user_id, expiry_time, None, conn, None) - * - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_utcnow); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 60, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - __pyx_t_7 = 0; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - __pyx_t_7 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; - __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_timedelta); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 60, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_days, __pyx_cur_scope->__pyx_v_duration_days) < 0) __PYX_ERR(0, 60, __pyx_L13_error) - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_balance); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_balance, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); - __pyx_cur_scope->__pyx_v_expiry_time = __pyx_t_4; __pyx_t_4 = 0; /* "handlers/payments/utils.py":61 - * if balance >= plan_price: - * expiry_time = datetime.utcnow() + timedelta(days=duration_days) - * await create_key(user_id, expiry_time, None, conn, None) # <<<<<<<<<<<<<< * - * await update_balance(user_id, -plan_price) + * balance = await get_balance(user_id) + * if balance >= plan_price: # <<<<<<<<<<<<<< + * expiry_time = datetime.utcnow() + timedelta(days=duration_days) + * await create_key(user_id, expiry_time, None, conn, None) */ - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_create_key); - __pyx_t_9 = __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_9))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_7 = 1; - } - } - #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_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 5+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4); + __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_balance, __pyx_cur_scope->__pyx_v_plan_price, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L13_error) + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 61, __pyx_L13_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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, 61, __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, 61, __pyx_L13_error) - } - } + if (__pyx_t_13) { - /* "handlers/payments/utils.py":63 - * await create_key(user_id, expiry_time, None, conn, None) + /* "handlers/payments/utils.py":62 + * balance = await get_balance(user_id) + * if balance >= plan_price: + * expiry_time = datetime.utcnow() + timedelta(days=duration_days) # <<<<<<<<<<<<<< + * await create_key(user_id, expiry_time, None, conn, None) * - * await update_balance(user_id, -plan_price) # <<<<<<<<<<<<<< - * - * await clear_temporary_data(conn, user_id) */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_update_balance); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 63, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = PyNumber_Negative(__pyx_cur_scope->__pyx_v_plan_price); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 63, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - __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; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_datetime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 62, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_utcnow); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(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_5}; - __pyx_t_4 = __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; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_timedelta); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 62, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_days, __pyx_cur_scope->__pyx_v_duration_days) < 0) __PYX_ERR(0, 62, __pyx_L13_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 62, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XGOTREF(__pyx_r); - 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, 63, __pyx_L13_error) - } else { - PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear(); - else __PYX_ERR(0, 63, __pyx_L13_error) - } - } + __Pyx_GIVEREF(__pyx_t_6); + __pyx_cur_scope->__pyx_v_expiry_time = __pyx_t_6; + __pyx_t_6 = 0; - /* "handlers/payments/utils.py":65 - * await update_balance(user_id, -plan_price) + /* "handlers/payments/utils.py":63 + * if balance >= plan_price: + * 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) # <<<<<<<<<<<<<< - * return + * await update_balance(user_id, -plan_price) + */ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_create_key); + __pyx_t_9 = __pyx_cur_scope->__pyx_v_create_key; __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[6] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_user_id, __pyx_cur_scope->__pyx_v_expiry_time, Py_None, __pyx_cur_scope->__pyx_v_conn, Py_None}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 5+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 63, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_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_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, 63, __pyx_L13_error) + } else { + PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear(); + else __PYX_ERR(0, 63, __pyx_L13_error) + } + } + + /* "handlers/payments/utils.py":65 + * await create_key(user_id, expiry_time, None, conn, None) + * + * await update_balance(user_id, -plan_price) # <<<<<<<<<<<<<< + * await clear_temporary_data(conn, user_id) + * return + */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_update_balance); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 65, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = PyNumber_Negative(__pyx_cur_scope->__pyx_v_plan_price); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_user_id, __pyx_t_4}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_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_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, 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":66 + * + * await update_balance(user_id, -plan_price) + * await clear_temporary_data(conn, user_id) # <<<<<<<<<<<<<< + * return * */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 65, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = NULL; - __pyx_t_7 = 0; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_7 = 1; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __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[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_conn, __pyx_cur_scope->__pyx_v_user_id}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XGOTREF(__pyx_r); - 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, 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) + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_conn, __pyx_cur_scope->__pyx_v_user_id}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_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_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, 66, __pyx_L13_error) + } else { + PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear(); + else __PYX_ERR(0, 66, __pyx_L13_error) + } } - } - /* "handlers/payments/utils.py":66 - * - * await clear_temporary_data(conn, user_id) - * return # <<<<<<<<<<<<<< + /* "handlers/payments/utils.py":67 + * await update_balance(user_id, -plan_price) + * await clear_temporary_data(conn, user_id) + * return # <<<<<<<<<<<<<< * * builder.row( */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = NULL; - goto __pyx_L12_return; + __Pyx_XDECREF(__pyx_r); + __pyx_r = NULL; + goto __pyx_L12_return; - /* "handlers/payments/utils.py":59 + /* "handlers/payments/utils.py":61 * - * balance = await get_balance(user_id) - * if balance >= plan_price: # <<<<<<<<<<<<<< - * expiry_time = datetime.utcnow() + timedelta(days=duration_days) - * await create_key(user_id, expiry_time, None, conn, None) + * balance = await get_balance(user_id) + * if balance >= plan_price: # <<<<<<<<<<<<<< + * expiry_time = datetime.utcnow() + timedelta(days=duration_days) + * await create_key(user_id, expiry_time, None, conn, None) + */ + } + + /* "handlers/payments/utils.py":56 + * return + * + * if state == "waiting_for_payment": # <<<<<<<<<<<<<< + * plan_price = data["plan_price"] + * duration_days = data["duration_days"] */ } - - /* "handlers/payments/utils.py":54 - * - * - * if state == "waiting_for_payment": # <<<<<<<<<<<<<< - * plan_price = data["plan_price"] - * duration_days = data["duration_days"] - */ } + __pyx_L17:; /* "handlers/payments/utils.py":27 * try: @@ -4567,65 +4660,65 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO */ } - /* "handlers/payments/utils.py":68 - * return + /* "handlers/payments/utils.py":69 + * return * * builder.row( # <<<<<<<<<<<<<< * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"), * InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"), */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 68, __pyx_L13_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_9); - /* "handlers/payments/utils.py":69 + /* "handlers/payments/utils.py":70 * * builder.row( * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"), # <<<<<<<<<<<<<< * InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"), * ) */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L13_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 69, __pyx_L13_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ADD_KEY); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 70, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_8); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ADD_KEY); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 69, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_text, __pyx_t_6) < 0) __PYX_ERR(0, 69, __pyx_L13_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_callback_data, __pyx_n_u_create_key) < 0) __PYX_ERR(0, 69, __pyx_L13_error) - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 69, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_text, __pyx_t_8) < 0) __PYX_ERR(0, 70, __pyx_L13_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_callback_data, __pyx_n_u_create_key) < 0) __PYX_ERR(0, 70, __pyx_L13_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 70, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "handlers/payments/utils.py":70 + /* "handlers/payments/utils.py":71 * builder.row( * InlineKeyboardButton(text=ADD_KEY, callback_data="create_key"), * InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"), # <<<<<<<<<<<<<< * ) * await bot.send_message( */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 70, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L13_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 71, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_RENEW_KEY); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 70, __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, 70, __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_view_keys) < 0) __PYX_ERR(0, 70, __pyx_L13_error) - __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 70, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_RENEW_KEY); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 71, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_14); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_text, __pyx_t_14) < 0) __PYX_ERR(0, 71, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_callback_data, __pyx_n_u_view_keys) < 0) __PYX_ERR(0, 71, __pyx_L13_error) + __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 71, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_5)) { + __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_5); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); __pyx_t_7 = 1; @@ -4633,113 +4726,179 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO } #endif { - PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_t_12}; - __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_4); + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_8, __pyx_t_14}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 69, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "handlers/payments/utils.py":72 + /* "handlers/payments/utils.py":73 * InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"), * ) * await bot.send_message( # <<<<<<<<<<<<<< * chat_id=user_id, * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_bot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_send_message); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 72, __pyx_L13_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_bot); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 73, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_send_message); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 73, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "handlers/payments/utils.py":73 + /* "handlers/payments/utils.py":74 * ) * await bot.send_message( * chat_id=user_id, # <<<<<<<<<<<<<< * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), * reply_markup=builder.as_markup(), */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_chat_id, __pyx_cur_scope->__pyx_v_user_id) < 0) __PYX_ERR(0, 73, __pyx_L13_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_chat_id, __pyx_cur_scope->__pyx_v_user_id) < 0) __PYX_ERR(0, 74, __pyx_L13_error) - /* "handlers/payments/utils.py":74 + /* "handlers/payments/utils.py":75 * 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, 74, __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, 74, __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, 74, __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, 74, __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, 74, __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, 74, __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_4, __pyx_n_s_text, __pyx_t_5) < 0) __PYX_ERR(0, 73, __pyx_L13_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_PAYMENT_SUCCESS_MESSAGE); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 75, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 75, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 75, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_4 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_amount, __pyx_t_4) < 0) __PYX_ERR(0, 75, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_text, __pyx_t_4) < 0) __PYX_ERR(0, 74, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "handlers/payments/utils.py":75 + /* "handlers/payments/utils.py":76 * 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, 75, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_6 = NULL; + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_as_markup); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 76, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_8 = 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); + if (likely(PyMethod_Check(__pyx_t_14))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_14); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); + __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); + __Pyx_DECREF_SET(__pyx_t_14, 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, 75, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_14, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_reply_markup, __pyx_t_5) < 0) __PYX_ERR(0, 73, __pyx_L13_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_reply_markup, __pyx_t_4) < 0) __PYX_ERR(0, 74, __pyx_L13_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "handlers/payments/utils.py":72 + /* "handlers/payments/utils.py":73 * InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys"), * ) * await bot.send_message( # <<<<<<<<<<<<<< * chat_id=user_id, * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 72, __pyx_L13_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XGOTREF(__pyx_r); + 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_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, 73, __pyx_L13_error) + } else { + PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear(); + else __PYX_ERR(0, 73, __pyx_L13_error) + } + } + + /* "handlers/payments/utils.py":78 + * reply_markup=builder.as_markup(), + * ) + * await clear_temporary_data(conn, user_id) # <<<<<<<<<<<<<< + * + * finally: + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = NULL; + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_7 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_cur_scope->__pyx_v_conn, __pyx_cur_scope->__pyx_v_user_id}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L13_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4); __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); @@ -4754,72 +4913,6 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO /* 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, 72, __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, 72, __pyx_L13_error) - } - } - - /* "handlers/payments/utils.py":77 - * reply_markup=builder.as_markup(), - * ) - * await clear_temporary_data(conn, user_id) # <<<<<<<<<<<<<< - * - * finally: - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_clear_temporary_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __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_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[3] = {__pyx_t_9, __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_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 77, __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 = 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; @@ -4830,17 +4923,17 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; __pyx_cur_scope->__pyx_t_2 = 0; __Pyx_XGOTREF(__pyx_t_3); - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 77, __pyx_L13_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 78, __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) + else __PYX_ERR(0, 78, __pyx_L13_error) } } } - /* "handlers/payments/utils.py":80 + /* "handlers/payments/utils.py":81 * * finally: * await conn.close() # <<<<<<<<<<<<<< @@ -4849,32 +4942,32 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); __pyx_t_9 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_6, 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_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __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, 80, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { __Pyx_XGIVEREF(__pyx_t_1); @@ -4887,7 +4980,7 @@ 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 = 13; + __pyx_generator->resume_label = 12; return __pyx_r; __pyx_L32_resume_from_await:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; @@ -4899,12 +4992,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, 80, __pyx_L4_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 81, __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, 80, __pyx_L4_error) + else __PYX_ERR(0, 81, __pyx_L4_error) } } goto __pyx_L14; @@ -4912,49 +5005,49 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __pyx_L13_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_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 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); - __Pyx_XGOTREF(__pyx_t_17); + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); - __pyx_t_13 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename; + __Pyx_XGOTREF(__pyx_t_22); + __Pyx_XGOTREF(__pyx_t_23); + __pyx_t_15 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename; { - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L34_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L34_error) + __Pyx_GOTREF(__pyx_t_6); __pyx_t_9 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_6, 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_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __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, 80, __pyx_L34_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L34_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { __Pyx_XGIVEREF(__pyx_t_1); @@ -4963,26 +5056,26 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; __Pyx_XGIVEREF(__pyx_t_3); __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; - __pyx_cur_scope->__pyx_t_3 = __pyx_t_13; - __pyx_cur_scope->__pyx_t_4 = __pyx_t_14; - __pyx_cur_scope->__pyx_t_5 = __pyx_t_15; - __Pyx_XGIVEREF(__pyx_t_16); - __pyx_cur_scope->__pyx_t_6 = __pyx_t_16; - __Pyx_XGIVEREF(__pyx_t_17); - __pyx_cur_scope->__pyx_t_7 = __pyx_t_17; + __pyx_cur_scope->__pyx_t_3 = __pyx_t_15; + __pyx_cur_scope->__pyx_t_4 = __pyx_t_16; + __pyx_cur_scope->__pyx_t_5 = __pyx_t_17; __Pyx_XGIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_t_8 = __pyx_t_18; + __pyx_cur_scope->__pyx_t_6 = __pyx_t_18; __Pyx_XGIVEREF(__pyx_t_19); - __pyx_cur_scope->__pyx_t_9 = __pyx_t_19; + __pyx_cur_scope->__pyx_t_7 = __pyx_t_19; __Pyx_XGIVEREF(__pyx_t_20); - __pyx_cur_scope->__pyx_t_10 = __pyx_t_20; + __pyx_cur_scope->__pyx_t_8 = __pyx_t_20; __Pyx_XGIVEREF(__pyx_t_21); - __pyx_cur_scope->__pyx_t_11 = __pyx_t_21; + __pyx_cur_scope->__pyx_t_9 = __pyx_t_21; + __Pyx_XGIVEREF(__pyx_t_22); + __pyx_cur_scope->__pyx_t_10 = __pyx_t_22; + __Pyx_XGIVEREF(__pyx_t_23); + __pyx_cur_scope->__pyx_t_11 = __pyx_t_23; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 14; + __pyx_generator->resume_label = 13; return __pyx_r; __pyx_L35_resume_from_await:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; @@ -4994,101 +5087,101 @@ 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); - __pyx_t_13 = __pyx_cur_scope->__pyx_t_3; - __pyx_t_14 = __pyx_cur_scope->__pyx_t_4; - __pyx_t_15 = __pyx_cur_scope->__pyx_t_5; - __pyx_t_16 = __pyx_cur_scope->__pyx_t_6; + __pyx_t_15 = __pyx_cur_scope->__pyx_t_3; + __pyx_t_16 = __pyx_cur_scope->__pyx_t_4; + __pyx_t_17 = __pyx_cur_scope->__pyx_t_5; + __pyx_t_18 = __pyx_cur_scope->__pyx_t_6; __pyx_cur_scope->__pyx_t_6 = 0; - __Pyx_XGOTREF(__pyx_t_16); - __pyx_t_17 = __pyx_cur_scope->__pyx_t_7; - __pyx_cur_scope->__pyx_t_7 = 0; - __Pyx_XGOTREF(__pyx_t_17); - __pyx_t_18 = __pyx_cur_scope->__pyx_t_8; - __pyx_cur_scope->__pyx_t_8 = 0; __Pyx_XGOTREF(__pyx_t_18); - __pyx_t_19 = __pyx_cur_scope->__pyx_t_9; - __pyx_cur_scope->__pyx_t_9 = 0; + __pyx_t_19 = __pyx_cur_scope->__pyx_t_7; + __pyx_cur_scope->__pyx_t_7 = 0; __Pyx_XGOTREF(__pyx_t_19); - __pyx_t_20 = __pyx_cur_scope->__pyx_t_10; - __pyx_cur_scope->__pyx_t_10 = 0; + __pyx_t_20 = __pyx_cur_scope->__pyx_t_8; + __pyx_cur_scope->__pyx_t_8 = 0; __Pyx_XGOTREF(__pyx_t_20); - __pyx_t_21 = __pyx_cur_scope->__pyx_t_11; - __pyx_cur_scope->__pyx_t_11 = 0; + __pyx_t_21 = __pyx_cur_scope->__pyx_t_9; + __pyx_cur_scope->__pyx_t_9 = 0; __Pyx_XGOTREF(__pyx_t_21); - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 80, __pyx_L34_error) + __pyx_t_22 = __pyx_cur_scope->__pyx_t_10; + __pyx_cur_scope->__pyx_t_10 = 0; + __Pyx_XGOTREF(__pyx_t_22); + __pyx_t_23 = __pyx_cur_scope->__pyx_t_11; + __pyx_cur_scope->__pyx_t_11 = 0; + __Pyx_XGOTREF(__pyx_t_23); + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 81, __pyx_L34_error) } 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, 80, __pyx_L34_error) + else __PYX_ERR(0, 81, __pyx_L34_error) } } } if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_19); - __Pyx_XGIVEREF(__pyx_t_20); __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21); + __Pyx_XGIVEREF(__pyx_t_22); + __Pyx_XGIVEREF(__pyx_t_23); + __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23); } - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); - __Pyx_ErrRestore(__pyx_t_16, __pyx_t_17, __pyx_t_18); - __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; + __Pyx_XGIVEREF(__pyx_t_19); + __Pyx_XGIVEREF(__pyx_t_20); + __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20); + __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; + __pyx_lineno = __pyx_t_15; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17; goto __pyx_L4_error; __pyx_L34_error:; if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_19); - __Pyx_XGIVEREF(__pyx_t_20); __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21); + __Pyx_XGIVEREF(__pyx_t_22); + __Pyx_XGIVEREF(__pyx_t_23); + __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23); } - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; goto __pyx_L4_error; } __pyx_L12_return: { __Pyx_PyThreadState_assign - __pyx_t_21 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0; __pyx_t_17 = 0; __pyx_t_16 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19); + __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_19, &__pyx_t_18); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21); + __Pyx_XGOTREF(__pyx_t_23); + __Pyx_XGOTREF(__pyx_t_22); __Pyx_XGOTREF(__pyx_t_21); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_18); - __Pyx_XGOTREF(__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_16); - __pyx_t_22 = __pyx_r; + __pyx_t_24 = __pyx_r; __pyx_r = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_conn, __pyx_n_s_close); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); __pyx_t_9 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_6, 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_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __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, 80, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { __Pyx_XGIVEREF(__pyx_t_1); @@ -5097,25 +5190,25 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __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_16); - __pyx_cur_scope->__pyx_t_6 = __pyx_t_16; - __Pyx_XGIVEREF(__pyx_t_17); - __pyx_cur_scope->__pyx_t_7 = __pyx_t_17; __Pyx_XGIVEREF(__pyx_t_18); - __pyx_cur_scope->__pyx_t_8 = __pyx_t_18; + __pyx_cur_scope->__pyx_t_6 = __pyx_t_18; __Pyx_XGIVEREF(__pyx_t_19); - __pyx_cur_scope->__pyx_t_9 = __pyx_t_19; + __pyx_cur_scope->__pyx_t_7 = __pyx_t_19; __Pyx_XGIVEREF(__pyx_t_20); - __pyx_cur_scope->__pyx_t_10 = __pyx_t_20; + __pyx_cur_scope->__pyx_t_8 = __pyx_t_20; __Pyx_XGIVEREF(__pyx_t_21); - __pyx_cur_scope->__pyx_t_11 = __pyx_t_21; + __pyx_cur_scope->__pyx_t_9 = __pyx_t_21; __Pyx_XGIVEREF(__pyx_t_22); - __pyx_cur_scope->__pyx_t_12 = __pyx_t_22; + __pyx_cur_scope->__pyx_t_10 = __pyx_t_22; + __Pyx_XGIVEREF(__pyx_t_23); + __pyx_cur_scope->__pyx_t_11 = __pyx_t_23; + __Pyx_XGIVEREF(__pyx_t_24); + __pyx_cur_scope->__pyx_t_12 = __pyx_t_24; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, awaiting value */ - __pyx_generator->resume_label = 15; + __pyx_generator->resume_label = 14; return __pyx_r; __pyx_L36_resume_from_await:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; @@ -5127,48 +5220,48 @@ 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); - __pyx_t_16 = __pyx_cur_scope->__pyx_t_6; + __pyx_t_18 = __pyx_cur_scope->__pyx_t_6; __pyx_cur_scope->__pyx_t_6 = 0; - __Pyx_XGOTREF(__pyx_t_16); - __pyx_t_17 = __pyx_cur_scope->__pyx_t_7; - __pyx_cur_scope->__pyx_t_7 = 0; - __Pyx_XGOTREF(__pyx_t_17); - __pyx_t_18 = __pyx_cur_scope->__pyx_t_8; - __pyx_cur_scope->__pyx_t_8 = 0; __Pyx_XGOTREF(__pyx_t_18); - __pyx_t_19 = __pyx_cur_scope->__pyx_t_9; - __pyx_cur_scope->__pyx_t_9 = 0; + __pyx_t_19 = __pyx_cur_scope->__pyx_t_7; + __pyx_cur_scope->__pyx_t_7 = 0; __Pyx_XGOTREF(__pyx_t_19); - __pyx_t_20 = __pyx_cur_scope->__pyx_t_10; - __pyx_cur_scope->__pyx_t_10 = 0; + __pyx_t_20 = __pyx_cur_scope->__pyx_t_8; + __pyx_cur_scope->__pyx_t_8 = 0; __Pyx_XGOTREF(__pyx_t_20); - __pyx_t_21 = __pyx_cur_scope->__pyx_t_11; - __pyx_cur_scope->__pyx_t_11 = 0; + __pyx_t_21 = __pyx_cur_scope->__pyx_t_9; + __pyx_cur_scope->__pyx_t_9 = 0; __Pyx_XGOTREF(__pyx_t_21); - __pyx_t_22 = __pyx_cur_scope->__pyx_t_12; - __pyx_cur_scope->__pyx_t_12 = 0; + __pyx_t_22 = __pyx_cur_scope->__pyx_t_10; + __pyx_cur_scope->__pyx_t_10 = 0; __Pyx_XGOTREF(__pyx_t_22); - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 80, __pyx_L4_error) + __pyx_t_23 = __pyx_cur_scope->__pyx_t_11; + __pyx_cur_scope->__pyx_t_11 = 0; + __Pyx_XGOTREF(__pyx_t_23); + __pyx_t_24 = __pyx_cur_scope->__pyx_t_12; + __pyx_cur_scope->__pyx_t_12 = 0; + __Pyx_XGOTREF(__pyx_t_24); + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 81, __pyx_L4_error) } 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, 80, __pyx_L4_error) + else __PYX_ERR(0, 81, __pyx_L4_error) } } - __pyx_r = __pyx_t_22; - __pyx_t_22 = 0; + __pyx_r = __pyx_t_24; + __pyx_t_24 = 0; if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_20); + __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_18); - __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16); + __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __pyx_t_18); } + __Pyx_XGIVEREF(__pyx_t_23); + __Pyx_XGIVEREF(__pyx_t_22); __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_XGIVEREF(__pyx_t_20); - __Pyx_XGIVEREF(__pyx_t_19); - __Pyx_ErrRestore(__pyx_t_21, __pyx_t_20, __pyx_t_19); - __pyx_t_21 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0; __pyx_t_17 = 0; __pyx_t_16 = 0; + __Pyx_ErrRestore(__pyx_t_23, __pyx_t_22, __pyx_t_21); + __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; __pyx_t_20 = 0; __pyx_t_19 = 0; __pyx_t_18 = 0; goto __pyx_L8_try_return; } __pyx_L14:; @@ -5184,7 +5277,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO goto __pyx_L10; } - /* "handlers/payments/utils.py":82 + /* "handlers/payments/utils.py":83 * await conn.close() * else: * builder.row(InlineKeyboardButton(text=ADD_KEY, callback_data="create_key")) # <<<<<<<<<<<<<< @@ -5192,159 +5285,159 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO * */ /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 82, __pyx_L4_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 83, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_12 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 82, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ADD_KEY); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __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, 82, __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_create_key) < 0) __PYX_ERR(0, 82, __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, 82, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_14 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 83, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ADD_KEY); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_text, __pyx_t_8) < 0) __PYX_ERR(0, 83, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_callback_data, __pyx_n_u_create_key) < 0) __PYX_ERR(0, 83, __pyx_L4_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_12); + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_14)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_7 = 1; } } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_6}; - __pyx_t_5 = __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; + PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "handlers/payments/utils.py":83 + /* "handlers/payments/utils.py":84 * else: * builder.row(InlineKeyboardButton(text=ADD_KEY, callback_data="create_key")) * builder.row(InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys")) # <<<<<<<<<<<<<< * * await bot.send_message( */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L4_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_row); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_12 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 83, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_RENEW_KEY); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 83, __pyx_L4_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_InlineKeyboardButton); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 84, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_14 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 84, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_RENEW_KEY); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 84, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_text, __pyx_t_9) < 0) __PYX_ERR(0, 83, __pyx_L4_error) + if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_text, __pyx_t_9) < 0) __PYX_ERR(0, 84, __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_view_keys) < 0) __PYX_ERR(0, 83, __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, 83, __pyx_L4_error) + if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_callback_data, __pyx_n_u_view_keys) < 0) __PYX_ERR(0, 84, __pyx_L4_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 84, __pyx_L4_error) __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_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_12); + if (likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_14)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_7 = 1; } } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_9}; - __pyx_t_5 = __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; + PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_9}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "handlers/payments/utils.py":85 + /* "handlers/payments/utils.py":86 * builder.row(InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys")) * * await bot.send_message( # <<<<<<<<<<<<<< * chat_id=user_id, * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_bot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L4_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, 85, __pyx_L4_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_bot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_send_message); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "handlers/payments/utils.py":86 + /* "handlers/payments/utils.py":87 * * 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, 86, __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, 86, __pyx_L4_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_chat_id, __pyx_cur_scope->__pyx_v_user_id) < 0) __PYX_ERR(0, 87, __pyx_L4_error) - /* "handlers/payments/utils.py":87 + /* "handlers/payments/utils.py":88 * 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, 87, __pyx_L4_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_PAYMENT_SUCCESS_MESSAGE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 88, __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, 87, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_format); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 88, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 87, __pyx_L4_error) + __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 88, __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, 87, __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, 87, __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, 87, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_8 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_amount); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 88, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_amount, __pyx_t_8) < 0) __PYX_ERR(0, 88, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 88, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_text, __pyx_t_6) < 0) __PYX_ERR(0, 86, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_text, __pyx_t_8) < 0) __PYX_ERR(0, 87, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "handlers/payments/utils.py":88 + /* "handlers/payments/utils.py":89 * 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, 88, __pyx_L4_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_builder, __pyx_n_s_as_markup); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 89, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_12 = NULL; + __pyx_t_14 = 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)) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_14)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); __pyx_t_7 = 1; @@ -5352,29 +5445,29 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO } #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, 88, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); + PyObject *__pyx_callargs[2] = {__pyx_t_14, NULL}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L4_error) + __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_6) < 0) __PYX_ERR(0, 86, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_reply_markup, __pyx_t_8) < 0) __PYX_ERR(0, 87, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "handlers/payments/utils.py":85 + /* "handlers/payments/utils.py":86 * builder.row(InlineKeyboardButton(text=RENEW_KEY, callback_data="view_keys")) * * await bot.send_message( # <<<<<<<<<<<<<< * chat_id=user_id, * text=PAYMENT_SUCCESS_MESSAGE.format(amount=amount), */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 85, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - __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_6); + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __Pyx_Coroutine_Yield_From(__pyx_generator, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XGOTREF(__pyx_r); if (likely(__pyx_r)) { __Pyx_XGIVEREF(__pyx_t_1); @@ -5387,7 +5480,7 @@ 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 = 16; + __pyx_generator->resume_label = 15; return __pyx_r; __pyx_L37_resume_from_await:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; @@ -5399,12 +5492,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, 85, __pyx_L4_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 86, __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, 85, __pyx_L4_error) + else __PYX_ERR(0, 86, __pyx_L4_error) } } } @@ -5423,102 +5516,106 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L9_try_end; __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "handlers/payments/utils.py":91 + /* "handlers/payments/utils.py":92 * ) * * except Exception as e: # <<<<<<<<<<<<<< * logger.error(f" {user_id}: {e}") + * */ - __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_14) { + __pyx_t_16 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_16) { __Pyx_AddTraceback("handlers.payments.utils.send_payment_success_notification", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 91, __pyx_L6_except_error) - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_5); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(0, 92, __pyx_L6_except_error) + __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_cur_scope->__pyx_v_e = __pyx_t_5; + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_e = __pyx_t_4; /*try:*/ { - /* "handlers/payments/utils.py":92 + /* "handlers/payments/utils.py":93 * * 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, 92, __pyx_L43_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_error); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 92, __pyx_L43_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 92, __pyx_L43_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_23 = 0; - __pyx_t_24 = 127; - __Pyx_INCREF(__pyx_kp_u__3); - __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, 92, __pyx_L43_error) + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_logger); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 93, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 93, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_11 = 0; + __pyx_t_12 = 127; + __Pyx_INCREF(__pyx_kp_u__5); + __pyx_t_12 = (65535 > __pyx_t_12) ? 65535 : __pyx_t_12; + __pyx_t_11 += 45; + __Pyx_GIVEREF(__pyx_kp_u__5); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_kp_u__5); + __pyx_t_25 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_user_id, __pyx_empty_unicode); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 93, __pyx_L43_error) __Pyx_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_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) : __pyx_t_12; + __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_25); __Pyx_GIVEREF(__pyx_t_25); - PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_25); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_25); __pyx_t_25 = 0; - __Pyx_INCREF(__pyx_kp_u__4); - __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, 92, __pyx_L43_error) + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_11 += 2; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_kp_u__6); + __pyx_t_25 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 93, __pyx_L43_error) __Pyx_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_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) : __pyx_t_12; + __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_25); __Pyx_GIVEREF(__pyx_t_25); - PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_25); + PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_25); __pyx_t_25 = 0; - __pyx_t_25 = __Pyx_PyUnicode_Join(__pyx_t_12, 4, __pyx_t_23, __pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 92, __pyx_L43_error) + __pyx_t_25 = __Pyx_PyUnicode_Join(__pyx_t_14, 4, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 93, __pyx_L43_error) __Pyx_GOTREF(__pyx_t_25); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_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); + if (unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_14)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_14); __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[2] = {__pyx_t_12, __pyx_t_25}; - __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_25}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 92, __pyx_L43_error) + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 93, __pyx_L43_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } - /* "handlers/payments/utils.py":91 + /* "handlers/payments/utils.py":92 * ) * * except Exception as e: # <<<<<<<<<<<<<< * logger.error(f" {user_id}: {e}") + * */ /*finally:*/ { /*normal exit:*/{ @@ -5529,43 +5626,43 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __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_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 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); - __Pyx_XGOTREF(__pyx_t_17); + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); - __pyx_t_14 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_26 = __pyx_filename; + __Pyx_XGOTREF(__pyx_t_22); + __Pyx_XGOTREF(__pyx_t_23); + __pyx_t_16 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_26 = __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_19); - __Pyx_XGIVEREF(__pyx_t_20); __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21); + __Pyx_XGIVEREF(__pyx_t_22); + __Pyx_XGIVEREF(__pyx_t_23); + __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23); } - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); - __Pyx_ErrRestore(__pyx_t_16, __pyx_t_17, __pyx_t_18); - __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_14; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_26; + __Pyx_XGIVEREF(__pyx_t_19); + __Pyx_XGIVEREF(__pyx_t_20); + __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20); + __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; + __pyx_lineno = __pyx_t_16; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_26; goto __pyx_L6_except_error; } __pyx_L44:; } - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L5_exception_handled; } goto __pyx_L6_except_error; @@ -5616,7 +5713,7 @@ static PyObject *__pyx_gb_8handlers_8payments_5utils_2generator(__pyx_CoroutineO __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_14); __Pyx_XDECREF(__pyx_t_25); __Pyx_AddTraceback("send_payment_success_notification", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; @@ -5682,6 +5779,7 @@ static void __pyx_tp_dealloc_8handlers_8payments_5utils___pyx_scope_struct__send 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_required_amount); Py_CLEAR(p->__pyx_v_state); Py_CLEAR(p->__pyx_v_temp_data); Py_CLEAR(p->__pyx_v_total_gb); @@ -5761,6 +5859,9 @@ static int __pyx_tp_traverse_8handlers_8payments_5utils___pyx_scope_struct__send if (p->__pyx_v_plan_price) { e = (*v)(p->__pyx_v_plan_price, a); if (e) return e; } + if (p->__pyx_v_required_amount) { + e = (*v)(p->__pyx_v_required_amount, a); if (e) return e; + } if (p->__pyx_v_state) { e = (*v)(p->__pyx_v_state, a); if (e) return e; } @@ -5923,16 +6024,18 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_DATABASE_URL, __pyx_k_DATABASE_URL, sizeof(__pyx_k_DATABASE_URL), 0, 0, 1, 1}, {&__pyx_n_s_InlineKeyboardBuilder, __pyx_k_InlineKeyboardBuilder, sizeof(__pyx_k_InlineKeyboardBuilder), 0, 0, 1, 1}, {&__pyx_n_s_InlineKeyboardButton, __pyx_k_InlineKeyboardButton, sizeof(__pyx_k_InlineKeyboardButton), 0, 0, 1, 1}, + {&__pyx_kp_u_PAYMENT, __pyx_k_PAYMENT, sizeof(__pyx_k_PAYMENT), 0, 1, 0, 0}, {&__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_kp_u__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 1, 0, 0}, + {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, {&__pyx_n_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 1}, + {&__pyx_n_s__9, __pyx_k__9, sizeof(__pyx_k__9), 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}, @@ -6002,6 +6105,8 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_u_plan_price, __pyx_k_plan_price, sizeof(__pyx_k_plan_price), 0, 1, 0, 1}, {&__pyx_n_u_profile, __pyx_k_profile, sizeof(__pyx_k_profile), 0, 1, 0, 1}, {&__pyx_n_s_reply_markup, __pyx_k_reply_markup, sizeof(__pyx_k_reply_markup), 0, 0, 1, 1}, + {&__pyx_n_s_required_amount, __pyx_k_required_amount, sizeof(__pyx_k_required_amount), 0, 0, 1, 1}, + {&__pyx_n_u_required_amount, __pyx_k_required_amount, sizeof(__pyx_k_required_amount), 0, 1, 0, 1}, {&__pyx_n_s_row, __pyx_k_row, sizeof(__pyx_k_row), 0, 0, 1, 1}, {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, {&__pyx_n_s_send_message, __pyx_k_send_message, sizeof(__pyx_k_send_message), 0, 0, 1, 1}, @@ -6022,13 +6127,14 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__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}, + {&__pyx_n_s_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 0, 0, 1, 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) + __pyx_builtin_all = __Pyx_GetBuiltinName(__pyx_n_s_all); if (!__pyx_builtin_all) __PYX_ERR(0, 46, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -6039,6 +6145,17 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + /* "handlers/payments/utils.py":31 + * data = temp_data["data"] + * + * required_amount = data.get("required_amount", 0) # <<<<<<<<<<<<<< + * + * if int(amount) != int(required_amount): + */ + __pyx_tuple__3 = PyTuple_Pack(2, __pyx_n_u_required_amount, __pyx_int_0); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); + /* "handlers/payments/utils.py":15 * * @@ -6046,10 +6163,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * try: * user_id = int(user_id) */ - __pyx_tuple__6 = 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__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, 20, 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__8 = PyTuple_Pack(21, __pyx_n_s_user_id, __pyx_n_s_amount, __pyx_n_s_builder, __pyx_n_s_create_key, __pyx_n_s_conn, __pyx_n_s_temp_data, __pyx_n_s_state, __pyx_n_s_data, __pyx_n_s_required_amount, __pyx_n_s_complete_key_renewal, __pyx_n_s_plan, __pyx_n_s_client_id, __pyx_n_s_new_expiry_time, __pyx_n_s_total_gb, __pyx_n_s_cost, __pyx_n_s_email, __pyx_n_s_balance, __pyx_n_s_plan_price, __pyx_n_s_duration_days, __pyx_n_s_expiry_time, __pyx_n_s_e); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_handlers_payments_utils_py, __pyx_n_s_send_payment_success_notificatio, 15, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -6060,6 +6177,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -9966,6 +10084,85 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { } #endif +/* PyIntFromDouble */ + #if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value) { + if (value >= (double)LONG_MIN && value <= (double)LONG_MAX) { + return PyInt_FromLong((long)value); + } + return PyLong_FromDouble(value); +} +#endif + +/* JoinPyUnicode */ + static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char) { +#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyObject *result_uval; + int result_ukind, kind_shift; + Py_ssize_t i, char_pos; + void *result_udata; + CYTHON_MAYBE_UNUSED_VAR(max_char); +#if CYTHON_PEP393_ENABLED + result_uval = PyUnicode_New(result_ulength, max_char); + if (unlikely(!result_uval)) return NULL; + result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; + kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; + result_udata = PyUnicode_DATA(result_uval); +#else + result_uval = PyUnicode_FromUnicode(NULL, result_ulength); + if (unlikely(!result_uval)) return NULL; + result_ukind = sizeof(Py_UNICODE); + kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1; + result_udata = PyUnicode_AS_UNICODE(result_uval); +#endif + assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); + char_pos = 0; + for (i=0; i < value_count; i++) { + int ukind; + Py_ssize_t ulength; + void *udata; + PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); + if (unlikely(__Pyx_PyUnicode_READY(uval))) + goto bad; + ulength = __Pyx_PyUnicode_GET_LENGTH(uval); + if (unlikely(!ulength)) + continue; + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) + goto overflow; + ukind = __Pyx_PyUnicode_KIND(uval); + udata = __Pyx_PyUnicode_DATA(uval); + if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { + memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); + } else { + #if PY_VERSION_HEX >= 0x030d0000 + if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; + #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) + _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); + #else + Py_ssize_t j; + for (j=0; j < ulength; j++) { + Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); + __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); + } + #endif + } + char_pos += ulength; + } + return result_uval; +overflow: + PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); +bad: + Py_DECREF(result_uval); + return NULL; +#else + CYTHON_UNUSED_VAR(max_char); + CYTHON_UNUSED_VAR(result_ulength); + CYTHON_UNUSED_VAR(value_count); + return PyUnicode_Join(__pyx_empty_unicode, value_tuple); +#endif +} + /* GetException */ #if CYTHON_FAST_THREAD_STATE static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) @@ -10061,75 +10258,6 @@ bad: return -1; } -/* JoinPyUnicode */ - static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, - Py_UCS4 max_char) { -#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - PyObject *result_uval; - int result_ukind, kind_shift; - Py_ssize_t i, char_pos; - void *result_udata; - CYTHON_MAYBE_UNUSED_VAR(max_char); -#if CYTHON_PEP393_ENABLED - result_uval = PyUnicode_New(result_ulength, max_char); - if (unlikely(!result_uval)) return NULL; - result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; - kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; - result_udata = PyUnicode_DATA(result_uval); -#else - result_uval = PyUnicode_FromUnicode(NULL, result_ulength); - if (unlikely(!result_uval)) return NULL; - result_ukind = sizeof(Py_UNICODE); - kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1; - result_udata = PyUnicode_AS_UNICODE(result_uval); -#endif - assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); - char_pos = 0; - for (i=0; i < value_count; i++) { - int ukind; - Py_ssize_t ulength; - void *udata; - PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); - if (unlikely(__Pyx_PyUnicode_READY(uval))) - goto bad; - ulength = __Pyx_PyUnicode_GET_LENGTH(uval); - if (unlikely(!ulength)) - continue; - if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) - goto overflow; - ukind = __Pyx_PyUnicode_KIND(uval); - udata = __Pyx_PyUnicode_DATA(uval); - if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { - memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); - } else { - #if PY_VERSION_HEX >= 0x030d0000 - if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; - #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) - _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); - #else - Py_ssize_t j; - for (j=0; j < ulength; j++) { - Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); - __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); - } - #endif - } - char_pos += ulength; - } - return result_uval; -overflow: - PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); -bad: - Py_DECREF(result_uval); - return NULL; -#else - CYTHON_UNUSED_VAR(max_char); - CYTHON_UNUSED_VAR(result_ulength); - CYTHON_UNUSED_VAR(value_count); - return PyUnicode_Join(__pyx_empty_unicode, value_tuple); -#endif -} - /* pep479 */ static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) { PyObject *exc, *val, *tb, *cur_exc; @@ -10421,7 +10549,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__7; CYTHON_UNUSED_VAR(parts_tuple); from_list = PyList_New(1); if (unlikely(!from_list)) @@ -11872,7 +12000,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__9); } 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 434f616c..13ce89eb 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