1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2024-11-21 21:44:19 +00:00

add configurable payment presets

This commit is contained in:
Pavlo Zhuk 2020-04-04 20:53:10 +03:00 committed by Stefano Pigozzi
parent 4c0c38902e
commit 5be2f9e762
2 changed files with 7 additions and 6 deletions

View file

@ -72,6 +72,9 @@ phone_required = yes
; 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
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
[Error Reporting]

View file

@ -593,11 +593,9 @@ class ChatWorker(threading.Thread):
def __add_credit_cc(self):
"""Add money to the wallet through a credit card payment."""
# Create a keyboard to be sent later
keyboard = [[telegram.KeyboardButton(str(utils.Price("10.00")))],
[telegram.KeyboardButton(str(utils.Price("25.00")))],
[telegram.KeyboardButton(str(utils.Price("50.00")))],
[telegram.KeyboardButton(str(utils.Price("100.00")))],
[telegram.KeyboardButton(strings.menu_cancel)]]
presets = configloader.config["Appearance"]["payment_presets"].split(',')
keyboard = [[telegram.KeyboardButton(str(utils.Price(preset)))] for preset in presets]
keyboard.append([telegram.KeyboardButton(strings.menu_cancel)]);
# Boolean variable to check if the user has cancelled the action
cancelled = False
# Loop used to continue asking if there's an error during the input
@ -630,7 +628,7 @@ class ChatWorker(threading.Thread):
else:
# Exit the function
return
# Issue the invoice
# Issue the payment invoice
self.__make_payment(amount=value)
def __make_payment(self, amount):