74 lines
1.8 KiB
TypeScript
74 lines
1.8 KiB
TypeScript
import { DomainEntity, type Percentage, type UniqueID } from "@repo/rdx-ddd";
|
|
import { type Maybe, Result } from "@repo/rdx-utils";
|
|
|
|
import type { InvoiceAmount } from "../../common";
|
|
|
|
export type IssuedInvoiceTaxProps = {
|
|
taxableAmount: InvoiceAmount;
|
|
|
|
ivaCode: string;
|
|
ivaPercentage: Percentage;
|
|
ivaAmount: InvoiceAmount;
|
|
|
|
recCode: Maybe<string>;
|
|
recPercentage: Maybe<Percentage>;
|
|
recAmount: InvoiceAmount;
|
|
|
|
retentionCode: Maybe<string>;
|
|
retentionPercentage: Maybe<Percentage>;
|
|
retentionAmount: InvoiceAmount;
|
|
|
|
taxesAmount: InvoiceAmount;
|
|
};
|
|
|
|
export class IssuedInvoiceTax extends DomainEntity<IssuedInvoiceTaxProps> {
|
|
public static create(
|
|
props: IssuedInvoiceTaxProps,
|
|
id?: UniqueID
|
|
): Result<IssuedInvoiceTax, Error> {
|
|
return Result.ok(new IssuedInvoiceTax(props, id));
|
|
}
|
|
|
|
public get taxableAmount(): InvoiceAmount {
|
|
return this.props.taxableAmount;
|
|
}
|
|
|
|
public get ivaCode(): string {
|
|
return this.props.ivaCode;
|
|
}
|
|
public get ivaPercentage(): Percentage {
|
|
return this.props.ivaPercentage;
|
|
}
|
|
public get ivaAmount(): InvoiceAmount {
|
|
return this.props.ivaAmount;
|
|
}
|
|
|
|
public get recCode(): Maybe<string> {
|
|
return this.props.recCode;
|
|
}
|
|
public get recPercentage(): Maybe<Percentage> {
|
|
return this.props.recPercentage;
|
|
}
|
|
public get recAmount(): InvoiceAmount {
|
|
return this.props.recAmount;
|
|
}
|
|
|
|
public get retentionCode(): Maybe<string> {
|
|
return this.props.retentionCode;
|
|
}
|
|
public get retentionPercentage(): Maybe<Percentage> {
|
|
return this.props.retentionPercentage;
|
|
}
|
|
public get retentionAmount(): InvoiceAmount {
|
|
return this.props.retentionAmount;
|
|
}
|
|
|
|
public get taxesAmount(): InvoiceAmount {
|
|
return this.props.taxesAmount;
|
|
}
|
|
|
|
public getProps(): IssuedInvoiceTaxProps {
|
|
return this.props;
|
|
}
|
|
}
|