Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions be/api/v1/endpoints/cart/checkout/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PaymentModel(BaseModel):


class PostCheckoutResponseModel(BaseModel):
orderId: str
id: str
email: str
items: list[OrderItem]
price: PriceModel
Expand Down Expand Up @@ -59,27 +59,29 @@ async def post_checkout(req: CheckoutRequestBodyModel):
receipt_email=req.email,
description=f"SCSE Merch Purchase:\n{description}"
)
orderDateTime = datetime.now().__str__()

id = uuid.uuid4().__str__()
dateTime = datetime.now().__str__()
customerEmail = req.email
transactionID = payment_intent.id
paymentPlatform = "stripe"
orderItems = items_products
items = items_products
status = OrderStatus.PENDING_PAYMENT

order = Order(
orderID = orderID,
orderDateTime = orderDateTime,
id = id,
dateTime = dateTime,
customerEmail = customerEmail,
transactionID = transactionID,
paymentGateway = paymentPlatform,
orderItems = orderItems,
items = items,
status = status
)

dal_create_order(order)

return {
"orderId": orderID,
"id": id,
"items": items_products,
"price": price,
"payment": {
Expand Down
Empty file.
14 changes: 0 additions & 14 deletions be/api/v1/endpoints/product_categories/conftest.py

This file was deleted.

23 changes: 0 additions & 23 deletions be/api/v1/endpoints/product_categories/delete.py

This file was deleted.

37 changes: 0 additions & 37 deletions be/api/v1/endpoints/product_categories/delete_test.py

This file was deleted.

24 changes: 0 additions & 24 deletions be/api/v1/endpoints/product_categories/get.py

This file was deleted.

14 changes: 0 additions & 14 deletions be/api/v1/endpoints/product_categories/get_test.py

This file was deleted.

27 changes: 0 additions & 27 deletions be/api/v1/endpoints/product_categories/post.py

This file was deleted.

21 changes: 0 additions & 21 deletions be/api/v1/endpoints/product_categories/post_test.py

This file was deleted.

45 changes: 0 additions & 45 deletions be/api/v1/endpoints/product_categories/test_utils.py

This file was deleted.

Empty file.
23 changes: 0 additions & 23 deletions be/api/v1/endpoints/users/get.py

This file was deleted.

18 changes: 0 additions & 18 deletions be/api/v1/endpoints/users/get_test.py

This file was deleted.

8 changes: 4 additions & 4 deletions be/api/v1/models/cart.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ class CartItem(BaseModel):
size: Optional[str]
quantity: int
colorway: str

class Cart(BaseModel):
items: list[CartItem]
promoCode: Optional[str]

class PriceModel(BaseModel):
currency: str
subtotal: float
discount: float
grandTotal: float
subtotal: int
discount: int
grandTotal: int
6 changes: 3 additions & 3 deletions be/api/v1/models/orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class OrderItem(BaseModel):
size: Optional[str]

class Order(BaseModel):
orderID: str
orderDateTime: datetime
id: str
dateTime: datetime
customerEmail: str
transactionID: str
paymentGateway: str
orderItems: list[OrderItem]
items: list[OrderItem]
status: OrderStatus
5 changes: 0 additions & 5 deletions be/api/v1/models/product_category.py

This file was deleted.

28 changes: 7 additions & 21 deletions be/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,14 @@
from fastapi.openapi.utils import get_openapi
from dotenv import load_dotenv

load_dotenv(join(dirname(__file__), '..', '.env.test'))
base_api_server_url: str = os.getenv('BASE_API_SERVER_URL')

from be.api.v1.endpoints.cart.checkout.post import router as v1_checkout_post
from be.api.v1.endpoints.cart.quotation.post import router as v1_cart_quotation_post
from be.api.v1.endpoints.orders.get import router as v1_orders_get
from be.api.v1.endpoints.payments.intent.post import router as v1_payments_intent_post
from be.api.v1.endpoints.products.get import router as v1_products_get


from be.api.v1.endpoints.product_categories.get import (
router as v1_product_categories_get,
)
from be.api.v1.endpoints.product_categories.post import (
router as v1_product_categories_post,
)
from be.api.v1.endpoints.product_categories.delete import (
router as v1_product_categories_delete,
)

from be.api.v1.endpoints.payments.intent.post import router as v1_payments_intent_post
from be.api.v1.endpoints.cart.quotation.post import router as v1_cart_quotation_post
from be.api.v1.endpoints.cart.checkout.post import router as v1_checkout_post
load_dotenv(join(dirname(__file__), '..', '.env.test'))
base_api_server_url: str = os.getenv('BASE_API_SERVER_URL')

tags_metadata = [
{
Expand All @@ -43,10 +32,7 @@
)

app.include_router(v1_products_get)

app.include_router(v1_product_categories_get)
app.include_router(v1_product_categories_post)
app.include_router(v1_product_categories_delete)
app.include_router(v1_orders_get)

app.include_router(v1_payments_intent_post)
app.include_router(v1_cart_quotation_post)
Expand Down
Loading