Skip to content

Conversation

@gustaavik
Copy link
Member

  • Updated CreateOrderInput to include session ID, email, phone number, and full name for guest checkouts.
  • Enhanced CreateOrderFromCart method to handle both authenticated and guest checkouts.
  • Added createOrderFromGuestCart method to process guest orders, including validation and cart retrieval.
  • Modified Order and Cart entities to accommodate guest information and session IDs.
  • Updated CartRepository to support retrieval by session ID and conversion of guest carts to user carts.
  • Enhanced OrderRepository to handle guest orders, including new fields for guest information.
  • Added unit tests for guest order creation and ensured cart and product stock updates are handled correctly.
  • Created database migrations to support the new guest checkout structure.

- Updated CreateOrderInput to include session ID, email, phone number, and full name for guest checkouts.
- Enhanced CreateOrderFromCart method to handle both authenticated and guest checkouts.
- Added createOrderFromGuestCart method to process guest orders, including validation and cart retrieval.
- Modified Order and Cart entities to accommodate guest information and session IDs.
- Updated CartRepository to support retrieval by session ID and conversion of guest carts to user carts.
- Enhanced OrderRepository to handle guest orders, including new fields for guest information.
- Added unit tests for guest order creation and ensured cart and product stock updates are handled correctly.
- Created database migrations to support the new guest checkout structure.
@gustaavik gustaavik requested a review from Copilot April 26, 2025 15:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements guest checkout functionality by updating order and cart repositories, use cases, and API endpoints to support guest users. Key changes include adding guest-specific fields to orders, enhancing cart handling to accommodate session IDs, and introducing new API routes and tests for guest orders and carts.

Reviewed Changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
testutil/mock/cart_repository.go Added guest cart support with session-based storage and thread safety.
internal/infrastructure/repository/postgres/order_repository.go Updated SQL queries and result scanning to include guest order fields.
internal/infrastructure/repository/postgres/cart_repository.go Modified cart repository to support guest cart conversion to user cart.
internal/domain/entity/order.go Introduced NewGuestOrder and additional guest fields in Order.
internal/domain/entity/cart.go Added NewGuestCart and updated JSON tags for guest carts.
internal/application/usecase/order_usecase.go Created separate guest order flow handling and validations.
internal/application/usecase/cart_usecase.go Added guest cart use case methods (get, add, update, remove, clear, convert).
internal/api/server.go Added guest endpoints for cart and order operations.
internal/api/handler/order_handler.go Updated order handler to support both authenticated and guest orders.
internal/api/handler/cart_handler.go Integrated session cookie handling for guest cart operations.
Files not reviewed (2)
  • migrations/000008_add_guest_checkout.down.sql: Language not supported
  • migrations/000008_add_guest_checkout.up.sql: Language not supported

@gustaavik gustaavik merged commit e6d940e into main Apr 26, 2025
1 check passed
@gustaavik gustaavik deleted the adding-guest-checkout branch April 26, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants