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

Move the presets to the [Credit Card] section

This commit is contained in:
Steffo 2020-04-07 02:02:07 +02:00
parent 9df1203b3e
commit 9d6e21fb4e
2 changed files with 8 additions and 5 deletions

View file

@ -53,6 +53,9 @@ credit_card_token = 123456789:YOUR_TOKEN_HERE_
min_amount = 1000 min_amount = 1000
; Maximum wallet payment accepted (in miniumum currency units, $1.00 = 100 units) ; Maximum wallet payment accepted (in miniumum currency units, $1.00 = 100 units)
max_amount = 10000 max_amount = 10000
; The preset selections that can be made when adding credit to the wallet with a credit card
; Presets are pipe-separated |, and should never be outside the bounds provided by the min_amount and max_amount options
payment_presets = 10.00 | 25.00 | 50.00 | 100.00
; Make the user pay a extra fee when adding credit to the wallet with a credit card ; Make the user pay a extra fee when adding credit to the wallet with a credit card
; The formula for determining the total cost is: ; The formula for determining the total cost is:
; cost = added_funds + added_funds * fee_percentage / 100 + fee_fixed ; cost = added_funds + added_funds * fee_percentage / 100 + fee_fixed
@ -72,8 +75,6 @@ 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
; Allow balance refill during the order checkout in case of unsufficient balance ; Allow balance refill during the order checkout in case of unsufficient balance
refill_on_checkout = yes refill_on_checkout = yes

View file

@ -600,7 +600,7 @@ 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
presets = configloader.config["Appearance"]["payment_presets"].split(',') presets = list(map(lambda s: s.strip(" "), configloader.config["Credit Card"]["payment_presets"].split('|')))
keyboard = [[telegram.KeyboardButton(str(utils.Price(preset)))] for preset in presets] keyboard = [[telegram.KeyboardButton(str(utils.Price(preset)))] for preset in presets]
keyboard.append([telegram.KeyboardButton(strings.menu_cancel)]) keyboard.append([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
@ -623,12 +623,14 @@ class ChatWorker(threading.Thread):
if value > utils.Price(int(configloader.config["Credit Card"]["max_amount"])): if value > utils.Price(int(configloader.config["Credit Card"]["max_amount"])):
self.bot.send_message(self.chat.id, self.bot.send_message(self.chat.id,
strings.error_payment_amount_over_max.format( strings.error_payment_amount_over_max.format(
max_amount=utils.Price(configloader.config["Payments"]["max_amount"]))) max_amount=utils.Price(configloader.config["Credit Card"]["max_amount"]))
)
continue continue
elif value < utils.Price(int(configloader.config["Credit Card"]["min_amount"])): elif value < utils.Price(int(configloader.config["Credit Card"]["min_amount"])):
self.bot.send_message(self.chat.id, self.bot.send_message(self.chat.id,
strings.error_payment_amount_under_min.format( strings.error_payment_amount_under_min.format(
min_amount=utils.Price(configloader.config["Payments"]["min_amount"]))) min_amount=utils.Price(configloader.config["Credit Card"]["min_amount"]))
)
continue continue
break break
# If the user cancelled the action... # If the user cancelled the action...