Development#19
Merged
Merged
Conversation
- Added ProductDetail component for displaying product information, variants, and images. - Integrated add to cart functionality with quantity selection and variant handling. - Created ProductsHome component to list products with filtering and sorting options. - Established CartContext for managing cart state, including adding, updating, and removing items. - Defined TypeScript types for products, variants, categories, and cart items. - Implemented CORS middleware for API to handle cross-origin requests.
…w payment methods
…-part2 Refactor stripe payment provider
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces several changes aimed at improving configuration management and deployment, updating payment processing for Stripe and MobilePay, standardizing product weight handling, and enhancing middleware functionality (including the addition of a CORS middleware).
- Updates to the configuration (added new environment variables, CORSConfig, and consolidated return URLs)
- Enhancements in Docker setup and payment processing (upgrade to stripe-go v82, new payment-related methods, and order use case updates)
- Simplification of weight handling by centralizing it at the product level, and additions to payment and webhook handling in various modules
Reviewed Changes
Copilot reviewed 19 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| readme.md | Updated instructions for Docker setup and payment integrations (switching PayPal references to MobilePay) |
| internal/interfaces/api/server.go | Added stripe webhook setup with conditional logging and new middleware integration (commented CORS code) |
| internal/interfaces/api/middleware/cors_middleware.go | Introduced a CORS middleware implementation using configurable allowed origins |
| internal/interfaces/api/handler/webhook_handler.go | Extended Stripe webhook event handling to include additional event types and record transactions |
| internal/interfaces/api/handler/product_handler.go | Removed references to per-variant weight to enforce product-level weight usage |
| internal/interfaces/api/handler/order_handler.go | Updated payment processing to use the guest email instead of the provided customer email for orders |
| internal/infrastructure/repository/* | Modified queries and JSON unmarshaling logic to remove weight column from product variants |
| internal/infrastructure/payment/stripe_payment_service.go | Upgraded Stripe library usage and refactored amount conversion, customer creation, and refund/capture logic |
| internal/infrastructure/container/middleware_provider.go | Added provision for the new CORS middleware |
| config/config.go | Extended configuration to support CORS settings and unified return URL handling |
| docker-compose.yml | Added services and configuration for deploying the API, migration, and seeding tools in Docker |
Files not reviewed (3)
- .env.example: Language not supported
- Dockerfile: Language not supported
- go.mod: Language not supported
Comments suppressed due to low confidence (1)
internal/infrastructure/payment/stripe_payment_service.go:167
- Ensure that 'request.Amount' is expressed in the smallest currency unit (e.g., cents) to align with Stripe's requirements, or add documentation to clarify the expected unit.
Amount: stripe.Int64(request.Amount),
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a variety of changes, including updates to configuration management, Docker setup, payment processing, and order handling. It also simplifies the handling of product weights and adds new middleware functionality. Below is a categorized summary of the most significant changes:
Configuration and Environment Updates:
STRIPE_WEBHOOK_SECRETandSTRIPE_PAYMENT_DESCRIPTIONto.env.examplefor Stripe integration. ConsolidatedRETURN_URLfor Stripe, PayPal, and MobilePay into a single environment variable. [1] [2]CORSConfigstructure to manage CORS settings, with defaults allowing all origins. UpdatedLoadConfigto include this configuration. [1] [2] [3] [4]Docker and Deployment Enhancements:
Dockerfilewith a multi-stage build process for API, migration, and seeding binaries.docker-compose.ymlto define services for PostgreSQL, the API, and database tools (migrate and seed).Payment and Order Processing Improvements:
stripe-golibrary from v72 to v82, enabling support for new Stripe features. [1] [2]GetOrderByPaymentIDandRecordPaymentTransactionmethods to theOrderUseCaseto enhance payment handling. [1] [2]Product Weight Simplification:
Middleware Enhancements:
CorsMiddlewareto handle Cross-Origin Resource Sharing (CORS) requests. Integrated it into the middleware provider. [1] [2] [3]These changes collectively improve the application's configuration flexibility, deployment options, payment processing capabilities, and code maintainability.