feat: stripe integration
This commit is contained in:
+3
-3
@@ -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",
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user