few fixes and made sure ledger widget displays the name of ledger wallet

This commit is contained in:
Arseni
2026-03-05 01:48:53 +03:00
parent c59538869b
commit 519a2b1304
18 changed files with 293 additions and 249 deletions

View File

@@ -0,0 +1,14 @@
import 'package:pweb/utils/payment/operation_code.dart';
const String _documentOperation = 'card_payout';
const String _documentAction = 'send';
bool isOperationDocumentEligible(String? operationCode) {
final pair = parseOperationCodePair(operationCode);
if (pair == null) return false;
return _isDocumentOperationPair(pair);
}
bool _isDocumentOperationPair(OperationCodePair pair) {
return pair.operation == _documentOperation && pair.action == _documentAction;
}

View File

@@ -5,8 +5,7 @@ import 'package:pshared/models/payment/status.dart';
import 'package:pshared/utils/money.dart';
import 'package:pweb/models/report/operation/document.dart';
import 'package:pweb/utils/payment/operation_code.dart';
import 'package:pweb/utils/report/operations/document_rule.dart';
OperationItem mapPaymentToOperation(Payment payment) {
final debit = payment.lastQuote?.amounts?.sourceDebitTotal;
@@ -63,9 +62,7 @@ OperationDocumentInfo? _resolveOperationDocument(Payment payment) {
if (operationRef == null || operationRef.isEmpty) continue;
if (gatewayService == null || gatewayService.isEmpty) continue;
final pair = parseOperationCodePair(operation.code);
if (pair == null) continue;
if (pair.operation != 'card_payout' || pair.action != 'send') continue;
if (!isOperationDocumentEligible(operation.code)) continue;
return OperationDocumentInfo(
operationRef: operationRef,
@@ -133,4 +130,4 @@ String? _firstNonEmpty(List<String?> values) {
if (trimmed != null && trimmed.isNotEmpty) return trimmed;
}
return null;
}
}