added platega.io

This commit is contained in:
machka pasla
2025-12-07 20:24:24 +03:00
parent 719369057f
commit fb06fbd0e1
12 changed files with 598 additions and 18 deletions
+11 -1
View File
@@ -13,6 +13,7 @@ from bot.services.tribute_service import TributeService
from bot.services.crypto_pay_service import CryptoPayService
from bot.services.panel_webhook_service import PanelWebhookService
from bot.services.freekassa_service import FreeKassaService
from bot.services.platega_service import PlategaService
def build_core_services(
@@ -54,6 +55,15 @@ def build_core_services(
subscription_service,
referral_service,
)
platega_service = PlategaService(
bot=bot,
settings=settings,
i18n=i18n,
async_session_factory=async_session_factory,
subscription_service=subscription_service,
referral_service=referral_service,
default_return_url=bot_username_for_default_return,
)
panel_webhook_service = PanelWebhookService(bot, settings, i18n, async_session_factory, panel_service)
yookassa_service = YooKassaService(
shop_id=settings.YOOKASSA_SHOP_ID,
@@ -83,5 +93,5 @@ def build_core_services(
"tribute_service": tribute_service,
"panel_webhook_service": panel_webhook_service,
"yookassa_service": yookassa_service,
"platega_service": platega_service,
}
+7 -1
View File
@@ -31,6 +31,7 @@ async def build_and_start_web_app(
"cryptopay_service",
"tribute_service",
"panel_webhook_service",
"platega_service",
):
# Access dispatcher workflow_data directly to avoid sequence protocol issues
if hasattr(dp, "workflow_data") and key in dp.workflow_data: # type: ignore
@@ -52,6 +53,7 @@ async def build_and_start_web_app(
from bot.services.crypto_pay_service import cryptopay_webhook_route
from bot.services.panel_webhook_service import panel_webhook_route
from bot.services.freekassa_service import freekassa_webhook_route
from bot.services.platega_service import platega_webhook_route
tribute_path = settings.tribute_webhook_path
if tribute_path.startswith("/"):
@@ -68,6 +70,11 @@ async def build_and_start_web_app(
app.router.add_post(fk_path, freekassa_webhook_route)
logging.info(f"FreeKassa webhook route configured at: [POST] {fk_path}")
pg_path = settings.platega_webhook_path
if pg_path.startswith("/"):
app.router.add_post(pg_path, platega_webhook_route)
logging.info(f"Platega webhook route configured at: [POST] {pg_path}")
# YooKassa webhook (register only when base URL present and path configured)
yk_path = settings.yookassa_webhook_path
if settings.WEBHOOK_BASE_URL and yk_path and yk_path.startswith("/"):
@@ -94,4 +101,3 @@ async def build_and_start_web_app(
# Run until cancelled
await asyncio.Event().wait()