Files
sendico/frontend/pshared/lib/models/recipient/recipient.dart
Stephan D bf85ca062c
All checks were successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
restucturization of recipients payment methods
2025-12-04 14:42:25 +01:00

87 lines
2.3 KiB
Dart

import 'package:pshared/models/payment/methods/card.dart';
import 'package:pshared/models/payment/methods/iban.dart';
import 'package:pshared/models/payment/methods/crypto_address.dart';
import 'package:pshared/models/payment/methods/russian_bank.dart';
import 'package:pshared/models/payment/methods/wallet.dart';
import 'package:pshared/models/recipient/status.dart';
import 'package:pshared/models/recipient/type.dart';
class Recipient {
final String? avatarUrl; // network URL / local asset
final String name;
final String email;
final RecipientStatus status;
final RecipientType type;
final CardPaymentMethod? card;
final IbanPaymentMethod? iban;
final RussianBankAccountPaymentMethod? bank;
final WalletPaymentMethod? wallet;
final CryptoAddressPaymentMethod? cryptoAddress;
const Recipient({
this.avatarUrl,
required this.name,
required this.email,
required this.status,
required this.type,
this.card,
this.iban,
this.bank,
this.wallet,
this.cryptoAddress,
});
/// Convenience factory for quickly creating mock recipients.
factory Recipient.mock({
required String name,
required String email,
required RecipientStatus status,
required RecipientType type,
CardPaymentMethod? card,
IbanPaymentMethod? iban,
RussianBankAccountPaymentMethod? bank,
WalletPaymentMethod? wallet,
CryptoAddressPaymentMethod? cryptoAddress,
}) =>
Recipient(
avatarUrl: null,
name: name,
email: email,
status: status,
type: type,
card: card,
iban: iban,
bank: bank,
wallet: wallet,
cryptoAddress: cryptoAddress,
);
bool matchesQuery(String q) {
final searchable = [
name,
email,
card?.pan,
card?.firstName,
card?.lastName,
iban?.iban,
iban?.accountHolder,
iban?.bic,
iban?.bankName,
bank?.accountNumber,
bank?.recipientName,
bank?.inn,
bank?.kpp,
bank?.bankName,
bank?.bik,
bank?.correspondentAccount,
wallet?.walletId,
cryptoAddress?.address,
cryptoAddress?.network,
cryptoAddress?.destinationTag,
];
return searchable.any((field) => field?.toLowerCase().contains(q) ?? false);
}
}