sync: migrate secure-online-shop to Gitea (2026-08-10)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.api.dependencies import get_current_user
|
||||
from app.db.session import get_db
|
||||
from app.models.user import User
|
||||
from app.schemas.payment import PaymentResponse
|
||||
from app.services.payment_service import PaymentService
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.post(
|
||||
"/orders/{order_id}/confirm",
|
||||
response_model=PaymentResponse,
|
||||
status_code=status.HTTP_200_OK,
|
||||
summary="Mock payment confirmation for an owned order",
|
||||
)
|
||||
def confirm_order_payment(
|
||||
order_id: int,
|
||||
db: Annotated[Session, Depends(get_db)],
|
||||
current_user: Annotated[User, Depends(get_current_user)],
|
||||
) -> PaymentResponse:
|
||||
order = PaymentService(db).confirm_payment(order_id, current_user)
|
||||
return PaymentResponse.model_validate(order)
|
||||
Reference in New Issue
Block a user