Top Up Balance logic and Added fixes for routing
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import 'package:pshared/service/wallet.dart' as shared_wallet_service;
|
||||
|
||||
import 'package:pweb/models/currency.dart';
|
||||
import 'package:pweb/models/wallet.dart';
|
||||
import 'package:pweb/data/mappers/wallet_ui.dart';
|
||||
|
||||
@@ -10,27 +9,6 @@ abstract class WalletsService {
|
||||
Future<double> getBalance(String organizationRef, String walletRef);
|
||||
}
|
||||
|
||||
class MockWalletsService implements WalletsService {
|
||||
final List<Wallet> _wallets = [
|
||||
Wallet(id: '1124', walletUserID: 'WA-12345667', name: 'Main Wallet', balance: 10000000.0, currency: Currency.rub, calculatedAt: DateTime.now()),
|
||||
Wallet(id: '2124', walletUserID: 'WA-76654321', name: 'Savings', balance: 2500.5, currency: Currency.usd, calculatedAt: DateTime.now()),
|
||||
];
|
||||
|
||||
@override
|
||||
Future<List<Wallet>> getWallets(String _) async {
|
||||
return _wallets;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<double> getBalance(String _, String walletRef) async {
|
||||
final wallet = _wallets.firstWhere(
|
||||
(w) => w.id == walletRef,
|
||||
orElse: () => throw Exception('Wallet not found'),
|
||||
);
|
||||
return wallet.balance;
|
||||
}
|
||||
}
|
||||
|
||||
class ApiWalletsService implements WalletsService {
|
||||
@override
|
||||
Future<List<Wallet>> getWallets(String organizationRef) async {
|
||||
|
||||
Reference in New Issue
Block a user