added wallet source to quotation preparation
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
import 'package:pshared/service/wallet.dart' as shared_wallet_service;
|
||||
|
||||
import 'package:pweb/models/wallet.dart';
|
||||
import 'package:pweb/data/mappers/wallet_ui.dart';
|
||||
|
||||
|
||||
abstract class WalletsService {
|
||||
Future<List<Wallet>> getWallets(String organizationRef);
|
||||
Future<double> getBalance(String organizationRef, String walletRef);
|
||||
}
|
||||
|
||||
class ApiWalletsService implements WalletsService {
|
||||
@override
|
||||
Future<List<Wallet>> getWallets(String organizationRef) async {
|
||||
final models = await shared_wallet_service.WalletService.list(organizationRef);
|
||||
return models.map((m) => m.toUi()).toList();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<double> getBalance(String organizationRef, String walletRef) async {
|
||||
final balance = await shared_wallet_service.WalletService.getBalance(
|
||||
organizationRef: organizationRef,
|
||||
walletRef: walletRef,
|
||||
);
|
||||
final amount = balance.available?.amount;
|
||||
return amount == null ? 0 : double.tryParse(amount) ?? 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user