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

@@ -1,12 +1,15 @@
import 'package:flutter/material.dart';
import 'package:pshared/models/payment/settlement_mode.dart';
class PaymentAmountProvider with ChangeNotifier {
double _amount = 10.0;
bool _payerCoversFee = true;
SettlementMode _settlementMode = SettlementMode.fixSource;
double get amount => _amount;
bool get payerCoversFee => _payerCoversFee;
SettlementMode get settlementMode => _settlementMode;
void setAmount(double value) {
_amount = value;
@@ -17,4 +20,10 @@ class PaymentAmountProvider with ChangeNotifier {
_payerCoversFee = value;
notifyListeners();
}
void setSettlementMode(SettlementMode value) {
if (_settlementMode == value) return;
_settlementMode = value;
notifyListeners();
}
}

View File

@@ -7,6 +7,7 @@ import 'package:pshared/provider/resource.dart';
import 'package:pshared/service/payment/multiple.dart';
import 'package:pshared/utils/exception.dart';
class MultiPaymentProvider extends ChangeNotifier {
late OrganizationsProvider _organization;
late MultiQuotationProvider _quotation;

View File

@@ -22,6 +22,8 @@ import 'package:pshared/utils/currency.dart';
import 'package:pshared/utils/payment/fx_helpers.dart';
class QuotationIntentBuilder {
static const String _settlementCurrency = 'RUB';
PaymentIntent? build({
required PaymentAmountProvider payment,
required WalletsController wallets,
@@ -39,10 +41,12 @@ class QuotationIntentBuilder {
data: paymentData,
);
final sourceCurrency = currencyCodeToString(selectedWallet.currency);
final amountCurrency = payment.settlementMode == SettlementMode.fixReceived
? _settlementCurrency
: sourceCurrency;
final amount = Money(
amount: payment.amount.toString(),
// TODO: adapt to possible other sources
currency: sourceCurrency,
currency: amountCurrency,
);
final isCryptoToCrypto =
paymentData is CryptoAddressPaymentMethod &&
@@ -50,7 +54,7 @@ class QuotationIntentBuilder {
amount.currency;
final fxIntent = FxIntentHelper.buildSellBaseBuyQuote(
baseCurrency: sourceCurrency,
quoteCurrency: 'RUB', // TODO: exentd target currencies
quoteCurrency: _settlementCurrency, // TODO: exentd target currencies
enabled: !isCryptoToCrypto,
);
return PaymentIntent(
@@ -68,7 +72,7 @@ class QuotationIntentBuilder {
feeTreatment: payment.payerCoversFee
? FeeTreatment.addToSource
: FeeTreatment.deductFromDestination,
settlementMode: SettlementMode.fixSource,
settlementMode: payment.settlementMode,
customer: customer,
);
}