Skip to content

Commit

Permalink
chore: remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
felixrodrigo19 committed Oct 16, 2024
1 parent 537a687 commit 5cc9f10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
13 changes: 9 additions & 4 deletions src/api/drivers/webhook/payment.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
from fastapi import APIRouter, HTTPException, Request, FastAPI
import httpx
import asyncio

import httpx
from fastapi import APIRouter, HTTPException, Request

router = APIRouter()


@router.post("/api/v1/payment-status")
async def receive_payment_status(request: Request):
try:
data = await request.json()
result = data["payment_status"]
print(f"Payment result {result}")
except Exception as exc:
except Exception:
raise HTTPException(status_code=500, detail="Server Error")


WEBHOOK_URL = "http://localhost:8001/set-webhook"


async def register_webhook_payment_server():
params = {
"user_id": "0",
}
body = {
"webhook_url": "http://localhost:8000/api/v1/payment-status"
}

async with httpx.AsyncClient() as client:
resp = await client.post(WEBHOOK_URL, params=params, json=body)
print(resp)
if (resp.status_code != 200):
print(f"Failed to register webhook in the payment mock server: {WEBHOOK_URL}")


asyncio.run(register_webhook_payment_server())
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from uuid import uuid4

from pydantic import BaseModel, Field
from pydantic import BaseModel

from src.api.presentation.shared.enums.categories import Categories

Expand Down
1 change: 0 additions & 1 deletion src/cart/adapters/postgresql_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.orm import Session

from cart.domain.entities.order_product import OrderProduct
from product.adapters.product_table import ProductTable
from src.cart.adapters.order_table import OrderTable, OrderProductTable
from src.cart.ports.repository_interface import IRepository
Expand Down

0 comments on commit 5cc9f10

Please sign in to comment.