This commit is contained in:
behruz-dev
2025-09-04 18:33:56 +05:00
parent a56a62acfa
commit fdf0c9808b
11 changed files with 115 additions and 11 deletions

View File

@@ -7,12 +7,24 @@ from config.env import env
token = env.str("BOT_TOKEN")
@shared_task
def send_orders_to_tg_bot(chat_id, product_name, quantity, price):
def send_orders_to_tg_bot(
chat_id, product_name, quantity, price, payment_type,
delivery_type, contact_number, address, comment, name
):
if payment_type == 'CASH':
payment_type = "Naqd to'lov"
elif payment_type == 'CARD':
payment_type = "Karta orqali to'lov"
elif payment_type == 'ACCOUNT_NUMBER':
payment_type = "Hisob raqam orqali to'lov"
url = f"https://api.telegram.org/bot{token}/sendMessage"
message = (
f"Mahsulot nomi: {product_name}\n"
f"Mahsulot soni: {quantity}\n"
f"Summa: {price}"
f"📦 Mahsulot nomi: {product_name}\n"
f"🔢 Mahsulot soni: {quantity}\n"
f"💰 Summa: {price}\n\n"
f"📞 Aloqa uchun: (99) 099-91-92"
)
payload = {
"chat_id": chat_id,