Clean up payment isolation

This commit is contained in:
dongli 2024-12-22 18:52:43 -08:00
parent cfea8b5889
commit 7dd8ef45c0

View File

@ -75,7 +75,7 @@ async def fetch_transaction_by_session_id(
# Web API # Web API
# Fetch stripe transaction for milestone # Fetch stripe transaction for milestone
@router.get( @router.get(
"/fetch_stripe_transaction_for_milestone/{project_id}/{milestone_index}", "/fetch_stripe_transaction_for_milestone/",
operation_id="fetch_stripe_transaction_for_milestone", operation_id="fetch_stripe_transaction_for_milestone",
summary="Fetch stripe transaction for milestone", summary="Fetch stripe transaction for milestone",
description="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( async def create_payment_link(
transaction_id: str transaction_id: str
): ) -> Optional[str]:
return await payment_hub.create_payment_link(transaction_id) return await payment_hub.create_payment_link(transaction_id)
# Web API # Web API
@ -138,7 +138,7 @@ async def create_payment_link(
) )
async def create_checkout_session( async def create_checkout_session(
transaction_id: str transaction_id: str
): ) -> Tuple[Optional[str], Optional[str]]:
return await payment_hub.create_checkout_session(transaction_id) return await payment_hub.create_checkout_session(transaction_id)
# Web API # Web API
@ -151,7 +151,7 @@ async def create_checkout_session(
) )
async def fetch_payment_link( async def fetch_payment_link(
transaction_id: str transaction_id: str
): ) -> Optional[str]:
return await payment_hub.fetch_payment_link(transaction_id) return await payment_hub.fetch_payment_link(transaction_id)
@ -165,7 +165,7 @@ async def fetch_payment_link(
) )
async def fetch_checkout_session_id( async def fetch_checkout_session_id(
transaction_id: str transaction_id: str
): ) -> Optional[str]:
return await payment_hub.fetch_checkout_session_id(transaction_id) return await payment_hub.fetch_checkout_session_id(transaction_id)
# Web API # Web API
@ -178,7 +178,7 @@ async def fetch_checkout_session_id(
) )
async def fetch_checkout_session_url( async def fetch_checkout_session_url(
transaction_id: str transaction_id: str
): ) -> Optional[str]:
return await payment_hub.fetch_checkout_session_url(transaction_id) return await payment_hub.fetch_checkout_session_url(transaction_id)
# Web API # Web API
@ -189,31 +189,11 @@ async def fetch_checkout_session_url(
summary="Invoke checkout session webhook", summary="Invoke checkout session webhook",
description="Invoke checkout session webhook", description="Invoke checkout session webhook",
) )
async def invoke_checkout_session_webhook(): async def invoke_checkout_session_webhook(
return await payment_hub.invoke_checkout_session_webhook() payload: str,
stripe_signature: str
@router.get(
"/test/{user_id}",
operation_id="test",
summary="test user_id",
description="test user_id",
)
async def test(
user_id: str
): ):
return user_id return await payment_hub.invoke_checkout_session_webhook(
payload,
@router.get( stripe_signature
"/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)