From 7dd8ef45c0f267eb99c1e1380ccee921aab692e6 Mon Sep 17 00:00:00 2001 From: dongli Date: Sun, 22 Dec 2024 18:52:43 -0800 Subject: [PATCH] Clean up payment isolation --- .../payment/stripe_manager_controller.py | 46 ++++++------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/apps/payment/webapi/routes/payment/stripe_manager_controller.py b/apps/payment/webapi/routes/payment/stripe_manager_controller.py index e22ffc0..f702edd 100644 --- a/apps/payment/webapi/routes/payment/stripe_manager_controller.py +++ b/apps/payment/webapi/routes/payment/stripe_manager_controller.py @@ -75,7 +75,7 @@ async def fetch_transaction_by_session_id( # Web API # Fetch stripe transaction for milestone @router.get( - "/fetch_stripe_transaction_for_milestone/{project_id}/{milestone_index}", + "/fetch_stripe_transaction_for_milestone/", operation_id="fetch_stripe_transaction_for_milestone", summary="Fetch stripe transaction for milestone", description="Fetch stripe transaction for milestone", @@ -125,7 +125,7 @@ async def create_stripe_transaction_for_milestone( ) async def create_payment_link( transaction_id: str -): +) -> Optional[str]: return await payment_hub.create_payment_link(transaction_id) # Web API @@ -138,7 +138,7 @@ async def create_payment_link( ) async def create_checkout_session( transaction_id: str -): +) -> Tuple[Optional[str], Optional[str]]: return await payment_hub.create_checkout_session(transaction_id) # Web API @@ -151,7 +151,7 @@ async def create_checkout_session( ) async def fetch_payment_link( transaction_id: str -): +) -> Optional[str]: return await payment_hub.fetch_payment_link(transaction_id) @@ -165,7 +165,7 @@ async def fetch_payment_link( ) async def fetch_checkout_session_id( transaction_id: str -): +) -> Optional[str]: return await payment_hub.fetch_checkout_session_id(transaction_id) # Web API @@ -178,7 +178,7 @@ async def fetch_checkout_session_id( ) async def fetch_checkout_session_url( transaction_id: str -): +) -> Optional[str]: return await payment_hub.fetch_checkout_session_url(transaction_id) # Web API @@ -189,31 +189,11 @@ async def fetch_checkout_session_url( summary="Invoke checkout session webhook", description="Invoke checkout session webhook", ) -async def invoke_checkout_session_webhook(): - return await payment_hub.invoke_checkout_session_webhook() - -@router.get( - "/test/{user_id}", - operation_id="test", - summary="test user_id", - description="test user_id", -) -async def test( - user_id: str +async def invoke_checkout_session_webhook( + payload: str, + stripe_signature: str ): - return user_id - -@router.get( - "/testproj/{project_id}", - operation_id="test", - summary="test project_id", - description="test project_id", -) -async def test_project( - project_id: str -): - return await ProjectDoc.get(project_id) - - - - + return await payment_hub.invoke_checkout_session_webhook( + payload, + stripe_signature + )