Files
gridpilot.gg/apps/website/lib/services/payments/WalletService.ts
2025-12-18 13:48:35 +01:00

23 lines
812 B
TypeScript

import { WalletViewModel } from '@/lib/view-models/WalletViewModel';
import { PaymentsApiClient } from '../../api/payments/PaymentsApiClient';
import { FullTransactionDto } from '../../view-models/WalletTransactionViewModel';
/**
* Wallet Service
*
* Orchestrates wallet operations by coordinating API calls and view model creation.
* All dependencies are injected via constructor.
*/
export class WalletService {
constructor(
private readonly apiClient: PaymentsApiClient
) {}
/**
* Get wallet by driver ID with view model transformation
*/
async getWallet(driverId: string): Promise<WalletViewModel> {
const { wallet, transactions } = await this.apiClient.getWallet(driverId);
return new WalletViewModel({ ...wallet, transactions: transactions as FullTransactionDto[] });
}
}