erp-construccion-backend-v2/src/modules/payment-terminals/dto/transaction.dto.ts
Adrian Flores Cortes 0493d4b8bd [PROP-CORE-004] feat: Add Phase 6 modules from erp-core
Propagated modules:
- payment-terminals: MercadoPago + Clip TPV
- ai: Role-based AI access (ADMIN, SUPERVISOR_OBRA, RESIDENTE, ALMACENISTA)
- mcp: 18 ERP tools for AI assistants

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 02:45:03 -06:00

76 lines
1.6 KiB
TypeScript

/**
* Transaction DTOs
*/
import { PaymentSourceType, PaymentMethod, PaymentStatus } from '../../mobile/entities/payment-transaction.entity';
export class ProcessPaymentDto {
terminalId: string;
amount: number;
currency?: string;
tipAmount?: number;
sourceType: PaymentSourceType;
sourceId: string;
description?: string;
customerEmail?: string;
customerPhone?: string;
}
export class PaymentResultDto {
success: boolean;
transactionId?: string;
externalTransactionId?: string;
amount: number;
totalAmount: number;
tipAmount: number;
currency: string;
status: PaymentStatus;
paymentMethod?: PaymentMethod;
cardBrand?: string;
cardLastFour?: string;
receiptUrl?: string;
error?: string;
errorCode?: string;
}
export class ProcessRefundDto {
transactionId: string;
amount?: number; // Partial refund if provided
reason?: string;
}
export class RefundResultDto {
success: boolean;
refundId?: string;
amount: number;
status: 'pending' | 'completed' | 'failed';
error?: string;
}
export class SendReceiptDto {
email?: string;
phone?: string;
}
export class TransactionFilterDto {
branchId?: string;
userId?: string;
status?: PaymentStatus;
startDate?: Date;
endDate?: Date;
sourceType?: PaymentSourceType;
terminalProvider?: string;
limit?: number;
offset?: number;
}
export class TransactionStatsDto {
total: number;
totalAmount: number;
byStatus: Record<PaymentStatus, number>;
byProvider: Record<string, { count: number; amount: number }>;
byPaymentMethod: Record<PaymentMethod, number>;
averageAmount: number;
successRate: number;
}