Skip to content

Feature/es 91 design the payments infrastructure layer#45

Merged
raouf-b-dev merged 10 commits intomasterfrom
feature/ES-91-design-the-payments-infrastructure-layer
Nov 23, 2025
Merged

Feature/es 91 design the payments infrastructure layer#45
raouf-b-dev merged 10 commits intomasterfrom
feature/ES-91-design-the-payments-infrastructure-layer

Conversation

@raouf-b-dev
Copy link
Owner

No description provided.

- 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.
@raouf-b-dev raouf-b-dev self-assigned this Nov 22, 2025
@raouf-b-dev raouf-b-dev merged commit b160741 into master Nov 23, 2025
1 check passed
@raouf-b-dev raouf-b-dev deleted the feature/ES-91-design-the-payments-infrastructure-layer branch November 23, 2025 00:01
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.

1 participant