Skip to content

Commit

Permalink
feat: support-purchased (#395)
Browse files Browse the repository at this point in the history
- 处理购买
  • Loading branch information
RaoHai authored Sep 14, 2024
2 parents ab1ab67 + 2022f3c commit 6748e1a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions server/github_app/purchased.py
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 4 additions & 0 deletions server/github_app/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"}

Expand Down

0 comments on commit 6748e1a

Please sign in to comment.