From 12991e4cb6e7cb8c671dc6442cf841ff3b19b782 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 19 Nov 2022 16:27:50 +0100 Subject: [PATCH 1/2] Create the `enable_pay_with_cash` and `enable_create_transaction` config options --- config/template_config.toml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/template_config.toml b/config/template_config.toml index 574a6ba..f2d956f 100644 --- a/config/template_config.toml +++ b/config/template_config.toml @@ -57,6 +57,15 @@ currency_exp = 2 currency_symbol = "€" +# Cash payment settings +[Payments.Cash] +# Display the "With cash" option in the Add Credit menu +enable_pay_with_cash = true +# Display the "Create transaction" option in the Manager menu +enable_create_transaction = true +# Customize the cash payment text in the strings files! + + # Credit card payment settings [Payments.CreditCard] # Telegram Payments provider token obtainable at https://t.me/BotFather in the bot's Payments menu From 222089ce2979612f7016d2ce82aed54af2db90e7 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 19 Nov 2022 16:33:18 +0100 Subject: [PATCH 2/2] Add configuration gates to the `menu_cash` and `menu_edit_credit` buttons --- worker.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/worker.py b/worker.py index 7b2e634..81685ef 100644 --- a/worker.py +++ b/worker.py @@ -749,7 +749,8 @@ def __add_credit_menu(self): keyboard = list() # Add the supported payment methods to the keyboard # Cash - keyboard.append([telegram.KeyboardButton(self.loc.get("menu_cash"))]) + if self.cfg["Payments"]["Cash"]["enable_pay_with_cash"]: + keyboard.append([telegram.KeyboardButton(self.loc.get("menu_cash"))]) # Telegram Payments if self.cfg["Payments"]["CreditCard"]["credit_card_token"] != "": keyboard.append([telegram.KeyboardButton(self.loc.get("menu_credit_card"))]) @@ -904,7 +905,8 @@ def __admin_menu(self): if self.admin.receive_orders: keyboard.append([self.loc.get("menu_orders")]) if self.admin.create_transactions: - keyboard.append([self.loc.get("menu_edit_credit")]) + if self.cfg["Payments"]["Cash"]["enable_create_transaction"]: + keyboard.append([self.loc.get("menu_edit_credit")]) keyboard.append([self.loc.get("menu_transactions"), self.loc.get("menu_csv")]) if self.admin.is_owner: keyboard.append([self.loc.get("menu_edit_admins")])