stars fixes
This commit is contained in:
parent
c9871b95e1
commit
45af09da0d
|
|
@ -80,16 +80,18 @@ async def s_api_v1_content_view(request, content_address: str):
|
|||
if request.ctx.user.telegram_id in [5587262915, 6861699286]:
|
||||
stars_cost = 2
|
||||
|
||||
invoice_id = f"access_{uuid.uuid4().hex}"
|
||||
exist_invoice = request.ctx.db_session.query(StarsInvoice).filter(
|
||||
and_(
|
||||
StarsInvoice.user_id == request.ctx.user.id,
|
||||
StarsInvoice.created > datetime.now() - timedelta(minutes=25),
|
||||
StarsInvoice.amount == stars_cost,
|
||||
StarsInvoice.external_id == invoice_id
|
||||
)
|
||||
).first()
|
||||
if exist_invoice:
|
||||
invoice_url = exist_invoice.invoice_url
|
||||
else:
|
||||
invoice_id = f"access_{uuid.uuid4().hex}"
|
||||
invocie_url = None
|
||||
try:
|
||||
invoice_url = await Bot(token=CLIENT_TELEGRAM_API_KEY).create_invoice_link(
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ router = Router()
|
|||
|
||||
async def t_pre_checkout_query_stars_processing(pre_checkout_query: types.PreCheckoutQuery, user=None, db_session=None,
|
||||
chat_wrap=None, **extra):
|
||||
make_log('t_pre_checkout_query_stars_processing', f"PreCheckoutQuery: {pre_checkout_query}")
|
||||
make_log('t_pre_checkout_query_stars_processing', f"User: {user}, db_session: {db_session}, chat_wrap: {chat_wrap}, extra: {extra}")
|
||||
|
||||
invoice_id = pre_checkout_query.invoice_payload
|
||||
|
||||
existing_invoice = db_session.query(StarsInvoice).filter(
|
||||
|
|
|
|||
Loading…
Reference in New Issue