""" Functionality for working with Telegram """ from tgio import Telegram from api.lib import cfg TG_TOKEN = cfg('tg.token') tg = Telegram(TG_TOKEN)
""" Payments functionality for the API """ from yookassa import Configuration, Payment from api.lib import cfg Configuration.account_id = cfg('yookassa.id') Configuration.secret_key = cfg('yookassa.secret') def create(amount, description, data=None, renewal=None): """ Create a payment """ req = { 'amount': { 'value': f'{amount}.00', 'currency': 'RUB' }, 'description': description, 'metadata': data, } if renewal: req['payment_method_id'] = renewal else: req['confirmation'] = { 'type': 'embedded', } req['capture'] = True
""" Base model of DB object """ from consys import make_base, Attribute from api.lib import cfg HOST = cfg('mongo.host') NAME = cfg('PROJECT_NAME') LOGIN = cfg('mongo.login') PASSWORD = cfg('mongo.password') Base = make_base(HOST, NAME, LOGIN, PASSWORD) __all__ = ( 'Base', 'Attribute', )
""" Sending SMS messages """ from api.lib import cfg LOGIN = cfg('smsc.login') PASSWORD = cfg('smsc.password') # TODO: Use pip/smsc
""" Reports functionality for the API """ from tgreports import Report from api.lib import cfg MODE = cfg('mode') TG_TOKEN = cfg('tg.token') BUG_CHAT = cfg('bug_chat') report = Report(MODE, TG_TOKEN, BUG_CHAT)