mirror of
https://github.com/Steffo99/greed.git
synced 2024-11-25 15:24:17 +00:00
Add invoice generation
This commit is contained in:
parent
ddbd7ee667
commit
be22e9351a
3 changed files with 25 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
@ -34,3 +34,7 @@ credit_card_token = 123456789:YOUR_TOKEN_HERE_
|
|||
min_amount = 10
|
||||
# Maximum wallet payment accepted
|
||||
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
|
|
@ -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' \
|
||||
|
|
11
worker.py
11
worker.py
|
@ -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."""
|
||||
|
|
Loading…
Reference in a new issue