Multiple Wallet support, history of each wallet and updated payment page

This commit is contained in:
Arseni
2025-11-21 19:22:23 +03:00
parent 4c64a8d6e6
commit 87636a7ec3
68 changed files with 2154 additions and 701 deletions

View File

@@ -0,0 +1,74 @@
import 'package:flutter/widgets.dart';
import 'package:pshared/models/payment/status.dart';
import 'package:pweb/models/currency.dart';
enum WalletTransactionType { topUp, payout }
extension WalletTransactionTypeX on WalletTransactionType {
String label(BuildContext context) {
switch (this) {
case WalletTransactionType.topUp:
return 'Top up';
case WalletTransactionType.payout:
return 'Payout';
}
}
String get sign => this == WalletTransactionType.topUp ? '+' : '-';
}
class WalletTransaction {
final String id;
final String walletId;
final WalletTransactionType type;
final OperationStatus status;
final double amount;
final Currency currency;
final DateTime date;
final String description;
final String? counterparty;
final double? balanceAfter;
const WalletTransaction({
required this.id,
required this.walletId,
required this.type,
required this.status,
required this.amount,
required this.currency,
required this.date,
required this.description,
this.counterparty,
this.balanceAfter,
});
bool get isTopUp => type == WalletTransactionType.topUp;
WalletTransaction copyWith({
String? id,
String? walletId,
WalletTransactionType? type,
OperationStatus? status,
double? amount,
Currency? currency,
DateTime? date,
String? description,
String? counterparty,
double? balanceAfter,
}) {
return WalletTransaction(
id: id ?? this.id,
walletId: walletId ?? this.walletId,
type: type ?? this.type,
status: status ?? this.status,
amount: amount ?? this.amount,
currency: currency ?? this.currency,
date: date ?? this.date,
description: description ?? this.description,
counterparty: counterparty ?? this.counterparty,
balanceAfter: balanceAfter ?? this.balanceAfter,
);
}
}