import 'package:pshared/models/payment/execution_operation.dart'; import 'package:pshared/models/payment/quote/quote.dart'; import 'package:pshared/models/payment/state.dart'; class Payment { final String? paymentRef; final String? idempotencyKey; final String? state; final PaymentOrchestrationState orchestrationState; final String? failureCode; final String? failureReason; final List operations; final PaymentQuote? lastQuote; final Map? metadata; final DateTime? createdAt; const Payment({ required this.paymentRef, required this.idempotencyKey, required this.state, required this.orchestrationState, required this.failureCode, required this.failureReason, required this.operations, required this.lastQuote, required this.metadata, required this.createdAt, }); bool get isPending => orchestrationState.isPending; bool get isTerminal => orchestrationState.isTerminal; bool get isFailure { if ((failureCode ?? '').trim().isNotEmpty) return true; return orchestrationState == PaymentOrchestrationState.failed; } }