Feature/es 91 design the payments infrastructure layer#45
Merged
raouf-b-dev merged 10 commits intomasterfrom Nov 23, 2025
Merged
Conversation
- Added methods to generate payment and refund IDs with appropriate prefixes and formats. - Implemented unit tests to verify the correctness of generated IDs and database interactions.
…tializer - Introduced PAYMENT_REDIS constants for managing payment-related Redis data. - Added PaymentIndexSchema to define the structure for payment data in Redis. - Updated RedisIndexInitializerService to ensure the creation of the payment index. - Enhanced unit tests to cover payment index creation and error handling scenarios.
…functionality - Updated Payment class to include refunds as an array of Refund objects, improving refund management. - Modified PaymentProps interface to accommodate refunds and adjusted related methods accordingly. - Enhanced Refund class with additional properties and methods for better encapsulation of refund data. - Refactored Money import to use shared domain value object, ensuring consistency across modules. - Removed obsolete Money class from payments domain, centralizing monetary operations in the shared module.
…nd refund ID handling - Renamed paymentInfoId to paymentId for consistency with updated naming conventions. - Added refundId to the mock structure to support refund ID generation. - Introduced generatePaymentInfoId method to maintain backward compatibility with existing tests. - Added getCurrentSequenceValue and resetSequence methods for enhanced mock functionality.
- Introduced PaymentEntity and RefundEntity classes to define the database schema for payments and refunds. - Implemented necessary columns and relationships, including payment details, refund management, and timestamps for tracking. - Enhanced data integrity with appropriate types and constraints for each field.
- Added PaymentBuilder to facilitate the creation of mock payment instances with customizable properties for testing. - Introduced PaymentTestFactory for generating mock payment data with default values and overrides. - Created PaymentEntityTestFactory to generate PaymentEntity instances with default values and various states (pending, failed, refunded). - Added RefundEntityTestFactory and RefundTestFactory for creating mock refund entities and refund data for testing purposes. - Implemented MockPaymentRepository to simulate payment repository interactions, including methods for finding, saving, and deleting payments and refunds.
…sformations - Added PaymentMapper to convert between PaymentEntity and Payment domain objects, including handling refunds. - Introduced PaymentCacheMapper for caching Payment data with timestamp adjustments. - Created RefundMapper to facilitate conversion between RefundEntity and Refund domain objects, including array handling for multiple refunds.
…agement - Created PostgresPaymentRepository to handle payment and refund operations using TypeORM. - Implemented methods for saving, updating, deleting, and finding payments and refunds by various identifiers. - Added transaction management to ensure data integrity during save operations. - Developed unit tests to validate repository functionality and error handling scenarios.
- Created RedisPaymentRepository to manage payment data caching with Redis. - Implemented methods for finding payments by ID, order ID, and transaction ID, with cache hit/miss logic. - Developed save, update, and delete methods to synchronize data between Redis and Postgres. - Added unit tests to validate repository functionality and error handling scenarios.
…tories - Added POSTGRES_PAYMENT_REPOSITORY and REDIS_PAYMENT_REPOSITORY constants for dependency injection. - Integrated TypeOrmModule for PaymentEntity and RefundEntity to manage database interactions. - Configured providers for PostgresPaymentRepository and RedisPaymentRepository, enhancing payment data management with caching. - Updated module imports to include RedisModule and CoreModule for improved functionality.
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.
No description provided.