mece request / payment economics
This commit is contained in:
@@ -21,7 +21,6 @@ import 'package:pshared/provider/recipient/provider.dart';
|
||||
import 'package:pshared/utils/currency.dart';
|
||||
import 'package:pshared/utils/payment/fx_helpers.dart';
|
||||
|
||||
|
||||
class QuotationIntentBuilder {
|
||||
PaymentIntent? build({
|
||||
required PaymentAmountProvider payment,
|
||||
@@ -45,8 +44,10 @@ class QuotationIntentBuilder {
|
||||
// TODO: adapt to possible other sources
|
||||
currency: sourceCurrency,
|
||||
);
|
||||
final isCryptoToCrypto = paymentData is CryptoAddressPaymentMethod &&
|
||||
(paymentData.asset?.tokenSymbol ?? '').trim().toUpperCase() == amount.currency;
|
||||
final isCryptoToCrypto =
|
||||
paymentData is CryptoAddressPaymentMethod &&
|
||||
(paymentData.asset?.tokenSymbol ?? '').trim().toUpperCase() ==
|
||||
amount.currency;
|
||||
final fxIntent = FxIntentHelper.buildSellBaseBuyQuote(
|
||||
baseCurrency: sourceCurrency,
|
||||
quoteCurrency: 'RUB', // TODO: exentd target currencies
|
||||
@@ -61,15 +62,13 @@ class QuotationIntentBuilder {
|
||||
asset: PaymentAsset(
|
||||
tokenSymbol: selectedWallet.tokenSymbol ?? '',
|
||||
chain: selectedWallet.network ?? ChainNetwork.unspecified,
|
||||
)
|
||||
),
|
||||
),
|
||||
fx: fxIntent,
|
||||
feeTreatment: payment.payerCoversFee ? FeeTreatment.addToSource : FeeTreatment.deductFromDestination,
|
||||
feeTreatment: payment.payerCoversFee
|
||||
? FeeTreatment.addToSource
|
||||
: FeeTreatment.deductFromDestination,
|
||||
settlementMode: SettlementMode.fixSource,
|
||||
settlementCurrency: FxIntentHelper.resolveSettlementCurrency(
|
||||
amount: amount,
|
||||
fx: fxIntent,
|
||||
),
|
||||
customer: customer,
|
||||
);
|
||||
}
|
||||
@@ -92,8 +91,9 @@ class QuotationIntentBuilder {
|
||||
: name.trim().split(RegExp(r'\s+'));
|
||||
final firstName = parts.isNotEmpty ? parts.first : null;
|
||||
final lastName = parts.length >= 2 ? parts.last : null;
|
||||
final middleName =
|
||||
parts.length > 2 ? parts.sublist(1, parts.length - 1).join(' ') : null;
|
||||
final middleName = parts.length > 2
|
||||
? parts.sublist(1, parts.length - 1).join(' ')
|
||||
: null;
|
||||
|
||||
return Customer(
|
||||
id: id,
|
||||
@@ -120,7 +120,9 @@ class QuotationIntentBuilder {
|
||||
return iban.accountHolder.trim();
|
||||
}
|
||||
|
||||
final bank = method?.bankAccountData ?? (data is RussianBankAccountPaymentMethod ? data : null);
|
||||
final bank =
|
||||
method?.bankAccountData ??
|
||||
(data is RussianBankAccountPaymentMethod ? data : null);
|
||||
if (bank != null && bank.recipientName.trim().isNotEmpty) {
|
||||
return bank.recipientName.trim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user