Skip to content

Commit

Permalink
Add purchase request logging API
Browse files Browse the repository at this point in the history
  • Loading branch information
U-lis committed Dec 27, 2023
1 parent 3ee4a56 commit 8a6d492
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions iap/api/purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from googleapiclient.errors import HttpError
from sqlalchemy import select
from sqlalchemy.orm import joinedload
from starlette.responses import JSONResponse

from common.enums import ReceiptStatus, Store, GooglePurchaseState
from common.models.product import Product
Expand Down Expand Up @@ -95,6 +96,21 @@ def raise_error(sess, receipt: Receipt, e: Exception):
raise e


@router.get("/log")
def log_request_product(planet_id: str, agent_address: str, avatar_address: str, product_id: str,
order_id: Optional[str] = "", data: Optional[str] = ""):
"""
# Purchase log
---
Logs purchase request data
"""
logger.info(f"[PURCHASE_LOG] {planet_id} :: {agent_address} :: {avatar_address} :: {product_id} :: {order_id}")
if data:
logger.info(data)
return JSONResponse(status_code=200, content=f"Order {order_id} for product {product_id} logged.")


@router.post("/request", response_model=ReceiptDetailSchema)
def request_product(receipt_data: ReceiptSchema, sess=Depends(session)):
"""
Expand Down

0 comments on commit 8a6d492

Please sign in to comment.