refactor of money utils with new money2 package
This commit is contained in:
@@ -2,15 +2,14 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'package:pshared/models/money.dart';
|
||||
import 'package:money2/money2.dart';
|
||||
|
||||
import 'package:pshared/utils/localization.dart';
|
||||
|
||||
import 'package:pweb/utils/money_display.dart';
|
||||
|
||||
|
||||
String formatMoney(BuildContext context, Money? money) {
|
||||
if (money == null || money.amount.trim().isEmpty) {
|
||||
return unavailableMoneyValue(context);
|
||||
}
|
||||
return formatMoneyUi(context, money);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:pshared/models/payment/operation.dart';
|
||||
import 'package:pshared/models/payment/payment.dart';
|
||||
import 'package:pshared/models/payment/state.dart';
|
||||
import 'package:pshared/models/payment/status.dart';
|
||||
import 'package:pshared/utils/money.dart';
|
||||
|
||||
import 'package:pweb/utils/payment/upload_metadata.dart';
|
||||
import 'package:pweb/utils/report/operations/document_rule.dart';
|
||||
@@ -14,12 +13,12 @@ OperationItem mapPaymentToOperation(Payment payment) {
|
||||
final settlement = payment.lastQuote?.amounts?.destinationSettlement;
|
||||
final amountMoney = debit ?? settlement;
|
||||
|
||||
final amount = parseMoneyAmount(amountMoney?.amount);
|
||||
final currency = amountMoney?.currency ?? '';
|
||||
final amount = amountMoney?.toDouble() ?? 0;
|
||||
final currency = amountMoney?.currency.isoCode ?? '';
|
||||
final toAmount = settlement == null
|
||||
? amount
|
||||
: parseMoneyAmount(settlement.amount);
|
||||
final toCurrency = settlement?.currency ?? currency;
|
||||
: settlement.toDouble();
|
||||
final toCurrency = settlement?.currency.isoCode ?? currency;
|
||||
|
||||
final payId = _firstNonEmpty([payment.paymentRef]) ?? '-';
|
||||
final name =
|
||||
|
||||
Reference in New Issue
Block a user