diff --git a/restoran_max_bot/max_bot/max_api.py b/restoran_max_bot/max_bot/max_api.py index 9f6de42..ad2adbf 100644 --- a/restoran_max_bot/max_bot/max_api.py +++ b/restoran_max_bot/max_bot/max_api.py @@ -3,6 +3,7 @@ import json import requests from max_bot.models import Client from restoran_max_bot.common import common_get_menu, common_get_data +from restoran_max_bot.settings import DEBUG def maxbot_send_text_message(chat_id: str, max_token: str, message: str): @@ -67,7 +68,8 @@ def maxbot_send_menu_button(client: Client, chat_id: str, max_token: str, messag cnt = cnt + 1 buttons.append(button) - print(buttons) + if DEBUG: + print(buttons) payload = json.dumps({ "text": message, "attachments": [ diff --git a/restoran_max_bot/max_bot/views.py b/restoran_max_bot/max_bot/views.py index ab5e352..ea6cf6b 100644 --- a/restoran_max_bot/max_bot/views.py +++ b/restoran_max_bot/max_bot/views.py @@ -10,6 +10,7 @@ from restoran_max_bot.bot_started import bot_started from restoran_max_bot.bot_stopped import bot_stopped from restoran_max_bot.bot_message import bot_message from restoran_max_bot.common import common_get_contact +from restoran_max_bot.settings import DEBUG from restoran_max_bot.utils import is_json, has_key @@ -66,7 +67,8 @@ def api_start_max_v1(request, token, **kwargs): client = kwargs['client'] settings_max = kwargs['settings_max'] - print(data) + if DEBUG: + print(data) if not has_key(data, 'update_type'): rt = {'success': False, 'error': 'data update_type not found', 'data': ''} @@ -117,7 +119,6 @@ def iiko_webhook(request: WSGIRequest, token): @csrf_exempt def iiko_send_message(request: WSGIRequest, token): rt = {'success': False, 'data': ''} - # print(request.body) if request.method == "POST": data = json.loads(request.body) client = Client.objects.filter(token=token).first() diff --git a/restoran_max_bot/restoran_max_bot/bot_message.py b/restoran_max_bot/restoran_max_bot/bot_message.py index 1df8440..aca0562 100644 --- a/restoran_max_bot/restoran_max_bot/bot_message.py +++ b/restoran_max_bot/restoran_max_bot/bot_message.py @@ -5,6 +5,7 @@ from restoran_max_bot.bot_started import check_registration from restoran_max_bot.common import * from restoran_max_bot.iiko_api import customer_info, customer_create, customer_wallet from restoran_max_bot.rkiper_api import rkiper_customer_info, rkiper_customer_create +from restoran_max_bot.settings import STATICFILES_DIRS from restoran_max_bot.utils import has_key @@ -100,7 +101,7 @@ def bot_message(client: Client, message: dict, settings: dict, message_type): for dt in data: if dt.title == '##bonus##': img = qrcode.make(contact.phone) - img.save(f"./restoran_max_bot/static/client_qr/{contact.phone}.png") + img.save(f"{STATICFILES_DIRS[0]}/client_qr/{contact.phone}.png") url = f"https://maxbot.telefon-ip.ru/static/client_qr/{contact.phone}.png" maxbot_send_img_message(chat_id=chat_id, max_token=settings['token'], img=url, message='QR-код для начисления, списания бонусов.') diff --git a/restoran_max_bot/restoran_max_bot/iiko_api.py b/restoran_max_bot/restoran_max_bot/iiko_api.py index ddc2476..65329c5 100644 --- a/restoran_max_bot/restoran_max_bot/iiko_api.py +++ b/restoran_max_bot/restoran_max_bot/iiko_api.py @@ -55,7 +55,6 @@ def customer_create(api_key, phone, name, organization_id, birthday: str): 'Authorization': 'Bearer ' + access_token(api_key) } response = requests.request("POST", url, headers=headers, data=payload) - print(response.text) if response.status_code == 200: data = response.json() else: