diff --git a/server/github_app/purchased.py b/server/github_app/purchased.py new file mode 100644 index 00000000..26787039 --- /dev/null +++ b/server/github_app/purchased.py @@ -0,0 +1,9 @@ + + +from fastapi.responses import JSONResponse + + +class PurchaseServer(): + def purchased(self, payload: dict): + print(f"purchased={payload}") + return JSONResponse(content={"status": "ok"}, status_code=200) \ No newline at end of file diff --git a/server/github_app/router.py b/server/github_app/router.py index 1550adad..caa9d9f5 100644 --- a/server/github_app/router.py +++ b/server/github_app/router.py @@ -21,6 +21,7 @@ from core.models.user import User from github_app.handlers import get_handler +from github_app.purchased import PurchaseServer from github_app.utils import ( get_app_installations_access_token, get_installation_repositories, @@ -97,6 +98,9 @@ async def github_app_webhook( x_github_event: str = Header(...), ): payload = await request.json() + if x_github_event == "marketplace_purchase": + return PurchaseServer().purchased(payload) + if "installation" not in payload: return {"success": False, "message": "Invalid Webhook request"}