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>
15 lines
456 B
TypeScript
15 lines
456 B
TypeScript
import { type DomainEvent } from '@modules/shared/domain/domain-event';
|
|
import { type PaymentProvider } from '@prisma/client';
|
|
|
|
export class PaymentCompletedEvent implements DomainEvent {
|
|
readonly eventName = 'payment.completed';
|
|
readonly occurredAt = new Date();
|
|
|
|
constructor(
|
|
public readonly aggregateId: string,
|
|
public readonly userId: string,
|
|
public readonly provider: PaymentProvider,
|
|
public readonly amountVND: bigint,
|
|
) {}
|
|
}
|