refactor
This commit is contained in:
21
core/payments/domain/entities/MemberPayment.ts
Normal file
21
core/payments/domain/entities/MemberPayment.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Domain Entity: MemberPayment
|
||||
*/
|
||||
|
||||
export enum MemberPaymentStatus {
|
||||
PENDING = 'pending',
|
||||
PAID = 'paid',
|
||||
OVERDUE = 'overdue',
|
||||
}
|
||||
|
||||
export interface MemberPayment {
|
||||
id: string;
|
||||
feeId: string;
|
||||
driverId: string;
|
||||
amount: number;
|
||||
platformFee: number;
|
||||
netAmount: number;
|
||||
status: MemberPaymentStatus;
|
||||
dueDate: Date;
|
||||
paidAt?: Date;
|
||||
}
|
||||
20
core/payments/domain/entities/MembershipFee.ts
Normal file
20
core/payments/domain/entities/MembershipFee.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Domain Entity: MembershipFee
|
||||
*/
|
||||
|
||||
export enum MembershipFeeType {
|
||||
SEASON = 'season',
|
||||
MONTHLY = 'monthly',
|
||||
PER_RACE = 'per_race',
|
||||
}
|
||||
|
||||
export interface MembershipFee {
|
||||
id: string;
|
||||
leagueId: string;
|
||||
seasonId?: string;
|
||||
type: MembershipFeeType;
|
||||
amount: number;
|
||||
enabled: boolean;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
35
core/payments/domain/entities/Payment.ts
Normal file
35
core/payments/domain/entities/Payment.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Domain Entity: Payment
|
||||
*/
|
||||
|
||||
export enum PaymentType {
|
||||
SPONSORSHIP = 'sponsorship',
|
||||
MEMBERSHIP_FEE = 'membership_fee',
|
||||
}
|
||||
|
||||
export enum PayerType {
|
||||
SPONSOR = 'sponsor',
|
||||
DRIVER = 'driver',
|
||||
}
|
||||
|
||||
export enum PaymentStatus {
|
||||
PENDING = 'pending',
|
||||
COMPLETED = 'completed',
|
||||
FAILED = 'failed',
|
||||
REFUNDED = 'refunded',
|
||||
}
|
||||
|
||||
export interface Payment {
|
||||
id: string;
|
||||
type: PaymentType;
|
||||
amount: number;
|
||||
platformFee: number;
|
||||
netAmount: number;
|
||||
payerId: string;
|
||||
payerType: PayerType;
|
||||
leagueId: string;
|
||||
seasonId?: string;
|
||||
status: PaymentStatus;
|
||||
createdAt: Date;
|
||||
completedAt?: Date;
|
||||
}
|
||||
24
core/payments/domain/entities/Prize.ts
Normal file
24
core/payments/domain/entities/Prize.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Domain Entity: Prize
|
||||
*/
|
||||
|
||||
export enum PrizeType {
|
||||
CASH = 'cash',
|
||||
MERCHANDISE = 'merchandise',
|
||||
OTHER = 'other',
|
||||
}
|
||||
|
||||
export interface Prize {
|
||||
id: string;
|
||||
leagueId: string;
|
||||
seasonId: string;
|
||||
position: number;
|
||||
name: string;
|
||||
amount: number;
|
||||
type: PrizeType;
|
||||
description?: string;
|
||||
awarded: boolean;
|
||||
awardedTo?: string;
|
||||
awardedAt?: Date;
|
||||
createdAt: Date;
|
||||
}
|
||||
37
core/payments/domain/entities/Wallet.ts
Normal file
37
core/payments/domain/entities/Wallet.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Domain Entity: Wallet
|
||||
*/
|
||||
|
||||
export interface Wallet {
|
||||
id: string;
|
||||
leagueId: string;
|
||||
balance: number;
|
||||
totalRevenue: number;
|
||||
totalPlatformFees: number;
|
||||
totalWithdrawn: number;
|
||||
currency: string;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export enum TransactionType {
|
||||
DEPOSIT = 'deposit',
|
||||
WITHDRAWAL = 'withdrawal',
|
||||
PLATFORM_FEE = 'platform_fee',
|
||||
}
|
||||
|
||||
export enum ReferenceType {
|
||||
SPONSORSHIP = 'sponsorship',
|
||||
MEMBERSHIP_FEE = 'membership_fee',
|
||||
PRIZE = 'prize',
|
||||
}
|
||||
|
||||
export interface Transaction {
|
||||
id: string;
|
||||
walletId: string;
|
||||
type: TransactionType;
|
||||
amount: number;
|
||||
description: string;
|
||||
referenceId?: string;
|
||||
referenceType?: ReferenceType;
|
||||
createdAt: Date;
|
||||
}
|
||||
5
core/payments/domain/entities/index.ts
Normal file
5
core/payments/domain/entities/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from './Payment';
|
||||
export * from './MembershipFee';
|
||||
export * from './MemberPayment';
|
||||
export * from './Prize';
|
||||
export * from './Wallet';
|
||||
Reference in New Issue
Block a user