ledger account service basis

This commit is contained in:
Stephan D
2026-01-22 01:00:55 +01:00
parent 62ff96b90e
commit 8e46bc6061
22 changed files with 118 additions and 65 deletions

View File

@@ -0,0 +1,31 @@
import 'package:pshared/api/responses/wallet_balance.dart';
import 'package:pshared/api/responses/wallets.dart';
import 'package:pshared/data/mapper/wallet/response.dart';
import 'package:pshared/models/wallet/balance.dart';
import 'package:pshared/models/wallet/wallet.dart';
import 'package:pshared/service/authorization/service.dart';
import 'package:pshared/service/services.dart';
class LedgerService {
static const String _objectType = Services.ledger;
static Future<List<WalletModel>> list(String organizationRef) async {
final json = await AuthorizationService.getGETResponse(
_objectType,
'/$organizationRef',
);
return WalletsResponse.fromJson(json).toDomain();
}
static Future<WalletBalance> getBalance({
required String organizationRef,
required String walletRef,
}) async {
final json = await AuthorizationService.getGETResponse(
_objectType,
'/$organizationRef/$walletRef/balance',
);
return WalletBalanceResponse.fromJson(json).toDomain();
}
}