Files
gridpilot.gg/apps/website/lib/services/payments/MembershipFeeService.ts
2025-12-18 22:19:40 +01:00

32 lines
1.1 KiB
TypeScript

import { MembershipFeeDto } from '@/lib/types/generated/MembershipFeeDto';
import { MembershipFeeViewModel } from '@/lib/view-models/MembershipFeeViewModel';
import { PaymentsApiClient } from '../../api/payments/PaymentsApiClient';
// TODO: This DTO should be generated from OpenAPI spec when the endpoint is added
export interface GetMembershipFeesOutputDto {
fee: MembershipFeeDto | null;
payments: import('./MemberPaymentDto').MemberPaymentDto[];
}
/**
* Membership Fee Service
*
* Orchestrates membership fee operations by coordinating API calls and view model creation.
* All dependencies are injected via constructor.
*/
export class MembershipFeeService {
constructor(
private readonly apiClient: PaymentsApiClient
) {}
/**
* Get membership fees by league ID with view model transformation
*/
async getMembershipFees(leagueId: string): Promise<{ fee: MembershipFeeViewModel | null; payments: any[] }> {
const dto = await this.apiClient.getMembershipFees({ leagueId });
return {
fee: dto.fee ? new MembershipFeeViewModel(dto.fee) : null,
payments: dto.payments // TODO: map to view models if needed
};
}
}