Files
sendico/frontend/pshared/lib/models/payment/payment.dart

36 lines
996 B
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 PaymentQuote? lastQuote;
final Map<String, String>? 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.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;
}
}