remove unused fields for tasks
This commit is contained in:
@@ -64,13 +64,6 @@ class OrderCreateSerializer(serializers.Serializer):
|
|||||||
chat_id=item.get('product').tg_id,
|
chat_id=item.get('product').tg_id,
|
||||||
product_name=item.get('product').name,
|
product_name=item.get('product').name,
|
||||||
quantity=item.get('quantity'),
|
quantity=item.get('quantity'),
|
||||||
price=item.get('price'),
|
|
||||||
payment_type=validated_data.get('payment_type'),
|
|
||||||
delivery_type=validated_data.get('delivery_type'),
|
|
||||||
contact_number=validated_data.get('contact_number'),
|
|
||||||
address=validated_data.get('address'),
|
|
||||||
comment=validated_data.get('comment'),
|
|
||||||
name=validated_data.get('name')
|
|
||||||
)
|
)
|
||||||
|
|
||||||
OrderItem.objects.bulk_create(items)
|
OrderItem.objects.bulk_create(items)
|
||||||
|
|||||||
@@ -7,24 +7,11 @@ from config.env import env
|
|||||||
token = env.str("BOT_TOKEN")
|
token = env.str("BOT_TOKEN")
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def send_orders_to_tg_bot(
|
def send_orders_to_tg_bot(chat_id, product_name, quantity):
|
||||||
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"
|
url = f"https://api.telegram.org/bot{token}/sendMessage"
|
||||||
message = (
|
message = (
|
||||||
f"📦 Mahsulot nomi: {product_name}\n"
|
f"📦 Mahsulot nomi: {product_name}\n"
|
||||||
f"🔢 Mahsulot soni: {quantity}\n"
|
f"🔢 Mahsulot soni: {quantity}\n"
|
||||||
f"💰 Summa: {price}\n\n"
|
|
||||||
|
|
||||||
f"📞 Aloqa uchun: (99) 099-91-92"
|
|
||||||
)
|
)
|
||||||
payload = {
|
payload = {
|
||||||
"chat_id": chat_id,
|
"chat_id": chat_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user