-
Notifications
You must be signed in to change notification settings - Fork 0
Migration cleanup payment providers #40
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
Merged
gustaavik
merged 29 commits into
migrations-cleanup2
from
migration-cleanup-payment-providers
Jul 1, 2025
Merged
Migration cleanup payment providers #40
gustaavik
merged 29 commits into
migrations-cleanup2
from
migration-cleanup-payment-providers
Jul 1, 2025
Conversation
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
…-related migrations - Deleted migrations for currency support, order customer details, product active status, default currency, cart tables, and checkout tables. - Removed constraints and indexes related to legacy cart and checkout functionality. - Cleaned up migrations for ensuring product variants and added unique constraints for shipping methods and categories. - Updated migrations for adding currency and payment status to orders, including necessary indexes and data updates. - Improved product deletion logic by removing unnecessary triggers and relying on application-level enforcement.
…ent provider configurations
…n webhook handlers
… transactions for various events
- Added a mock logger implementation to facilitate logging in tests. - Created mock repositories for PaymentProvider, PaymentTransaction, Order, and Product to simulate database interactions. - Developed a mock payment provider service to handle payment provider operations in tests. - Implemented comprehensive test cases for each mock service to ensure expected behavior and error handling.
…ntities - Implement tests for PaymentProvider including validation, methods, and constants. - Add tests for PaymentTransaction covering creation, validation, metadata, and status updates. - Create tests for Product and ProductVariant with focus on creation, validation, and variant management. - Introduce tests for User entity covering creation, password management, and role validation. - Ensure comprehensive coverage for all new functionalities and edge cases.
…Product, Shipping Method, Rate, and Zone
…orders, and discounts - Implemented user seeding with role assignment and existence check. - Added category seeding with hierarchical relationships. - Enhanced product seeding to include variants and category mapping. - Introduced order seeding with user and product variant associations. - Added discount seeding with various types and constraints. - Implemented shipping methods and zones seeding. - Enhanced payment transaction seeding for completed orders. - Improved checkout seeding with session management and item tracking. - Updated clearData function to use DELETE for SQLite compatibility.
… generation for UUID
…, currencies, shipping, and users - Implemented CategoryDTO for category representation. - Created CheckoutDTO and related structures for checkout sessions. - Added OrderDTO and OrderItemDTO for order management. - Introduced ProductDTO and VariantDTO for product details. - Developed DiscountDTO and AppliedDiscountDTO for discount handling. - Established CurrencyDTO for currency representation. - Created Shipping-related DTOs including ShippingMethodDetailDTO, ShippingZoneDTO, and ShippingRateDTO. - Implemented UserDTO for user management. - Generated TypeScript contracts for API interactions.
- Updated import paths for DTOs in various entity files to use the new location under internal/domain/dto. - Removed old DTO files from internal/interfaces/api/contracts/dto as they have been migrated to internal/domain/dto. - Added new DTO definitions for Category, Checkout, Common, Currency, Discount, Order, Product, Shipping, and User in the internal/domain/dto directory. - Updated related contract files to reference the new DTOs. - Cleaned up the readme and removed the todo file.
…cy across entities
…ptions and applied discounts
…scounts - Updated Checkout and Order entities to store shipping and billing addresses as JSON. - Introduced helper methods for setting and getting addresses and discounts in JSON format. - Modified checkout and order processing logic to utilize new JSON methods for address and discount handling. - Adjusted related use cases and repositories to accommodate changes in address storage. - Enhanced webhook handling to allow requests without an Origin header. - Separated webhook routes from main API routes for better organization and security.
… update PaymentTransaction to use it for metadata
…ustomer details, and add item DTO conversion
…move debug logs from CORS middleware
… addresses, and applied discounts
…ance checkout currency handling
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 significant updates to the payment provider system, checkout process, and development environment setup. Key changes include the implementation of a centralized
PaymentProviderRepositorysystem, enhancements to the checkout use case for better handling of discounts and shipping options, and adjustments to the development environment to support PostgreSQL and SQLite configurations. Additionally, new helper methods and dependencies have been added to improve functionality and maintainability.Payment Provider System Enhancements:
PaymentProviderRepositorysystem to manage payment providers and their configurations, replacing the webhook repository approach. This includes CRUD operations, webhook management, and dynamic provider discovery. (docs/PAYMENT_PROVIDER_SYSTEM.md)PaymentProviderTypeandPaymentMethodto prevent circular imports and improve type safety. (internal/domain/common/payment_types.go) [1] [2]Checkout Process Improvements:
internal/application/usecase/checkout_recovery_usecase.go,internal/application/usecase/checkout_usecase.go) [1] [2]internal/application/usecase/checkout_usecase.go) [1] [2]internal/application/usecase/checkout_usecase.go)Development Environment Updates:
db-startcommand to initialize the database. (Makefile)runtarget to support SQLite for specific use cases. (Makefile)Additional Changes:
GetOrderByExternalIDto theOrderUseCasefor retrieving orders based on external references, such as MobilePay webhook events. (internal/application/usecase/order_usecase.go)go.modto include new dependencies likegithub.com/stretchr/testifyandgithub.com/zenfulcode/vipps-mobilepay-sdk. (go.mod)These changes collectively enhance the scalability, maintainability, and functionality of the application while adhering to clean architecture principles.