feat(api): add price history, Stringee SMS, Zalo OA, WebSocket notifications, and feature-listing command

- Add PriceHistory model + migration, price-changed domain event, and event handler
- Add GetPriceHistory query handler and controller endpoint
- Implement StringeeSmsService and ZaloOaService with unit tests
- Add Zalo ZNS templates for Vietnamese notification messages
- Add WebSocket notification gateway for real-time push
- Add FeatureListingCommand for promoted listings
- Apply remaining consistent-type-imports lint fixes across API modules

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-16 05:15:04 +07:00
parent c920934fb6
commit d4e100a00c
48 changed files with 1766 additions and 225 deletions

View File

@@ -1,17 +1,17 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, EventBus, ICommandHandler } from '@nestjs/cqrs';
import { PaymentStatus } from '@prisma/client';
import { CommandHandler, type EventBus, type ICommandHandler } from '@nestjs/cqrs';
import { type PaymentStatus } from '@prisma/client';
import {
DomainException,
NotFoundException,
ValidationException,
LoggerService,
type LoggerService,
} from '@modules/shared';
import {
PAYMENT_REPOSITORY,
IPaymentRepository,
type IPaymentRepository,
} from '../../../domain/repositories/payment.repository';
import { BankTransferService } from '../../../infrastructure/services/bank-transfer.service';
import { type BankTransferService } from '../../../infrastructure/services/bank-transfer.service';
import { ConfirmBankTransferCommand } from './confirm-bank-transfer.command';
export interface ConfirmBankTransferResult {

View File

@@ -1,14 +1,14 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, EventBus, ICommandHandler } from '@nestjs/cqrs';
import { PaymentStatus } from '@prisma/client';
import { DomainException, NotFoundException, ValidationException, LoggerService } from '@modules/shared';
import { CommandHandler, type EventBus, type ICommandHandler } from '@nestjs/cqrs';
import { type PaymentStatus } from '@prisma/client';
import { DomainException, NotFoundException, ValidationException, type LoggerService } from '@modules/shared';
import {
PAYMENT_REPOSITORY,
IPaymentRepository,
type IPaymentRepository,
} from '../../../domain/repositories/payment.repository';
import {
PAYMENT_GATEWAY_FACTORY,
IPaymentGatewayFactory,
type IPaymentGatewayFactory,
} from '../../../infrastructure/services/payment-gateway.interface';
import { HandleCallbackCommand } from './handle-callback.command';

View File

