wip
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
* Value Object: MembershipFee
|
||||
* Represents membership fee configuration for league drivers
|
||||
*/
|
||||
|
||||
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
import type { Money } from './Money';
|
||||
import type { IValueObject } from '@gridpilot/shared/domain';
|
||||
|
||||
export type MembershipFeeType = 'season' | 'monthly' | 'per_race';
|
||||
|
||||
@@ -14,7 +15,7 @@ export interface MembershipFeeProps {
|
||||
amount: Money;
|
||||
}
|
||||
|
||||
export class MembershipFee {
|
||||
export class MembershipFee implements IValueObject<MembershipFeeProps> {
|
||||
readonly type: MembershipFeeType;
|
||||
readonly amount: Money;
|
||||
|
||||
@@ -53,6 +54,13 @@ export class MembershipFee {
|
||||
return this.amount.calculateNetAmount();
|
||||
}
|
||||
|
||||
get props(): MembershipFeeProps {
|
||||
return {
|
||||
type: this.type,
|
||||
amount: this.amount,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this is a recurring fee
|
||||
*/
|
||||
@@ -60,6 +68,12 @@ export class MembershipFee {
|
||||
return this.type === 'monthly';
|
||||
}
|
||||
|
||||
equals(other: IValueObject<MembershipFeeProps>): boolean {
|
||||
const a = this.props;
|
||||
const b = other.props;
|
||||
return a.type === b.type && a.amount.equals(b.amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get display name for fee type
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user