Add webhook support for modules / Implement hooks for payment keyboard

This commit is contained in:
Capybara-z
2025-08-04 20:31:28 +03:00
parent 35ef17660c
commit a833b11b8e
3 changed files with 42 additions and 0 deletions
+13
View File
@@ -6,6 +6,7 @@ from .heleket_payment import heleket_payment_webhook
from .kassai_payment import kassai_payment_webhook
from .tblocker import tblocker_webhook
from .wata_payment import wata_payment_webhook
from utils.modules_loader import load_module_webhooks
WATA_WEBHOOK_PATH = "/wata/webhook"
@@ -18,3 +19,15 @@ async def register_web_routes(router: UrlDispatcher) -> None:
router.add_post(WATA_WEBHOOK_PATH, wata_payment_webhook)
router.add_post(KASSAI_WEBHOOK_PATH, kassai_payment_webhook)
router.add_post(HELEKET_WEBHOOK_PATH, heleket_payment_webhook)
try:
module_webhooks = load_module_webhooks()
for webhook_data in module_webhooks:
path = webhook_data.get("path")
handler = webhook_data.get("handler")
if path and handler:
router.add_post(path, handler)
print(f"[Web] Зарегистрирован вебхук модуля: {path}")
except Exception as e:
print(f"[Web] Ошибка при загрузке вебхуков модулей: {e}")