few fixes and made sure ledger widget displays the name of ledger wallet
This commit is contained in:
14
frontend/pweb/lib/utils/report/operations/document_rule.dart
Normal file
14
frontend/pweb/lib/utils/report/operations/document_rule.dart
Normal 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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user