Ho Ngoc Hai
e9889539ea
fix: eliminate untyped repository returns and standardize DomainException usage across all handlers
...
- Create typed DTOs (ListingDetailData, ListingSearchItem, ListingSellerItem) for repository read methods
- Replace all Promise<any> and PaginatedResult<any> with concrete types in repository interface and implementation
- Remove `as any` casts in search params by using Prisma enum types (TransactionType, PropertyType)
- Migrate all 16 handlers from NestJS built-in exceptions to domain exceptions (NotFoundException, ValidationException, etc.)
- Add CONTRIBUTING.md documenting error handling convention
- All 230 tests pass, typecheck clean
Co-Authored-By: Paperclip <noreply@paperclip.ing >
2026-04-08 06:25:44 +07:00
Ho Ngoc Hai
9583d1cb66
fix(payments): harden payment flow with idempotency keys, amount validation, and magic byte file validation
...
- Add dedicated idempotencyKey column with unique constraint (userId, provider, idempotencyKey) to prevent duplicate payments at DB level
- Add @Min(1) @Max(100B) validators on amountVND in CreatePaymentDto to reject invalid amounts at API boundary
- Replace read-check-write callback handler with atomic updateIfStatus to eliminate race condition on concurrent callbacks
- Add magic byte verification in FileValidationPipe to validate file content matches declared MIME type server-side
Co-Authored-By: Paperclip <noreply@paperclip.ing >
2026-04-08 06:18:26 +07:00
Ho Ngoc Hai
ad7713968a
feat(payments): implement Payments module with VNPay, MoMo, ZaloPay integration
...
Implement complete payment processing module following DDD + CQRS patterns:
- Domain layer: PaymentEntity aggregate, Money value object, domain events
- Infrastructure: PrismaPaymentRepository, VnpayService, MomoService, ZalopayService
- PaymentGatewayFactory pattern for provider abstraction
- CQRS Commands: CreatePayment, HandleCallback, RefundPayment
- CQRS Queries: GetPaymentStatus, ListTransactions
- Callback/webhook endpoints with signature verification and idempotency
- 23 unit tests covering domain, VNPay service, and gateway factory
Co-Authored-By: Paperclip <noreply@paperclip.ing >
2026-04-08 01:57:23 +07:00