payment quotation v2 + payment orchestration v2 draft

This commit is contained in:
Stephan D
2026-02-24 13:01:35 +01:00
parent 0646f55189
commit 6444813f38
289 changed files with 17005 additions and 16065 deletions

View File

@@ -1,10 +1,11 @@
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;
@@ -15,6 +16,7 @@ class Payment {
required this.paymentRef,
required this.idempotencyKey,
required this.state,
required this.orchestrationState,
required this.failureCode,
required this.failureReason,
required this.lastQuote,
@@ -22,9 +24,12 @@ class Payment {
required this.createdAt,
});
bool get isPending => orchestrationState.isPending;
bool get isTerminal => orchestrationState.isTerminal;
bool get isFailure {
if ((failureCode ?? '').trim().isNotEmpty) return true;
final normalized = (state ?? '').trim().toLowerCase();
return normalized.contains('fail') || normalized.contains('cancel');
return orchestrationState == PaymentOrchestrationState.failed;
}
}