feat: stripe integration

This commit is contained in:
2025-05-27 19:35:07 +05:30
parent 611de1bf2a
commit b198b7678e
15 changed files with 410 additions and 38 deletions
+3 -3
View File
@@ -2,12 +2,10 @@ from fastapi import APIRouter, Depends, Security
from middleware.auth_dependency import auth_required
from fastapi.security import HTTPBearer
from apis.endpoints import sns
# Import the security scheme
bearer_scheme = HTTPBearer(scheme_name="Bearer Authentication")
from .endpoints import clinics, doctors, calender, appointments, patients, admin, auth, s3, users, clinicDoctor, dashboard, call_transcripts, notifications,sns
from .endpoints import clinics, doctors, calender, appointments, patients, admin, auth, s3, users, clinicDoctor, dashboard, call_transcripts, notifications,sns, stripe
api_router = APIRouter()
# api_router.include_router(twilio.router, prefix="/twilio")
@@ -23,6 +21,8 @@ api_router.include_router(patients.router, prefix="/patients", tags=["patients"]
api_router.include_router(sns.router, prefix="/sns", tags=["sns"], include_in_schema=False)
api_router.include_router(stripe.router, prefix="/stripe", tags=["stripe"])
api_router.include_router(
admin.router,
prefix="/admin",
+2 -2
View File
@@ -18,9 +18,9 @@ async def login(data: AuthBase):
@router.post("/register")
async def register(user_data: UserCreate, background_tasks: BackgroundTasks):
token = await AuthService().register(user_data, background_tasks)
response = await AuthService().register(user_data, background_tasks)
return ApiResponse(
data=token,
data=response,
message="User registered successfully"
)
+28
View File
@@ -0,0 +1,28 @@
from fastapi import APIRouter, Request
from services.stripeServices import StripeServices
router = APIRouter()
stripe_service = StripeServices()
@router.post("/create-checkout-session")
async def create_checkout_session(user_id: int):
return await stripe_service.create_checkout_session(1)
@router.post("/create-subscription-checkout")
async def create_subscription_checkout():
return await stripe_service.create_subscription_checkout(
fees_to_be={
"per_call_charges": 10,
"setup_fees": 100,
"subscription_fees": 100,
"total": 210
},
clinic_id=1,
account_id="acct_1RT1UFPTNqn2kWQ8",
customer_id="cus_SNn49FDltUcSLP"
)
@router.post("/webhook")
async def stripe_webhook(request: Request):
return await stripe_service.handle_webhook(request)