Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable cash payments #190

Merged
merged 2 commits into from
Nov 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions config/template_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))])
Expand Down Expand Up @@ -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")])
Expand Down