removed legacy from bff

This commit is contained in:
Stephan D
2026-02-24 21:18:23 +01:00
parent a998b59072
commit da11be526a
26 changed files with 343 additions and 273 deletions

View File

@@ -5,10 +5,9 @@ import 'package:pshared/utils/money.dart';
import 'package:pweb/models/payment/payment_state.dart';
OperationItem mapPaymentToOperation(Payment payment) {
final debit = payment.lastQuote?.debitAmount;
final settlement = payment.lastQuote?.expectedSettlementAmount;
final debit = payment.lastQuote?.amounts?.sourceDebitTotal;
final settlement = payment.lastQuote?.amounts?.destinationSettlement;
final amountMoney = debit ?? settlement;
final amount = parseMoneyAmount(amountMoney?.amount);
@@ -18,18 +17,17 @@ OperationItem mapPaymentToOperation(Payment payment) {
: parseMoneyAmount(settlement.amount);
final toCurrency = settlement?.currency ?? currency;
final payId = _firstNonEmpty([
payment.paymentRef,
payment.idempotencyKey,
]) ??
'-';
final name = _firstNonEmpty([
final payId =
_firstNonEmpty([payment.paymentRef, payment.idempotencyKey]) ?? '-';
final name =
_firstNonEmpty([
payment.lastQuote?.quoteRef,
payment.paymentRef,
payment.idempotencyKey,
]) ??
'-';
final comment = _firstNonEmpty([
final comment =
_firstNonEmpty([
payment.failureReason,
payment.failureCode,
payment.state,
@@ -72,17 +70,17 @@ DateTime resolvePaymentDate(Payment payment) {
final expiresAt = payment.lastQuote?.fxQuote?.expiresAtUnixMs;
if (expiresAt != null && expiresAt > 0) {
return DateTime.fromMillisecondsSinceEpoch(expiresAt, isUtc: true).toLocal();
return DateTime.fromMillisecondsSinceEpoch(
expiresAt,
isUtc: true,
).toLocal();
}
return DateTime.fromMillisecondsSinceEpoch(0);
}
String? paymentIdFromOperation(OperationItem operation) {
final candidates = [
operation.paymentRef,
operation.payId,
];
final candidates = [operation.paymentRef, operation.payId];
for (final candidate in candidates) {
final trimmed = candidate?.trim();
if (trimmed != null && trimmed.isNotEmpty && trimmed != '-') {