refactor payments module

This commit is contained in:
2025-12-22 17:52:59 +01:00
parent 0828506c21
commit c90b2166c1
28 changed files with 524 additions and 268 deletions

View File

@@ -2,7 +2,39 @@ import { Test, TestingModule } from '@nestjs/testing';
import { vi } from 'vitest';
import { PaymentsController } from './PaymentsController';
import { PaymentsService } from './PaymentsService';
import { GetPaymentsQuery, CreatePaymentInput, UpdatePaymentStatusInput, GetMembershipFeesQuery, UpsertMembershipFeeInput, UpdateMemberPaymentInput, GetPrizesQuery, CreatePrizeInput, AwardPrizeInput, DeletePrizeInput, GetWalletQuery, ProcessWalletTransactionInput } from './dtos/PaymentsDto';
import {
GetPaymentsQuery,
CreatePaymentInput,
UpdatePaymentStatusInput,
GetMembershipFeesQuery,
UpsertMembershipFeeInput,
UpdateMemberPaymentInput,
GetPrizesQuery,
CreatePrizeInput,
AwardPrizeInput,
DeletePrizeInput,
GetWalletQuery,
ProcessWalletTransactionInput,
PaymentType,
PayerType,
PaymentStatus,
MembershipFeeType,
MemberPaymentStatus,
PrizeType,
TransactionType,
GetPaymentsOutput,
CreatePaymentOutput,
UpdatePaymentStatusOutput,
GetMembershipFeesOutput,
UpsertMembershipFeeOutput,
UpdateMemberPaymentOutput,
GetPrizesOutput,
CreatePrizeOutput,
AwardPrizeOutput,
DeletePrizeOutput,
GetWalletOutput,
ProcessWalletTransactionOutput
} from './dtos/PaymentsDto';
describe('PaymentsController', () => {
let controller: PaymentsController;
@@ -38,9 +70,9 @@ describe('PaymentsController', () => {
describe('getPayments', () => {
it('should return payments', async () => {
const query: GetPaymentsQuery = { status: 'pending' };
const result = { payments: [] };
service.getPayments.mockResolvedValue({ viewModel: result } as any);
const query: GetPaymentsQuery = { leagueId: 'league-123' };
const result: GetPaymentsOutput = { payments: [] };
service.getPayments.mockResolvedValue(result);
const response = await controller.getPayments(query);
@@ -51,9 +83,28 @@ describe('PaymentsController', () => {
describe('createPayment', () => {
it('should create payment', async () => {
const input: CreatePaymentInput = { amount: 100, type: 'membership_fee', payerId: 'payer-123', payerType: 'driver', leagueId: 'league-123' };
const result = { payment: { id: 'pay-123' } };
service.createPayment.mockResolvedValue({ viewModel: result } as any);
const input: CreatePaymentInput = {
amount: 100,
type: PaymentType.MEMBERSHIP_FEE,
payerId: 'payer-123',
payerType: PayerType.DRIVER,
leagueId: 'league-123'
};
const result: CreatePaymentOutput = {
payment: {
id: 'pay-123',
type: PaymentType.MEMBERSHIP_FEE,
amount: 100,
platformFee: 5,
netAmount: 95,
payerId: 'payer-123',
payerType: PayerType.DRIVER,
leagueId: 'league-123',
status: PaymentStatus.PENDING,
createdAt: new Date()
}
};
service.createPayment.mockResolvedValue(result);
const response = await controller.createPayment(input);
@@ -64,9 +115,23 @@ describe('PaymentsController', () => {
describe('updatePaymentStatus', () => {
it('should update payment status', async () => {
const input: UpdatePaymentStatusInput = { paymentId: 'pay-123', status: 'completed' };
const result = { payment: { id: 'pay-123', status: 'completed' } };
service.updatePaymentStatus.mockResolvedValue({ viewModel: result } as any);
const input: UpdatePaymentStatusInput = { paymentId: 'pay-123', status: PaymentStatus.COMPLETED };
const result: UpdatePaymentStatusOutput = {
payment: {
id: 'pay-123',
type: PaymentType.MEMBERSHIP_FEE,
amount: 100,
platformFee: 5,
netAmount: 95,
payerId: 'payer-123',
payerType: PayerType.DRIVER,
leagueId: 'league-123',
status: PaymentStatus.COMPLETED,
createdAt: new Date(),
completedAt: new Date()
}
};
service.updatePaymentStatus.mockResolvedValue(result);
const response = await controller.updatePaymentStatus(input);
@@ -78,8 +143,19 @@ describe('PaymentsController', () => {
describe('getMembershipFees', () => {
it('should return membership fees', async () => {
const query: GetMembershipFeesQuery = { leagueId: 'league-123' };
const result = { fees: [] };
service.getMembershipFees.mockResolvedValue({ viewModel: result } as any);
const result: GetMembershipFeesOutput = {
fee: {
id: 'fee-123',
leagueId: 'league-123',
type: MembershipFeeType.MONTHLY,
amount: 50,
enabled: true,
createdAt: new Date(),
updatedAt: new Date()
},
payments: []
};
service.getMembershipFees.mockResolvedValue(result);
const response = await controller.getMembershipFees(query);
@@ -90,9 +166,23 @@ describe('PaymentsController', () => {
describe('upsertMembershipFee', () => {
it('should upsert membership fee', async () => {
const input: UpsertMembershipFeeInput = { leagueId: 'league-123', amount: 50 };
const result = { feeId: 'fee-123' };
service.upsertMembershipFee.mockResolvedValue({ viewModel: result } as any);
const input: UpsertMembershipFeeInput = {
leagueId: 'league-123',
type: MembershipFeeType.MONTHLY,
amount: 50
};
const result: UpsertMembershipFeeOutput = {
fee: {
id: 'fee-123',
leagueId: 'league-123',
type: MembershipFeeType.MONTHLY,
amount: 50,
enabled: true,
createdAt: new Date(),
updatedAt: new Date()
}
};
service.upsertMembershipFee.mockResolvedValue(result);
const response = await controller.upsertMembershipFee(input);
@@ -103,9 +193,25 @@ describe('PaymentsController', () => {
describe('updateMemberPayment', () => {
it('should update member payment', async () => {
const input: UpdateMemberPaymentInput = { memberId: 'member-123', paymentId: 'pay-123' };
const result = { success: true };
service.updateMemberPayment.mockResolvedValue({ viewModel: result } as any);
const input: UpdateMemberPaymentInput = {
feeId: 'fee-123',
driverId: 'driver-123',
status: MemberPaymentStatus.PAID
};
const result: UpdateMemberPaymentOutput = {
payment: {
id: 'mp-123',
feeId: 'fee-123',
driverId: 'driver-123',
amount: 50,
platformFee: 2.5,
netAmount: 47.5,
status: MemberPaymentStatus.PAID,
dueDate: new Date(),
paidAt: new Date()
}
};
service.updateMemberPayment.mockResolvedValue(result);
const response = await controller.updateMemberPayment(input);
@@ -117,8 +223,8 @@ describe('PaymentsController', () => {
describe('getPrizes', () => {
it('should return prizes', async () => {
const query: GetPrizesQuery = { leagueId: 'league-123' };
const result = { prizes: [] };
service.getPrizes.mockResolvedValue({ viewModel: result } as any);
const result: GetPrizesOutput = { prizes: [] };
service.getPrizes.mockResolvedValue(result);
const response = await controller.getPrizes(query);
@@ -129,9 +235,28 @@ describe('PaymentsController', () => {
describe('createPrize', () => {
it('should create prize', async () => {
const input: CreatePrizeInput = { name: 'Prize', amount: 100 };
const result = { prizeId: 'prize-123' };
service.createPrize.mockResolvedValue({ viewModel: result } as any);
const input: CreatePrizeInput = {
leagueId: 'league-123',
seasonId: 'season-123',
position: 1,
name: 'Champion',
amount: 1000,
type: PrizeType.CASH
};
const result: CreatePrizeOutput = {
prize: {
id: 'prize-123',
leagueId: 'league-123',
seasonId: 'season-123',
position: 1,
name: 'Champion',
amount: 1000,
type: PrizeType.CASH,
awarded: false,
createdAt: new Date()
}
};
service.createPrize.mockResolvedValue(result);
const response = await controller.createPrize(input);
@@ -143,8 +268,22 @@ describe('PaymentsController', () => {
describe('awardPrize', () => {
it('should award prize', async () => {
const input: AwardPrizeInput = { prizeId: 'prize-123', driverId: 'driver-123' };
const result = { success: true };
service.awardPrize.mockResolvedValue({ viewModel: result } as any);
const result: AwardPrizeOutput = {
prize: {
id: 'prize-123',
leagueId: 'league-123',
seasonId: 'season-123',
position: 1,
name: 'Champion',
amount: 1000,
type: PrizeType.CASH,
awarded: true,
awardedTo: 'driver-123',
awardedAt: new Date(),
createdAt: new Date()
}
};
service.awardPrize.mockResolvedValue(result);
const response = await controller.awardPrize(input);
@@ -156,8 +295,8 @@ describe('PaymentsController', () => {
describe('deletePrize', () => {
it('should delete prize', async () => {
const query: DeletePrizeInput = { prizeId: 'prize-123' };
const result = { success: true };
service.deletePrize.mockResolvedValue({ viewModel: result } as any);
const result: DeletePrizeOutput = { success: true };
service.deletePrize.mockResolvedValue(result);
const response = await controller.deletePrize(query);
@@ -168,9 +307,21 @@ describe('PaymentsController', () => {
describe('getWallet', () => {
it('should return wallet', async () => {
const query: GetWalletQuery = { userId: 'user-123' };
const result = { balance: 100 };
service.getWallet.mockResolvedValue({ viewModel: result } as any);
const query: GetWalletQuery = { leagueId: 'league-123' };
const result: GetWalletOutput = {
wallet: {
id: 'wallet-123',
leagueId: 'league-123',
balance: 100,
totalRevenue: 100,
totalPlatformFees: 5,
totalWithdrawn: 0,
currency: 'USD',
createdAt: new Date()
},
transactions: []
};
service.getWallet.mockResolvedValue(result);
const response = await controller.getWallet(query);
@@ -181,9 +332,33 @@ describe('PaymentsController', () => {
describe('processWalletTransaction', () => {
it('should process wallet transaction', async () => {
const input: ProcessWalletTransactionInput = { userId: 'user-123', amount: 50, type: 'deposit' };
const result = { transactionId: 'tx-123' };
service.processWalletTransaction.mockResolvedValue({ viewModel: result } as any);
const input: ProcessWalletTransactionInput = {
leagueId: 'league-123',
amount: 50,
type: TransactionType.DEPOSIT,
description: 'Test deposit'
};
const result: ProcessWalletTransactionOutput = {
wallet: {
id: 'wallet-123',
leagueId: 'league-123',
balance: 150,
totalRevenue: 150,
totalPlatformFees: 7.5,
totalWithdrawn: 0,
currency: 'USD',
createdAt: new Date()
},
transaction: {
id: 'tx-123',
walletId: 'wallet-123',
type: TransactionType.DEPOSIT,
amount: 50,
description: 'Test deposit',
createdAt: new Date()
}
};
service.processWalletTransaction.mockResolvedValue(result);
const response = await controller.processWalletTransaction(input);

View File

@@ -34,8 +34,7 @@ export class PaymentsController {
@ApiOperation({ summary: 'Get membership fees and member payments' })
@ApiResponse({ status: 200, description: 'Membership fee configuration and member payments', type: GetMembershipFeesOutput })
async getMembershipFees(@Query() query: GetMembershipFeesQuery): Promise<GetMembershipFeesOutput> {
const presenter = await this.paymentsService.getMembershipFees(query);
return presenter.viewModel;
return this.paymentsService.getMembershipFees(query);
}
@Post('membership-fees')
@@ -43,23 +42,20 @@ export class PaymentsController {
@ApiOperation({ summary: 'Create or update membership fee configuration' })
@ApiResponse({ status: 201, description: 'Membership fee configuration created or updated', type: UpsertMembershipFeeOutput })
async upsertMembershipFee(@Body() input: UpsertMembershipFeeInput): Promise<UpsertMembershipFeeOutput> {
const presenter = await this.paymentsService.upsertMembershipFee(input);
return presenter.viewModel;
return this.paymentsService.upsertMembershipFee(input);
}
@Patch('membership-fees/member-payment')
@ApiOperation({ summary: 'Record or update a member payment' })
@ApiResponse({ status: 200, description: 'Member payment recorded or updated', type: UpdateMemberPaymentOutput })
async updateMemberPayment(@Body() input: UpdateMemberPaymentInput): Promise<UpdateMemberPaymentOutput> {
const presenter = await this.paymentsService.updateMemberPayment(input);
return presenter.viewModel;
return this.paymentsService.updateMemberPayment(input);
}
@Get('prizes')
@ApiOperation({ summary: 'Get prizes for a league or season' })
@ApiResponse({ status: 200, description: 'List of prizes', type: GetPrizesOutput })
async getPrizes(@Query() query: GetPrizesQuery): Promise<GetPrizesOutput> {
const presenter = await this.paymentsService.getPrizes(query);
return presenter.viewModel;
return this.paymentsService.getPrizes(query);
}
@Post('prizes')
@@ -67,31 +63,27 @@ export class PaymentsController {
@ApiOperation({ summary: 'Create a new prize' })
@ApiResponse({ status: 201, description: 'Prize created', type: CreatePrizeOutput })
async createPrize(@Body() input: CreatePrizeInput): Promise<CreatePrizeOutput> {
const presenter = await this.paymentsService.createPrize(input);
return presenter.viewModel;
return this.paymentsService.createPrize(input);
}
@Patch('prizes/award')
@ApiOperation({ summary: 'Award a prize to a driver' })
@ApiResponse({ status: 200, description: 'Prize awarded', type: AwardPrizeOutput })
async awardPrize(@Body() input: AwardPrizeInput): Promise<AwardPrizeOutput> {
const presenter = await this.paymentsService.awardPrize(input);
return presenter.viewModel;
return this.paymentsService.awardPrize(input);
}
@Delete('prizes')
@ApiOperation({ summary: 'Delete a prize' })
@ApiResponse({ status: 200, description: 'Prize deleted', type: DeletePrizeOutput })
async deletePrize(@Query() query: DeletePrizeInput): Promise<DeletePrizeOutput> {
const presenter = await this.paymentsService.deletePrize(query);
return presenter.viewModel;
return this.paymentsService.deletePrize(query);
}
@Get('wallets')
@ApiOperation({ summary: 'Get wallet information and transactions' })
@ApiResponse({ status: 200, description: 'Wallet and transaction data', type: GetWalletOutput })
async getWallet(@Query() query: GetWalletQuery): Promise<GetWalletOutput> {
const presenter = await this.paymentsService.getWallet(query);
return presenter.viewModel;
return this.paymentsService.getWallet(query);
}
@Post('wallets/transactions')
@@ -99,7 +91,6 @@ export class PaymentsController {
@ApiOperation({ summary: 'Process a wallet transaction (deposit or withdrawal)' })
@ApiResponse({ status: 201, description: 'Wallet transaction processed', type: ProcessWalletTransactionOutput })
async processWalletTransaction(@Body() input: ProcessWalletTransactionInput): Promise<ProcessWalletTransactionOutput> {
const presenter = await this.paymentsService.processWalletTransaction(input);
return presenter.viewModel;
return this.paymentsService.processWalletTransaction(input);
}
}

View File

@@ -32,17 +32,23 @@ import { UpsertMembershipFeePresenter } from './presenters/UpsertMembershipFeePr
// DTOs
import type {
AwardPrizeInput,
AwardPrizeOutput,
CreatePaymentInput,
CreatePaymentOutput,
CreatePrizeInput,
CreatePrizeOutput,
DeletePrizeInput,
DeletePrizeOutput,
GetMembershipFeesOutput,
GetMembershipFeesQuery,
GetPaymentsOutput,
GetPaymentsQuery,
GetPrizesOutput,
GetPrizesQuery,
GetWalletOutput,
GetWalletQuery,
ProcessWalletTransactionInput,
ProcessWalletTransactionOutput,
UpdateMemberPaymentInput,
UpdateMemberPaymentOutput,
UpdatePaymentStatusInput,
@@ -103,7 +109,7 @@ export class PaymentsService {
const result = await this.getPaymentsUseCase.execute(query);
if (result.isErr()) {
throw new Error(result.unwrapErr().details?.message ?? 'Failed to get payments');
throw new Error(result.unwrapErr().code ?? 'Failed to get payments');
}
return this.getPaymentsPresenter.getResponseModel();
}
@@ -113,7 +119,7 @@ export class PaymentsService {
const result = await this.createPaymentUseCase.execute(input);
if (result.isErr()) {
throw new Error(result.unwrapErr().details?.message ?? 'Failed to create payment');
throw new Error(result.unwrapErr().code ?? 'Failed to create payment');
}
return this.createPaymentPresenter.getResponseModel();
}
@@ -123,7 +129,7 @@ export class PaymentsService {
const result = await this.updatePaymentStatusUseCase.execute(input);
if (result.isErr()) {
throw new Error(result.unwrapErr().details?.message ?? 'Failed to update payment status');
throw new Error(result.unwrapErr().code ?? 'Failed to update payment status');
}
return this.updatePaymentStatusPresenter.getResponseModel();
}
@@ -133,9 +139,9 @@ export class PaymentsService {
const result = await this.getMembershipFeesUseCase.execute(query);
if (result.isErr()) {
throw new Error(result.unwrapErr().details?.message ?? 'Failed to get membership fees');
throw new Error(result.unwrapErr().code ?? 'Failed to get membership fees');
}
return this.getMembershipFeesPresenter.getResponseModel();
return this.getMembershipFeesPresenter.viewModel;
}
async upsertMembershipFee(input: UpsertMembershipFeeInput): Promise<UpsertMembershipFeeOutput> {
@@ -143,9 +149,11 @@ export class PaymentsService {
const result = await this.upsertMembershipFeeUseCase.execute(input);
if (result.isErr()) {
throw new Error(result.unwrapErr().details?.message ?? 'Failed to upsert membership fee');
// Since UpsertMembershipFeeUseCase has never as error type, this should never happen
// but we keep the check for consistency
throw new Error('Failed to upsert membership fee');
}
return this.upsertMembershipFeePresenter.getResponseModel();
return this.upsertMembershipFeePresenter.viewModel;
}
async updateMemberPayment(input: UpdateMemberPaymentInput): Promise<UpdateMemberPaymentOutput> {
@@ -153,56 +161,56 @@ export class PaymentsService {
const result = await this.updateMemberPaymentUseCase.execute(input);
if (result.isErr()) {
throw new Error(result.unwrapErr().details?.message ?? 'Failed to update member payment');
throw new Error(result.unwrapErr().code ?? 'Failed to update member payment');
}
return this.updateMemberPaymentPresenter.getResponseModel();
return this.updateMemberPaymentPresenter.viewModel;
}
async getPrizes(query: GetPrizesQuery): Promise<GetPrizesPresenter> { // TODO must return ResponseModel not Presenter
async getPrizes(query: GetPrizesQuery): Promise<GetPrizesOutput> {
this.logger.debug('[PaymentsService] Getting prizes', { query });
const presenter = new GetPrizesPresenter();
await this.getPrizesUseCase.execute({ leagueId: query.leagueId!, seasonId: query.seasonId }, presenter);
return presenter;
const input: { leagueId: string; seasonId?: string } = {
leagueId: query.leagueId!,
};
if (query.seasonId !== undefined) {
input.seasonId = query.seasonId;
}
await this.getPrizesUseCase.execute(input);
return this.getPrizesPresenter.viewModel;
}
async createPrize(input: CreatePrizeInput): Promise<CreatePrizePresenter> { // TODO must return ResponseModel not Presenter
async createPrize(input: CreatePrizeInput): Promise<CreatePrizeOutput> {
this.logger.debug('[PaymentsService] Creating prize', { input });
const presenter = new CreatePrizePresenter();
await this.createPrizeUseCase.execute(input, presenter);
return presenter;
await this.createPrizeUseCase.execute(input);
return this.createPrizePresenter.viewModel;
}
async awardPrize(input: AwardPrizeInput): Promise<AwardPrizePresenter> { // TODO must return ResponseModel not Presenter
async awardPrize(input: AwardPrizeInput): Promise<AwardPrizeOutput> {
this.logger.debug('[PaymentsService] Awarding prize', { input });
const presenter = new AwardPrizePresenter();
await this.awardPrizeUseCase.execute(input, presenter);
return presenter;
await this.awardPrizeUseCase.execute(input);
return this.awardPrizePresenter.viewModel;
}
async deletePrize(input: DeletePrizeInput): Promise<DeletePrizePresenter> { // TODO must return ResponseModel not Presenter
async deletePrize(input: DeletePrizeInput): Promise<DeletePrizeOutput> {
this.logger.debug('[PaymentsService] Deleting prize', { input });
const presenter = new DeletePrizePresenter();
await this.deletePrizeUseCase.execute(input, presenter);
return presenter;
await this.deletePrizeUseCase.execute(input);
return this.deletePrizePresenter.viewModel;
}
async getWallet(query: GetWalletQuery): Promise<GetWalletPresenter> { // TODO must return ResponseModel not Presenter
async getWallet(query: GetWalletQuery): Promise<GetWalletOutput> {
this.logger.debug('[PaymentsService] Getting wallet', { query });
const presenter = new GetWalletPresenter();
await this.getWalletUseCase.execute({ leagueId: query.leagueId! }, presenter);
return presenter;
await this.getWalletUseCase.execute({ leagueId: query.leagueId! });
return this.getWalletPresenter.viewModel;
}
async processWalletTransaction(input: ProcessWalletTransactionInput): Promise<ProcessWalletTransactionPresenter> {
async processWalletTransaction(input: ProcessWalletTransactionInput): Promise<ProcessWalletTransactionOutput> {
this.logger.debug('[PaymentsService] Processing wallet transaction', { input });
const presenter = new ProcessWalletTransactionPresenter();
await this.processWalletTransactionUseCase.execute(input, presenter);
return presenter;
await this.processWalletTransactionUseCase.execute(input);
return this.processWalletTransactionPresenter.viewModel;
}
}
}

View File

@@ -0,0 +1,9 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsObject } from 'class-validator';
import { PrizeDto } from './PaymentsDto';
export class AwardPrizeResultDTO {
@ApiProperty({ type: PrizeDto })
@IsObject()
prize!: PrizeDto;
}

View File

@@ -6,23 +6,23 @@ import { PayerType } from './PayerType';
export class CreatePaymentInputDTO {
@ApiProperty({ enum: PaymentType })
@IsEnum(PaymentType)
type: PaymentType;
type!: PaymentType;
@ApiProperty()
@IsNumber()
amount: number;
amount!: number;
@ApiProperty()
@IsString()
payerId: string;
payerId!: string;
@ApiProperty({ enum: PayerType })
@IsEnum(PayerType)
payerType: PayerType;
payerType!: PayerType;
@ApiProperty()
@IsString()
leagueId: string;
leagueId!: string;
@ApiProperty({ required: false })
@IsOptional()

View File

@@ -3,5 +3,5 @@ import { PaymentDTO } from './PaymentDTO';
export class CreatePaymentOutputDTO {
@ApiProperty({ type: PaymentDTO })
payment: PaymentDTO;
payment!: PaymentDTO;
}

View File

@@ -0,0 +1,9 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsObject } from 'class-validator';
import { PrizeDto } from './PaymentsDto';
export class CreatePrizeResultDTO {
@ApiProperty({ type: PrizeDto })
@IsObject()
prize!: PrizeDto;
}

View File

@@ -0,0 +1,8 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsBoolean } from 'class-validator';
export class DeletePrizeResultDTO {
@ApiProperty()
@IsBoolean()
success!: boolean;
}

View File

@@ -0,0 +1,13 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsObject, IsArray } from 'class-validator';
import { MembershipFeeDto, MemberPaymentDto } from './PaymentsDto';
export class GetMembershipFeesResultDTO {
@ApiProperty({ type: MembershipFeeDto, nullable: true })
@IsObject()
fee!: MembershipFeeDto | null;
@ApiProperty({ type: [MemberPaymentDto] })
@IsArray()
payments!: MemberPaymentDto[];
}

View File

@@ -0,0 +1,9 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsArray } from 'class-validator';
import { PrizeDto } from './PaymentsDto';
export class GetPrizesResultDTO {
@ApiProperty({ type: [PrizeDto] })
@IsArray()
prizes!: PrizeDto[];
}

View File

@@ -0,0 +1,13 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsObject, IsArray } from 'class-validator';
import { WalletDto, TransactionDto } from './PaymentsDto';
export class GetWalletResultDTO {
@ApiProperty({ type: WalletDto })
@IsObject()
wallet!: WalletDto;
@ApiProperty({ type: [TransactionDto] })
@IsArray()
transactions!: TransactionDto[];
}

View File

@@ -7,35 +7,35 @@ import { PaymentStatus } from './PaymentStatus';
export class PaymentDTO {
@ApiProperty()
@IsString()
id: string;
id!: string;
@ApiProperty({ enum: PaymentType })
@IsEnum(PaymentType)
type: PaymentType;
type!: PaymentType;
@ApiProperty()
@IsNumber()
amount: number;
amount!: number;
@ApiProperty()
@IsNumber()
platformFee: number;
platformFee!: number;
@ApiProperty()
@IsNumber()
netAmount: number;
netAmount!: number;
@ApiProperty()
@IsString()
payerId: string;
payerId!: string;
@ApiProperty({ enum: PayerType })
@IsEnum(PayerType)
payerType: PayerType;
payerType!: PayerType;
@ApiProperty()
@IsString()
leagueId: string;
leagueId!: string;
@ApiProperty({ required: false })
@IsOptional()
@@ -44,11 +44,11 @@ export class PaymentDTO {
@ApiProperty({ enum: PaymentStatus })
@IsEnum(PaymentStatus)
status: PaymentStatus;
status!: PaymentStatus;
@ApiProperty()
@IsDate()
createdAt: Date;
createdAt!: Date;
@ApiProperty({ required: false })
@IsOptional()

View File

@@ -21,35 +21,35 @@ export enum PaymentStatus {
export class PaymentDto {
@ApiProperty()
@IsString()
id: string;
id!: string;
@ApiProperty({ enum: PaymentType })
@IsEnum(PaymentType)
type: PaymentType;
type!: PaymentType;
@ApiProperty()
@IsNumber()
amount: number;
amount!: number;
@ApiProperty()
@IsNumber()
platformFee: number;
platformFee!: number;
@ApiProperty()
@IsNumber()
netAmount: number;
netAmount!: number;
@ApiProperty()
@IsString()
payerId: string;
payerId!: string;
@ApiProperty({ enum: PayerType })
@IsEnum(PayerType)
payerType: PayerType;
payerType!: PayerType;
@ApiProperty()
@IsString()
leagueId: string;
leagueId!: string;
@ApiProperty({ required: false })
@IsOptional()
@@ -58,11 +58,11 @@ export class PaymentDto {
@ApiProperty({ enum: PaymentStatus })
@IsEnum(PaymentStatus)
status: PaymentStatus;
status!: PaymentStatus;
@ApiProperty()
@IsDate()
createdAt: Date;
createdAt!: Date;
@ApiProperty({ required: false })
@IsOptional()
@@ -73,23 +73,23 @@ export class PaymentDto {
export class CreatePaymentInput {
@ApiProperty({ enum: PaymentType })
@IsEnum(PaymentType)
type: PaymentType;
type!: PaymentType;
@ApiProperty()
@IsNumber()
amount: number;
amount!: number;
@ApiProperty()
@IsString()
payerId: string;
payerId!: string;
@ApiProperty({ enum: PayerType })
@IsEnum(PayerType)
payerType: PayerType;
payerType!: PayerType;
@ApiProperty()
@IsString()
leagueId: string;
leagueId!: string;
@ApiProperty({ required: false })
@IsOptional()
@@ -99,22 +99,22 @@ export class CreatePaymentInput {
export class CreatePaymentOutput {
@ApiProperty({ type: PaymentDto })
payment: PaymentDto;
payment!: PaymentDto;
}
export class UpdatePaymentStatusInput {
@ApiProperty()
@IsString()
paymentId: string;
paymentId!: string;
@ApiProperty({ enum: PaymentStatus })
@IsEnum(PaymentStatus)
status: PaymentStatus;
status!: PaymentStatus;
}
export class UpdatePaymentStatusOutput {
@ApiProperty({ type: PaymentDto })
payment: PaymentDto;
payment!: PaymentDto;
}
export enum MembershipFeeType {
@@ -132,11 +132,11 @@ export enum MemberPaymentStatus {
export class MembershipFeeDto {
@ApiProperty()
@IsString()
id: string;
id!: string;
@ApiProperty()
@IsString()
leagueId: string;
leagueId!: string;
@ApiProperty({ required: false })
@IsOptional()
@@ -145,57 +145,57 @@ export class MembershipFeeDto {
@ApiProperty({ enum: MembershipFeeType })
@IsEnum(MembershipFeeType)
type: MembershipFeeType;
type!: MembershipFeeType;
@ApiProperty()
@IsNumber()
amount: number;
amount!: number;
@ApiProperty()
@IsBoolean()
enabled: boolean;
enabled!: boolean;
@ApiProperty()
@IsDate()
createdAt: Date;
createdAt!: Date;
@ApiProperty()
@IsDate()
updatedAt: Date;
updatedAt!: Date;
}
export class MemberPaymentDto {
@ApiProperty()
@IsString()
id: string;
id!: string;
@ApiProperty()
@IsString()
feeId: string;
feeId!: string;
@ApiProperty()
@IsString()
driverId: string;
driverId!: string;
@ApiProperty()
@IsNumber()
amount: number;
amount!: number;
@ApiProperty()
@IsNumber()
platformFee: number;
platformFee!: number;
@ApiProperty()
@IsNumber()
netAmount: number;
netAmount!: number;
@ApiProperty({ enum: MemberPaymentStatus })
@IsEnum(MemberPaymentStatus)
status: MemberPaymentStatus;
status!: MemberPaymentStatus;
@ApiProperty()
@IsDate()
dueDate: Date;
dueDate!: Date;
@ApiProperty({ required: false })
@IsOptional()
@@ -206,7 +206,7 @@ export class MemberPaymentDto {
export class GetMembershipFeesQuery {
@ApiProperty()
@IsString()
leagueId: string;
leagueId!: string;
@ApiProperty({ required: false })
@IsOptional()
@@ -216,16 +216,16 @@ export class GetMembershipFeesQuery {
export class GetMembershipFeesOutput {
@ApiProperty({ type: MembershipFeeDto, nullable: true })
fee: MembershipFeeDto | null;
fee!: MembershipFeeDto | null;
@ApiProperty({ type: [MemberPaymentDto] })
payments: MemberPaymentDto[];
payments!: MemberPaymentDto[];
}
export class UpsertMembershipFeeInput {
@ApiProperty()
@IsString()
leagueId: string;
leagueId!: string;
@ApiProperty({ required: false })
@IsOptional()
@@ -234,26 +234,26 @@ export class UpsertMembershipFeeInput {
@ApiProperty({ enum: MembershipFeeType })
@IsEnum(MembershipFeeType)
type: MembershipFeeType;
type!: MembershipFeeType;
@ApiProperty()
@IsNumber()
amount: number;
amount!: number;
}
export class UpsertMembershipFeeOutput {
@ApiProperty({ type: MembershipFeeDto })
fee: MembershipFeeDto;
fee!: MembershipFeeDto;
}
export class UpdateMemberPaymentInput {
@ApiProperty()
@IsString()
feeId: string;
feeId!: string;
@ApiProperty()
@IsString()
driverId: string;
driverId!: string;
@ApiProperty({ required: false, enum: MemberPaymentStatus })
@IsOptional()
@@ -268,7 +268,7 @@ export class UpdateMemberPaymentInput {
export class UpdateMemberPaymentOutput {
@ApiProperty({ type: MemberPaymentDto })
payment: MemberPaymentDto;
payment!: MemberPaymentDto;
}
export class GetPaymentsQuery {
@@ -290,7 +290,7 @@ export class GetPaymentsQuery {
export class GetPaymentsOutput {
@ApiProperty({ type: [PaymentDto] })
payments: PaymentDto[];
payments!: PaymentDto[];
}
export enum PrizeType {
@@ -302,31 +302,31 @@ export enum PrizeType {
export class PrizeDto {
@ApiProperty()
@IsString()
id: string;
id!: string;
@ApiProperty()
@IsString()
leagueId: string;
leagueId!: string;
@ApiProperty()
@IsString()
seasonId: string;
seasonId!: string;
@ApiProperty()
@IsNumber()
position: number;
position!: number;
@ApiProperty()
@IsString()
name: string;
name!: string;
@ApiProperty()
@IsNumber()
amount: number;
amount!: number;
@ApiProperty({ enum: PrizeType })
@IsEnum(PrizeType)
type: PrizeType;
type!: PrizeType;
@ApiProperty({ required: false })
@IsOptional()
@@ -335,7 +335,7 @@ export class PrizeDto {
@ApiProperty()
@IsBoolean()
awarded: boolean;
awarded!: boolean;
@ApiProperty({ required: false })
@IsOptional()
@@ -349,7 +349,7 @@ export class PrizeDto {
@ApiProperty()
@IsDate()
createdAt: Date;
createdAt!: Date;
}
export class GetPrizesQuery {
@@ -365,33 +365,33 @@ export class GetPrizesQuery {
export class GetPrizesOutput {
@ApiProperty({ type: [PrizeDto] })
prizes: PrizeDto[];
prizes!: PrizeDto[];
}
export class CreatePrizeInput {
@ApiProperty()
@IsString()
leagueId: string;
leagueId!: string;
@ApiProperty()
@IsString()
seasonId: string;
seasonId!: string;
@ApiProperty()
@IsNumber()
position: number;
position!: number;
@ApiProperty()
@IsString()
name: string;
name!: string;
@ApiProperty()
@IsNumber()
amount: number;
amount!: number;
@ApiProperty({ enum: PrizeType })
@IsEnum(PrizeType)
type: PrizeType;
type!: PrizeType;
@ApiProperty({ required: false })
@IsOptional()
@@ -401,34 +401,34 @@ export class CreatePrizeInput {
export class CreatePrizeOutput {
@ApiProperty({ type: PrizeDto })
prize: PrizeDto;
prize!: PrizeDto;
}
export class AwardPrizeInput {
@ApiProperty()
@IsString()
prizeId: string;
prizeId!: string;
@ApiProperty()
@IsString()
driverId: string;
driverId!: string;
}
export class AwardPrizeOutput {
@ApiProperty({ type: PrizeDto })
prize: PrizeDto;
prize!: PrizeDto;
}
export class DeletePrizeInput {
@ApiProperty()
@IsString()
prizeId: string;
prizeId!: string;
}
export class DeletePrizeOutput {
@ApiProperty()
@IsBoolean()
success: boolean;
success!: boolean;
}
export enum TransactionType {
@@ -446,57 +446,57 @@ export enum ReferenceType {
export class WalletDto {
@ApiProperty()
@IsString()
id: string;
id!: string;
@ApiProperty()
@IsString()
leagueId: string;
leagueId!: string;
@ApiProperty()
@IsNumber()
balance: number;
balance!: number;
@ApiProperty()
@IsNumber()
totalRevenue: number;
totalRevenue!: number;
@ApiProperty()
@IsNumber()
totalPlatformFees: number;
totalPlatformFees!: number;
@ApiProperty()
@IsNumber()
totalWithdrawn: number;
totalWithdrawn!: number;
@ApiProperty()
@IsDate()
createdAt: Date;
createdAt!: Date;
@ApiProperty()
@IsString()
currency: string;
currency!: string;
}
export class TransactionDto {
@ApiProperty()
@IsString()
id: string;
id!: string;
@ApiProperty()
@IsString()
walletId: string;
walletId!: string;
@ApiProperty({ enum: TransactionType })
@IsEnum(TransactionType)
type: TransactionType;
type!: TransactionType;
@ApiProperty()
@IsNumber()
amount: number;
amount!: number;
@ApiProperty()
@IsString()
description: string;
description!: string;
@ApiProperty({ required: false })
@IsOptional()
@@ -510,7 +510,7 @@ export class TransactionDto {
@ApiProperty()
@IsDate()
createdAt: Date;
createdAt!: Date;
}
export class GetWalletQuery {
@@ -521,29 +521,29 @@ export class GetWalletQuery {
export class GetWalletOutput {
@ApiProperty({ type: WalletDto })
wallet: WalletDto;
wallet!: WalletDto;
@ApiProperty({ type: [TransactionDto] })
transactions: TransactionDto[];
transactions!: TransactionDto[];
}
export class ProcessWalletTransactionInput {
@ApiProperty()
@IsString()
leagueId: string;
leagueId!: string;
@ApiProperty({ enum: TransactionType })
@IsEnum(TransactionType)
type: TransactionType;
type!: TransactionType;
@ApiProperty()
@IsNumber()
amount: number;
amount!: number;
@ApiProperty()
@IsString()
@IsNotEmpty()
description: string;
description!: string;
@ApiProperty({ required: false })
@IsOptional()
@@ -558,9 +558,8 @@ export class ProcessWalletTransactionInput {
export class ProcessWalletTransactionOutput {
@ApiProperty({ type: WalletDto })
wallet: WalletDto;
wallet!: WalletDto;
@ApiProperty({ type: TransactionDto })
transaction: TransactionDto;
}
transaction!: TransactionDto;
}

View File

@@ -0,0 +1,13 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsObject } from 'class-validator';
import { WalletDto, TransactionDto } from './PaymentsDto';
export class ProcessWalletTransactionResultDTO {
@ApiProperty({ type: WalletDto })
@IsObject()
wallet!: WalletDto;
@ApiProperty({ type: TransactionDto })
@IsObject()
transaction!: TransactionDto;
}

View File

@@ -0,0 +1,9 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsObject } from 'class-validator';
import { MemberPaymentDto } from './PaymentsDto';
export class UpdateMemberPaymentResultDTO {
@ApiProperty({ type: MemberPaymentDto })
@IsObject()
payment!: MemberPaymentDto;
}

View File

@@ -5,9 +5,9 @@ import { PaymentStatus } from './PaymentStatus';
export class UpdatePaymentStatusInputDTO {
@ApiProperty()
@IsString()
paymentId: string;
paymentId!: string;
@ApiProperty({ enum: PaymentStatus })
@IsEnum(PaymentStatus)
status: PaymentStatus;
status!: PaymentStatus;
}

View File

@@ -3,5 +3,5 @@ import { PaymentDTO } from './PaymentDTO';
export class UpdatePaymentStatusOutputDTO {
@ApiProperty({ type: PaymentDTO })
payment: PaymentDTO;
payment!: PaymentDTO;
}

View File

@@ -0,0 +1,9 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsObject } from 'class-validator';
import { MembershipFeeDto } from './PaymentsDto';
export class UpsertMembershipFeeResultDTO {
@ApiProperty({ type: MembershipFeeDto })
@IsObject()
fee!: MembershipFeeDto;
}

View File

@@ -1,11 +1,10 @@
import type {
IAwardPrizePresenter,
AwardPrizeResultDTO,
AwardPrizeViewModel,
} from '@core/payments/application/presenters/IAwardPrizePresenter';
import type { Presenter } from '@core/shared/presentation/Presenter';
import { AwardPrizeResultDTO } from '../dtos/AwardPrizeDTO';
export interface IAwardPrizePresenter extends Presenter<AwardPrizeResultDTO, AwardPrizeResultDTO> {}
export class AwardPrizePresenter implements IAwardPrizePresenter {
private result: AwardPrizeViewModel | null = null;
private result: AwardPrizeResultDTO | null = null;
reset() {
this.result = null;
@@ -15,11 +14,11 @@ export class AwardPrizePresenter implements IAwardPrizePresenter {
this.result = dto;
}
getViewModel(): AwardPrizeViewModel | null {
getResponseModel(): AwardPrizeResultDTO | null {
return this.result;
}
get viewModel(): AwardPrizeViewModel {
get viewModel(): AwardPrizeResultDTO {
if (!this.result) throw new Error('Presenter not presented');
return this.result;
}

View File

@@ -1,11 +1,10 @@
import type {
ICreatePrizePresenter,
CreatePrizeResultDTO,
CreatePrizeViewModel,
} from '@core/payments/application/presenters/ICreatePrizePresenter';
import type { Presenter } from '@core/shared/presentation/Presenter';
import { CreatePrizeResultDTO } from '../dtos/CreatePrizeDTO';
export interface ICreatePrizePresenter extends Presenter<CreatePrizeResultDTO, CreatePrizeResultDTO> {}
export class CreatePrizePresenter implements ICreatePrizePresenter {
private result: CreatePrizeViewModel | null = null;
private result: CreatePrizeResultDTO | null = null;
reset() {
this.result = null;
@@ -15,11 +14,11 @@ export class CreatePrizePresenter implements ICreatePrizePresenter {
this.result = dto;
}
getViewModel(): CreatePrizeViewModel | null {
getResponseModel(): CreatePrizeResultDTO | null {
return this.result;
}
get viewModel(): CreatePrizeViewModel {
get viewModel(): CreatePrizeResultDTO {
if (!this.result) throw new Error('Presenter not presented');
return this.result;
}

View File

@@ -1,11 +1,10 @@
import type {
IDeletePrizePresenter,
DeletePrizeResultDTO,
DeletePrizeViewModel,
} from '@core/payments/application/presenters/IDeletePrizePresenter';
import type { Presenter } from '@core/shared/presentation/Presenter';
import { DeletePrizeResultDTO } from '../dtos/DeletePrizeDTO';
export interface IDeletePrizePresenter extends Presenter<DeletePrizeResultDTO, DeletePrizeResultDTO> {}
export class DeletePrizePresenter implements IDeletePrizePresenter {
private result: DeletePrizeViewModel | null = null;
private result: DeletePrizeResultDTO | null = null;
reset() {
this.result = null;
@@ -15,11 +14,11 @@ export class DeletePrizePresenter implements IDeletePrizePresenter {
this.result = dto;
}
getViewModel(): DeletePrizeViewModel | null {
getResponseModel(): DeletePrizeResultDTO | null {
return this.result;
}
get viewModel(): DeletePrizeViewModel {
get viewModel(): DeletePrizeResultDTO {
if (!this.result) throw new Error('Presenter not presented');
return this.result;
}

View File

@@ -1,11 +1,10 @@
import type {
IGetMembershipFeesPresenter,
GetMembershipFeesResultDTO,
GetMembershipFeesViewModel,
} from '@core/payments/application/presenters/IGetMembershipFeesPresenter';
import type { Presenter } from '@core/shared/presentation/Presenter';
import { GetMembershipFeesResultDTO } from '../dtos/GetMembershipFeesDTO';
export interface IGetMembershipFeesPresenter extends Presenter<GetMembershipFeesResultDTO, GetMembershipFeesResultDTO> {}
export class GetMembershipFeesPresenter implements IGetMembershipFeesPresenter {
private result: GetMembershipFeesViewModel | null = null;
private result: GetMembershipFeesResultDTO | null = null;
reset() {
this.result = null;
@@ -15,11 +14,11 @@ export class GetMembershipFeesPresenter implements IGetMembershipFeesPresenter {
this.result = dto;
}
getViewModel(): GetMembershipFeesViewModel | null {
getResponseModel(): GetMembershipFeesResultDTO | null {
return this.result;
}
get viewModel(): GetMembershipFeesViewModel {
get viewModel(): GetMembershipFeesResultDTO {
if (!this.result) throw new Error('Presenter not presented');
return this.result;
}

View File

@@ -28,7 +28,7 @@ export class GetPaymentsPresenter implements UseCaseOutputPort<GetPaymentsResult
};
}
get responseModel(): GetPaymentsOutput {
getResponseModel(): GetPaymentsOutput {
if (!this.responseModel) throw new Error('Presenter not presented');
return this.responseModel;
}

View File

@@ -1,11 +1,10 @@
import type {
IGetPrizesPresenter,
GetPrizesResultDTO,
GetPrizesViewModel,
} from '@core/payments/application/presenters/IGetPrizesPresenter';
import type { Presenter } from '@core/shared/presentation/Presenter';
import { GetPrizesResultDTO } from '../dtos/GetPrizesDTO';
export interface IGetPrizesPresenter extends Presenter<GetPrizesResultDTO, GetPrizesResultDTO> {}
export class GetPrizesPresenter implements IGetPrizesPresenter {
private result: GetPrizesViewModel | null = null;
private result: GetPrizesResultDTO | null = null;
reset() {
this.result = null;
@@ -15,11 +14,11 @@ export class GetPrizesPresenter implements IGetPrizesPresenter {
this.result = dto;
}
getViewModel(): GetPrizesViewModel | null {
getResponseModel(): GetPrizesResultDTO | null {
return this.result;
}
get viewModel(): GetPrizesViewModel {
get viewModel(): GetPrizesResultDTO {
if (!this.result) throw new Error('Presenter not presented');
return this.result;
}

View File

@@ -1,11 +1,10 @@
import type {
IGetWalletPresenter,
GetWalletResultDTO,
GetWalletViewModel,
} from '@core/payments/application/presenters/IGetWalletPresenter';
import type { Presenter } from '@core/shared/presentation/Presenter';
import { GetWalletResultDTO } from '../dtos/GetWalletDTO';
export interface IGetWalletPresenter extends Presenter<GetWalletResultDTO, GetWalletResultDTO> {}
export class GetWalletPresenter implements IGetWalletPresenter {
private result: GetWalletViewModel | null = null;
private result: GetWalletResultDTO | null = null;
reset() {
this.result = null;
@@ -15,11 +14,11 @@ export class GetWalletPresenter implements IGetWalletPresenter {
this.result = dto;
}
getViewModel(): GetWalletViewModel | null {
getResponseModel(): GetWalletResultDTO | null {
return this.result;
}
get viewModel(): GetWalletViewModel {
get viewModel(): GetWalletResultDTO {
if (!this.result) throw new Error('Presenter not presented');
return this.result;
}

View File

@@ -1,11 +1,10 @@
import type {
IProcessWalletTransactionPresenter,
ProcessWalletTransactionResultDTO,
ProcessWalletTransactionViewModel,
} from '@core/payments/application/presenters/IProcessWalletTransactionPresenter';
import type { Presenter } from '@core/shared/presentation/Presenter';
import { ProcessWalletTransactionResultDTO } from '../dtos/ProcessWalletTransactionDTO';
export interface IProcessWalletTransactionPresenter extends Presenter<ProcessWalletTransactionResultDTO, ProcessWalletTransactionResultDTO> {}
export class ProcessWalletTransactionPresenter implements IProcessWalletTransactionPresenter {
private result: ProcessWalletTransactionViewModel | null = null;
private result: ProcessWalletTransactionResultDTO | null = null;
reset() {
this.result = null;
@@ -15,11 +14,11 @@ export class ProcessWalletTransactionPresenter implements IProcessWalletTransact
this.result = dto;
}
getViewModel(): ProcessWalletTransactionViewModel | null {
getResponseModel(): ProcessWalletTransactionResultDTO | null {
return this.result;
}
get viewModel(): ProcessWalletTransactionViewModel {
get viewModel(): ProcessWalletTransactionResultDTO {
if (!this.result) throw new Error('Presenter not presented');
return this.result;
}

View File

@@ -1,11 +1,10 @@
import type {
IUpdateMemberPaymentPresenter,
UpdateMemberPaymentResultDTO,
UpdateMemberPaymentViewModel,
} from '@core/payments/application/presenters/IUpdateMemberPaymentPresenter';
import type { Presenter } from '@core/shared/presentation/Presenter';
import { UpdateMemberPaymentResultDTO } from '../dtos/UpdateMemberPaymentDTO';
export interface IUpdateMemberPaymentPresenter extends Presenter<UpdateMemberPaymentResultDTO, UpdateMemberPaymentResultDTO> {}
export class UpdateMemberPaymentPresenter implements IUpdateMemberPaymentPresenter {
private result: UpdateMemberPaymentViewModel | null = null;
private result: UpdateMemberPaymentResultDTO | null = null;
reset() {
this.result = null;
@@ -15,11 +14,11 @@ export class UpdateMemberPaymentPresenter implements IUpdateMemberPaymentPresent
this.result = dto;
}
getViewModel(): UpdateMemberPaymentViewModel | null {
getResponseModel(): UpdateMemberPaymentResultDTO | null {
return this.result;
}
get viewModel(): UpdateMemberPaymentViewModel {
get viewModel(): UpdateMemberPaymentResultDTO {
if (!this.result) throw new Error('Presenter not presented');
return this.result;
}

View File

@@ -1,11 +1,10 @@
import type {
IUpsertMembershipFeePresenter,
UpsertMembershipFeeResultDTO,
UpsertMembershipFeeViewModel,
} from '@core/payments/application/presenters/IUpsertMembershipFeePresenter';
import type { Presenter } from '@core/shared/presentation/Presenter';
import { UpsertMembershipFeeResultDTO } from '../dtos/UpsertMembershipFeeDTO';
export interface IUpsertMembershipFeePresenter extends Presenter<UpsertMembershipFeeResultDTO, UpsertMembershipFeeResultDTO> {}
export class UpsertMembershipFeePresenter implements IUpsertMembershipFeePresenter {
private result: UpsertMembershipFeeViewModel | null = null;
private result: UpsertMembershipFeeResultDTO | null = null;
reset() {
this.result = null;
@@ -15,11 +14,11 @@ export class UpsertMembershipFeePresenter implements IUpsertMembershipFeePresent
this.result = dto;
}
getViewModel(): UpsertMembershipFeeViewModel | null {
getResponseModel(): UpsertMembershipFeeResultDTO | null {
return this.result;
}
get viewModel(): UpsertMembershipFeeViewModel {
get viewModel(): UpsertMembershipFeeResultDTO {
if (!this.result) throw new Error('Presenter not presented');
return this.result;
}