mirror of
https://github.com/Steffo99/greed.git
synced 2024-11-22 05:54:18 +00:00
add configurable payment presets
This commit is contained in:
parent
4c0c38902e
commit
5be2f9e762
2 changed files with 7 additions and 6 deletions
|
@ -72,6 +72,9 @@ phone_required = yes
|
||||||
; Display the full order information to the customers instead of the shortened version
|
; Display the full order information to the customers instead of the shortened version
|
||||||
; The full order information includes the order number and the timestamp of the order placement
|
; The full order information includes the order number and the timestamp of the order placement
|
||||||
full_order_info = no
|
full_order_info = no
|
||||||
|
; Payment presets would be suggested to the user as buttons, when making credit card transaction
|
||||||
|
payment_presets = 10.00,25.00,50.00,100.00
|
||||||
|
|
||||||
|
|
||||||
# Exception reporting settings
|
# Exception reporting settings
|
||||||
[Error Reporting]
|
[Error Reporting]
|
||||||
|
|
10
worker.py
10
worker.py
|
@ -593,11 +593,9 @@ class ChatWorker(threading.Thread):
|
||||||
def __add_credit_cc(self):
|
def __add_credit_cc(self):
|
||||||
"""Add money to the wallet through a credit card payment."""
|
"""Add money to the wallet through a credit card payment."""
|
||||||
# Create a keyboard to be sent later
|
# Create a keyboard to be sent later
|
||||||
keyboard = [[telegram.KeyboardButton(str(utils.Price("10.00")))],
|
presets = configloader.config["Appearance"]["payment_presets"].split(',')
|
||||||
[telegram.KeyboardButton(str(utils.Price("25.00")))],
|
keyboard = [[telegram.KeyboardButton(str(utils.Price(preset)))] for preset in presets]
|
||||||
[telegram.KeyboardButton(str(utils.Price("50.00")))],
|
keyboard.append([telegram.KeyboardButton(strings.menu_cancel)]);
|
||||||
[telegram.KeyboardButton(str(utils.Price("100.00")))],
|
|
||||||
[telegram.KeyboardButton(strings.menu_cancel)]]
|
|
||||||
# Boolean variable to check if the user has cancelled the action
|
# Boolean variable to check if the user has cancelled the action
|
||||||
cancelled = False
|
cancelled = False
|
||||||
# Loop used to continue asking if there's an error during the input
|
# Loop used to continue asking if there's an error during the input
|
||||||
|
@ -630,7 +628,7 @@ class ChatWorker(threading.Thread):
|
||||||
else:
|
else:
|
||||||
# Exit the function
|
# Exit the function
|
||||||
return
|
return
|
||||||
# Issue the invoice
|
# Issue the payment invoice
|
||||||
self.__make_payment(amount=value)
|
self.__make_payment(amount=value)
|
||||||
|
|
||||||
def __make_payment(self, amount):
|
def __make_payment(self, amount):
|
||||||
|
|
Loading…
Reference in a new issue