feat(payments): add Order & Escrow entities with CQRS commands, Prisma schema

- Add Order entity with lifecycle (pending → paid → completed/cancelled/refunded)
- Add Escrow entity with hold/release/dispute flow for secure transactions
- Add PlatformFee value object with tiered commission calculation
- Implement CQRS: CreateOrder, CancelOrder, HoldEscrow, ReleaseEscrow commands
- Add GetOrderStatus query handler
- Add OrdersController with REST endpoints and DTOs
- Add Prisma models for Order, Escrow, EscrowStatusHistory
- Add domain event classes for order and escrow state changes
- Add unit tests for Order, Escrow entities and PlatformFee VO
- Update PROJECT_TRACKER to Wave 14 status

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ho Ngoc Hai
2026-04-12 23:40:00 +07:00
parent 836499c1cf
commit 2c97f99214
42 changed files with 1786 additions and 34 deletions

View File

@@ -1,10 +1,20 @@
export { CancelOrderCommand } from './commands/cancel-order/cancel-order.command';
export { CancelOrderHandler, type CancelOrderResult } from './commands/cancel-order/cancel-order.handler';
export { CreateOrderCommand } from './commands/create-order/create-order.command';
export { CreateOrderHandler, type CreateOrderResult } from './commands/create-order/create-order.handler';
export { CreatePaymentCommand } from './commands/create-payment/create-payment.command';
export { CreatePaymentHandler, type CreatePaymentResult } from './commands/create-payment/create-payment.handler';
export { HandleCallbackCommand } from './commands/handle-callback/handle-callback.command';
export { HandleCallbackHandler, type HandleCallbackResult } from './commands/handle-callback/handle-callback.handler';
export { HoldEscrowCommand } from './commands/hold-escrow/hold-escrow.command';
export { HoldEscrowHandler, type HoldEscrowResult } from './commands/hold-escrow/hold-escrow.handler';
export { RefundPaymentCommand } from './commands/refund-payment/refund-payment.command';
export { RefundPaymentHandler, type RefundPaymentResult } from './commands/refund-payment/refund-payment.handler';
export { ReleaseEscrowCommand } from './commands/release-escrow/release-escrow.command';
export { ReleaseEscrowHandler, type ReleaseEscrowResult } from './commands/release-escrow/release-escrow.handler';
export { GetOrderStatusQuery } from './queries/get-order-status/get-order-status.query';
export { GetOrderStatusHandler, type OrderStatusDto } from './queries/get-order-status/get-order-status.handler';
export { GetPaymentStatusQuery } from './queries/get-payment-status/get-payment-status.query';
export { GetPaymentStatusHandler, type PaymentStatusDto } from './queries/get-payment-status/get-payment-status.handler';
export { ListTransactionsQuery } from './queries/list-transactions/list-transactions.query';