api client refactor
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import { api as api } from '../../api';
|
||||
import { presentMembershipFee } from '../../presenters';
|
||||
import { MembershipFeeViewModel } from '../../view-models';
|
||||
|
||||
export async function getMembershipFees(leagueId: string): Promise<MembershipFeeViewModel[]> {
|
||||
const dto = await api.payments.getMembershipFees(leagueId);
|
||||
return dto.fees.map(f => presentMembershipFee(f));
|
||||
}
|
||||
12
apps/website/lib/services/payments/PaymentService.ts
Normal file
12
apps/website/lib/services/payments/PaymentService.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { api as api } from '../../api';
|
||||
import { presentPayment } from '../../presenters';
|
||||
import { PaymentViewModel } from '../../view-models';
|
||||
|
||||
export async function getPayments(leagueId?: string, driverId?: string): Promise<PaymentViewModel[]> {
|
||||
const dto = await api.payments.getPayments(leagueId, driverId);
|
||||
return dto.payments.map(p => presentPayment(p));
|
||||
}
|
||||
|
||||
export async function createPayment(input: any): Promise<any> {
|
||||
return await api.payments.createPayment(input);
|
||||
}
|
||||
8
apps/website/lib/services/payments/WalletService.ts
Normal file
8
apps/website/lib/services/payments/WalletService.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { api as api } from '../../api';
|
||||
import { presentWallet } from '../../presenters';
|
||||
import { WalletViewModel } from '../../view-models';
|
||||
|
||||
export async function getWallet(driverId: string): Promise<WalletViewModel> {
|
||||
const dto = await api.payments.getWallet(driverId);
|
||||
return presentWallet(dto);
|
||||
}
|
||||
Reference in New Issue
Block a user