website cleanup
This commit is contained in:
@@ -16,8 +16,22 @@ export class WalletService {
|
||||
/**
|
||||
* 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[] });
|
||||
async getWallet(leagueId?: string): Promise<WalletViewModel> {
|
||||
const { wallet, transactions } = await this.apiClient.getWallet({ leagueId });
|
||||
|
||||
// Convert TransactionDTO to FullTransactionDto format
|
||||
const convertedTransactions: FullTransactionDto[] = transactions.map(t => ({
|
||||
id: t.id,
|
||||
type: t.type as 'sponsorship' | 'membership' | 'withdrawal' | 'prize',
|
||||
description: t.description,
|
||||
amount: t.amount,
|
||||
fee: t.amount * 0.05, // Calculate fee (5%)
|
||||
netAmount: t.amount * 0.95, // Calculate net amount
|
||||
date: new Date(t.createdAt),
|
||||
status: 'completed',
|
||||
referenceId: t.referenceId
|
||||
}));
|
||||
|
||||
return new WalletViewModel({ ...wallet, transactions: convertedTransactions });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user