@@ -1,13 +1,13 @@
import { Injectable, BadRequestException } from '@nestjs/common';
import { PaymentProvider } from '@prisma/client';
import { BankTransferService } from './bank-transfer.service';
import { MomoService } from './momo.service';
import { type PaymentProvider } from '@prisma/client';
import { type BankTransferService } from './bank-transfer.service';
import { type MomoService } from './momo.service';
import {
type IPaymentGateway,
IPaymentGatewayFactory,
type IPaymentGatewayFactory,
} from './payment-gateway.interface';
import { VnpayService } from './vnpay.service';
import { ZalopayService } from './zalopay.service';
import { type VnpayService } from './vnpay.service';
import { type ZalopayService } from './zalopay.service';
@Injectable()
export class PaymentGatewayFactory implements IPaymentGatewayFactory {

View File

@@ -6,26 +6,26 @@ import {
Post,
UseGuards,
} from '@nestjs/common';
import { CommandBus, QueryBus } from '@nestjs/cqrs';
import { type CommandBus, type QueryBus } from '@nestjs/cqrs';
import {
ApiTags,
ApiOperation,
ApiResponse,
ApiBearerAuth,
} from '@nestjs/swagger';
import { JwtPayload, CurrentUser, Roles, JwtAuthGuard, RolesGuard } from '@modules/auth';
import { type JwtPayload, CurrentUser, Roles, JwtAuthGuard, RolesGuard } from '@modules/auth';
import { CancelOrderCommand } from '../../application/commands/cancel-order/cancel-order.command';
import { CancelOrderResult } from '../../application/commands/cancel-order/cancel-order.handler';
import { type CancelOrderResult } from '../../application/commands/cancel-order/cancel-order.handler';
import { CreateOrderCommand } from '../../application/commands/create-order/create-order.command';
import { CreateOrderResult } from '../../application/commands/create-order/create-order.handler';
import { type CreateOrderResult } from '../../application/commands/create-order/create-order.handler';
import { HoldEscrowCommand } from '../../application/commands/hold-escrow/hold-escrow.command';
import { HoldEscrowResult } from '../../application/commands/hold-escrow/hold-escrow.handler';
import { type HoldEscrowResult } from '../../application/commands/hold-escrow/hold-escrow.handler';
import { ReleaseEscrowCommand } from '../../application/commands/release-escrow/release-escrow.command';
import { ReleaseEscrowResult } from '../../application/commands/release-escrow/release-escrow.handler';
import { OrderStatusDto } from '../../application/queries/get-order-status/get-order-status.handler';
import { type ReleaseEscrowResult } from '../../application/commands/release-escrow/release-escrow.handler';
import { type OrderStatusDto } from '../../application/queries/get-order-status/get-order-status.handler';
import { GetOrderStatusQuery } from '../../application/queries/get-order-status/get-order-status.query';
import { CancelOrderDto } from '../dto/cancel-order.dto';
import { CreateOrderDto } from '../dto/create-order.dto';
import { type CancelOrderDto } from '../dto/cancel-order.dto';
import { type CreateOrderDto } from '../dto/create-order.dto';
@ApiTags('orders')
@Controller('orders')

View File

@@ -8,7 +8,7 @@ import {
Query,
UseGuards,
} from '@nestjs/common';
import { CommandBus, QueryBus } from '@nestjs/cqrs';
import { type CommandBus, type QueryBus } from '@nestjs/cqrs';
import {
ApiTags,
ApiOperation,
@@ -17,25 +17,25 @@ import {
ApiParam,
} from '@nestjs/swagger';
import { Throttle } from '@nestjs/throttler';
import { PaymentProvider } from '@prisma/client';
import { JwtPayload, CurrentUser, Roles, JwtAuthGuard, RolesGuard } from '@modules/auth';
import { type PaymentProvider } from '@prisma/client';
import { type JwtPayload, CurrentUser, Roles, JwtAuthGuard, RolesGuard } from '@modules/auth';
import { EndpointRateLimit, EndpointRateLimitGuard } from '@modules/shared';
import { ConfirmBankTransferCommand } from '../../application/commands/confirm-bank-transfer/confirm-bank-transfer.command';
import { ConfirmBankTransferResult } from '../../application/commands/confirm-bank-transfer/confirm-bank-transfer.handler';
import { type ConfirmBankTransferResult } from '../../application/commands/confirm-bank-transfer/confirm-bank-transfer.handler';
import { CreatePaymentCommand } from '../../application/commands/create-payment/create-payment.command';
import { CreatePaymentResult } from '../../application/commands/create-payment/create-payment.handler';
import { type CreatePaymentResult } from '../../application/commands/create-payment/create-payment.handler';
import { HandleCallbackCommand } from '../../application/commands/handle-callback/handle-callback.command';
import { HandleCallbackResult } from '../../application/commands/handle-callback/handle-callback.handler';
import { type HandleCallbackResult } from '../../application/commands/handle-callback/handle-callback.handler';
import { RefundPaymentCommand } from '../../application/commands/refund-payment/refund-payment.command';
import { RefundPaymentResult } from '../../application/commands/refund-payment/refund-payment.handler';
import { PaymentStatusDto } from '../../application/queries/get-payment-status/get-payment-status.handler';
import { type RefundPaymentResult } from '../../application/commands/refund-payment/refund-payment.handler';
import { type PaymentStatusDto } from '../../application/queries/get-payment-status/get-payment-status.handler';
import { GetPaymentStatusQuery } from '../../application/queries/get-payment-status/get-payment-status.query';
import { TransactionListDto } from '../../application/queries/list-transactions/list-transactions.handler';
import { type TransactionListDto } from '../../application/queries/list-transactions/list-transactions.handler';
import { ListTransactionsQuery } from '../../application/queries/list-transactions/list-transactions.query';
import { ConfirmBankTransferDto } from '../dto/confirm-bank-transfer.dto';
import { CreatePaymentDto } from '../dto/create-payment.dto';
import { ListTransactionsDto } from '../dto/list-transactions.dto';
import { RefundPaymentDto } from '../dto/refund-payment.dto';
import { type ConfirmBankTransferDto } from '../dto/confirm-bank-transfer.dto';
import { type CreatePaymentDto } from '../dto/create-payment.dto';
import { type ListTransactionsDto } from '../dto/list-transactions.dto';
import { type RefundPaymentDto } from '../dto/refund-payment.dto';
@ApiTags('payments')
@Controller('payments')