SEND063
This commit is contained in:
23
frontend/pweb/lib/utils/payment/operation_code.dart
Normal file
23
frontend/pweb/lib/utils/payment/operation_code.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
class OperationCodePair {
|
||||
final String operation;
|
||||
final String action;
|
||||
|
||||
const OperationCodePair({required this.operation, required this.action});
|
||||
}
|
||||
|
||||
OperationCodePair? parseOperationCodePair(String? code) {
|
||||
final normalized = code?.trim().toLowerCase();
|
||||
if (normalized == null || normalized.isEmpty) return null;
|
||||
|
||||
final parts = normalized.split('.').where((part) => part.isNotEmpty).toList();
|
||||
if (parts.length >= 4 && (parts.first == 'hop' || parts.first == 'edge')) {
|
||||
return OperationCodePair(operation: parts[2], action: parts[3]);
|
||||
}
|
||||
if (parts.length >= 2) {
|
||||
return OperationCodePair(
|
||||
operation: parts[parts.length - 2],
|
||||
action: parts.last,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user