SEND063
This commit is contained in:
23
frontend/pshared/lib/models/payment/execution_operation.dart
Normal file
23
frontend/pshared/lib/models/payment/execution_operation.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
class PaymentExecutionOperation {
|
||||
final String? stepRef;
|
||||
final String? operationRef;
|
||||
final String? code;
|
||||
final String? state;
|
||||
final String? label;
|
||||
final String? failureCode;
|
||||
final String? failureReason;
|
||||
final DateTime? startedAt;
|
||||
final DateTime? completedAt;
|
||||
|
||||
const PaymentExecutionOperation({
|
||||
required this.stepRef,
|
||||
required this.operationRef,
|
||||
required this.code,
|
||||
required this.state,
|
||||
required this.label,
|
||||
required this.failureCode,
|
||||
required this.failureReason,
|
||||
required this.startedAt,
|
||||
required this.completedAt,
|
||||
});
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:pshared/models/payment/execution_operation.dart';
|
||||
import 'package:pshared/models/payment/quote/quote.dart';
|
||||
import 'package:pshared/models/payment/state.dart';
|
||||
|
||||
@@ -8,6 +9,7 @@ class Payment {
|
||||
final PaymentOrchestrationState orchestrationState;
|
||||
final String? failureCode;
|
||||
final String? failureReason;
|
||||
final List<PaymentExecutionOperation> operations;
|
||||
final PaymentQuote? lastQuote;
|
||||
final Map<String, String>? metadata;
|
||||
final DateTime? createdAt;
|
||||
@@ -19,6 +21,7 @@ class Payment {
|
||||
required this.orchestrationState,
|
||||
required this.failureCode,
|
||||
required this.failureReason,
|
||||
required this.operations,
|
||||
required this.lastQuote,
|
||||
required this.metadata,
|
||||
required this.createdAt,
|
||||
|
||||
@@ -2,24 +2,35 @@ import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'package:pshared/generated/i18n/ps_localizations.dart';
|
||||
|
||||
|
||||
enum OperationStatus {
|
||||
pending,
|
||||
processing,
|
||||
retrying,
|
||||
success,
|
||||
skipped,
|
||||
cancelled,
|
||||
needsAttention,
|
||||
error,
|
||||
}
|
||||
|
||||
|
||||
extension OperationStatusX on OperationStatus {
|
||||
/// Returns the localized string for this status,
|
||||
/// e.g. “Processing”, “Success”, “Error”.
|
||||
String localized(BuildContext context) {
|
||||
final loc = PSLocalizations.of(context)!;
|
||||
switch (this) {
|
||||
case OperationStatus.pending:
|
||||
return loc.operationStatusPending;
|
||||
case OperationStatus.processing:
|
||||
return loc.operationStatusProcessing;
|
||||
case OperationStatus.retrying:
|
||||
return loc.operationStatusRetrying;
|
||||
case OperationStatus.success:
|
||||
return loc.operationStatusSuccess;
|
||||
case OperationStatus.skipped:
|
||||
return loc.operationStatusSkipped;
|
||||
case OperationStatus.cancelled:
|
||||
return loc.operationStatusCancelled;
|
||||
case OperationStatus.needsAttention:
|
||||
return loc.operationStatusNeedsAttention;
|
||||
case OperationStatus.error:
|
||||
return loc.operationStatusError;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user