view models
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import { PaymentsApiClient } from '../../api/payments/PaymentsApiClient';
|
||||
import { presentWallet } from '../../presenters/WalletPresenter';
|
||||
import type { WalletViewModel } from '../../view-models';
|
||||
import { WalletViewModel } from '../../view-models';
|
||||
|
||||
/**
|
||||
* Wallet Service
|
||||
*
|
||||
* Orchestrates wallet operations by coordinating API calls and presentation logic.
|
||||
* Orchestrates wallet operations by coordinating API calls and view model creation.
|
||||
* All dependencies are injected via constructor.
|
||||
*/
|
||||
export class WalletService {
|
||||
@@ -14,14 +13,10 @@ export class WalletService {
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Get wallet by driver ID with presentation transformation
|
||||
* Get wallet by driver ID with view model transformation
|
||||
*/
|
||||
async getWallet(driverId: string): Promise<WalletViewModel> {
|
||||
try {
|
||||
const dto = await this.apiClient.getWallet(driverId);
|
||||
return presentWallet(dto);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
const dto = await this.apiClient.getWallet(driverId);
|
||||
return new WalletViewModel(dto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user