-
Notifications
You must be signed in to change notification settings - Fork 0
Development #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Development #19
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
There was a problem hiding this 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 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 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.