1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2024-11-22 05:54:18 +00:00

Add invoice generation

This commit is contained in:
Steffo 2018-01-03 15:23:08 +01:00
parent ddbd7ee667
commit be22e9351a
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: C27544372FBB445D
3 changed files with 25 additions and 3 deletions

View file

@ -3,7 +3,7 @@
# Config file parameters
[Config]
; Config file version. DO NOT EDIT THIS!
version = 6
version = 7
; Set this to no when you are done editing the file
is_template = yes
@ -33,4 +33,8 @@ credit_card_token = 123456789:YOUR_TOKEN_HERE_
# Minimum wallet payment accepted
min_amount = 10
# Maximum wallet payment accepted
max_amount = 100
max_amount = 100
# ISO currency code
currency = EUR
# Currency exp parameter. You can find that on https://core.telegram.org/bots/payments/currencies.json
currency_exp = 2

View file

@ -57,6 +57,15 @@ payment_cash = "Puoi pagare in contanti alla sede fisica del negozio.\n" \
# Payment: invoice amount
payment_cc_amount = "Quanti fondi vuoi aggiungere al tuo portafoglio?"
# Payment: add funds invoice title
payment_invoice_title = "Aggiunta di fondi"
# Payment: add funds invoice description
payment_invoice_description = "Pagando questa ricevuta verranno aggiunti {amount} al portafoglio."
# Payment: label of the labeled price on the invoice
payment_invoice_label = "Ricarica"
# Info: informazioni sul bot
bot_info = 'Questo bot utilizza <a href="https://github.com/Steffo99/greed">greed</a>,' \
' un framework di @Steffo per i pagamenti su Telegram rilasciato sotto la' \

View file

@ -210,7 +210,16 @@ class ChatWorker(threading.Thread):
self.bot.send_message(self.chat.id, strings.error_payment_amount_under_min.format(min_amount=strings.currency_format_string.format(symbol=strings.currency_symbol, value=configloader.config["Payments"]["min_amount"])))
continue
# The amount is valid, send the invoice
print(selection)
self.bot.send_invoice(self.chat.id,
title=strings.payment_invoice_title,
description=strings.payment_invoice_description.format(amount=strings.currency_format_string.format(symbol=strings.currency_symbol, value=selection)),
payload="temppayload", # TODO: change this
provider_token=configloader.config["Payment Methods"]["credit_card_token"],
start_parameter="tempdeeplink", # TODO: change this
currency=configloader.config["Payments"]["currency"],
prices=[telegram.LabeledPrice(label=strings.payment_invoice_label, amount=int(selection * (10 ** int(configloader.config["Payments"]["currency_exp"]))))])
# TODO: what should happen now?
break
def __bot_info(self):
"""Send information about the bot."""