Files
gridpilot.gg/packages/racing/application/ports/IPaymentGateway.ts
2025-12-10 00:38:59 +01:00

48 lines
923 B
TypeScript

/**
* Application Port: IPaymentGateway
*
* Defines interface for payment processing.
* Infrastructure will provide mock or real implementation.
*/
import type { Money } from '../../domain/value-objects/Money';
export interface PaymentResult {
success: boolean;
transactionId?: string;
error?: string;
timestamp: Date;
}
export interface RefundResult {
success: boolean;
refundId?: string;
error?: string;
timestamp: Date;
}
export interface IPaymentGateway {
/**
* Process a payment
*/
processPayment(
amount: Money,
payerId: string,
description: string,
metadata?: Record<string, unknown>
): Promise<PaymentResult>;
/**
* Refund a payment
*/
refund(
originalTransactionId: string,
amount: Money,
reason: string
): Promise<RefundResult>;
/**
* Verify payment status
*/
verifyPayment(transactionId: string): Promise<PaymentResult>;
}