From a3cdd85f4de1ca1878735f3c60fe8079693dc4ff Mon Sep 17 00:00:00 2001 From: ebo_shit <79515659+ebosh-alt@users.noreply.github.com> Date: Tue, 21 Feb 2023 17:01:43 +0300 Subject: [PATCH] debug payment --- Openai.py | 1 + Reminders.py | 20 +++++++++----------- db.db | Bin 8192 -> 8192 bytes db.db-shm | Bin 32768 -> 0 bytes db.db-wal | Bin 280192 -> 0 bytes functions.py | 14 +++++++++----- main.py | 12 ++++++------ texts.py | 2 +- 8 files changed, 26 insertions(+), 23 deletions(-) delete mode 100644 db.db-shm delete mode 100644 db.db-wal diff --git a/Openai.py b/Openai.py index e03e9d2..eb2212f 100644 --- a/Openai.py +++ b/Openai.py @@ -4,6 +4,7 @@ class OpenAi: def __init__(self, openai_api_key): self.openai = openai + self.openai.log = "info" self.openai.api_key = openai_api_key async def question(self, text: str) -> str: diff --git a/Reminders.py b/Reminders.py index 6b38b59..89f0140 100644 --- a/Reminders.py +++ b/Reminders.py @@ -3,8 +3,6 @@ import datetime from multiprocessing import Process -import schedule - import functions import texts from Enum_classes import Reminder @@ -36,7 +34,7 @@ async def work(): time_transition_payment = datetime.datetime.utcfromtimestamp(user.time_transition_payment) if (now_time - time_transition_payment) > time_reminder_1 and user.count_reminder == 0: data = functions.create_pay(user_id=str(user_id), - price="2990.00") + price=2990) key = data[1] link = data[0] user.key_payment = key @@ -57,7 +55,7 @@ async def work(): and time_reminder.tm_min == now_time_tuple.tm_min: if user.reminder == Reminder.first_reminder: data = functions.create_pay(user_id=str(user_id), - price="2990.00") + price=2990) key = data[1] link = data[0] user.key_payment = key @@ -76,17 +74,17 @@ async def work(): elif user.reminder == Reminder.second_reminder: data = functions.create_pay(user_id=str(user_id), - price="9990.00") + price=9990) key = data[1] link = data[0] user.key_payment = key await bot.send_message(chat_id=user_id, text=texts.text_for_reminder_4.format(username=user.username), reply_markup=functions.inl_create_keyboard(buttons= - [["Написать нам", - link_to_bot], - ["Оплатить 9990 руб.", - link]])) + [["Написать нам",link_to_bot], + ["Оплатить 9990 руб.", link]] + ) + ) time_rem = datetime.datetime(year=now_time_tuple.tm_year, month=now_time_tuple.tm_mon, day=now_time_tuple.tm_mday, hour=15, minute=15, second=0) time_rem += datetime.timedelta(days=2) @@ -96,7 +94,7 @@ async def work(): elif user.reminder == Reminder.third_reminder: data = functions.create_pay(user_id=str(user_id), - price="990.00") + price=990) key = data[1] link = data[0] user.key_payment = key @@ -114,7 +112,7 @@ async def work(): elif user.reminder == Reminder.fourth_reminder: data = functions.create_pay(user_id=str(user_id), - price="990.00") + price=990) key = data[1] link = data[0] user.key_payment = key diff --git a/db.db b/db.db index 96351371083e370fc3a13e317bcbc27e79cf9acc..38548b365147478ab78e43128ed9d341c5cc3cbd 100644 GIT binary patch delta 482 zcmZp0XmHrTC?Lvrje(udhnc^ce-Hl)zPtPid_8l^OR(z<4GhhbjgnGL%*>OYEx5tkIB)rMUZCSRgc&%@85lS` lixM9uB>;Uc2E=GUsPSdPGHsAzSq2Uud0`zeV0T>X2LSBVm?!`M delta 196 zcmZp0XmHrTC?LrHmVuQ&j)8v<|7`v^{!9F;Hx{nvo7gb7-n{AfjB_rW44j;jES#YX zewo>sC5g#TE^8YlnVY4Wr6%bb7#O7KngU5(3lL#wWMpERVqt2Snqtn?IB)rMUUmi! z4q*lk&!R-`DF^rdGY9cS89010s}co|t-WjmY#?Qt k$_yMA)?aM6uj3#$_cg*Zfoc+CT zCO7QHYrQz+&SLxB(&cu?W%l9r-S(;WR=XqiU-Lo$0R#|0009ILKmY**5I{h1fh(52 z_R2+HktEB#Bw3PdV`?4>_T2aUo5PG-wzB-#t>H5#g{Ot}7OmR8NwPNuY?94bu~kWG zUE_+TKvDapt+HlH&5WRa^vxko&F2k!!&-%+D3J<}@m`_E-W*P++Y?efj&R6lKPX*! z(N~!G&arP>T)Vnqd2#GV=@I`?MoteJ-_!X0lr$8?whfl#=;r3$OY6@x6vTEJ*Tzq0 z+*%mj(_9n43#_Lv@a@CET?7z7009ILKmY** z5I_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*xV~77UuO zXx7UY$OY1m0jmfgfB*srAbChJl#`^+pXV~F( z`t`8WWAp`<=b|sr_{E>qhst&O0)mb=$3_4F1Q0*~0R#|0009IL$RJ>PE|A<8=-OOh zdw!p-8^8R$OkW_w9I%W40tg_000IagfB*srARwlI>A65kUqDUt1)SaveSyUD1>B0? z8TKmPkjrWG1$N}3FA#p@>DPyJKR=dSK+N&x)CeGe00IagfB*srAbU`U2rZU%=x`=?iEc zuQ#G7&am-}fwq}9<)SaJZT89$>$^X2id;a<@#fSBAbU z`T|{=3#i52{;=bdw{IpF$S?;iBY*$`2q1s}0tg_000IbzDPVdokkl7AHn3NsFA(bZ zc?ACW=Mnfqp`gp>cKCHwKQ{2{T=WG_+%>T=?~9cMopOOW_Ex(?%wIRBMgRc>5I_I{ z1Q0*~0R#|0pp(F*<^p}20yfEJE6cZ4Norl=il#tO{PKqOKg+SD{BD&sQ)*@ejlb@H g6$^wrK6WtiF@=imRJ}n>b*K)#?T1_P%*X})4-o$ml>h($ diff --git a/functions.py b/functions.py index 868977f..75f82ac 100644 --- a/functions.py +++ b/functions.py @@ -5,7 +5,7 @@ Configuration.secret_key = 'live_JB-sjh_-FPp_2Rl5QeX5Rlm6lwqarahXnk4YAbZCOnQ' -def create_pay(user_id: str, price: str) -> tuple: +def create_pay(user_id: str, price: int) -> tuple: payment = Payment.create({ "amount": { "value": price, @@ -17,9 +17,13 @@ def create_pay(user_id: str, price: str) -> tuple: }, "capture": True, - "description": user_id + "description": user_id, + "receipt": {"customer": {"email": "evsevm@gmail.com"}} }) - + # print(payment.amount.__dict__) + # print(payment.recipient.__dict__) + # print(payment.confirmation.__dict__) + # print(payment.confirmation.confirmation_url, payment.id) return payment.confirmation.confirmation_url, payment.id @@ -34,7 +38,7 @@ def create_keyboard(name_buttons: list, ) -> types.ReplyKeyboardMarkup: return keyboard -def inl_create_keyboard(buttons: list[list], ): +def inl_create_keyboard(buttons: list, ): keyboard = types.InlineKeyboardMarkup(row_width=len(buttons), resize_keyboard=True) array = [] for button in buttons: @@ -55,4 +59,4 @@ def inl_create_keyboard(buttons: list[list], ): if __name__ == "__main__": - create_pay("55", "29990.00") + print(create_pay("55", 2)) diff --git a/main.py b/main.py index fe6383d..562a3f1 100644 --- a/main.py +++ b/main.py @@ -113,32 +113,32 @@ async def main_hand(message: types.Message): elif text == "Хочу начать": data = functions.create_pay(user_id=str(user_id), - price="2990.00") + price=2990) key = data[1] link = data[0] user.key_payment = key await bot.send_message(chat_id=user_id, text=texts.text_for_payment, reply_markup=functions.inl_create_keyboard( - buttons=[["Оплатить 2990 руб.", link + buttons=[["Оплатить 2990 руб.", f"{link}" ]] ), parse_mode="Markdown", disable_web_page_preview=True, ) - now_time = message.date + now_time = message.date.utcnow() now_time_tuple = now_time.timetuple() user.flag = Flags.Payment user.time_transition_payment = time.mktime(now_time_tuple) user.reminder = Reminder.first_reminder - if now_time_tuple.tm_hour >= 20 and now_time_tuple.tm_min >= 15: + if now_time_tuple.tm_hour >= 16 and now_time_tuple.tm_min >= 15: time_rem = datetime.datetime(year=now_time_tuple.tm_year, month=now_time_tuple.tm_mon, - day=now_time_tuple.tm_mday, hour=19, minute=48, second=0) + day=now_time_tuple.tm_mday, hour=16, minute=15, second=0) time_rem += datetime.timedelta(days=1) user.time_reminder = time.mktime(time_rem.timetuple()) else: time_rem = datetime.datetime(year=now_time_tuple.tm_year, month=now_time_tuple.tm_mon, - day=now_time_tuple.tm_mday, hour=19, minute=54, second=0) + day=now_time_tuple.tm_mday, hour=16, minute=15, second=0) user.time_reminder = time.mktime(time_rem.timetuple()) diff --git a/texts.py b/texts.py index 9438286..070ca9a 100644 --- a/texts.py +++ b/texts.py @@ -37,7 +37,7 @@ text_after_pay = "Спасибо за оплату! \n\nНу что, начнем?" -text_for_reminder = "Вы можете подробнее прочитать про наш курс на нашем сайте. Если у вас останутся вопросы, " \ +text_for_reminder = "Вы можете подробнее прочитать про наш курс на [нашем сайте](https://www.skillbots.ru/design?utm_source=error_code_tg&utm_medium=tgbot). Если у вас останутся вопросы, " \ "то напишите на [@skillbots_support]" \ "(https://t.me/skillbots_support)\n\nТакже напоминаю, " \ "что сегодня у вас есть возможность получить курс всего за 2990 руб."