changed color theme to be black and added the ability to enter the amount in the recipient’s currency

This commit is contained in:
Arseni
2026-03-02 17:41:41 +03:00
parent 17e08ff26f
commit 6bb3ab5063
41 changed files with 618 additions and 239 deletions

View File

@@ -0,0 +1,57 @@
import 'package:pshared/models/payment/methods/card.dart';
import 'package:pshared/models/payment/methods/crypto_address.dart';
import 'package:pshared/models/payment/methods/data.dart';
import 'package:pshared/models/payment/methods/iban.dart';
import 'package:pshared/models/payment/methods/russian_bank.dart';
import 'package:pshared/models/payment/quote/quote.dart';
class PaymentQuotationCurrencyResolver {
static String? resolveQuoteCurrency({
PaymentQuote? quote,
PaymentMethodData? paymentData,
}) {
final quoteCurrency = _normalizeCurrency(
quote?.amounts?.destinationSettlement?.currency,
);
if (quoteCurrency != null) return quoteCurrency;
if (paymentData == null) return null;
final metadataCurrency = _normalizeCurrency(
paymentData.metadata?['currency'],
);
if (metadataCurrency != null) return metadataCurrency;
if (paymentData is CryptoAddressPaymentMethod) {
return _normalizeCurrency(paymentData.asset?.tokenSymbol);
}
if (paymentData is RussianBankAccountPaymentMethod ||
paymentData is CardPaymentMethod) {
return 'RUB';
}
if (paymentData is IbanPaymentMethod) {
return 'EUR';
}
return null;
}
static bool isFxEnabled({
required String? sourceCurrency,
required String? quoteCurrency,
}) {
final normalizedSource = _normalizeCurrency(sourceCurrency);
final normalizedQuote = _normalizeCurrency(quoteCurrency);
if (normalizedSource == null || normalizedQuote == null) return false;
return normalizedSource != normalizedQuote;
}
static String? _normalizeCurrency(String? value) {
final normalized = value?.trim().toUpperCase();
if (normalized == null || normalized.isEmpty) return null;
return normalized;
}
}