added wallet source to quotation preparation
This commit is contained in:
@@ -3,6 +3,7 @@ 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/managed_wallet.dart';
|
||||
import 'package:pshared/models/payment/methods/russian_bank.dart';
|
||||
import 'package:pshared/models/payment/methods/wallet.dart';
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
@@ -43,6 +44,7 @@ class PaymentMethod implements PermissionBoundStorable, Describable {
|
||||
IbanPaymentMethod? get ibanData => dataAsOrNull<IbanPaymentMethod>();
|
||||
RussianBankAccountPaymentMethod? get bankAccountData => dataAsOrNull<RussianBankAccountPaymentMethod>();
|
||||
WalletPaymentMethod? get walletData => dataAsOrNull<WalletPaymentMethod>();
|
||||
ManagedWalletPaymentMethod? get managedWalletData => dataAsOrNull<ManagedWalletPaymentMethod>();
|
||||
CryptoAddressPaymentMethod? get cryptoAddressData => dataAsOrNull<CryptoAddressPaymentMethod>();
|
||||
|
||||
@override
|
||||
|
||||
68
frontend/pshared/lib/models/payment/wallet.dart
Normal file
68
frontend/pshared/lib/models/payment/wallet.dart
Normal file
@@ -0,0 +1,68 @@
|
||||
import 'package:pshared/models/currency.dart';
|
||||
import 'package:pshared/models/describable.dart';
|
||||
import 'package:pshared/models/payment/chain_network.dart';
|
||||
|
||||
|
||||
class Wallet implements Describable {
|
||||
final String id;
|
||||
final String walletUserID; // ID or number that we show the user
|
||||
final double balance;
|
||||
final Currency currency;
|
||||
final bool isHidden;
|
||||
final DateTime calculatedAt;
|
||||
final String? depositAddress;
|
||||
final ChainNetwork? network;
|
||||
final String? tokenSymbol;
|
||||
final String? contractAddress;
|
||||
final Describable describable;
|
||||
|
||||
@override
|
||||
String get name => describable.name;
|
||||
|
||||
@override
|
||||
String? get description => describable.description;
|
||||
|
||||
Wallet({
|
||||
required this.id,
|
||||
required this.walletUserID,
|
||||
required this.balance,
|
||||
required this.currency,
|
||||
required this.calculatedAt,
|
||||
required this.describable,
|
||||
this.isHidden = true,
|
||||
this.depositAddress,
|
||||
this.network,
|
||||
this.tokenSymbol,
|
||||
this.contractAddress,
|
||||
});
|
||||
|
||||
Wallet copyWith({
|
||||
String? id,
|
||||
double? balance,
|
||||
Currency? currency,
|
||||
String? walletUserID,
|
||||
bool? isHidden,
|
||||
String? depositAddress,
|
||||
ChainNetwork? network,
|
||||
String? tokenSymbol,
|
||||
String? contractAddress,
|
||||
Describable? describable,
|
||||
String? name,
|
||||
String? Function()? description,
|
||||
}) => Wallet(
|
||||
id: id ?? this.id,
|
||||
balance: balance ?? this.balance,
|
||||
currency: currency ?? this.currency,
|
||||
walletUserID: walletUserID ?? this.walletUserID,
|
||||
isHidden: isHidden ?? this.isHidden,
|
||||
calculatedAt: calculatedAt,
|
||||
depositAddress: depositAddress ?? this.depositAddress,
|
||||
network: network ?? this.network,
|
||||
tokenSymbol: tokenSymbol ?? this.tokenSymbol,
|
||||
contractAddress: contractAddress ?? this.contractAddress,
|
||||
describable: describable
|
||||
?? (name != null || description != null
|
||||
? this.describable.copyWith(name: name, description: description)
|
||||
: this.describable),
|
||||
);
|
||||
}
|
||||
14
frontend/pshared/lib/models/wallet/asset.dart
Normal file
14
frontend/pshared/lib/models/wallet/asset.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
import 'package:pshared/models/payment/chain_network.dart';
|
||||
|
||||
|
||||
class WalletAsset {
|
||||
final ChainNetwork chain;
|
||||
final String tokenSymbol;
|
||||
final String contractAddress;
|
||||
|
||||
const WalletAsset({
|
||||
required this.chain,
|
||||
required this.tokenSymbol,
|
||||
required this.contractAddress,
|
||||
});
|
||||
}
|
||||
@@ -1,21 +1,9 @@
|
||||
import 'package:pshared/models/describable.dart';
|
||||
import 'package:pshared/models/payment/chain_network.dart';
|
||||
import 'package:pshared/models/wallet/asset.dart';
|
||||
import 'package:pshared/models/wallet/balance.dart';
|
||||
import 'package:pshared/models/wallet/money.dart';
|
||||
|
||||
|
||||
class WalletAsset {
|
||||
final ChainNetwork chain;
|
||||
final String tokenSymbol;
|
||||
final String contractAddress;
|
||||
|
||||
const WalletAsset({
|
||||
required this.chain,
|
||||
required this.tokenSymbol,
|
||||
required this.contractAddress,
|
||||
});
|
||||
}
|
||||
|
||||
class WalletModel implements Describable {
|
||||
final String walletRef;
|
||||
final String organizationRef;
|
||||
@@ -55,20 +43,18 @@ class WalletModel implements Describable {
|
||||
WalletBalance? balance,
|
||||
WalletMoney? availableMoney,
|
||||
Describable? describable,
|
||||
}) {
|
||||
return WalletModel(
|
||||
walletRef: walletRef,
|
||||
organizationRef: organizationRef,
|
||||
ownerRef: ownerRef,
|
||||
asset: asset,
|
||||
depositAddress: depositAddress,
|
||||
status: status,
|
||||
metadata: metadata,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
balance: balance ?? this.balance,
|
||||
availableMoney: availableMoney ?? this.availableMoney,
|
||||
describable: describable ?? this.describable,
|
||||
);
|
||||
}
|
||||
}) => WalletModel(
|
||||
walletRef: walletRef,
|
||||
organizationRef: organizationRef,
|
||||
ownerRef: ownerRef,
|
||||
asset: asset,
|
||||
depositAddress: depositAddress,
|
||||
status: status,
|
||||
metadata: metadata,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
balance: balance ?? this.balance,
|
||||
availableMoney: availableMoney ?? this.availableMoney,
|
||||
describable: describable ?? this.describable,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user